diff --git a/.hgignore b/.hgignore index be55e3a7c83827635d49ec818d2a03774c021752..52a5512a408912d15d645c6adb390ed2368ea042 100644 --- a/.hgignore +++ b/.hgignore @@ -1,6 +1,5 @@ ^build/ ^dist/ -^nbproject/private/ -^make/netbeans/.*/nbproject/private/ +/nbproject/private/ ^make/netbeans/.*/build/ ^make/netbeans/.*/dist/ diff --git a/.hgtags b/.hgtags index 3d77e3c8b78697c046fd7dbce0c70c95669823f2..e6ad3c85d52145e3ac33a454acb7f14d3294b63c 100644 --- a/.hgtags +++ b/.hgtags @@ -52,3 +52,6 @@ eacb36e30327e7ae33baa068e82ddccbd91eaae2 jdk7-b74 8885b22565077236a927e824ef450742e434a230 jdk7-b75 8fb602395be0f7d5af4e7e93b7df2d960faf9d17 jdk7-b76 e6a5d095c356a547cf5b3c8885885aca5e91e09b jdk7-b77 +1143e498f813b8223b5e3a696d79da7ff7c25354 jdk7-b78 +918920710d65432a2d54fdf407c1524a5571c4ad jdk7-b79 +049cfaaa9a7374e3768a79969a799e8b59ad52fa jdk7-b80 diff --git a/make/Makefile b/make/Makefile index c78e4c27e01bde63bb50a6b6f2d17c257cc9e754..04c5a563ee719a83627d57de500d5a41debc648d 100644 --- a/make/Makefile +++ b/make/Makefile @@ -74,6 +74,7 @@ import -- copy in the pre-built components (e.g. VM) \n\ import_product -- copy in the product components \n\ import_fastdebug -- copy in the fastdebug components \n\ import_debug -- copy in the debug components \n\ +modules -- build the jdk and jre module images (experimental) \n\ sccs_get -- make sure all SCCS files are up-to-date (need SCCS) \n\ create_links -- create softlinks in Solaris 32bit build to 64bit dirs \n\ " @@ -257,6 +258,7 @@ docs:: sanity-docs post-sanity-docs # Release engineering targets. # include $(BUILDDIR)/common/Release.gmk +include $(BUILDDIR)/common/Modules.gmk # # Cscope targets. diff --git a/make/com/sun/crypto/provider/Makefile b/make/com/sun/crypto/provider/Makefile index 8cf809dc46964cb809f7eefa72778862db6c5696..96b12e9989efd9bb45723feaad8025053d722c34 100644 --- a/make/com/sun/crypto/provider/Makefile +++ b/make/com/sun/crypto/provider/Makefile @@ -249,7 +249,7 @@ $(JAR_DESTFILE): $(UNSIGNED_DIR)/sunjce_provider.jar else $(JAR_DESTFILE): $(SIGNED_DIR)/sunjce_provider.jar endif - $(install-file) + $(install-non-module-file) ifndef OPENJDK install-prebuilt: diff --git a/make/com/sun/java/pack/Makefile b/make/com/sun/java/pack/Makefile index 1d013c0894b3c76ccad04e52b800a8f1720f9d59..4598313fdbaa092a48eb8a3dd6db19cb94392681 100644 --- a/make/com/sun/java/pack/Makefile +++ b/make/com/sun/java/pack/Makefile @@ -28,6 +28,7 @@ # BUILDDIR = ../../../.. +MODULE = pack200 PACKAGE = com.sun.java.util.jar.pack LIBRARY = unpack PRODUCT = sun @@ -123,11 +124,14 @@ COBJDIR = $(strip $(subst unpack,unpack-cmd,$(OBJDIR))) all: build -build: prop +build: prop pack200-tool prop: $(MAKE) -C prop +pack200-tool: + $(call make-launcher, pack200, com.sun.java.util.jar.pack.Driver, , --pack) + unpacker: $(MAKE) $(UNPACK_EXE) STANDALONE=true LDMAPFLAGS_OPT= LDMAPFLAGS_DBG= @@ -151,6 +155,7 @@ ifdef MT $(MT) /manifest $(TEMPDIR)/unpack200$(EXE_SUFFIX).manifest /outputresource:$(TEMPDIR)/unpack200$(EXE_SUFFIX);#1 endif $(CP) $(TEMPDIR)/unpack200$(EXE_SUFFIX) $(UNPACK_EXE) + $(install-module-file) ifeq ($(PLATFORM), windows) $(RES):: $(VERSIONINFO_RESOURCE) diff --git a/make/com/sun/java/pack/prop/Makefile b/make/com/sun/java/pack/prop/Makefile index 59a53f663be33edf51b6e36cc089b09d28fe152a..e0bda2de040acd160e5d25f4b614fcbddf78220f 100644 --- a/make/com/sun/java/pack/prop/Makefile +++ b/make/com/sun/java/pack/prop/Makefile @@ -29,6 +29,7 @@ # to a collision of rules with Classes.gmk and Library.gmk BUILDDIR = ../../../../.. +MODULE = pack200 PACKAGE = com.sun.java.util.jar.pack PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk diff --git a/make/com/sun/jndi/cosnaming/Makefile b/make/com/sun/jndi/cosnaming/Makefile index 1657e9be36b7ad6cf86008967f1d1f28da615561..9cc85a196ff284a87d705735f894ac3dbde5e76a 100644 --- a/make/com/sun/jndi/cosnaming/Makefile +++ b/make/com/sun/jndi/cosnaming/Makefile @@ -28,6 +28,7 @@ # BUILDDIR = ../../../.. +MODULE = jndi-cosnaming PACKAGE = com.sun.jndi.cosnaming PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk diff --git a/make/com/sun/jndi/dns/Makefile b/make/com/sun/jndi/dns/Makefile index ed2641527b78c27d5ed4893a24b4004614d53074..a081c2559242223da25530c08492808c3732d15e 100644 --- a/make/com/sun/jndi/dns/Makefile +++ b/make/com/sun/jndi/dns/Makefile @@ -28,6 +28,7 @@ # BUILDDIR = ../../../.. +MODULE = jndi-dns PACKAGE = com.sun.jndi.dns PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk diff --git a/make/com/sun/jndi/ldap/Makefile b/make/com/sun/jndi/ldap/Makefile index eac6568ba2f65489d8c4559b376a00c7ed2d45e4..e6286c093c7d5a6f0f29b8d2f04ee88d0ecb5b89 100644 --- a/make/com/sun/jndi/ldap/Makefile +++ b/make/com/sun/jndi/ldap/Makefile @@ -28,6 +28,7 @@ # BUILDDIR = ../../../.. +MODULE = jndi-ldap PACKAGE = com.sun.jndi.ldap PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk diff --git a/make/com/sun/jndi/rmi/registry/Makefile b/make/com/sun/jndi/rmi/registry/Makefile index 4192b55e406ab8888bfd77352bad73b1058dad3b..34a4e8170cb3f9a41345b48d12107e78d00c0de2 100644 --- a/make/com/sun/jndi/rmi/registry/Makefile +++ b/make/com/sun/jndi/rmi/registry/Makefile @@ -28,6 +28,7 @@ # BUILDDIR = ../../../../.. +MODULE = jndi-rmiregistry PACKAGE = com.sun.jndi.rmi.registry PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk diff --git a/make/com/sun/nio/sctp/FILES_java.gmk b/make/com/sun/nio/sctp/FILES_java.gmk index 8be820fae9cab2a4b81c3e978128a24ea4bd2bda..09c1563dcb9d43b286056e4ef06cdaa6afa035e9 100644 --- a/make/com/sun/nio/sctp/FILES_java.gmk +++ b/make/com/sun/nio/sctp/FILES_java.gmk @@ -57,8 +57,7 @@ FILES_java += \ sun/nio/ch/SctpResultContainer.java \ sun/nio/ch/SctpSendFailed.java \ sun/nio/ch/SctpServerChannelImpl.java \ - sun/nio/ch/SctpShutdown.java \ - sun/nio/ch/SctpSocketDispatcher.java + sun/nio/ch/SctpShutdown.java else FILES_java += \ sun/nio/ch/SctpChannelImpl.java \ diff --git a/make/com/sun/nio/sctp/Makefile b/make/com/sun/nio/sctp/Makefile index d5acea340a95a9f3f92ed96ebc268eef87e76d2d..1eadf769122f224e960643631521d9f3dbc6fc31 100644 --- a/make/com/sun/nio/sctp/Makefile +++ b/make/com/sun/nio/sctp/Makefile @@ -28,6 +28,7 @@ # BUILDDIR = ../../../.. +MODULE = sctp PACKAGE = com.sun.nio.sctp LIBRARY = sctp PRODUCT = sun diff --git a/make/com/sun/nio/sctp/mapfile-vers b/make/com/sun/nio/sctp/mapfile-vers index 0e5138586a08cd3fd7b6b3bbc263b5346165e95e..21ac26ea7d8d8f3759b4950eff2dd4417e0d7177 100644 --- a/make/com/sun/nio/sctp/mapfile-vers +++ b/make/com/sun/nio/sctp/mapfile-vers @@ -25,9 +25,14 @@ SUNWprivate_1.1 { global: + Java_sun_nio_ch_SctpNet_init; Java_sun_nio_ch_SctpNet_socket0; Java_sun_nio_ch_SctpNet_bindx; Java_sun_nio_ch_SctpNet_branch0; + Java_sun_nio_ch_SctpNet_listen0; + Java_sun_nio_ch_SctpNet_connect0; + Java_sun_nio_ch_SctpNet_close0; + Java_sun_nio_ch_SctpNet_preClose0; Java_sun_nio_ch_SctpNet_getLocalAddresses0; Java_sun_nio_ch_SctpNet_getRemoteAddresses0; Java_sun_nio_ch_SctpNet_getPrimAddrOption0; diff --git a/make/com/sun/org/apache/xml/Makefile b/make/com/sun/org/apache/xml/Makefile index 36a15bac490748837c2d5fac4f1ac04e35e11c11..f57e3d0cfc3bd7c9d1c1aca432f1d7a8586278e0 100644 --- a/make/com/sun/org/apache/xml/Makefile +++ b/make/com/sun/org/apache/xml/Makefile @@ -28,6 +28,7 @@ # BUILDDIR = ../../../../.. +MODULE = security-xmldsig PACKAGE = com.sun.org.apache.xml PRODUCT = xml include $(BUILDDIR)/common/Defs.gmk diff --git a/make/com/sun/rowset/Makefile b/make/com/sun/rowset/Makefile index ff7641a128e15f6d4cca1458e17f05958b804ddc..3f73fd6e7914348c4093dcf0a28f4e0e081b36f4 100644 --- a/make/com/sun/rowset/Makefile +++ b/make/com/sun/rowset/Makefile @@ -28,6 +28,7 @@ # BUILDDIR = ../../.. +MODULE = jdbc-enterprise PACKAGE = com.sun.rowset PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk diff --git a/make/com/sun/script/Makefile b/make/com/sun/script/Makefile index 5e4c83063d598fa79c0ec24ea4e02561189097df..07159b0b6be3730ad2731412ac0a607d799a855c 100644 --- a/make/com/sun/script/Makefile +++ b/make/com/sun/script/Makefile @@ -25,6 +25,7 @@ BUILDDIR = ../../.. +MODULE = scripting-rhino PACKAGE = com.sun.script PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk diff --git a/make/com/sun/security/auth/module/Makefile b/make/com/sun/security/auth/module/Makefile index d7a4abdf1652e7c334f9809ab6b56ebcc161900e..8552ffe758c77b699a06a32ef3597a1c87c1669a 100644 --- a/make/com/sun/security/auth/module/Makefile +++ b/make/com/sun/security/auth/module/Makefile @@ -26,6 +26,7 @@ # Makefile for building auth modules. BUILDDIR = ../../../../.. +MODULE = security-auth PACKAGE = com.sun.security.auth.module PRODUCT = sun diff --git a/make/com/sun/servicetag/Makefile b/make/com/sun/servicetag/Makefile index e7914e8278ee2d1f764297105edfd1d691b64fb2..4ec4bc7f08d6752957270d08be4e3b927c7c68de 100644 --- a/make/com/sun/servicetag/Makefile +++ b/make/com/sun/servicetag/Makefile @@ -22,6 +22,7 @@ # have any questions. BUILDDIR = ../../.. +MODULE = servicetag PACKAGE = com.sun.servicetag PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk @@ -68,7 +69,7 @@ $(CLASSBINDIR)/%: $(SHARE_SRC)/classes/% $(SERVICETAG_LIBDIR)/jdk_header.png: $(SHARE_SRC)/classes/com/sun/servicetag/resources/jdk_header.png $(install-file) - $(CHMOD) 444 $@ + $(call chmod-file, 444) install-servicetag-lib: @$(RM) -rf $(SERVICETAG_LIBDIR) diff --git a/make/com/sun/tools/attach/Makefile b/make/com/sun/tools/attach/Makefile index 25421bff371b94b5b8c523694d13cecc8359957d..f1b3a3a5538d363e638a60be1c9f26c7da1f6011 100644 --- a/make/com/sun/tools/attach/Makefile +++ b/make/com/sun/tools/attach/Makefile @@ -25,6 +25,7 @@ BUILDDIR = ../../../.. +MODULE = attach PACKAGE = com.sun.tools.attach LIBRARY = attach PRODUCT = sun @@ -65,6 +66,7 @@ $(SERVICEDIR)/%: $(SHARE_SRC)/classes/sun/tools/attach/META-INF/services/% @$(MKDIR) -p $(@D) @$(RM) $@ @$(CAT) $< | $(SED) -e "s/^#\[$(PLATFORM)\]//" > $@ + @$(install-module-file) .PHONY: copy-files diff --git a/make/common/Defs.gmk b/make/common/Defs.gmk index de974fe62ec9b32ad41dd5e2cef436e1144212c3..88a49d4443e38c2bb5cce26781dec1d80f85c2da 100644 --- a/make/common/Defs.gmk +++ b/make/common/Defs.gmk @@ -225,12 +225,6 @@ DEVTOOLS_FT_DIR_EXISTS = $(shell \ endif endif - ifeq ($(PLATFORM), windows) - FREETYPE_LIB = $(FREETYPE_LIB_PATH)/freetype.lib - else - FREETYPE_LIB = -L$(FREETYPE_LIB_PATH) -lfreetype - endif - ifdef ALT_FREETYPE_HEADERS_PATH FREETYPE_HEADERS_PATH = $(ALT_FREETYPE_HEADERS_PATH) else @@ -313,6 +307,9 @@ INCLUDEDIR = $(OUTPUTDIR)/include # for generated class files CLASSBINDIR = $(OUTPUTDIR)/classes DEMOCLASSDIR = $(OUTPUTDIR)/democlasses +# for modules +MODULES_DIR = $(OUTPUTDIR)/modules +ABS_MODULES_DIR = $(ABS_OUTPUTDIR)/modules # for generated tool class files BUILDTOOLCLASSDIR = $(OUTPUTDIR)/btclasses # for build tool jar files @@ -388,6 +385,22 @@ ifneq ($(THREADDIR),) UNIQUE_LOCATION_STRING += /$(THREADDIR) endif +# +# Build units may or may not define MODULE. Default to "other". +# +# MODULE variable defines the lowest-level module name that +# might or might not be the name of the modules created in +# the modules build (see make/modules/modules.config and +# modules.group). +# +MODULES_TEMPDIR = $(OUTPUTDIR)/tmp/modules +ABS_MODULES_TEMPDIR = $(ABS_OUTPUTDIR)/tmp/modules + +ifndef MODULE + MODULE = other +endif +override MODULE_DEST_DIR = $(MODULES_TEMPDIR)/$(MODULE) + # the use of += above makes a space separated list which we need to # remove for filespecs. # @@ -497,6 +510,58 @@ PKGDIR = $(subst .,/,$(PACKAGE)) # include $(JDK_MAKE_SHARED_DIR)/Defs-java.gmk +# +# Macros to find the module that $@ belongs to +# + +UNIQUE_PATH_PATTERN = $(subst /,.,$(UNIQUE_PATH)) +MODULE_PATH_PATTERN = -e 's%.*\/classes\/%classes\/%' \ + -e 's%.*\/$(UNIQUE_PATH_PATTERN)\/%classes\/%' \ + -e 's%.*\/lib\/%lib\/%' \ + -e 's%.*\/bin\/%bin\/%' \ + -e 's%.*\/include\/%include\/%' \ + -e 's%.*\/demo\/%demo\/%' \ + -e 's%.*\/sample\/%sample\/%' + +# Install a file to its module +define install-module-file +dest=`echo $(@D)/ | $(SED) $(MODULE_PATH_PATTERN)` ; \ +$(MKDIR) -p $(MODULE_DEST_DIR)/$$dest; \ +$(CP) -f $@ $(MODULE_DEST_DIR)/$$dest +endef + +# Install all files from the directory to its module +define install-module-dir +dest=`echo $(@D)/ | $(SED) $(MODULE_PATH_PATTERN)` ; \ +$(MKDIR) -p $(MODULE_DEST_DIR)/$$dest; \ +$(CP) -rf $(@D)/* $(MODULE_DEST_DIR)/$$dest +endef + +# chmod the file in its module +define chmod-module-file +dest=`echo $@ | $(SED) $(MODULE_PATH_PATTERN)` ; \ +$(CHMOD) $1 $(MODULE_DEST_DIR)/$$dest +endef + +# install a sym link in its module +define install-module-sym-link +dest=`echo $@ | $(SED) $(MODULE_PATH_PATTERN)` ; \ +$(LN) -sf $1 $(MODULE_DEST_DIR)/$$dest +endef + + +# Run MAKE $@ for a launcher: +# $(call make-launcher, name, mainclass, java-args, main-args) +define make-launcher +$(CD) $(BUILDDIR)/launchers && \ +$(MAKE) -f Makefile.launcher \ + MODULE=$(MODULE) \ + PROGRAM=$(strip $1) \ + MAIN_CLASS=$(strip $2) \ + MAIN_JAVA_ARGS="$(strip $3)" \ + MAIN_ARGS="$(strip $4)" +endef + # # Convenient macros # @@ -511,6 +576,28 @@ endef define install-file $(prep-target) $(CP) $< $@ +$(install-module-file) +endef + +define chmod-file +$(CHMOD) $1 $@ +$(call chmod-module-file, $1) +endef + +define install-sym-link +$(LN) -s $1 $@ +$(call install-module-sym-link, $1) +endef + +# +# Marcos for files not belonging to any module +define install-non-module-file +$(prep-target) +$(CP) $< $@ +endef + +define install-manifest-file +$(install-non-module-file) endef # Cleanup rule for after debug java run (hotspot.log file is left around) @@ -712,7 +799,7 @@ else endif # Install of imported file (JDK_IMPORT_PATH, or some other external location) -define install-import-file +define install-importonly-file @$(ECHO) "ASSEMBLY_IMPORT: $@" $(prep-target) $(CP) $< $@ @@ -730,4 +817,9 @@ $(CP) $< $@ fi endef +define install-import-file +$(install-importonly-file) +$(install-module-file) +endef + .PHONY: all build clean clobber diff --git a/make/common/Demo.gmk b/make/common/Demo.gmk index 12a3ce105e4735080376fb8feeb21b8fdeb5858d..26b8ea221ec204404d480056a32178713cc834f5 100644 --- a/make/common/Demo.gmk +++ b/make/common/Demo.gmk @@ -25,6 +25,8 @@ # JDK Demo building jar file. +MODULE = demos + # Some names are defined with LIBRARY inside the Defs.gmk file LIBRARY=$(DEMONAME) OBJDIR=$(TEMPDIR)/$(DEMONAME) diff --git a/make/common/Library.gmk b/make/common/Library.gmk index 22b9bc4f3241a42bd59a7a24cdec6fd50896d342..b95f43d7ef718dd2ac38816b1f8b9aaa4abaaeaa 100644 --- a/make/common/Library.gmk +++ b/make/common/Library.gmk @@ -193,9 +193,18 @@ ifdef MT $(MT) /manifest $(OBJDIR)/$(@F).manifest /outputresource:$(OBJDIR)/$(@F);#2 endif $(CP) $(OBJDIR)/$(@F) $@ + $(install-module-file) $(CP) $(OBJDIR)/$(LIBRARY).map $(@D) $(CP) $(OBJDIR)/$(LIBRARY).pdb $(@D) +$(ACTUAL_LIBRARY):: $(ACTUAL_LIBRARY_DIR)/$(LIBRARY).map $(ACTUAL_LIBRARY_DIR)/$(LIBRARY).pdb + +$(ACTUAL_LIBRARY_DIR)/%.map: FORCE + $(install-module-file) + +$(ACTUAL_LIBRARY_DIR)/%.pdb: FORCE + $(install-module-file) + endif # LIBRARY $(OBJDIR)/$(LIBRARY).lcf: $(OBJDIR)/$(LIBRARY).res $(COMPILE_FILES_o) $(FILES_m) @@ -250,6 +259,7 @@ ifeq ($(LIBRARY), fdlibm) $(AR) -r $@ $(FILES_o) else # LIBRARY $(LINKER) $(SHARED_LIBRARY_FLAG) -o $@ $(FILES_o) $(LDLIBS) + $(install-module-file) ifeq ($(WRITE_LIBVERSION),true) $(MCS) -d -a "$(FULL_VERSION)" $@ endif # WRITE_LIBVERSION @@ -353,5 +363,7 @@ fastdebug: openjdk: $(MAKE) OPENJDK=true build +FORCE: + .PHONY: all build debug fastdebug diff --git a/make/common/Modules.gmk b/make/common/Modules.gmk new file mode 100644 index 0000000000000000000000000000000000000000..435129dcfed3f5420c5f7f48276bbabebe041ab9 --- /dev/null +++ b/make/common/Modules.gmk @@ -0,0 +1,481 @@ +# +# Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. Sun designates this +# particular file as subject to the "Classpath" exception as provided +# by Sun in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, +# CA 95054 USA or visit www.sun.com if you need additional information or +# have any questions. +# + +JDK_MODULE_IMAGE_DIR = $(ABS_OUTPUTDIR)/jdk-module-image +JRE_MODULE_IMAGE_DIR = $(ABS_OUTPUTDIR)/jre-module-image + +# +# modules Target to build jdk and jre module image +# +# There is one jar file per module containing classes only. +# All module jars are currently placed under jre/lib directory. +# +# Open issues that need further investigation: +# 1. Classes in jre/lib/ext/dnsns.jar are currently put in jre/lib/jndi-dns +# module. META-INF/services file is not installed. +# 2. Signed jars +# For JDK build, signed jars are copied to the build. +# All jars in the module image are unsigned. + +MODULE_IMAGEBINDIR = bin + +# +# Targets. +# +INITIAL_MODULE_IMAGE_JRE=initial-module-image-jre +INITIAL_MODULE_IMAGE_JDK=initial-module-image-jdk +ifeq ($(PLATFORM), solaris) + ifeq ($(ARCH_DATA_MODEL), 64) + INITIAL_MODULE_IMAGE_JRE=initial-module-image-jre-sol64 + INITIAL_MODULE_IMAGE_JDK=initial-module-image-jdk-sol64 + endif +endif + +modules modules-clobber \ +initial-module-image-jre initial-module-image-jdk \ +initial-module-image-jre-sol64 initial-module-image-jdk-sol64 \ +trim-module-image-jre trim-module-image-jdk \ +process-module-image-jre process-module-image-jdk :: + @$(ECHO) ">>>Making "$@" @ `$(DATE)` ..." + +# Order is important here, trim jre after jdk image is created +modules:: gen-modules \ + sanity-module-images post-sanity-module-images \ + $(INITIAL_MODULE_IMAGE_JRE) $(INITIAL_MODULE_IMAGE_JDK) \ + trim-module-image-jre trim-module-image-jdk \ + process-module-image-jre process-module-image-jdk + +# Don't use these +module-image-jre:: initial-module-image-jre trim-module-image-jre process-module-image-jre +module-image-jdk:: initial-module-image-jdk trim-module-image-jdk process-module-image-jdk + +# +# Paths to these files we need +JDK_MODULE_LICENSES = $(LICENSE_DOCLIST_JDK:%=$(JDK_MODULE_IMAGE_DIR)/%) +JDK_MODULE_64_LICENSES = $(LICENSE_DOCLIST_JDK:%=$(JDK_MODULE_IMAGE_DIR)/%64) +JDK_MODULE_DOCFILES = $(OTHER_DOCLIST_JDK:%=$(JDK_MODULE_IMAGE_DIR)/%) + +JRE_MODULE_LICENSES = $(LICENSE_DOCLIST_JRE:%=$(JRE_MODULE_IMAGE_DIR)/%) +JRE_MODULE_64_LICENSES = $(LICENSE_DOCLIST_JRE:%=$(JRE_MODULE_IMAGE_DIR)/%64) +JRE_MODULE_DOCFILES = $(OTHER_DOCLIST_JRE:%=$(JRE_MODULE_IMAGE_DIR)/%) +JRE_MODULE_DOCFILES += $(JRE_NAMECHANGE_DOCLIST:%=$(JRE_MODULE_IMAGE_DIR)/%$(TEXT_SUFFIX)) + +###### RULES + +# JDK files +$(JDK_MODULE_IMAGE_DIR)/%: $(SHARE_JDK_DOC_SRC)/% + $(process-doc-file) +# Removes LICENSE_VERSION or not +ifdef LICENSE_VERSION +$(JDK_MODULE_IMAGE_DIR)/%: $(SHARE_JDK_DOC_SRC)/%$(LICENSE_VERSION) + $(process-doc-file) +$(JDK_MODULE_IMAGE_DIR)/%64: $(SHARE_JDK_DOC_SRC)/%$(LICENSE_VERSION) + $(process-doc-file) +else +$(JDK_MODULE_IMAGE_DIR)/%64: $(SHARE_JDK_DOC_SRC)/% + $(process-doc-file) +endif + +# JRE files +$(JRE_MODULE_IMAGE_DIR)/%: $(SHARE_JRE_DOC_SRC)/% + $(process-doc-file) +# Add $(TEXT_SUFFIX) suffix +ifdef TEXT_SUFFIX +$(JRE_MODULE_IMAGE_DIR)/%$(TEXT_SUFFIX): $(SHARE_JRE_DOC_SRC)/% + $(process-doc-file) +endif +# Removes LICENSE_VERSION or not +ifdef LICENSE_VERSION +$(JRE_MODULE_IMAGE_DIR)/%: $(SHARE_JRE_DOC_SRC)/%$(LICENSE_VERSION) + $(process-doc-file) +$(JRE_MODULE_IMAGE_DIR)/%64: $(SHARE_JRE_DOC_SRC)/%$(LICENSE_VERSION) + $(process-doc-file) +else +$(JRE_MODULE_IMAGE_DIR)/%64: $(SHARE_JRE_DOC_SRC)/% + $(process-doc-file) +endif + +###################################################### +# JRE Image +###################################################### + +MODULES_LIST = $(MODULES_TEMPDIR)/classlist/modules.list + +# Modules in the jre/lib/security directory +POLICY_MODULES = US_export_policy local_policy + +# Modules in the modules/ext directory +EXT_MODULES = localedata security-sunec security-sunjce + +# Build PKCS#11 on all platforms except 64-bit Windows. +PKCS11 = security-sunpkcs11 +ifeq ($(ARCH_DATA_MODEL), 64) + ifeq ($(PLATFORM), windows) + PKCS11 = + endif +endif + +EXT_MODULES += $(PKCS11) + +# Build Microsoft CryptoAPI provider only on (non-64-bit) Windows platform. +ifeq ($(PLATFORM), windows) + ifneq ($(ARCH_DATA_MODEL), 64) + EXT_MODULES += security-sunmscapi + endif +endif + +# Modules for JDK only +JDK_MODULES = tools + +gen-modules: + $(CD) modules; $(MAKE) all + +initial-module-image-jre-setup: + $(RM) -r $(JRE_MODULE_IMAGE_DIR) + $(MKDIR) -p $(JRE_MODULE_IMAGE_DIR) + +# 64-bit solaris jre image contains only the 64-bit add-on files. +initial-module-image-jre-sol64:: initial-module-image-jre-setup \ + $(JRE_MODULE_LICENSES) $(JRE_MODULE_64_LICENSES) + @# Use tar instead of cp to preserve the symbolic links + for dir in bin lib ; do \ + ( $(CD) $(OUTPUTDIR) && \ + $(TAR) cf - `$(FIND) $$dir -name '$(ARCH)' -print` | \ + ($(CD) $(JRE_MODULE_IMAGE_DIR) && $(TAR) xf -) ) ; \ + done + @# Remove some files from the jre area + for t in $(NOTJRETOOLS) ; do \ + $(RM) $(JRE_MODULE_IMAGE_DIR)/bin$(ISA_DIR)/$$t ; \ + done + $(RM) `$(FIND) $(JRE_MODULE_IMAGE_DIR)/lib -name 'orb.idl'` + $(RM) `$(FIND) $(JRE_MODULE_IMAGE_DIR)/lib -name 'ir.idl'` + +# Construct an initial jre image (initial jdk jre) no trimming or stripping +initial-module-image-jre:: initial-module-image-jre-setup \ + $(JRE_LICENSES) $(JRE_MODULE_DOCFILES) \ + $(BUILDMETAINDEX_JARFILE) + @# Copy in bin directory + $(CD) $(OUTPUTDIR) && $(FIND) bin -depth | $(CPIO) -pdum $(JRE_MODULE_IMAGE_DIR) + @# CTE plugin security change require new empty directory lib/applet + $(MKDIR) -p $(JRE_MODULE_IMAGE_DIR)/lib/applet + @# Copy files but not .jar in lib directory + $(CD) $(OUTPUTDIR) && $(FIND) lib -depth | $(EGREP) -v ".jar$$" | $(CPIO) -pdum $(JRE_MODULE_IMAGE_DIR) + @# + @# copy modules to jre/lib + @# + for m in `$(NAWK) '{print $$1}' $(MODULES_LIST)` ; do \ + $(CP) $(MODULES_DIR)/$$m/lib/$$m.jar $(JRE_MODULE_IMAGE_DIR)/lib ; \ + done + $(MKDIR) -p $(JRE_MODULE_IMAGE_DIR)/lib/ext + for m in $(EXT_MODULES) ; do \ + $(MV) $(JRE_MODULE_IMAGE_DIR)/lib/$$m.jar $(JRE_MODULE_IMAGE_DIR)/lib/ext ; \ + done + for m in $(POLICY_MODULES) ; do \ + $(MV) $(JRE_MODULE_IMAGE_DIR)/lib/$$m.jar $(JRE_MODULE_IMAGE_DIR)/lib/security; \ + done + @# Remove jdk modules + for m in $(JDK_MODULES) ; do \ + $(RM) $(JRE_MODULE_IMAGE_DIR)/lib/$$m.jar ; \ + done + + @# Make sure all directories are read/execute for everyone + $(CHMOD) a+rx `$(FIND) $(JRE_MODULE_IMAGE_DIR) -type d` + @# Remove some files from the jre area + for t in $(NOTJRETOOLS) ; do \ + $(RM) $(JRE_MODULE_IMAGE_DIR)/bin$(ISA_DIR)/$$t ; \ + done + @# Remove orb.idl and ir.idl from jre + $(FIND) $(JRE_MODULE_IMAGE_DIR)/lib -name 'orb.idl' -exec $(RM) \{} \; + $(FIND) $(JRE_MODULE_IMAGE_DIR)/lib -name 'ir.idl' -exec $(RM) \{} \; + @# Generate meta-index to make boot and extension class loaders lazier + $(CD) $(JRE_MODULE_IMAGE_DIR)/lib && \ + $(BOOT_JAVA_CMD) -jar $(BUILDMETAINDEX_JARFILE) \ + -o meta-index *.jar + @$(CD) $(JRE_MODULE_IMAGE_DIR)/lib && $(java-vm-cleanup) + $(CD) $(JRE_MODULE_IMAGE_DIR)/lib/ext && \ + $(BOOT_JAVA_CMD) -jar $(BUILDMETAINDEX_JARFILE) \ + -o meta-index *.jar + @$(CD) $(JRE_MODULE_IMAGE_DIR)/lib/ext && $(java-vm-cleanup) +ifeq ($(PLATFORM), windows) + @# Remove certain *.lib files + $(CD) $(JRE_MODULE_IMAGE_DIR)/lib && \ + $(RM) java.$(LIB_SUFFIX) jvm.$(LIB_SUFFIX) \ + hpi.$(LIB_SUFFIX) awt.$(LIB_SUFFIX) jawt.$(LIB_SUFFIX) + ifeq ($(ARCH_DATA_MODEL), 32) + @# The Java Kernel JRE image ships with a special VM. It is not included + @# in the full JRE image, so remove it. Also, is it only for 32-bit windows. + $(CD) $(JRE_MODULE_IMAGE_DIR)/bin && $(RM) -r kernel + endif +endif # Windows +ifneq ($(PLATFORM), windows) + $(call copy-man-pages,$(JRE_MODULE_IMAGE_DIR),$(JRE_MAN_PAGES)) +endif # !windows + +# Trim out any extra files not for the jre shipment but wanted in the jdk jre. +# (Note the jdk WILL want the jre image before this trimming) +# Removes server VM on Windows 32bit. +# Remove certain shared libraries that should not be in the jre image +# but should be in the jdk jre image. +trim-module-image-jre:: +ifeq ($(PLATFORM), windows) + ifeq ($(ARCH_DATA_MODEL), 32) + $(RM) -r $(JRE_MODULE_IMAGE_DIR)/bin/server + endif + ifdef NOTJRE_SHARED_LIBS + for l in $(NOTJRE_SHARED_LIBS) ; do \ + $(RM) $(JRE_MODULE_IMAGE_DIR)/bin/$$l ; \ + done ; + endif +else # PLATFORM + ifdef NOTJRE_SHARED_LIBS + for l in $(NOTJRE_SHARED_LIBS) ; do \ + $(RM) $(JRE_MODULE_IMAGE_DIR)/lib/$(LIBARCH)/$$l ; \ + done ; + endif +endif # PLATFORM + +# Get list of all Elf files in the jre +JRE_MODULE_ELF_LIST=$(MODULES_TEMPDIR)/jre-elf-files.list +$(JRE_MODULE_ELF_LIST): + @$(prep-target) +ifneq ($(PLATFORM), windows) + $(RM) $@ + $(FIND) $(JRE_MODULE_IMAGE_DIR)/lib -type f -name \*.$(LIB_SUFFIX) >> $@ + $(FILE) `$(FIND) $(JRE_MODULE_IMAGE_DIR)/bin -type f -name \*$(EXE_SUFFIX)` \ + | $(EGREP) 'ELF' | $(CUT) -d':' -f1 >> $@ +endif + +# Post process the image (strips and mcs on Elf files we are shipping) +# (Note the jdk WILL want the jre image before this processing) +process-module-image-jre:: $(JRE_MODULE_ELF_LIST) +ifneq ($(POST_STRIP_PROCESS), ) + for f in `$(CAT) $(JRE_MODULE_ELF_LIST)`; do \ + $(CHMOD) u+w $${f}; \ + $(ECHO) $(POST_STRIP_PROCESS) $${f}; \ + $(POST_STRIP_PROCESS) $${f}; \ + $(CHMOD) go-w $${f}; \ + done +endif +ifneq ($(POST_MCS_PROCESS), ) + for f in `$(CAT) $(JRE_MODULE_ELF_LIST)`; do \ + $(CHMOD) u+w $${f}; \ + $(ECHO) $(POST_MCS_PROCESS) $${f}; \ + $(POST_MCS_PROCESS) $${f}; \ + $(CHMOD) go-w $${f}; \ + done +endif + $(RM) $(JRE_MODULE_ELF_LIST) + +###################################################### +# JDK Image +###################################################### +# Note: cpio ($(CPIO)) sometimes leaves directories without rx access. + +initial-module-image-jdk-setup: + $(RM) -r $(JDK_MODULE_IMAGE_DIR) + $(MKDIR) -p $(JDK_MODULE_IMAGE_DIR)/jre + ($(CD) $(JRE_MODULE_IMAGE_DIR) && $(FIND) . -depth -print \ + | $(CPIO) -pdum $(JDK_MODULE_IMAGE_DIR)/jre ) + $(RM) -rf $(JDK_MODULE_IMAGE_DIR)/jre/man + $(CHMOD) a+rx `$(FIND) $(JDK_MODULE_IMAGE_DIR) -type d` + +initial-module-image-jdk64-bindemos: + for dir in bin demo ; do \ + ( $(CD) $(OUTPUTDIR) && \ + $(TAR) cf - `$(FIND) $$dir -name '$(LIBARCH)' -print` | \ + ($(CD) $(JDK_MODULE_IMAGE_DIR) && $(TAR) xf -) ) ; \ + done + +# Solaris 64 bit image is special +initial-module-image-jdk-sol64:: initial-module-image-jdk-setup \ + initial-module-image-jdk64-bindemos \ + $(JDK_MODULE_LICENSES) $(JDK_MODULARLIZED_64_LICENSES) + +# DB files to add +ifeq ($(OPENJDK),true) + +initial-module-image-jdk-db: + +else + +# Create the list of db *.zip files to bundle with jdk +ABS_DB_PATH :=$(call FullPath,$(CLOSED_SHARE_SRC)/db) +DB_ZIP_LIST = $(shell $(LS) $(ABS_DB_PATH)/*.zip 2>/dev/null) + +initial-module-image-jdk-db: $(DB_ZIP_LIST) + $(MKDIR) -p $(JDK_MODULE_IMAGE_DIR)/db + for d in $(DB_ZIP_LIST); do \ + ($(CD) $(JDK_MODULE_IMAGE_DIR)/db && $(UNZIP) -o $$d); \ + done + +endif + +# Standard jdk image +initial-module-image-jdk:: initial-module-image-jdk-setup \ + initial-module-image-jdk-db \ + $(JDK_MODULE_LICENSES) $(JDK_MODULE_DOCFILES) + $(MKDIR) $(JDK_MODULE_IMAGE_DIR)/lib + @# + @# copy jdk modules to jdk/lib + @# + $(MKDIR) -p $(JDK_MODULE_IMAGE_DIR)/lib + for m in $(JDK_MODULES) ; do \ + $(CP) $(MODULES_DIR)/$$m/lib/$$m.jar $(JDK_MODULE_IMAGE_DIR)/lib ; \ + done + ifeq ($(PLATFORM), windows) + @# + @# lib/ + @# + $(CP) $(LIBDIR)/$(LIB_PREFIX)jvm.$(LIB_SUFFIX) $(JDK_MODULE_IMAGE_DIR)/lib + $(CP) $(LIBDIR)/$(LIB_PREFIX)jawt.$(LIB_SUFFIX) $(JDK_MODULE_IMAGE_DIR)/lib + @# + @# bin/ + @# + @# copy all EXE files and only certain DLL files from BINDIR + $(MKDIR) -p $(JDK_MODULE_IMAGE_DIR)/bin + $(CP) $(BINDIR)/*$(EXE_SUFFIX) $(JDK_MODULE_IMAGE_DIR)/bin + $(CP) $(BINDIR)/jli.$(LIBRARY_SUFFIX) $(JDK_MODULE_IMAGE_DIR)/bin + ifeq ($(ARCH_DATA_MODEL), 32) + ifeq ($(COMPILER_VERSION), VS2003) + $(CP) $(BINDIR)/msvc*71.$(LIBRARY_SUFFIX) $(JDK_MODULE_IMAGE_DIR)/bin + endif + endif + else # PLATFORM + @# + @# bin/ + @# + ($(CD) $(BINDIR)/.. && $(TAR) cf - \ + `$(FIND) bin \( -type f -o -type l \) -print `) | \ + ($(CD) $(JDK_MODULE_IMAGE_DIR) && $(TAR) xf -) + endif # PLATFORM + @# + @# lib/ct.sym + @# + $(MKDIR) -p $(OUTPUTDIR)/symbols/META-INF/sym + $(JAVAC_CMD) -XDprocess.packages -proc:only \ + -processor com.sun.tools.javac.sym.CreateSymbols \ + -Acom.sun.tools.javac.sym.Jar=$(RT_JAR) \ + -Acom.sun.tools.javac.sym.Dest=$(OUTPUTDIR)/symbols/META-INF/sym/rt.jar \ + $(CORE_PKGS) $(NON_CORE_PKGS) $(EXCLUDE_PROPWARN_PKGS) + $(BOOT_JAR_CMD) c0f $(LIBDIR)/ct.sym \ + -C $(OUTPUTDIR)/symbols META-INF $(BOOT_JAR_JFLAGS) + @$(java-vm-cleanup) + $(CP) $(LIBDIR)/ct.sym $(JDK_MODULE_IMAGE_DIR)/lib/ct.sym + @# + @# CORBA supported orb.idl and ir.idl should be copied to lib + @# + $(CP) $(LIBDIR)/orb.idl $(JDK_MODULE_IMAGE_DIR)/lib/orb.idl + $(CP) $(LIBDIR)/ir.idl $(JDK_MODULE_IMAGE_DIR)/lib/ir.idl + ifeq ($(PLATFORM), linux) + @# + @# on Linux copy jexec from jre/lib to /lib + @# + $(CP) $(LIBDIR)/jexec $(JDK_MODULE_IMAGE_DIR)/lib/jexec + endif # PLATFORM + @# + @# demo, include + @# + $(CP) -r -f $(DEMODIR) $(JDK_MODULE_IMAGE_DIR) + $(CP) -r -f $(SAMPLEDIR) $(JDK_MODULE_IMAGE_DIR) + $(CP) -r $(INCLUDEDIR) $(JDK_MODULE_IMAGE_DIR) + @# + @# Swing BeanInfo generation + @# + $(CD) javax/swing/beaninfo && $(MAKE) JDK_IMAGE_DIR=$(JDK_MODULE_IMAGE_DIR) swing-1.2-beans +ifneq ($(PLATFORM), windows) + $(call copy-man-pages,$(JDK_MODULE_IMAGE_DIR),$(JDK_MAN_PAGES)) +endif # !windows + +# Trim out files we don't want to ship +trim-module-image-jdk:: + @# Remove tools that should not be part of SDK. + for t in $(NOTJDKTOOLS); do \ + $(RM) $(JDK_MODULE_IMAGE_DIR)/bin/$${t}$(EXE_SUFFIX) \ + $(JDK_MODULE_IMAGE_DIR)/bin/*/native_threads/$${t}$(EXE_SUFFIX); \ + done + +# Get list of Elf files in the jdk +JDK_MODULE_ELF_LIST=$(MODULES_TEMPDIR)/jdk-elf-files.list +$(JDK_MODULE_ELF_LIST): + @$(prep-target) +ifneq ($(PLATFORM), windows) + $(RM) $@ + $(FIND) $(JDK_MODULE_IMAGE_DIR)/jre/lib -type f -name \*.$(LIB_SUFFIX) >> $@ + $(FILE) `$(FIND) $(JDK_MODULE_IMAGE_DIR)/jre/bin -type f -name \*$(EXE_SUFFIX)` \ + | $(EGREP) 'ELF' | $(CUT) -d':' -f1 >> $@ + file `$(FIND) $(JDK_MODULE_IMAGE_DIR)/bin -type f -name \*$(EXE_SUFFIX)` \ + | $(EGREP) 'ELF' | $(CUT) -d':' -f1 >> $@ +endif + +# Post process the image (strips and mcs on files we are shipping) +process-module-image-jdk:: $(JDK_MODULE_ELF_LIST) +ifneq ($(POST_STRIP_PROCESS), ) + for f in `$(CAT) $(JDK_MODULE_ELF_LIST)`; do \ + $(CHMOD) u+w $${f}; \ + $(ECHO) $(POST_STRIP_PROCESS) $${f}; \ + $(POST_STRIP_PROCESS) $${f}; \ + $(CHMOD) go-w $${f}; \ + done +endif +ifneq ($(POST_MCS_PROCESS), ) + for f in `$(CAT) $(JDK_MODULE_ELF_LIST)`; do \ + $(CHMOD) u+w $${f}; \ + $(ECHO) $(POST_MCS_PROCESS) $${f}; \ + $(POST_MCS_PROCESS) $${f}; \ + $(CHMOD) go-w $${f}; \ + done +endif + $(RM) $(JDK_MODULE_ELF_LIST) + +###################################################### +# clobber +###################################################### +modules-clobber:: + $(RM) -r $(JDK_MODULE_IMAGE_DIR) + $(RM) -r $(JRE_MODULE_IMAGE_DIR) + +# +# TODO - nop for now +sanity-module-images post-sanity-module-images: + +modules modules-clobber:: + @$(ECHO) ">>>Finished making "$@" @ `$(DATE)` ..." + @$(java-vm-cleanup) + +.PHONY: modules module-image-jre module-image-jdk \ + initial-module-image-jre initial-module-image-jdk \ + initial-module-image-jre-sol64 initial-module-image-jdk-sol64 \ + initial-module-image-jdk-setup \ + initial-module-image-jdk-db \ + initial-module-image-jdk64-bindemos \ + initial-module-image-jre-setup \ + trim-module-image-jre trim-module-image-jdk \ + process-module-image-jre process-module-image-jdk \ + install-previous-jre install-previous-jdk \ + modules-clobber + +# Force rule +FRC: + diff --git a/make/common/Program.gmk b/make/common/Program.gmk index 091ec95f8098d5c6db9687c602422ec54ee072c2..7cae90fb10f5bc1c21db67c1694d2f136f78c2ef 100644 --- a/make/common/Program.gmk +++ b/make/common/Program.gmk @@ -50,8 +50,6 @@ ACTUAL_PROGRAM_NAME = $(PROGRAM)$(EXE_SUFFIX) ACTUAL_PROGRAM_DIR = $(BINDIR) ACTUAL_PROGRAM = $(ACTUAL_PROGRAM_DIR)/$(ACTUAL_PROGRAM_NAME) -JVMCFG = $(LIBDIR)/$(LIBARCH)/jvm.cfg - # Make sure the default rule is all program_default_rule: all @@ -116,7 +114,7 @@ endif ifeq ($(COMPILE_IT),true) -$(ACTUAL_PROGRAM):: classes $(JVMCFG) $(INIT) +$(ACTUAL_PROGRAM):: classes $(INIT) # # Windows only @@ -190,12 +188,13 @@ $(ACTUAL_PROGRAM):: $(FILES_o) @$(MKDIR) -p $(TEMPDIR) $(LINK_PRE_CMD) $(CC) $(CC_OBJECT_OUTPUT_FLAG)$@ $(LDFLAGS) \ $(FILES_o) $(THREADLIBS) $(LDLIBS) + $(install-module-file) endif # PLATFORM else # COMPILE_IT -$(ACTUAL_PROGRAM):: $(JVMCFG) +$(ACTUAL_PROGRAM):: # Copies in the file from the JDK_IMPORT_PATH area $(ACTUAL_PROGRAM_DIR)/%: $(JDK_IMPORT_PATH)/jre/bin/% @@ -271,18 +270,6 @@ $(OBJDIR)/main.$(OBJECT_SUFFIX): $(LAUNCHER_SHARE_SRC)/bin/main.c $(COMPILE.c) $(CC_OBJECT_OUTPUT_FLAG)$(OBJDIR)/main.$(OBJECT_SUFFIX) \ $(VERSION_DEFINES) $< -# -# How to install jvm.cfg. -# -ifeq ($(ZERO_BUILD), true) -JVMCFG_ARCH = zero -else -JVMCFG_ARCH = $(ARCH) -endif - -$(JVMCFG): $(LAUNCHER_PLATFORM_SRC)/bin/$(JVMCFG_ARCH)/jvm.cfg - $(install-file) - # # Default dependencies # diff --git a/make/common/internal/BinaryPlugs.gmk b/make/common/internal/BinaryPlugs.gmk index a77044af43cc4c65db8afd7c72e9062154c07a70..96c7ba989bd3a90bebf5ff287c0abf82caa6c156 100644 --- a/make/common/internal/BinaryPlugs.gmk +++ b/make/common/internal/BinaryPlugs.gmk @@ -116,7 +116,7 @@ PLUG_IMPORT_JARFILE=$(BINARY_PLUGS_JARFILE) define import-binary-plug-file @$(ECHO) "PLUG IMPORT: $(@F)" -$(install-file) +$(install-non-module-file) endef # import-binary-plug-file # Import classes command @@ -184,7 +184,7 @@ PLUG_EXPORT_JARFILE=$(PLUG_EXPORT_DIR)/jre/lib/$(BINARY_PLUGS_JARNAME) define export-binary-plug-file @$(ECHO) "PLUG EXPORT: $(@F)" -$(install-file) +$(install-non-module-file) endef # export-binary-plug-file # OpenJDK Binary Plug License diff --git a/make/common/internal/Resources.gmk b/make/common/internal/Resources.gmk index a772194b471b5ac2e8de97764e3d64f6395a0e4b..dbbc4b561d8209c83f35059c6feeb7dddc5d812e 100644 --- a/make/common/internal/Resources.gmk +++ b/make/common/internal/Resources.gmk @@ -139,7 +139,7 @@ STRIP_PROP_FILES = $(PROPERTIES_FILES:%=$(CLASSDESTDIR)/%) STRIP_PROP_options=$(TEMPDIR)/strip_prop_options define install-properties-file $(install-file) -$(CHMOD) a+rw $@ +$(call chmod-file, a+rw) @$(ECHO) "# Adding to strip properties list: $@" $(ECHO) "$@" >> $(STRIP_PROP_options) endef diff --git a/make/common/shared/Sanity.gmk b/make/common/shared/Sanity.gmk index e8b19c942ebf03e2ec14a73070787f0152b03415..c19df0eb6effaf00ae7ad51c58d4d194ea89fcce 100644 --- a/make/common/shared/Sanity.gmk +++ b/make/common/shared/Sanity.gmk @@ -1117,7 +1117,7 @@ TMP_SDK_INCLUDE_GET_FULL_VERSION= $(TMP_SDK_INCLUDE_FIND_VERSION) | \ # be checked when this represents a full control build (i.e. the # HOTSPOT_IMPORT_PATH includes these files in it's 'include' directory). $(TEMPDIR)/%.h: $(SHARE_SRC)/javavm/export/%.h - @$(install-file) + @$(install-non-module-file) @$(RM) $@.IMPORT @if [ -r $(HOTSPOT_IMPORT_PATH)/include/$(@F) ]; then \ $(CP) $(HOTSPOT_IMPORT_PATH)/include/$(@F) $@.IMPORT ; \ @@ -1131,7 +1131,7 @@ $(TEMPDIR)/%.h: $(SHARE_SRC)/javavm/export/%.h fi $(TEMPDIR)/%.h: $(PLATFORM_SRC)/javavm/export/%.h - @$(install-file) + @$(install-non-module-file) @$(RM) $@.IMPORT @if [ -r $(HOTSPOT_IMPORT_PATH)/include/$(PLATFORM_INCLUDE_NAME)/$(@F) ]; then \ $(CP) $(HOTSPOT_IMPORT_PATH)/include/$(PLATFORM_INCLUDE_NAME)/$(@F) $@.IMPORT ; \ diff --git a/make/java/awt/Makefile b/make/java/awt/Makefile index e019a309d9f650631650a4fecb7f98056b06fff3..f8c56732c3a12c91cc207b149e68414ad0e39682 100644 --- a/make/java/awt/Makefile +++ b/make/java/awt/Makefile @@ -24,6 +24,7 @@ # BUILDDIR = ../.. +MODULE = awt PACKAGE = java.awt PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk diff --git a/make/java/fdlibm/Makefile b/make/java/fdlibm/Makefile index 739eaf4403fd701cd74f8d351ee1f129c9edfb63..fcacf2d7106ee21f7ed81e14f63599a5098f04b0 100644 --- a/make/java/fdlibm/Makefile +++ b/make/java/fdlibm/Makefile @@ -31,6 +31,7 @@ # BUILDDIR = ../.. +MODULE = base LIBRARY = fdlibm PRODUCT = java diff --git a/make/java/hpi/native/Makefile b/make/java/hpi/native/Makefile index 7e9f2d2047ce9f186a21d7ca7f1c84e86589af07..79cafdcf82e401a0b0e6d2889067ddc014ef8000 100644 --- a/make/java/hpi/native/Makefile +++ b/make/java/hpi/native/Makefile @@ -28,6 +28,7 @@ # BUILDDIR = ../../.. +MODULE = base LIBRARY = hpi PRODUCT = java THREADDIR = native_threads diff --git a/make/java/hpi/windows/Makefile b/make/java/hpi/windows/Makefile index b82d8853ab2bc11443aebc81be1c8d5e7e6e5ed2..44d0501363a3863556d75c9171beb5eee89c4555 100644 --- a/make/java/hpi/windows/Makefile +++ b/make/java/hpi/windows/Makefile @@ -26,8 +26,9 @@ # # Makefile for Windows HPI DLL # -BUILDDIR = ../../.. -LIBRARY = hpi +BUILDDIR = ../../.. +MODULE = base +LIBRARY = hpi PRODUCT = java THREADDIR = windows_threads LIB_LOCATION = $(BINDIR) diff --git a/make/java/instrument/Makefile b/make/java/instrument/Makefile index f46b3d10cc107ca84e31372e6556a2c5d28c2f30..8b703afd92045cbeab865b69b87e9f9a14bea130 100644 --- a/make/java/instrument/Makefile +++ b/make/java/instrument/Makefile @@ -27,6 +27,7 @@ # agent, supporting java.lang.instrument BUILDDIR = ../.. +MODULE = instrument PACKAGE = sun.instrument LIBRARY = instrument PRODUCT = sun diff --git a/make/java/java/Makefile b/make/java/java/Makefile index b0e40530f4ee70a098dba62ef0a0acc8049fdb25..e3d5ee4231cc3ff99bdfe009d3c5015bf0afdc61 100644 --- a/make/java/java/Makefile +++ b/make/java/java/Makefile @@ -29,6 +29,7 @@ # BUILDDIR = ../.. +MODULE = base PACKAGE = java.lang LIBRARY = java PRODUCT = java @@ -241,7 +242,7 @@ ifneq ($(PLATFORM),windows) $(GENSRCDIR)/java/lang/UNIXProcess.java: \ $(PLATFORM_SRC)/classes/java/lang/UNIXProcess.java.$(PLATFORM) - $(install-file) + $(install-non-module-file) clean:: $(RM) $(GENSRCDIR)/java/lang/UNIXProcess.java @@ -285,7 +286,7 @@ TZMAPFILE = $(PLATFORM_SRC)/lib/tzmappings $(TZMAP): $(TZMAPFILE) $(install-file) - $(CHMOD) 444 $@ + $(call chmod-file, 444) endif build: $(LIBDIR)/$(PROPS) $(LIBDIR)/$(CAL_PROPS) $(TZMAP) @@ -315,7 +316,8 @@ $(CURDATA): \ $(BOOT_JAVA_CMD) -jar $(GENERATECURRENCYDATA_JARFILE) -o $@.temp \ < $(SHARE_SRC)/classes/java/util/CurrencyData.properties $(MV) $@.temp $@ - $(CHMOD) 444 $@ + $(install-module-file) + $(call chmod-file, 444) clean:: $(RM) $(CURDATA) @@ -369,7 +371,7 @@ $(GENSRCDIR)/java/lang/CharacterDataLatin1.java \ -usecharforbyte 11 4 1 $(GENSRCDIR)/java/lang/%.java : $(CHARACTERDATA)/%.java.template - $(install-file) + $(install-non-module-file) clean:: $(RM) $(GENSRCDIR)/java/lang/CharacterDataLatin1.java diff --git a/make/java/java/mapfile-vers b/make/java/java/mapfile-vers index 661db2f463c44b0663a8fad8981c22313bfc659a..24c8d21a7898424d7f73ee28f5d012585ed6483b 100644 --- a/make/java/java/mapfile-vers +++ b/make/java/java/mapfile-vers @@ -150,10 +150,8 @@ SUNWprivate_1.1 { Java_java_lang_StrictMath_asin; Java_java_lang_StrictMath_atan; Java_java_lang_StrictMath_atan2; - Java_java_lang_StrictMath_ceil; Java_java_lang_StrictMath_cos; Java_java_lang_StrictMath_exp; - Java_java_lang_StrictMath_floor; Java_java_lang_StrictMath_log; Java_java_lang_StrictMath_log10; Java_java_lang_StrictMath_pow; diff --git a/make/java/java/reorder-i586 b/make/java/java/reorder-i586 index 6489abcdc2c3107b08c27eac89a3a3b3fc542b4a..fc3202a8439e0af4b31940130880d4e611f40da6 100644 --- a/make/java/java/reorder-i586 +++ b/make/java/java/reorder-i586 @@ -107,4 +107,3 @@ text: .text%Java_java_lang_Class_isInstance; text: .text%Java_java_util_TimeZone_getSystemTimeZoneID; text: .text%findJavaTZ_md; text: .text%Java_java_lang_StrictMath_log; -text: .text%Java_java_lang_StrictMath_floor; diff --git a/make/java/java/reorder-sparc b/make/java/java/reorder-sparc index 22a178b649842c6aa9476da13cd18581783fc526..090f0001da2a01222f5eade924a44c71f5d5992b 100644 --- a/make/java/java/reorder-sparc +++ b/make/java/java/reorder-sparc @@ -105,4 +105,3 @@ text: .text%Java_java_util_TimeZone_getSystemTimeZoneID; text: .text%findJavaTZ_md; text: .text%Java_java_lang_StrictMath_log; text: .text%Java_java_lang_StrictMath_sqrt; -text: .text%Java_java_lang_StrictMath_floor; diff --git a/make/java/java/reorder-sparcv9 b/make/java/java/reorder-sparcv9 index d5f49f21ac6d26a6ae569102bd3741a92cde425c..b20b45ab960380dbe4034ff1711dffcdf32f3069 100644 --- a/make/java/java/reorder-sparcv9 +++ b/make/java/java/reorder-sparcv9 @@ -101,4 +101,3 @@ text: .text%Java_java_util_TimeZone_getSystemTimeZoneID; text: .text%findJavaTZ_md; text: .text%Java_java_lang_StrictMath_log; text: .text%Java_java_lang_StrictMath_sqrt; -text: .text%Java_java_lang_StrictMath_floor; diff --git a/make/java/java_crw_demo/Makefile b/make/java/java_crw_demo/Makefile index 6c45bcbd499b896e14a481d2ed64255da72d6f7b..4ee6467aa6dc1e6e4299e36379a0347c1ce3ce22 100644 --- a/make/java/java_crw_demo/Makefile +++ b/make/java/java_crw_demo/Makefile @@ -24,6 +24,8 @@ # BUILDDIR = ../.. + +MODULE = demos LIBRARY = java_crw_demo PRODUCT = sun LIBRARY_OUTPUT = java_crw_demo diff --git a/make/java/java_hprof_demo/Makefile b/make/java/java_hprof_demo/Makefile index 4e1ef2a31a89f14dd4db7ed77b08b542241c4a67..0826dd0213d7bae6fa293eeb79ae0f3ee75ec260 100644 --- a/make/java/java_hprof_demo/Makefile +++ b/make/java/java_hprof_demo/Makefile @@ -24,6 +24,7 @@ # BUILDDIR = ../.. +MODULE = instrument LIBRARY = hprof PRODUCT = sun LIBRARY_OUTPUT = hprof_jvmti diff --git a/make/java/jli/Makefile b/make/java/jli/Makefile index eeb64ca6e3413cc1c3d450feca0ea7a0dec084d5..98a7874402eae781a0790eef8d8199485991c062 100644 --- a/make/java/jli/Makefile +++ b/make/java/jli/Makefile @@ -30,6 +30,7 @@ # its manifestations (java, javaw, javac, ...). # BUILDDIR = ../.. +MODULE = base LIBRARY = jli PRODUCT = java @@ -152,7 +153,6 @@ STATIC_LIBRARY_NAME = $(LIBPREFIX)$(LIBRARY).lib STATIC_LIBRARY = $(STATIC_LIBRARY_DIR)/$(STATIC_LIBRARY_NAME) $(STATIC_LIBRARY_DIR): $(OBJDIR) - @$(prep-target) @$(MKDIR) $(STATIC_LIBRARY_DIR) $(STATIC_LIBRARY): $(STATIC_LIBRARY_DIR) diff --git a/make/java/jvm/Makefile b/make/java/jvm/Makefile index 42b756309f4df2ec590fddf496d096faa0c88c0a..ee992a1630b8348529517d8acc1d1947f4758225 100644 --- a/make/java/jvm/Makefile +++ b/make/java/jvm/Makefile @@ -24,6 +24,8 @@ # BUILDDIR = ../.. +MODULE = base + include $(BUILDDIR)/common/Defs.gmk # @@ -36,15 +38,29 @@ FILES_h = $(INCLUDEDIR)/jni.h \ $(INCLUDEDIR)/classfile_constants.h $(INCLUDEDIR)/%.h: $(SHARE_SRC)/javavm/export/%.h - $(install-file) + $(install-non-module-file) $(PLATFORM_INCLUDE)/%.h: $(PLATFORM_SRC)/javavm/export/%.h + $(install-non-module-file) + +JVMCFG = $(LIBDIR)/$(LIBARCH)/jvm.cfg + +# +# How to install jvm.cfg. +# +ifeq ($(ZERO_BUILD), true) +JVMCFG_ARCH = zero +else +JVMCFG_ARCH = $(ARCH) +endif + +$(JVMCFG): $(PLATFORM_SRC)/bin/$(JVMCFG_ARCH)/jvm.cfg $(install-file) all: build -build: $(FILES_h) +build: $(FILES_h) $(JVMCFG) clean clobber:: - $(RM) $(FILES_h) + $(RM) $(FILES_h) $(JVMCFG) diff --git a/make/java/logging/Makefile b/make/java/logging/Makefile index 444c1c63b5a76d35c182dd7667240ada67a58b8d..2077c02a01bd8478ce9cd280a2445a7842bea10e 100644 --- a/make/java/logging/Makefile +++ b/make/java/logging/Makefile @@ -24,6 +24,7 @@ # BUILDDIR = ../.. +MODULE = logging PACKAGE = java.util.logging PRODUCT = java include $(BUILDDIR)/common/Defs.gmk diff --git a/make/java/main/java/Makefile b/make/java/main/java/Makefile index 37fdf2bdd0f038350b40a9aa92b3538d5dbf8240..b24e9f0aaaed6743ab157a0d3ba39196ff395b53 100644 --- a/make/java/main/java/Makefile +++ b/make/java/main/java/Makefile @@ -24,6 +24,7 @@ # BUILDDIR = ../../.. +MODULE = base PROGRAM = java PRODUCT = java diff --git a/make/java/main/javaw/Makefile b/make/java/main/javaw/Makefile index 7ebc218f669c897b74de90a57e4bdb727ab20bf7..cd81b3ae1138c439cf445657019a610a25294a85 100644 --- a/make/java/main/javaw/Makefile +++ b/make/java/main/javaw/Makefile @@ -28,6 +28,7 @@ # BUILDDIR = ../../.. +MODULE = base PROGRAM = javaw PRODUCT = java diff --git a/make/java/management/Makefile b/make/java/management/Makefile index f579e10c105afe770511d684f0785ba54ccdf920..17c778e938ce07c1be698d303dec3fe2505311fd 100644 --- a/make/java/management/Makefile +++ b/make/java/management/Makefile @@ -24,6 +24,7 @@ # BUILDDIR = ../.. +MODULE = management PACKAGE = java.lang.management LIBRARY = management PRODUCT = java @@ -99,7 +100,7 @@ $(AGENTJAR): $(LIBDIR) $(TEMPDIR)/manifest @$(java-vm-cleanup) $(TEMPDIR)/manifest: $(MANIFEST) - $(install-file) + $(install-manifest-file) build: $(AGENTJAR) diff --git a/make/java/net/Makefile b/make/java/net/Makefile index 3c0985bcf9d8736a186c5f292c3c1673ed7949c8..c714d0a61ac73378002652507e834af11bf004a2 100644 --- a/make/java/net/Makefile +++ b/make/java/net/Makefile @@ -24,6 +24,7 @@ # BUILDDIR = ../.. +MODULE = base PACKAGE = java.net LIBRARY = net PRODUCT = sun @@ -111,8 +112,7 @@ LOCALE_SET_DEFINITION = jre MISC_FILES = $(LIBDIR) $(LIBDIR)/net.properties $(LIBDIR)/net.properties: $(SHARE_SRC)/lib/net.properties - @$(RM) $@ - $(CP) $< $@ + $(install-file) # # SDP configuration template diff --git a/make/java/nio/FILES_java.gmk b/make/java/nio/FILES_java.gmk index f3ba8254868d816ac899db2d23f86db5fff6ff3f..e38e4c67d0be0eb2da26456fe93437c346d5c50b 100644 --- a/make/java/nio/FILES_java.gmk +++ b/make/java/nio/FILES_java.gmk @@ -234,6 +234,7 @@ FILES_src = \ sun/nio/cs/UTF_16BE.java \ sun/nio/cs/UTF_16LE.java \ sun/nio/cs/UTF_8.java \ + sun/nio/cs/Unicode.java \ sun/nio/cs/UnicodeDecoder.java \ sun/nio/cs/UnicodeEncoder.java \ sun/nio/cs/UTF_32.java \ diff --git a/make/java/nio/Makefile b/make/java/nio/Makefile index 455d7529f67767282d4a71a59fb3463e97685fef..6dd15eac239ba8469c1c7a9e8cd9ac1853383f2c 100644 --- a/make/java/nio/Makefile +++ b/make/java/nio/Makefile @@ -28,6 +28,7 @@ # BUILDDIR = ../.. +MODULE = nio PACKAGE = java.nio LIBRARY = nio PRODUCT = java @@ -816,7 +817,7 @@ SOR_COPYRIGHT_YEARS = $(shell $(CAT) $(GENSOR_SRC) | \ $(NAWK) '/^.*Copyright.*Sun/ { print $$3 }') $(TEMPDIR)/$(GENSOR_SRC) : $(GENSOR_SRC) - $(install-file) + $(install-non-module-file) $(GENSOR_EXE) : $(TEMPDIR)/$(GENSOR_SRC) $(prep-target) diff --git a/make/java/nio/genBuffer.sh b/make/java/nio/genBuffer.sh index 27e3f82f0fd138a876c05ccd15ca63e955684c0a..69e86238baa9a07b22e0bc1b7f82a5a3cf1f1bb9 100644 --- a/make/java/nio/genBuffer.sh +++ b/make/java/nio/genBuffer.sh @@ -44,6 +44,7 @@ rwkey=XX case $type in char) fulltype=character;; + int) fulltype=integer;; *) fulltype=$type;; esac @@ -54,6 +55,11 @@ case $type in long | double) LBPV=3;; esac +case $type in + float|double) floatingPointOrIntegralType=floatingPointType;; + *) floatingPointOrIntegralType=integralType;; +esac + typesAndBits() { type="$1"; BO="$2" @@ -101,6 +107,7 @@ set -e $SPP <$SRC >$DST \ -K$type \ + -K$floatingPointOrIntegralType \ -Dtype=$type \ -DType=$Type \ -Dfulltype=$fulltype \ diff --git a/make/java/npt/Makefile b/make/java/npt/Makefile index 57e6a66380519d722ada4cebb4d61226faf299a0..77afce633dda8b47963c789906662459caa2b8e1 100644 --- a/make/java/npt/Makefile +++ b/make/java/npt/Makefile @@ -24,6 +24,9 @@ # BUILDDIR = ../.. + +# It's currently used by jpda and hprof. Put it in base module for now. +MODULE = base LIBRARY = npt PRODUCT = sun LIBRARY_OUTPUT = npt diff --git a/make/java/redist/Makefile b/make/java/redist/Makefile index 69d95a605777c7f126e9be8d3a38df6788d34a63..d66244920f32327da3df22d19faab7b538a079cb 100644 --- a/make/java/redist/Makefile +++ b/make/java/redist/Makefile @@ -35,6 +35,7 @@ # BUILDDIR = ../.. +MODULE = base PRODUCT = java include $(BUILDDIR)/common/Defs.gmk @@ -61,7 +62,11 @@ CLASSSHARINGDATA_DIR = $(BUILDDIR)/tools/sharing # Needed to do file copy ABS_BUILDDIR :=$(call FullPath,$(BUILDDIR)) -all: build +SUBDIRS = fonts sajdi +all clean clobber:: + $(SUBDIRS-loop) + +all:: build # List of files created here or coming from BUILDDIR area (this workspace) INTERNAL_IMPORT_LIST = $(LIBDIR)/classlist @@ -70,30 +75,6 @@ INTERNAL_IMPORT_LIST = $(LIBDIR)/classlist IMPORT_LIST = $(LIB_LOCATION)/$(SERVER_LOCATION)/$(JVM_NAME) \ $(LIB_LOCATION)/$(SERVER_LOCATION)/Xusage.txt -# INCLUDE_SA is false on platforms where SA is not supported. -# On platforms where it is supported, we want to allow it to -# not be present, at least temporarily. So, -# if the SA files (well, just sa-jdi.jar) do not exist -# in the HOTSPOT_IMPORT_PATH, then we won't build SA. -SA_EXISTS := $(shell if [ -r $(HOTSPOT_IMPORT_PATH)/lib/sa-jdi.jar ] ; then \ - $(ECHO) true; \ - else \ - $(ECHO) false; \ - fi) - -ifeq ($(SA_EXISTS), false) - INCLUDE_SA := false -endif - -ifeq ($(INCLUDE_SA), true) - IMPORT_LIST += $(LIBDIR)/sa-jdi.jar \ - $(LIB_LOCATION)/$(SALIB_NAME) - ifeq ($(PLATFORM), windows) - IMPORT_LIST += $(LIB_LOCATION)/$(SAMAP_NAME) \ - $(LIB_LOCATION)/$(SAPDB_NAME) - endif -endif # INCLUDE_SA - # Hotspot client is only available on 32-bit non-Zero builds ifneq ($(ZERO_BUILD), true) ifeq ($(ARCH_DATA_MODEL), 32) @@ -110,10 +91,10 @@ IMPORT_LIST += $(MS_RUNTIME_LIBRARIES:%=$(BINDIR)/%) # NOTE: These might actually come from BUILDDIR, depends on the settings. $(BINDIR)/msvcrt.dll: $(MSVCRT_DLL_PATH)/msvcrt.dll $(install-import-file) - $(CHMOD) a+x $@ + $(call chmod-file, a+x) $(BINDIR)/$(MSVCRNN_DLL): $(MSVCRNN_DLL_PATH)/$(MSVCRNN_DLL) $(install-import-file) - $(CHMOD) a+x $@ + $(call chmod-file, a+x) # Get the hotspot .map and .pdb files for client and server IMPORT_LIST += \ @@ -140,26 +121,32 @@ $(LIBDIR)/$(JVMLIB_NAME): $(HOTSPOT_LIB_PATH)/$(JVMLIB_NAME) $(LIB_LOCATION)/$(CLIENT_LOCATION)/$(JVMMAP_NAME): @$(prep-target) -$(CP) $(HOTSPOT_CLIENT_PATH)/$(JVMMAP_NAME) $@ + @$(install-module-file) $(LIB_LOCATION)/$(KERNEL_LOCATION)/$(JVMMAP_NAME): @$(prep-target) -$(CP) $(HOTSPOT_KERNEL_PATH)/$(JVMMAP_NAME) $@ + @$(install-module-file) $(LIB_LOCATION)/$(SERVER_LOCATION)/$(JVMMAP_NAME): @$(prep-target) -$(CP) $(HOTSPOT_SERVER_PATH)/$(JVMMAP_NAME) $@ + @$(install-module-file) $(LIB_LOCATION)/$(CLIENT_LOCATION)/$(JVMPDB_NAME): @$(prep-target) -$(CP) $(HOTSPOT_CLIENT_PATH)/$(JVMPDB_NAME) $@ + @$(install-module-file) $(LIB_LOCATION)/$(KERNEL_LOCATION)/$(JVMPDB_NAME): @$(prep-target) -$(CP) $(HOTSPOT_KERNEL_PATH)/$(JVMPDB_NAME) $@ + @$(install-module-file) $(LIB_LOCATION)/$(SERVER_LOCATION)/$(JVMPDB_NAME): @$(prep-target) -$(CP) $(HOTSPOT_SERVER_PATH)/$(JVMPDB_NAME) $@ + @$(install-module-file) # Windows ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Windows else # PLATFORM @@ -220,7 +207,7 @@ $(LIB_LOCATION)/$(LIBJSIG_NAME): $(HOTSPOT_IMPORT_PATH)/$(ARCH_VM_SUBDIR)/$(LIBJ $(LIB_LOCATION)/$(CLIENT_LOCATION)/$(LIBJSIG_NAME) \ $(LIB_LOCATION)/$(SERVER_LOCATION)/$(LIBJSIG_NAME): @$(prep-target) - $(LN) -s ../$(LIBJSIG_NAME) $@ + $(call install-sym-link, ../$(LIBJSIG_NAME)) $(LIB_LOCATION)/$(CLIENT_LOCATION)/$(JVMDB_NAME): $(HOTSPOT_CLIENT_PATH)/$(JVMDB_NAME) $(install-import-file) @@ -246,28 +233,6 @@ $(LIB_LOCATION)/$(CLIENT_LOCATION)/Xusage.txt : $(HOTSPOT_CLIENT_PATH)/Xusage.tx $(LIB_LOCATION)/$(KERNEL_LOCATION)/Xusage.txt : $(HOTSPOT_KERNEL_PATH)/Xusage.txt $(install-file) -ifeq ($(INCLUDE_SA), true) -# The Serviceability Agent is built in the Hotspot workspace. -# It contains two files: -# - sa-jdi.jar: This goes into the same dir as tools.jar. -# - a shared library: sawindbg.dll on windows / libproc.sa on unix -# This goes into the same dir as the other -# shared libs, eg. libjdwp.so. -$(LIBDIR)/sa-jdi.jar: $(HOTSPOT_IMPORT_PATH)/lib/sa-jdi.jar - $(install-import-file) - -$(LIB_LOCATION)/$(SALIB_NAME): $(HOTSPOT_SALIB_PATH)/$(SALIB_NAME) - $(install-import-file) - -ifeq ($(PLATFORM), windows) -$(LIB_LOCATION)/$(SAPDB_NAME): $(HOTSPOT_SALIB_PATH)/$(SAPDB_NAME) - $(install-import-file) - -$(LIB_LOCATION)/$(SAMAP_NAME): $(HOTSPOT_SALIB_PATH)/$(SAMAP_NAME) - $(install-import-file) -endif # windows -endif # INCLUDE_SA - # # Specific to OpenJDK building # @@ -288,7 +253,7 @@ INTERNAL_IMPORT_LIST += \ $(LIBDIR)/jce.jar: \ $(BUILDDIR)/closed/tools/crypto/jce/jce.jar - $(install-file) + $(install-non-module-file) $(LIBDIR)/security/US_export_policy.jar: \ $(BUILDDIR)/closed/tools/crypto/jce/US_export_policy.jar $(install-file) @@ -310,46 +275,6 @@ $(LIBDIR)/classlist: \ $(CLASSSHARINGDATA_DIR)/classlist.$(PLATFORM) $@.temp $(MV) $@.temp $@ -ifndef OPENJDK - -# Lucida font files are not included in the OpenJDK distribution. -# Get names of font files -include FILES.gmk - -# Copy font files into OUTPUTDIR area - -FONTFILES = $(SHARED_FONTFILES) -FONTSDIR = $(LIBDIR)/fonts -FONTSDIRFILE = $(FONTSDIR)/fonts.dir -INTERNAL_IMPORT_LIST += $(FONTFILES) - -ifneq ($(PLATFORM), windows) - INTERNAL_IMPORT_LIST += $(FONTSDIRFILE) -endif - -$(LIBDIR)/fonts/%.ttf: $(CLOSED_SRC)/share/lib/fonts/%.ttf - $(install-file) - -$(FONTSDIRFILE): $(PLATFORM_SRC)/classes/sun/awt/motif/java.fonts.dir - $(install-file) - -ifeq ($(PLATFORM), linux) - -# The oblique fonts are only needed/wanted on Linux. - -OBLFONTSDIR = $(LIBDIR)/oblique-fonts -OBLFONTSDIRFILE = $(OBLFONTSDIR)/fonts.dir -INTERNAL_IMPORT_LIST += $(OBLIQUE_FONTFILES) $(OBLFONTSDIRFILE) - -$(LIBDIR)/oblique-fonts/%.ttf: $(CLOSED_SRC)/share/lib/fonts/oblique/%.ttf - $(install-file) - -$(OBLFONTSDIRFILE): $(PLATFORM_SRC)/classes/sun/awt/motif/java.oblique-fonts.dir - $(install-file) - -endif # linux -endif # !OPENJDK - # Import internal files (ones that are stashed in this source tree) import_internal_files : $(INTERNAL_IMPORT_LIST) diff --git a/make/java/redist/FILES.gmk b/make/java/redist/fonts/Makefile similarity index 65% rename from make/java/redist/FILES.gmk rename to make/java/redist/fonts/Makefile index a90da603f4acc6dd608c32c6a59de0effebbf731..263d9b25c0e2bda0fcbd2aea6d21d52d37000aff 100644 --- a/make/java/redist/FILES.gmk +++ b/make/java/redist/fonts/Makefile @@ -1,5 +1,5 @@ # -# Copyright 1998-2003 Sun Microsystems, Inc. All Rights Reserved. +# Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -23,6 +23,12 @@ # have any questions. # +BUILDDIR = ../../.. +MODULE = font +PRODUCT = java +include $(BUILDDIR)/common/Defs.gmk + + # # List of lucida font files that we redistribute. # @@ -54,3 +60,52 @@ OBLIQUE_FONTFILES = \ $(LIBDIR)/oblique-fonts/LucidaSansDemiOblique.ttf \ endif + +ifndef OPENJDK + +# Lucida font files are not included in the OpenJDK distribution. +# Get names of font files + +# Copy font files into OUTPUTDIR area + +FONTFILES = $(SHARED_FONTFILES) +FONTSDIR = $(LIBDIR)/fonts +FONTSDIRFILE = $(FONTSDIR)/fonts.dir +INTERNAL_IMPORT_LIST = $(FONTFILES) + +ifneq ($(PLATFORM), windows) + INTERNAL_IMPORT_LIST += $(FONTSDIRFILE) +endif + +$(LIBDIR)/fonts/%.ttf: $(CLOSED_SRC)/share/lib/fonts/%.ttf + $(install-file) + +$(FONTSDIRFILE): $(PLATFORM_SRC)/classes/sun/awt/motif/java.fonts.dir + $(install-file) + +ifeq ($(PLATFORM), linux) + +# The oblique fonts are only needed/wanted on Linux. + +OBLFONTSDIR = $(LIBDIR)/oblique-fonts +OBLFONTSDIRFILE = $(OBLFONTSDIR)/fonts.dir +INTERNAL_IMPORT_LIST += $(OBLIQUE_FONTFILES) $(OBLFONTSDIRFILE) + +$(LIBDIR)/oblique-fonts/%.ttf: $(CLOSED_SRC)/share/lib/fonts/oblique/%.ttf + $(install-file) + +$(OBLFONTSDIRFILE): $(PLATFORM_SRC)/classes/sun/awt/motif/java.oblique-fonts.dir + $(install-file) + +endif # linux + +all build : $(INTERNAL_IMPORT_LIST) + +clean clobber:: + $(RM) $(INTERNAL_IMPORT_LIST) + +else + +all build clean clobber : + +endif # !OPENJDK diff --git a/make/java/redist/sajdi/Makefile b/make/java/redist/sajdi/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..7117763e299d877af51ced131859ed5a65f43e19 --- /dev/null +++ b/make/java/redist/sajdi/Makefile @@ -0,0 +1,87 @@ +# +# Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. Sun designates this +# particular file as subject to the "Classpath" exception as provided +# by Sun in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, +# CA 95054 USA or visit www.sun.com if you need additional information or +# have any questions. +# + +BUILDDIR = ../../.. +MODULE = sajdi +PRODUCT = java +include $(BUILDDIR)/common/Defs.gmk + +ifeq ($(PLATFORM), windows) + LIB_LOCATION = $(BINDIR) +else + LIB_LOCATION = $(LIBDIR)/$(LIBARCH) +endif + +# INCLUDE_SA is false on platforms where SA is not supported. +# On platforms where it is supported, we want to allow it to +# not be present, at least temporarily. So, +# if the SA files (well, just sa-jdi.jar) do not exist +# in the HOTSPOT_IMPORT_PATH, then we won't build SA. +SA_EXISTS := $(shell if [ -r $(HOTSPOT_IMPORT_PATH)/lib/sa-jdi.jar ] ; then \ + $(ECHO) true; \ + else \ + $(ECHO) false; \ + fi) + +ifeq ($(SA_EXISTS), false) + INCLUDE_SA := false +endif + +IMPORT_LIST = +ifeq ($(INCLUDE_SA), true) + IMPORT_LIST += $(LIBDIR)/sa-jdi.jar \ + $(LIB_LOCATION)/$(SALIB_NAME) + ifeq ($(PLATFORM), windows) + IMPORT_LIST += $(LIB_LOCATION)/$(SAMAP_NAME) \ + $(LIB_LOCATION)/$(SAPDB_NAME) + endif +endif # INCLUDE_SA + + +ifeq ($(INCLUDE_SA), true) +# The Serviceability Agent is built in the Hotspot workspace. +# It contains two files: +# - sa-jdi.jar: This goes into the same dir as tools.jar. +# - a shared library: sawindbg.dll on windows / libproc.sa on unix +# This goes into the same dir as the other +# shared libs, eg. libjdwp.so. +$(LIBDIR)/sa-jdi.jar: $(HOTSPOT_IMPORT_PATH)/lib/sa-jdi.jar + $(install-importonly-file) + +$(LIB_LOCATION)/$(SALIB_NAME): $(HOTSPOT_SALIB_PATH)/$(SALIB_NAME) + $(install-import-file) + +ifeq ($(PLATFORM), windows) +$(LIB_LOCATION)/$(SAPDB_NAME): $(HOTSPOT_SALIB_PATH)/$(SAPDB_NAME) + $(install-import-file) + +$(LIB_LOCATION)/$(SAMAP_NAME): $(HOTSPOT_SALIB_PATH)/$(SAMAP_NAME) + $(install-import-file) +endif # windows +endif # INCLUDE_SA + +all: $(IMPORT_LIST) + +clean clobber:: diff --git a/make/java/security/Makefile b/make/java/security/Makefile index 5da905a698dfcb8031359290b81fa1fbd672228a..8228eea85dbc8060d69411ae91c06f26a345e7e9 100644 --- a/make/java/security/Makefile +++ b/make/java/security/Makefile @@ -24,6 +24,7 @@ # BUILDDIR = ../.. +MODULE = base PACKAGE = java.security PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk @@ -38,11 +39,9 @@ AUTO_FILES_JAVA_DIRS = java/security # PROPS_SRC = $(TOPDIR)/src/share/lib/security/java.security -SUNPKCS11 = ifeq ($(PLATFORM), solaris) PROPS_SRC = $(TOPDIR)/src/share/lib/security/java.security-solaris -SUNPKCS11 = sunpkcs11 else # PLATFORM @@ -57,9 +56,6 @@ endif # PLATFORM PROPS_BUILD = $(LIBDIR)/security/java.security -SUNPKCS11_SRC = $(TOPDIR)/src/share/lib/security/sunpkcs11-solaris.cfg -SUNPKCS11_BUILD = $(LIBDIR)/security/sunpkcs11-solaris.cfg - POLICY_SRC = $(TOPDIR)/src/share/lib/security/java.policy POLICY_BUILD = $(LIBDIR)/security/java.policy @@ -73,14 +69,12 @@ FILES_class = $(FILES_java:%.java=$(CLASSBINDIR)/%.class) # include $(BUILDDIR)/common/Rules.gmk -build: properties $(SUNPKCS11) policy cacerts +build: properties policy cacerts install: all properties: classes $(PROPS_BUILD) -sunpkcs11: classes $(SUNPKCS11_BUILD) - policy: classes $(POLICY_BUILD) cacerts: classes $(CACERTS_BUILD) @@ -88,9 +82,6 @@ cacerts: classes $(CACERTS_BUILD) $(PROPS_BUILD): $(PROPS_SRC) $(install-file) -$(SUNPKCS11_BUILD): $(SUNPKCS11_SRC) - $(install-file) - $(POLICY_BUILD): $(POLICY_SRC) $(install-file) @@ -99,7 +90,7 @@ $(CACERTS_BUILD): $(CACERTS_SRC) clean clobber:: .delete.classlist $(RM) -r $(CLASSBINDIR)/java/security - $(RM) $(PROPS_BUILD) $(POLICY_BUILD) $(CACERTS_BUILD) $(SUNPKCS11_BUILD) + $(RM) $(PROPS_BUILD) $(POLICY_BUILD) $(CACERTS_BUILD) # Additional Rule for building sun.security.util $(CLASSBINDIR)/%.class: $(SHARE_SRC)/sun/%.java diff --git a/make/java/sql/Makefile b/make/java/sql/Makefile index 61e8047227b7e844df67177232f7fa9276a7fb08..62ce4b726e664cfb27269012395f67371904e3c0 100644 --- a/make/java/sql/Makefile +++ b/make/java/sql/Makefile @@ -28,6 +28,7 @@ # BUILDDIR = ../.. +MODULE = jdbc-base PACKAGE = java.sql PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk diff --git a/make/java/text/Makefile b/make/java/text/Makefile index 4db338926f38cf87bc6b3be0d41760ff2b804aef..001f4717a9ec8def93de4f6d57351d2b5fdab869 100644 --- a/make/java/text/Makefile +++ b/make/java/text/Makefile @@ -24,7 +24,7 @@ # BUILDDIR = ../.. - +MODULE = base PACKAGE = java.text PRODUCT = sun diff --git a/make/java/verify/Makefile b/make/java/verify/Makefile index 24bcc0f48d4aa17f70190b3b69c9997e610bd543..783dd2c55c724a3d3c52806b0d661c5704def8cd 100644 --- a/make/java/verify/Makefile +++ b/make/java/verify/Makefile @@ -28,6 +28,7 @@ # BUILDDIR = ../.. +MODULE = base PRODUCT = java LIBRARY = verify include $(BUILDDIR)/common/Defs.gmk diff --git a/make/java/zip/Makefile b/make/java/zip/Makefile index cec9d0d6cf1ef75e4f5e1a380be1c18f6261e5b5..809753050e1cb1daf8f520392806c70ef25d2046 100644 --- a/make/java/zip/Makefile +++ b/make/java/zip/Makefile @@ -25,6 +25,7 @@ BUILDDIR = ../.. +MODULE = base PACKAGE = java.util.zip LIBRARY = zip PRODUCT = sun diff --git a/make/javax/crypto/Makefile b/make/javax/crypto/Makefile index fe07ed5edf7a33178b4528bf5b095f86d6f3eacc..19a00a5e197ceeafc67ff473851e5ac6790818ab 100644 --- a/make/javax/crypto/Makefile +++ b/make/javax/crypto/Makefile @@ -108,6 +108,7 @@ # BUILDDIR = ../.. +MODULE = base PACKAGE = javax.crypto PRODUCT = sun @@ -293,7 +294,7 @@ limited: \ $(UNSIGNED_POLICY_BUILDDIR)/limited/US_export_policy.jar: \ $(UNSIGNED_POLICY_BUILDDIR)/unlimited/US_export_policy.jar - $(install-file) + $(install-non-module-file) $(UNSIGNED_POLICY_BUILDDIR)/limited/local_policy.jar: \ policy/limited/default_local.policy \ @@ -414,7 +415,7 @@ $(JAR_DESTFILE): $(UNSIGNED_DIR)/jce.jar else $(JAR_DESTFILE): $(SIGNED_DIR)/jce.jar endif - $(install-file) + $(install-non-module-file) # # Install the appropriate policy file, depending on the type of build. @@ -425,7 +426,7 @@ else INSTALL_POLICYDIR = $(SIGNED_POLICY_BUILDDIR) endif -install-limited: \ +install-limited-jars: \ $(INSTALL_POLICYDIR)/limited/US_export_policy.jar \ $(INSTALL_POLICYDIR)/limited/local_policy.jar $(MKDIR) -p $(POLICY_DESTDIR) @@ -433,24 +434,28 @@ install-limited: \ $(POLICY_DESTDIR)/US_export_policy.jar \ $(POLICY_DESTDIR)/local_policy.jar $(CP) $^ $(POLICY_DESTDIR) + +install-limited: install-limited-jars install-module-files ifndef OPENJDK $(release-warning) endif -install-unlimited: \ +install-unlimited-jars: \ $(INSTALL_POLICYDIR)/unlimited/US_export_policy.jar \ - $(INSTALL_POLICYDIR)/unlimited/local_policy.jar + $(INSTALL_POLICYDIR)/unlimited/local_policy.jar $(MKDIR) -p $(POLICY_DESTDIR) $(RM) \ $(POLICY_DESTDIR)/US_export_policy.jar \ $(POLICY_DESTDIR)/local_policy.jar $(CP) $^ $(POLICY_DESTDIR) + +install-unlimited: install-unlimited-jars install-module-files ifndef OPENJDK $(release-warning) endif ifndef OPENJDK -install-prebuilt: +install-prebuilt-jars: @$(ECHO) "\n>>>Installing prebuilt JCE framework..." $(RM) $(JAR_DESTFILE) \ $(POLICY_DESTDIR)/US_export_policy.jar \ @@ -460,8 +465,16 @@ install-prebuilt: $(PREBUILT_DIR)/jce/US_export_policy.jar \ $(PREBUILT_DIR)/jce/local_policy.jar \ $(POLICY_DESTDIR) + +install-prebuilt: install-prebuilt-jars install-module-files endif +install-module-files: \ + $(POLICY_DESTDIR)/US_export_policy.jar \ + $(POLICY_DESTDIR)/local_policy.jar + +$(POLICY_DESTDIR)/%.jar : + $(install-module-file) # ===================================================== # Support routines. diff --git a/make/javax/imageio/Makefile b/make/javax/imageio/Makefile index b3f75d181815e39bdb4f72489a38dc5eec8ff1c8..62f3b1b65ed6c91669389c7dd18590748c15c4ee 100644 --- a/make/javax/imageio/Makefile +++ b/make/javax/imageio/Makefile @@ -28,6 +28,7 @@ # BUILDDIR = ../.. +MODULE = imageio PACKAGE = javax.imageio PRODUCT = jiio include $(BUILDDIR)/common/Defs.gmk diff --git a/make/javax/print/Makefile b/make/javax/print/Makefile index b3652f8368e885fae6ea3314857244372e790454..639dc148556986255e71f39bd989c00c7bb7c4cb 100644 --- a/make/javax/print/Makefile +++ b/make/javax/print/Makefile @@ -28,6 +28,7 @@ # BUILDDIR = ../.. +MODULE = print PACKAGE = javax.print PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk diff --git a/make/javax/sound/Makefile b/make/javax/sound/Makefile index d2d1e736aeadd0752979e6de546c472c2900fb66..8b4948a15e1fe58d6df8037d0d6f76a2ce9d806a 100644 --- a/make/javax/sound/Makefile +++ b/make/javax/sound/Makefile @@ -26,6 +26,7 @@ # WARNING: Make sure the OPENJDK plugs are up-to-date, see make/common/internal/BinaryPlugs.gmk BUILDDIR = ../.. +MODULE = sound PACKAGE = javax.sound LIBRARY = jsound PRODUCT = sun diff --git a/make/javax/sound/jsoundalsa/Makefile b/make/javax/sound/jsoundalsa/Makefile index 6fdde65ee5c2818502f50e06166dcdaa5ce5db75..15b215fe6b27df105da0281982720fb2a94437d8 100644 --- a/make/javax/sound/jsoundalsa/Makefile +++ b/make/javax/sound/jsoundalsa/Makefile @@ -24,6 +24,7 @@ # BUILDDIR = ../../.. +MODULE = sound PACKAGE = javax.sound LIBRARY = jsoundalsa PRODUCT = sun diff --git a/make/javax/sound/jsoundds/Makefile b/make/javax/sound/jsoundds/Makefile index 5dcd336c9356668e2cfc10e791903d68ece7d1b1..5da3ee7bf77bb3a2494f1b34d9c0d02d172bc78d 100644 --- a/make/javax/sound/jsoundds/Makefile +++ b/make/javax/sound/jsoundds/Makefile @@ -24,6 +24,7 @@ # BUILDDIR = ../../.. +MODULE = sound PACKAGE = javax.sound LIBRARY = jsoundds PRODUCT = sun diff --git a/make/javax/sql/Makefile b/make/javax/sql/Makefile index 9edaff36f5cd89e4e77cab869ba3aa5186d3722d..deac8ea2399ae1dc85f2a32917e239503d279dfd 100644 --- a/make/javax/sql/Makefile +++ b/make/javax/sql/Makefile @@ -28,6 +28,7 @@ # BUILDDIR = ../.. +MODULE = jdbc-enterprise PACKAGE = javax.sql PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk diff --git a/make/javax/swing/Makefile b/make/javax/swing/Makefile index 1f3fa6c0f39b6c47854a19ccda8357da85e9839a..16bfcac03ab8fb9bf730cc9c92324fefa41a390e 100644 --- a/make/javax/swing/Makefile +++ b/make/javax/swing/Makefile @@ -24,6 +24,7 @@ # BUILDDIR = ../.. +MODULE = swing PACKAGE = javax.swing PRODUCT = com SWING_SRC = $(SHARE_SRC)/classes/javax/swing diff --git a/make/javax/swing/plaf/Makefile b/make/javax/swing/plaf/Makefile index c0c5ebecc70a0bf4e65b7a25688a1f2c84633298..2ef72c8b4c1fa26aae3f804e0d2519b531abc82e 100644 --- a/make/javax/swing/plaf/Makefile +++ b/make/javax/swing/plaf/Makefile @@ -24,6 +24,7 @@ # BUILDDIR = ../../.. +MODULE = swing PACKAGE = javax.swing.plaf PRODUCT = com SWING_SRC = $(SHARE_SRC)/classes/javax/swing diff --git a/make/jpda/back/Makefile b/make/jpda/back/Makefile index 5237d9c798ccb76afb1362076a7c9ffa84c4cb86..e2e073f31a6c07ad27f6e795618a0cc3b3ce6ee1 100644 --- a/make/jpda/back/Makefile +++ b/make/jpda/back/Makefile @@ -28,6 +28,7 @@ # BUILDDIR = ../.. +MODULE = debugging LIBRARY = jdwp PRODUCT = jpda diff --git a/make/jpda/transport/Makefile b/make/jpda/transport/Makefile index 8e507eab5966c44d24ab7b3869eb20c89265425d..9069032fa6ecc57c859f752aed7f308d18f21834 100644 --- a/make/jpda/transport/Makefile +++ b/make/jpda/transport/Makefile @@ -28,6 +28,7 @@ # BUILDDIR = ../.. +MODULE = debugging PRODUCT = jpda include $(BUILDDIR)/common/Defs.gmk diff --git a/make/jpda/transport/shmem/Makefile b/make/jpda/transport/shmem/Makefile index fcc8c632de47bff174055180642b2757d94da4ec..36d1d7fe861003917e5da94e4cd89e06f32a4fb3 100644 --- a/make/jpda/transport/shmem/Makefile +++ b/make/jpda/transport/shmem/Makefile @@ -28,6 +28,7 @@ # BUILDDIR = ../../.. +MODULE = debugging LIBRARY = dt_shmem PRODUCT = jbug diff --git a/make/jpda/transport/socket/Makefile b/make/jpda/transport/socket/Makefile index 65f8018477fd2f823f4b510b8fd5809f9e1c7dd4..d48d032752450a621c7c9a148452e712f78b4b56 100644 --- a/make/jpda/transport/socket/Makefile +++ b/make/jpda/transport/socket/Makefile @@ -28,6 +28,7 @@ # BUILDDIR = ../../.. +MODULE = debugging LIBRARY = dt_socket PRODUCT = jbug diff --git a/make/jpda/tty/Makefile b/make/jpda/tty/Makefile index 4468bddbeb3a18d71d9ec278163a324fe703246d..1706aba16414c513e4b8cfc563bbd819b8dd5790 100644 --- a/make/jpda/tty/Makefile +++ b/make/jpda/tty/Makefile @@ -28,6 +28,7 @@ # BUILDDIR = ../.. +MODULE = jdb PACKAGE = com.sun.tools.example.debug.tty PRODUCT = jpda PROGRAM = jdb diff --git a/make/launchers/Makefile b/make/launchers/Makefile index e9f949c1b287d0309aeb701c8563c26d310a3aac..c9d32b9d207bfff4c393b19f637f5137b507707f 100644 --- a/make/launchers/Makefile +++ b/make/launchers/Makefile @@ -28,33 +28,23 @@ # BUILDDIR = .. +MODULE = tools PACKAGE = launchers PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk -# Run MAKE $@ for a launcher: +# Run MAKE $@ for a launcher for the corba module: # $(call make-launcher, name, mainclass, java-args, main-args) -define make-launcher +define make-corba-launcher +$(CD) $(BUILDDIR)/launchers && \ $(MAKE) -f Makefile.launcher \ - PROGRAM=$(strip $1) \ - MAIN_CLASS=$(strip $2) \ - MAIN_JAVA_ARGS="$(strip $3)" \ - MAIN_ARGS="$(strip $4)" $@ + MODULE=corba \ + PROGRAM=$(strip $1) \ + MAIN_CLASS=$(strip $2) \ + MAIN_JAVA_ARGS="$(strip $3)" \ + MAIN_ARGS="$(strip $4)" endef -# Run MAKE $@ for all launchers -ifeq ($(PLATFORM),windows) -# Run MAKE $@ for all platform specific launchers -define make-platform-specific-launchers -$(call make-launcher, kinit, sun.security.krb5.internal.tools.Kinit, , ) -$(call make-launcher, klist, sun.security.krb5.internal.tools.Klist, , ) -$(call make-launcher, ktab, sun.security.krb5.internal.tools.Ktab, , ) -endef -else -# Run MAKE $@ for all platform specific launchers -define make-platform-specific-launchers -endef -endif # Run MAKE $@ for all generic launchers define make-all-launchers $(call make-launcher, appletviewer, sun.applet.Main, , ) @@ -85,36 +75,29 @@ $(call make-launcher, jstack, sun.tools.jstack.JStack, \ -J-Dsun.jvm.hotspot.debugger.useWindbgDebugger, ) $(call make-launcher, jstat, sun.tools.jstat.Jstat, , ) $(call make-launcher, jstatd, sun.tools.jstatd.Jstatd, , ) -$(call make-launcher, keytool, sun.security.tools.KeyTool, , ) $(call make-launcher, native2ascii, sun.tools.native2ascii.Main, , ) -$(call make-launcher, orbd, com.sun.corba.se.impl.activation.ORBD, \ - -J-Dcom.sun.CORBA.activation.DbDir=./orb.db \ - -J-Dcom.sun.CORBA.activation.Port=1049 \ - -J-Dcom.sun.CORBA.POA.ORBServerId=1, ) -$(call make-launcher, pack200, com.sun.java.util.jar.pack.Driver, , --pack) -$(call make-launcher, policytool, sun.security.tools.PolicyTool, , ) $(call make-launcher, rmic, sun.rmi.rmic.Main, , ) -$(call make-launcher, rmid, sun.rmi.server.Activation, , ) -$(call make-launcher, rmiregistry, sun.rmi.registry.RegistryImpl, , ) $(call make-launcher, schemagen, com.sun.tools.internal.jxc.SchemaGenerator, , ) $(call make-launcher, serialver, sun.tools.serialver.SerialVer, , ) -$(call make-launcher, servertool, com.sun.corba.se.impl.activation.ServerTool, , ) -$(call make-launcher, tnameserv, com.sun.corba.se.impl.naming.cosnaming.TransientNameServer, \ +$(call make-launcher, xjc, com.sun.tools.internal.xjc.Driver, , ) +$(call make-launcher, wsgen, com.sun.tools.internal.ws.WsGen, , ) +$(call make-launcher, wsimport, com.sun.tools.internal.ws.WsImport, , ) +$(call make-corba-launcher, orbd, com.sun.corba.se.impl.activation.ORBD, \ + -J-Dcom.sun.CORBA.activation.DbDir=./orb.db \ + -J-Dcom.sun.CORBA.activation.Port=1049 \ + -J-Dcom.sun.CORBA.POA.ORBServerId=1, ) +$(call make-corba-launcher, servertool, com.sun.corba.se.impl.activation.ServerTool, , ) +$(call make-corba-launcher, tnameserv, com.sun.corba.se.impl.naming.cosnaming.TransientNameServer, \ -J-Dcom.sun.CORBA.activation.DbDir=./orb.db \ -J-Djava.util.logging.LoggingPermission=contol \ -J-Dcom.sun.CORBA.POA.ORBServerId=1, ) -$(call make-launcher, wsgen, com.sun.tools.internal.ws.WsGen, , ) -$(call make-launcher, wsimport, com.sun.tools.internal.ws.WsImport, , ) -$(call make-launcher, xjc, com.sun.tools.internal.xjc.Driver, , ) endef build: $(make-all-launchers) - $(make-platform-specific-launchers) clean clobber:: $(make-all-launchers) - $(make-platform-specific-launchers) include $(BUILDDIR)/common/Rules.gmk diff --git a/make/mkdemo/jvmti/Makefile b/make/mkdemo/jvmti/Makefile index 592413087f1f647ace7406d4e449af8a14a7fdef..749068b909d193c9ecc06232a60637e951c6c411 100644 --- a/make/mkdemo/jvmti/Makefile +++ b/make/mkdemo/jvmti/Makefile @@ -28,6 +28,7 @@ # BUILDDIR = ../.. +MODULE = demos PRODUCT = demos include $(BUILDDIR)/common/Defs.gmk diff --git a/make/mkdemo/management/Makefile b/make/mkdemo/management/Makefile index b021ddd1eb0adc49bd5060fbe1e1a7a25b221242..e80b30afe0c04d7275998dd6c9ccccae1b9eb17b 100644 --- a/make/mkdemo/management/Makefile +++ b/make/mkdemo/management/Makefile @@ -28,6 +28,7 @@ # BUILDDIR = ../.. +MODULE = demos PRODUCT = demos include $(BUILDDIR)/common/Defs.gmk diff --git a/make/mksample/dtrace/Makefile b/make/mksample/dtrace/Makefile index 056f0b29f7355530be8a27a92a535e40bed80793..dbe1eed81598ff2bac2524ef28ce8a1ce91f5d58 100644 --- a/make/mksample/dtrace/Makefile +++ b/make/mksample/dtrace/Makefile @@ -29,6 +29,7 @@ BUILDDIR = ../.. +MODULE = samples PRODUCT = java include $(BUILDDIR)/common/Defs.gmk diff --git a/make/mksample/jmx/jmx-scandir/Makefile b/make/mksample/jmx/jmx-scandir/Makefile index b32a419175034553c9016070338b753d81ce5b79..5c06efce7dd4179f867f2557c97a1aca5610ed6f 100644 --- a/make/mksample/jmx/jmx-scandir/Makefile +++ b/make/mksample/jmx/jmx-scandir/Makefile @@ -29,6 +29,7 @@ BUILDDIR = ../../.. +MODULE = samples PRODUCT = java include $(BUILDDIR)/common/Defs.gmk diff --git a/make/mksample/nbproject/Makefile b/make/mksample/nbproject/Makefile index abc326c9000748d66f2fa69146fce8025a382efd..6543282c220512b616d4d7bcbe98a3ccacbf9d80 100644 --- a/make/mksample/nbproject/Makefile +++ b/make/mksample/nbproject/Makefile @@ -29,6 +29,7 @@ BUILDDIR = ../.. +MODULE = samples PRODUCT = java include $(BUILDDIR)/common/Defs.gmk diff --git a/make/mksample/nio/file/Makefile b/make/mksample/nio/file/Makefile index f7159de83a32e609d3e2847343faaead881fa77d..3181339e180a0ed6bae46e762129edfcd85bd231 100644 --- a/make/mksample/nio/file/Makefile +++ b/make/mksample/nio/file/Makefile @@ -29,6 +29,7 @@ BUILDDIR = ../../.. +MODULE = samples PRODUCT = java include $(BUILDDIR)/common/Defs.gmk diff --git a/make/mksample/nio/multicast/Makefile b/make/mksample/nio/multicast/Makefile index 179d3d4a97c5895c7b05b0f2147aaf2f80b8ac49..7e794c905392362df791dd8a21a880669348f996 100644 --- a/make/mksample/nio/multicast/Makefile +++ b/make/mksample/nio/multicast/Makefile @@ -29,6 +29,7 @@ BUILDDIR = ../../.. +MODULE = samples PRODUCT = java include $(BUILDDIR)/common/Defs.gmk diff --git a/make/mksample/nio/server/Makefile b/make/mksample/nio/server/Makefile index a776fa98fb3bcfe06c52aa1dd6c2df93696fcce5..3eced2d38ba26fdd62c26b5d7973f298b02f6ccf 100644 --- a/make/mksample/nio/server/Makefile +++ b/make/mksample/nio/server/Makefile @@ -29,6 +29,7 @@ BUILDDIR = ../../.. +MODULE = samples PRODUCT = java include $(BUILDDIR)/common/Defs.gmk diff --git a/make/mksample/scripting/scriptpad/Makefile b/make/mksample/scripting/scriptpad/Makefile index 8918764ed5ee3eb7a5f89dfc7720234354abaddd..bd9009aa95451e196f2737a1f6382d603381fbf1 100644 --- a/make/mksample/scripting/scriptpad/Makefile +++ b/make/mksample/scripting/scriptpad/Makefile @@ -29,6 +29,7 @@ BUILDDIR = ../../.. +MODULE = samples PRODUCT = java include $(BUILDDIR)/common/Defs.gmk diff --git a/make/mksample/webservices/EbayClient/Makefile b/make/mksample/webservices/EbayClient/Makefile index 541bd14d4f42f734292c3672d0cecd707e236fae..16f42d214fcba04ef8c15d3f09d515a3ba566463 100644 --- a/make/mksample/webservices/EbayClient/Makefile +++ b/make/mksample/webservices/EbayClient/Makefile @@ -29,6 +29,7 @@ BUILDDIR = ../../.. +MODULE = samples PRODUCT = java include $(BUILDDIR)/common/Defs.gmk diff --git a/make/mksample/webservices/EbayServer/Makefile b/make/mksample/webservices/EbayServer/Makefile index a0481cdedb9e86abce8d7f45616f1084314302df..6cbe9f06235e5ba77adce2e3b11258c3470cd602 100644 --- a/make/mksample/webservices/EbayServer/Makefile +++ b/make/mksample/webservices/EbayServer/Makefile @@ -29,6 +29,7 @@ BUILDDIR = ../../.. +MODULE = samples PRODUCT = java include $(BUILDDIR)/common/Defs.gmk diff --git a/make/modules/Makefile b/make/modules/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..ca7528f611e623d6361007029efffa90b846c1f0 --- /dev/null +++ b/make/modules/Makefile @@ -0,0 +1,134 @@ +# +# Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. Sun designates this +# particular file as subject to the "Classpath" exception as provided +# by Sun in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, +# CA 95054 USA or visit www.sun.com if you need additional information or +# have any questions. +# + +BUILDDIR = .. +include $(BUILDDIR)/common/Defs.gmk + +# +# Modularizing the JDK +# - Post jdk build process until the source tree is restructured +# for modules build +# - /modules/ will be created for each module. +# +# Steps: +# 0. During jdk build before this makefile is invoked, classes, +# resource files, and other non-class files such as native libraries, +# properties file, images, etc are created. +# +# Non-class files are copied to /tmp/modules/ +# directory in this step to prepare for the post-build modularization. +# +# The MODULE variable defined in other makefiles specifies +# the lowest-level module that the non-class files belong to. +# The name might or might not be the same as the name of the modules +# in the resulting /modules directory. +# +# 1. Unpack all jars in the /lib directory to a temporary +# location (/tmp/modules/classes) to prepare for modules +# creation. +# +# 2. Run ClassAnalyzer tool to analyze all jdk classes and generate +# class list for all modules and also perform dependency analysis. +# +# Input configuration files :- +# +# modules.config : defines the low-level modules and specifies +# what classes and resource files each module includes. +# modules.group : defines the module groups and its members. +# jdk7.depconfig : lists the dynamic dependencies including +# use of reflection Class.forName and JNI FindClass and +# service provider. +# optional.depconfig : lists the optional dependencies +# +# 3. Create one directory for each module (/modules/) +# based on the output files from (2). +# +# modules.list lists the modules to be created for the modules +# build and its members. For each module (m) in modules.list, +# a. create $m/lib/$m.jar with all classes and resource files +# listed in $m.classlist and $m.resources respectively. +# b. copy all non-class files from its members to +# /modules/$m. + + +MAINMANIFEST=$(JDK_TOPDIR)/make/tools/manifest.mf +MODULE_JAR_MANIFEST_FILE=$(ABS_TEMPDIR)/manifest.tmp + +TMP = $(ABS_MODULES_TEMPDIR) +MODULE_CLASSLIST = $(ABS_MODULES_TEMPDIR)/classlist +MODULE_CLASSES = $(ABS_MODULES_TEMPDIR)/classes +MODULES_LIST = $(MODULE_CLASSLIST)/modules.list + +all:: unpack-jars gen-classlist modularize + +JAR_LIST := $(shell $(FIND) $(ABS_OUTPUTDIR)/lib -name \*.jar -print) +unpack-jars: + @$(ECHO) ">>>Making "$@" @ `$(DATE)` ..." + $(RM) -rf $(MODULE_CLASSES) + $(MKDIR) -p $(MODULE_CLASSES) + $(CP) -rf $(CLASSBINDIR)/* $(MODULE_CLASSES) + @for jf in $(JAR_LIST) ; do \ + $(CD) $(MODULE_CLASSES) && $(BOOT_JAR_CMD) xf $$jf $(BOOT_JAR_JFLAGS);\ + done + @$(ECHO) ">>>Finished making "$@" @ `$(DATE)` ..." + +gen-classlist: + $(CD) tools && $(MAKE) all + +modularize: $(MODULE_JAR_MANIFEST_FILE) + @$(ECHO) ">>>Making "$@" @ `$(DATE)` ..." + @$(RM) -rf $(MODULES_DIR) + + @# create jar file for modules and + @# copy other files from all members of this module + for m in `$(NAWK) '{print $$1}' $(MODULES_LIST)` ; do \ + $(ECHO) "Creating module $$m" ; \ + $(SED) -e 's%\\%\/%g' < $(MODULE_CLASSLIST)/$$m.classlist > $(TMP)/tmp.cf ; \ + if [ -f $(MODULE_CLASSLIST)/$$m.resources ] ; then \ + $(SED) -e 's%\\%\/%g' < $(MODULE_CLASSLIST)/$$m.resources >> $(TMP)/tmp.cf ; \ + fi ; \ + $(MKDIR) -p $(ABS_MODULES_DIR)/$$m/lib; \ + $(CD) $(MODULE_CLASSES) && \ + $(BOOT_JAR_CMD) c0mf $(MODULE_JAR_MANIFEST_FILE) \ + $(ABS_MODULES_DIR)/$$m/lib/$$m.jar \ + @$(TMP)/tmp.cf \ + $(BOOT_JAR_JFLAGS); \ + for s in `$(GREP) "^$$m" $(MODULES_LIST)` ; do \ + if [ -d $(TMP)/$$s ] ; then \ + $(CP) -rf $(TMP)/$$s/* $(ABS_MODULES_DIR)/$$m; \ + $(RM) -rf $(ABS_MODULES_DIR)/$$m/classes; \ + fi \ + done \ + done + @$(CD) $(MODULE_CLASSES) && $(java-vm-cleanup) + @$(ECHO) ">>>Finished making "$@" @ `$(DATE)` ..." + +$(MODULE_JAR_MANIFEST_FILE): + $(SED) -e "s/@@RELEASE@@/$(RELEASE)/" $(MAINMANIFEST) > $@ + +clean clobber:: + $(RM) -rf $(MODULE_CLASSLIST) + $(RM) -rf $(MODULES_DIR) + $(RM) $(MODULE_JAR_MANIFEST_FILE) diff --git a/make/modules/bootmodule.roots b/make/modules/bootmodule.roots new file mode 100644 index 0000000000000000000000000000000000000000..cd0b264b2549006d6043f2c2cfd8e4d9e1bbbba5 --- /dev/null +++ b/make/modules/bootmodule.roots @@ -0,0 +1,199 @@ +# +# Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, +# CA 95054 USA or visit www.sun.com if you need additional information or +# have any questions. +# + +# +# List of root classes/methods, each line of the following syntax: +# +# |* +# exclude | + +# The boot module generated based on this rootset does not support +# - security permission check +# - non-standard charset +# - logging output +# - resource bundles +# including error output from the launcher + +# VM preloaded classes +java.lang.Object +java.lang.String +java.lang.Class +java.lang.Cloneable +java.lang.ClassLoader +java.lang.System +java.lang.Throwable +java.lang.Error +java.lang.ThreadDeath +java.lang.Exception +java.lang.RuntimeException +java.security.ProtectionDomain +java.security.AccessControlContext +java.lang.ClassNotFoundException +java.lang.NoClassDefFoundError +java.lang.ClassCastException +java.lang.ArrayStoreException +java.lang.VirtualMachineError +java.lang.OutOfMemoryError +java.lang.StackOverflowError +java.lang.IllegalMonitorStateException +java.lang.ref.Reference +java.lang.ref.SoftReference +java.lang.ref.WeakReference +java.lang.ref.FinalReference +java.lang.ref.PhantomReference +java.lang.ref.Finalizer +java.lang.Runnable +java.lang.Thread +java.lang.ThreadGroup +java.util.Properties +java.lang.reflect.AccessibleObject +java.lang.reflect.Member +java.lang.reflect.Field +java.lang.reflect.Method +java.lang.reflect.Constructor +java.lang.reflect.Type +sun.reflect.MagicAccessorImpl +sun.reflect.MethodAccessorImpl +sun.reflect.ConstructorAccessorImpl +sun.reflect.DelegatingClassLoader +sun.reflect.ConstantPool +sun.reflect.UnsafeStaticFieldAccessorImpl +java.util.Vector +java.lang.StringBuffer +java.lang.StackTraceElement +java.nio.Buffer +java.lang.Boolean +java.lang.Character +java.lang.Float +java.lang.Double +java.lang.Byte +java.lang.Short +java.lang.Integer +java.lang.Long +java.lang.NullPointerException +java.lang.ArithmeticException +java.lang.Compiler + + +# Root methods +java.lang.ClassLoader.getSystemClassLoader ()Ljava/lang/ClassLoader; +java.lang.System.initializeSystemClass ()V +sun.launcher.LauncherHelper.checkAndLoadMain (ZZLjava/lang/String;)Ljava/lang/Object; + +# The tool doesn't automatically find superclasses and parse the method +# if overridden as it tries to reduce unnecessary classes being pulled in. +# The following forces the dependency to be included the result. +sun.net.www.protocol.file.Handler. ()V +sun.net.www.protocol.jar.Handler. ()V +sun.net.www.protocol.file.Handler.openConnection * +sun.net.www.protocol.jar.Handler.openConnection * +sun.misc.URLClassPath$JarLoader. (Ljava/net/URL;Ljava/net/URLStreamHandler;Ljava/util/HashMap;)V +sun.misc.URLClassPath$FileLoader. (Ljava/net/URL;)V +sun.misc.URLClassPath$FileLoader.getClassPath * +sun.misc.URLClassPath$FileLoader.getResource * +sun.misc.URLClassPath$JarLoader.getResource * +sun.misc.URLClassPath$JarLoader.getClassPath * + +# permission collections +java.io.FilePermission.newPermissionCollection ()Ljava/security/PermissionCollection; +java.security.BasicPermission.newPermissionCollection ()Ljava/security/PermissionCollection; + +# native +java.io.UnixFileSystem +java.io.UnixFileSystem. ()V +java.io.UnixFileSystem.canonicalize * +java.io.Win32FileSystem +java.io.Win32FileSystem. ()V +java.io.Win32FileSystem.canonicalize * +java.io.WinNTFileSystem +java.io.WinNTFileSystem. ()V +java.io.WinNTFileSystem.canonicalize * + +# missing +java.util.HashMap. ()V +java.util.HashMap$EntrySet.iterator * + +# Called from native GetStringPlatformChars (jni_util.c) +java.lang.String.getBytes * + +# charset +sun.nio.cs.US_ASCII.newEncoder ()Ljava/nio/charset/CharsetEncoder; +sun.nio.cs.UTF_8.newEncoder ()Ljava/nio/charset/CharsetEncoder; +sun.nio.cs.UTF_8.newDecoder * +sun.nio.cs.UTF_16.newEncoder ()Ljava/nio/charset/CharsetEncoder; +sun.nio.cs.UTF_16.newDecoder * +sun.nio.cs.UTF_32.newEncoder ()Ljava/nio/charset/CharsetEncoder; +sun.nio.cs.UTF_32.newDecoder * + +# hashcode +java.util.jar.Attributes$Name.hashCode * + +# nio +sun.nio.ByteBuffered +sun.nio.ch.DirectBuffer +java.nio.DirectByteBuffer +java.nio.MappedByteBuffer +java.nio.DirectLongBufferU + +# resource files +sun.launcher.resources.launcher + +sun.misc.Launcher$AppClassLoader.getPermissions * +sun.misc.Launcher$AppClassLoader.loadClass (Ljava/lang/String;)Ljava/lang/Class; +sun.misc.Launcher$AppClassLoader.findClass (Ljava/lang/String;)Ljava/lang/Class; +sun.misc.Launcher$ExtClassLoader.getPermissions * +sun.misc.Launcher$ExtClassLoader.loadClass (Ljava/lang/String;)Ljava/lang/Class; +sun.misc.Launcher$ExtClassLoader.findClass (Ljava/lang/String;)Ljava/lang/Class; +java.lang.ClassLoader.checkPackageAccess * +java.lang.ClassLoader.findClass * +java.lang.ClassLoader.defineClass * +java.net.URLClassLoader.getPermissions * +java.net.URLClassLoader.findClass * +java.net.URLClassLoader.defineClass * +java.security.SecureClassLoader.defineClass * +# need to parse superclasses +java.security.SecureClassLoader. ()V + +exclude sun.security.provider.PolicyFile. +exclude java.lang.ClassLoader.compareCerts +exclude java.security.cert.Certificate.equals +# unsigned jars - no verifier +exclude java.util.jar.JarFile.initializeVerifier +exclude java.util.jar.JarVerifier +exclude sun.security.util.SignatureFileVerifier. + + +# what about other charset +exclude sun.misc.Service +exclude java.util.ServiceLoader + +# exclude support for localized messages +exclude java.util.ResourceBundle.getBundle +exclude java.text.MessageFormat +exclude sun.util.logging.PlatformLogger$LoggerProxy.format * + +# exclude nio and miscellaneous classes +exclude java.nio.channels.** +exclude sun.misc.FloatingDecimal +exclude sun.misc.FormattedFloatingDecimal +exclude sun.misc.FDBigInt diff --git a/make/modules/jdk7.depconfig b/make/modules/jdk7.depconfig new file mode 100644 index 0000000000000000000000000000000000000000..286b19e3ad0bf099a0cc917768e655c97f351e9d --- /dev/null +++ b/make/modules/jdk7.depconfig @@ -0,0 +1,473 @@ +# +# Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, +# CA 95054 USA or visit www.sun.com if you need additional information or +# have any questions. +# + +# private java.lang.Object createInetSocketAddress(java.lang.String, int) +@ClassForName + com.sun.jndi.ldap.Connection -> java.net.InetSocketAddress + com.sun.jndi.ldap.Connection -> java.net.SocketAddress + +# com.sun.jndi.ldap.VersionHelper +@ClassForName(optional) + com.sun.jndi.ldap.VersionHelper -> com.sun.jndi.ldap.VersionHelper* + +# private static void initMethodHandles() +@ClassForName + com.sun.jndi.toolkit.corba.CorbaUtils -> javax.rmi.CORBA.Stub + com.sun.jndi.toolkit.corba.CorbaUtils -> javax.rmi.PortableRemoteObject + +# com.sun.naming.internal.ResourceManager$AppletParameter +@ClassForName(optional) + com.sun.naming.internal.ResourceManager$AppletParameter -> java.applet.Applet + +# private static boolean loadProviderAsService() +@Provider + com.sun.net.httpserver.spi.HttpServerProvider -> META-INF/services/com.sun.net.httpserver.spi.HttpServerProvider + +# com.sun.org.apache.xml.internal.security.transforms.implementations.TransformXSLT +@ClassForName + com.sun.org.apache.xml.internal.security.transforms.implementations.TransformXSLT -> javax.xml.XMLConstants + +# public static java.beans.PersistenceDelegate getPersistenceDelegate(java.lang.Class) +@ClassForName + java.beans.MetaData -> java.beans.*_PersistenceDelegate + +# private static java.lang.reflect.Method getNanosMethod() +@ClassForName(optional) + java.beans.java_sql_Timestamp_PersistenceDelegate -> java.sql.Timestamp + +# java.beans.java_util_Collections$CheckedCollection_PersistenceDelegate +@ClassForName + java.beans.java_util_Collections$CheckedCollection_PersistenceDelegate -> java.util.Collections$CheckedCollection + +# java.beans.java_util_Collections$CheckedMap_PersistenceDelegate +@ClassForName + java.beans.java_util_Collections$CheckedMap_PersistenceDelegate -> java.util.Collections$CheckedMap + +# private static java.lang.Object getType(java.lang.Object) +@ClassForName + java.beans.java_util_EnumMap_PersistenceDelegate -> java.util.EnumMap + +# private java.lang.Integer getAxis(java.lang.Object) +@ClassForName + java.beans.javax_swing_Box_PersistenceDelegate -> javax.swing.BoxLayout + +# java.lang.Double +@Inline + java.lang.Double -> sun.misc.FloatConsts + java.lang.Double -> sun.misc.DoubleConsts + +# java.lang.Float +@Inline + java.lang.Float -> sun.misc.FloatConsts + java.lang.Float -> sun.misc.DoubleConsts + +# java.net.DefaultDatagramSocketImplFactory +@ClassForName(optional) + java.net.DefaultDatagramSocketImplFactory -> java.net.*DatagramSocketImpl + +# private static sun.net.spi.nameservice.NameService createNSProvider(java.lang.String) +@Provider + java.net.InetAddress -> META-INF/services/sun.net.spi.nameservice.NameServiceDescriptor + +# static java.net.InetAddressImpl create() +@ClassForName + java.net.InetAddressImplFactory -> java.net.*Inet[46]AddressImpl + +# private static void init() +@NativeFindClass + java.net.PlainDatagramSocketImpl -> java.io.FileDescriptor + +# java.net.ProxySelector +@ClassForName + java.net.ProxySelector -> sun.net.spi.DefaultProxySelector + +# static java.net.URLStreamHandler getURLStreamHandler(java.lang.String) +@ClassForName(optional) + java.net.URL -> sun.net.www.protocol.*.Handler + +# private java.net.ContentHandler lookupContentHandlerClassFor(java.lang.String) +@ClassForName + java.net.URLConnection -> sun.net.www.content.* + +# private static java.nio.channels.spi.AsynchronousChannelProvider loadProviderAsService() +@Provider + java.nio.channels.spi.AsynchronousChannelProvider$ProviderHolder -> META-INF/services/java.nio.channels.spi.AsynchronousChannelProvider + +# private static boolean loadProviderFromProperty() +@ClassForName + java.nio.channels.spi.SelectorProvider -> sun.nio.ch.DefaultSelectorProvider + +# private static boolean loadProviderAsService() +@Provider + java.nio.channels.spi.SelectorProvider -> META-INF/services/java.nio.channels.spi.SelectorProvider + +# private static java.util.Iterator providers() +@Provider + java.nio.charset.Charset -> META-INF/services/java.nio.charset.spi.CharsetProvider + +# private static void probeExtendedProvider() +@ClassForName(optional) + java.nio.charset.Charset -> sun.nio.cs.ext.ExtendedCharsets + +# public static java.nio.file.FileSystem newFileSystem(java.net.URI, java.util.Map, java.lang.ClassLoader) +@Provider + java.nio.file.FileSystems -> META-INF/services/java.nio.file.FileSystemProvider + +# private static java.util.List loadInstalledDetectors() +@Provider + java.nio.file.Files$DefaultFileTypeDetectorHolder -> META-INF/services/java.nio.file.spi.FileTypeDetector + +# public static java.util.List installedProviders() +@Provider + java.nio.file.spi.FileSystemProvider -> META-INF/services/java.nio.file.FileSystemProvider + +# private static java.rmi.server.RMIClassLoaderSpi initializeProvider() +@Provider + java.rmi.server.RMIClassLoader -> META-INF/services/java.rmi.server.RMIClassLoaderSpi + +# private static void initializeSystemScope() +@ClassForName(optional) + java.security.IdentityScope -> sun.security.provider.IdentityDatabase + +# static java.security.Policy getPolicyNoCheck() +@ClassForName + java.security.Policy -> sun.security.provider.PolicyFile + +# private static java.lang.Class getSpiClass(java.lang.String) +@ClassForName + java.security.Security -> java.security.*Spi + +# private static void invalidateSMCache(java.lang.String) +@ClassForName + java.security.Security -> java.lang.SecurityManager + +# private static void loadInitialDrivers() +@Provider + java.sql.DriverManager -> META-INF/services/java.sql.Driver + +# private static java.text.BreakIterator createBreakInstance(java.util.Locale, int, java.lang.String, java.lang.String) +@Provider + java.text.BreakIterator -> META-INF/services/java.util.spi.BreakIteratorProvider + +# public static java.text.Collator getInstance(java.util.Locale) +@Provider + java.text.Collator -> META-INF/services/java.util.spi.CollatorProvider + +# private static java.text.DateFormat get(int, int, int, java.util.Locale) +@Provider + java.text.DateFormat -> META-INF/services/java.util.spi.DateNameProvider + +# public static java.util.Locale[] getAvailableLocales() +@Provider + java.text.DateFormatSymbols -> META-INF/services/java.util.spi.DateFormatSymbolsProvider + +# public static java.util.Locale[] getAvailableLocales() +@Provider + java.text.DecimalFormatSymbols -> META-INF/services/java.util.spi.DecimalFormatSymbolsProvider + +# public static java.util.Locale[] getAvailableLocales() +@Provider + java.text.NumberFormat -> META-INF/services/java.util.spi.NumberFormatProvider + +# public java.lang.String getDisplayName(java.util.Locale) +@Provider + java.util.Currency -> META-INF/services/java.util.spi.CurrencyNameProvider + +# java.util.Formatter +@Inline + java.util.Formatter -> sun.misc.DoubleConsts + +# java.util.Locale +@Inline + java.util.Locale -> java.util.LocaleISOData + +# private java.lang.String getDisplayString(java.lang.String, java.util.Locale, int) +@Provider + java.util.Locale -> META-INF/services/java.util.spi.LocaleNameProvider + +# private static java.util.prefs.PreferencesFactory factory1() +@ClassForName + java.util.prefs.Preferences -> java.util.prefs.WindowsPreferencesFactory + java.util.prefs.Preferences -> java.util.prefs.FileSystemPreferencesFactory + +# private static java.util.prefs.PreferencesFactory factory1() +@Provider + java.util.prefs.Preferences -> META-INF/services/java.util.prefs.PreferencesFactory + +# public void registerApplicationClasspathSpis() +@Provider + javax.imageio.spi.IIORegistry -> META-INF/services/javax.imageio.spi.IIOServiceProvider + +# private void registerInstalledProviders() +@Provider + javax.imageio.spi.IIORegistry -> META-INF/services/javax.imageio.spi.ImageReaderSpi + javax.imageio.spi.IIORegistry -> META-INF/services/javax.imageio.spi.ImageWriterSpi + javax.imageio.spi.IIORegistry -> META-INF/services/javax.imageio.spi.ImageReaderWriterSpi + javax.imageio.spi.IIORegistry -> META-INF/services/javax.imageio.spi.ImageTranscoderSpi + javax.imageio.spi.IIORegistry -> META-INF/services/javax.imageio.spi.ImageInputStreamSpi + javax.imageio.spi.IIORegistry -> META-INF/services/javax.imageio.spi.ImageOutputStreamSpi + +# public javax.naming.ldap.ExtendedResponse createExtendedResponse(java.lang.String, byte[], int, int) +@Provider + javax.naming.ldap.StartTlsRequest -> META-INF/services/javax.naming.ldap.StartTlsResponse + +# private static java.util.ArrayList getAllLookupServices() +@Provider + javax.print.PrintServiceLookup -> META-INF/services/javax.print.PrintServiceLookup + +# private static java.util.ArrayList getAllFactories() +@Provider + javax.print.StreamPrintServiceFactory -> META-INF/services/javax.print.StreamPrintServiceFactory + +# private void initEngines(java.lang.ClassLoader) +@Provider + javax.script.ScriptEngineManager -> META-INF/services/javax.script.ScriptEngineFactory + +# private void initializeInputMethodLocatorList() +@Provider + sun.awt.im.ExecutableInputMethodManager -> META-INF/services/java.awt.im.spi.InputMethodDescriptor + +# private static java.lang.Class getConverterClass(int, java.lang.String) +@ClassForName(optional) + sun.io.Converters -> sun.io.* + +# public static sun.java2d.cmm.PCMM getModule() +@Provider + sun.java2d.cmm.CMSManager -> META-INF/services/sun.java2d.cmm.PCMM + +# public static sun.java2d.pipe.RenderingEngine getInstance() +@Provider + sun.java2d.pipe.RenderingEngine -> META-INF/services/sun.java2d.pipe.RenderingEngine + +# public static sun.java2d.pipe.RenderingEngine getInstance() +@ClassForName(optional) + sun.java2d.pipe.RenderingEngine -> sun.dc.DuctusRenderingEngine + +# sun.misc.FloatingDecimal +@Inline + sun.misc.FloatingDecimal -> sun.misc.FloatConsts + sun.misc.FloatingDecimal -> sun.misc.DoubleConsts + +# sun.misc.FormattedFloatingDecimal +@Inline + sun.misc.FormattedFloatingDecimal -> sun.misc.FloatConsts + sun.misc.FormattedFloatingDecimal -> sun.misc.DoubleConsts + +# sun.misc.FpUtils +@Inline + sun.misc.FpUtils -> sun.misc.FloatConsts + sun.misc.FpUtils -> sun.misc.DoubleConsts + +# public java.net.URLStreamHandler createURLStreamHandler(java.lang.String) +@ClassForName(optional) + sun.misc.Launcher$Factory -> sun.net.www.protocol.*.Handler + +# private static sun.net.NetHooks$Provider loadProvider(java.lang.String) +@ClassForName(optional) + sun.net.NetHooks -> sun.net.spi.SdpProvider + +# sun.net.idn.StringPrep +@Inline + sun.net.idn.StringPrep -> sun.net.idn.UCharacterDirection + +# private static boolean init() +@NativeFindClass + sun.net.spi.DefaultProxySelector -> java.net.Proxy + sun.net.spi.DefaultProxySelector -> java.net.Proxy$Type + sun.net.spi.DefaultProxySelector -> java.net.InetSocketAddress + +# private static java.nio.channels.Channel createChannel() +@ClassForName + sun.nio.ch.InheritedChannel -> java.io.FileDescriptor + +# private static void initDBBConstructor() +@ClassForName + sun.nio.ch.Util -> java.nio.DirectByteBuffer + +# private static void initDBBRConstructor() +@ClassForName + sun.nio.ch.Util -> java.nio.DirectByteBufferR + +# private java.nio.charset.Charset lookup(java.lang.String) +@ClassForName(optional) + sun.nio.cs.FastCharsetProvider -> sun.nio.cs.* + +# sun.nio.cs.ext.ExtendedCharsets +@ClassForName(optional) + sun.nio.cs.ext.ExtendedCharsets -> sun.nio.cs.ext.* + +# sun.nio.cs.ext.ExtendedCharsets +@ClassForName(optional) + sun.nio.cs.ext.ExtendedCharsets -> sun.nio.cs.ext.* + +# public static java.nio.file.spi.FileSystemProvider create() +@ClassForName + sun.nio.fs.DefaultFileSystemProvider -> sun.nio.fs.SolarisFileSystemProvider + sun.nio.fs.DefaultFileSystemProvider -> sun.nio.fs.LinuxFileSystemProvider + +# sun.rmi.server.MarshalInputStream +@ClassForName + sun.rmi.server.MarshalInputStream -> sun.rmi.server.Activation$ActivationSystemImpl_Stub + sun.rmi.server.MarshalInputStream -> sun.rmi.registry.RegistryImpl_Stub + +# private java.security.Provider doLoadProvider() +@ClassForName(optional) + sun.security.jca.ProviderConfig -> sun.security.pkcs11.SunPKCS11 + sun.security.jca.ProviderConfig -> sun.security.provider.Sun + sun.security.jca.ProviderConfig -> sun.security.rsa.SunRsaSign + sun.security.jca.ProviderConfig -> sun.security.ec.SunEC + sun.security.jca.ProviderConfig -> com.sun.net.ssl.internal.ssl.Provider + sun.security.jca.ProviderConfig -> com.sun.crypto.provider.SunJCE + sun.security.jca.ProviderConfig -> sun.security.jgss.SunProvider + sun.security.jca.ProviderConfig -> com.sun.security.sasl.Provider + sun.security.jca.ProviderConfig -> org.jcp.xml.dsig.internal.dom.XMLDSigRI + sun.security.jca.ProviderConfig -> sun.security.smartcardio.SunPCSC + sun.security.jca.ProviderConfig -> sun.security.mscapi.SunMSCAPI + +# public static java.security.Provider getSunProvider() +@ClassForName + sun.security.jca.Providers -> sun.security.provider.Sun + sun.security.jca.Providers -> sun.security.provider.VerificationProvider + +# private static sun.security.jgss.spi.MechanismFactory getMechFactoryImpl(java.security.Provider, java.lang.String, org.ietf.jgss.Oid, sun.security.jgss.GSSCaller) +@ClassForName + sun.security.jgss.ProviderList -> sun.security.jgss.spi.MechanismFactory + +# sun.security.jgss.wrapper.SunNativeProvider +@NativeFindClass + sun.security.jgss.wrapper.SunNativeProvider -> org.ietf.jgss.Oid + sun.security.jgss.wrapper.SunNativeProvider -> org.ietf.jgss.GSSException + sun.security.jgss.wrapper.SunNativeProvider -> sun.security.jgss.wrapper.GSSNameElement + sun.security.jgss.wrapper.SunNativeProvider -> sun.security.jgss.wrapper.GSSCredElement + sun.security.jgss.wrapper.SunNativeProvider -> sun.security.jgss.wrapper.NativeGSSContext + sun.security.jgss.wrapper.SunNativeProvider -> sun.security.jgss.wrapper.SunNativeProvider + sun.security.jgss.wrapper.SunNativeProvider -> org.ietf.jgss.MessageProp + sun.security.jgss.wrapper.SunNativeProvider -> org.ietf.jgss.ChannelBinding + sun.security.jgss.wrapper.SunNativeProvider -> java.net.InetAddress + sun.security.jgss.wrapper.SunNativeProvider -> sun.security.jgss.wrapper.GSSLibStub + +# static void ensureLoaded() +@NativeFindClass + sun.security.krb5.Credentials -> sun.security.krb5.internal.Krb5 + sun.security.krb5.Credentials -> sun.security.krb5.internal.Ticket + sun.security.krb5.Credentials -> sun.security.krb5.PrincipalName + sun.security.krb5.Credentials -> sun.security.util.DerValue + sun.security.krb5.Credentials -> sun.security.krb5.EncryptionKey + sun.security.krb5.Credentials -> sun.security.krb5.internal.TicketFlags + sun.security.krb5.Credentials -> sun.security.krb5.internal.KerberosTime + +# public static java.lang.String getDefaultCacheName() +@ClassForName(optional) + sun.security.krb5.internal.ccache.FileCredentialsCache -> com.sun.security.auth.module.UnixSystem + +# sun.security.pkcs.PKCS9Attribute +@ClassForName + sun.security.pkcs.PKCS9Attribute -> sun.security.util.ObjectIdentifier + sun.security.pkcs.PKCS9Attribute -> java.util.Date + sun.security.pkcs.PKCS9Attribute -> sun.security.pkcs.SignerInfo + sun.security.pkcs.PKCS9Attribute -> sun.security.x509.CertificateExtensions + +# protected T engineGetKeySpec(java.security.Key, java.lang.Class) +@ClassForName + sun.security.provider.DSAKeyFactory -> java.security.spec.DSAPublicKeySpec + sun.security.provider.DSAKeyFactory -> java.security.spec.X509EncodedKeySpec + sun.security.provider.DSAKeyFactory -> java.security.spec.DSAPrivateKeySpec + sun.security.provider.DSAKeyFactory -> java.security.spec.PKCS8EncodedKeySpec + +# protected T engineGetParameterSpec(java.lang.Class) +@ClassForName + sun.security.provider.DSAParameters -> java.security.spec.DSAParameterSpec + +# sun.security.provider.VerificationProvider +@ClassForName(optional) + sun.security.provider.VerificationProvider -> sun.security.provider.Sun + sun.security.provider.VerificationProvider -> sun.security.rsa.SunRsaSign + +# sun.security.provider.certpath.URICertStore$LDAP +@ClassForName(optional) + sun.security.provider.certpath.URICertStore$LDAP -> sun.security.provider.certpath.ldap.LDAPCertStoreHelper + +# sun.security.smartcardio.PCSC +@NativeFindClass + sun.security.smartcardio.PCSC -> sun.security.smartcardio.PCSCException + +# sun.security.ssl.HandshakeMessage +@ClassForName + sun.security.ssl.HandshakeMessage -> java.security.MessageDigest$Delegate + +# sun.security.ssl.JsseJce +@ClassForName(optional) + sun.security.ssl.JsseJce -> sun.security.krb5.PrincipalName + +# sun.security.x509.OIDMap$OIDInfo +@ClassForName + sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.SubjectKeyIdentifierExtension + sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.KeyUsageExtension + sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.PrivateKeyUsageExtension + sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.SubjectAlternativeNameExtension + sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.IssuerAlternativeNameExtension + sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.BasicConstraintsExtension + sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.CRLNumberExtension + sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.CRLReasonCodeExtension + sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.NameConstraintsExtension + sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.PolicyMappingsExtension + sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.AuthorityKeyIdentifierExtension + sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.PolicyConstraintsExtension + sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.NetscapeCertTypeExtension + sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.CertificatePoliciesExtension + sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.ExtendedKeyUsageExtension + sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.InhibitAnyPolicyExtension + sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.CRLDistributionPointsExtension + sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.CertificateIssuerExtension + sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.SubjectInfoAccessExtension + sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.AuthorityInfoAccessExtension + sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.IssuingDistributionPointExtension + sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.DeltaCRLIndicatorExtension + sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.FreshestCRLExtension + sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.OCSPNoCheckExtension + +# sun.util.LocaleServiceProviderPool$AllAvailableLocales +@Provider + sun.util.LocaleServiceProviderPool$AllAvailableLocales -> META-INF/services/java.text.spi.BreakIteratorProvider + sun.util.LocaleServiceProviderPool$AllAvailableLocales -> META-INF/services/java.text.spi.CollatorProvider + sun.util.LocaleServiceProviderPool$AllAvailableLocales -> META-INF/services/java.text.spi.DateFormatProvider + sun.util.LocaleServiceProviderPool$AllAvailableLocales -> META-INF/services/java.text.spi.DateFormatSymbolsProvider + sun.util.LocaleServiceProviderPool$AllAvailableLocales -> META-INF/services/java.text.spi.DecimalFormatSymbolsProvider + sun.util.LocaleServiceProviderPool$AllAvailableLocales -> META-INF/services/java.text.spi.NumberFormatProvider + sun.util.LocaleServiceProviderPool$AllAvailableLocales -> META-INF/services/java.util.spi.CurrencyNameProvider + sun.util.LocaleServiceProviderPool$AllAvailableLocales -> META-INF/services/java.util.spi.LocaleNameProvider + sun.util.LocaleServiceProviderPool$AllAvailableLocales -> META-INF/services/java.util.spi.TimeZoneNameProvider + +# private static final java.lang.String[] retrieveDisplayNames(sun.util.resources.OpenListResourceBundle, java.lang.String, java.util.Locale) +@Provider + sun.util.TimeZoneNameUtility -> META-INF/services/java.util.spi.TimeZoneNamePProvider + +# public static sun.util.calendar.CalendarSystem forName(java.lang.String) +@ClassForName + sun.util.calendar.CalendarSystem -> sun.util.calendar.Gregorian + sun.util.calendar.CalendarSystem -> sun.util.calendar.LocalGregorianCalendar + sun.util.calendar.CalendarSystem -> sun.util.calendar.JulianCalendar + +# sun.util.logging.LoggingSupport +@ClassForName(optional) + sun.util.logging.LoggingSupport -> java.util.logging.LoggingProxyImpl diff --git a/make/modules/modules.config b/make/modules/modules.config new file mode 100644 index 0000000000000000000000000000000000000000..bcc0493a980bd23364b748e611acc38a85dad3ec --- /dev/null +++ b/make/modules/modules.config @@ -0,0 +1,929 @@ +/* + * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ + +// These classes are not referenced in the JDK but we can't +// remove them for compatibility reason. Define this module +// first so that other modules don't need to exclude these clases +module private-legacy { + include sun.misc.Cache*, + sun.misc.ClassLoaderUtil, + sun.misc.Compare, + sun.misc.ConditionLock, + sun.misc.CRC16, + sun.misc.Lock, + sun.misc.Regexp, + sun.misc.RequestProcessor, + sun.misc.Sort, + sun.misc.Request, + sun.misc.Timeable, + sun.misc.Timer, + sun.misc.TimerThread, + sun.misc.TimerTickThread, + sun.misc.UCDecoder, + sun.misc.UCEncoder, + sun.misc.UUDecoder, + sun.misc.UUEncoder, + com.sun.net.ssl.SSLContext, + sun.net.NetworkServer, + sun.net.URLCanonicalizer, + sun.reflect.misc.ConstructorUtil, + sun.reflect.FieldInfo, + sun.reflect.SignatureIterator, + sun.reflect.generics.reflectiveObjects.NotImplementedException, + sunw.io.Serializable, + sunw.util.EventListener, + sunw.util.EventObject; +} + +// Deprecated classes that aren't referenced/used go here. +module deprecated { + // add deprecated security classes once b78 is promoted +} + +/**************************************************************************/ + +module base { + // core classes + include java.lang.*, + java.lang.annotation.*, + java.lang.ref.*, + java.lang.reflect.*, + java.math.*, + java.net.*, + java.util.*, + java.util.concurrent.**, + java.util.jar.*, + java.util.regex.*, + java.util.spi.*, + java.util.zip.*, + java.text.**; + + exclude java.util.jar.Pack200*, + java.util.XMLUtils, + java.text.Bidi; + + include java.io.*, java.nio.*, java.nio.charset.**; + exclude java.io.TempFileHelper, java.nio.BufferPoolMXBean; + + // security APIs + // javax.crypto and javax.security.auth are included to avoid inconsistent + // spliting of JCA and JAAS. This adds about 85k. Also note that some deprecated + // classes must be included for now (see 6876158, 6876170) + include java.security.*, + java.security.cert.*, + java.security.interfaces.*, + java.security.spec.*, + javax.security.auth.**, + javax.crypto.**; + + // Sun and RSA security providers (except LDAP CertStore) + // roots sun.security.provider.* sun.security.provider.certpath.* sun.security.rsa.* + include com.sun.security.auth.PrincipalComparator, + com.sun.security.auth.SubjectCodeSource, + com.sun.security.auth.login.**, + com.sun.security.auth.Policy*, + sun.security.action.*, + sun.security.ec.*, + sun.security.jca.*, + sun.security.pkcs.*, + sun.security.provider.*, + sun.security.provider.certpath.*, + sun.security.rsa.*, + sun.security.util.*, + sun.security.validator.*, + sun.security.x509.*, + sun.security.timestamp.*; + + // this list is based on the classlist generated from the rootset + // need investigation + exclude sun.security.ec.ECD*, + sun.security.ec.ECKeyPairGenerator, + sun.security.ec.SunEC*, + sun.security.pkcs.PKCS10*, + sun.security.pkcs.EncodingException, + sun.security.util.AuthResources_*, + sun.security.util.Resources_*, + sun.security.util.BigInt, + sun.security.util.HostnameChecker, + sun.security.x509.CertAndKeyGen, + sun.security.util.PathList; + + // Kerberos not needed + exclude javax.security.auth.kerberos.**, + sun.security.jgss.**, + sun.security.krb5.**, + sun.security.ssl.Kerberos*, + org.ietf.jgss.**; + + // property events and annotations + include java.beans.ChangeListenerMap, + java.beans.IndexedPropertyChangeEvent, + java.beans.PropertyChange*, + java.beans.PropertyVetoException, + java.beans.VetoableChange*, + java.beans.ConstructorProperties; + + // mandatory charsets + include sun.nio.cs.*; + + exclude sun.nio.cs.AbstractCharsetProvider, + sun.nio.cs.CharsetMapping, + sun.nio.cs.IBM*, + sun.nio.cs.ISO*, + sun.nio.cs.KOI8_*, + sun.nio.cs.MS125*, + sun.nio.cs.UTF_32*, + sun.nio.cs.SingleByteDecoder, + sun.nio.cs.SingleByteEncoder; + + allow sun.nio.cs.ISO_8859_1, + sun.nio.cs.ISO_8859_15, + sun.nio.cs.MS1252; + + include sun.text.*, + sun.text.normalizer.*; + + // resource files + include sun/text/resources/*.icu; + + exclude sun.text.bidi.*, + sun.text.CharArrayCodePointIterator, + sun.text.CharSequenceCodePointIterator, + sun.text.CharacterIteratorCodePointIterator, + sun.text.CodePointIterator; + + include sun.util.*, + sun.util.calendar.*, + sun.util.logging.*, + sun.util.resources.LocaleData, + sun.util.resources.LocaleNamesBundle, + sun.util.resources.OpenListResourceBundle; + + // US_en locale + include sun.text.resources.BreakIteratorInfo, + sun.text.resources.FormatData, + sun.text.resources.FormatData_en_US, + sun.util.resources.CalendarData, + sun.util.resources.CalendarData_en, + sun.util.resources.TimeZoneNames, + sun.util.resources.TimeZoneNames_en, + sun.util.resources.TimeZoneNamesBundle, + sun.util.resources.LocaleNames, + sun.util.resources.LocaleNames_en, + sun.util.resources.LocalenamesBundles, + sun.util.resources.CurrencyNames, + sun.util.resources.CurrencyNames_en_US, + sun.util.EmptyListResourceBundle; + + // resources file needed by + // - sun.misc.ExtensionInfo + // - sun.security.provider.PolicyFile + // - com.sun.security.auth.PolicyFile + include sun.misc.resources.Messages, + sun.security.util.Resources, + sun.security.util.AuthResources; + + // java.nio.channels and java.nio.file not in base + include sun.nio.ch.Interruptible, + sun.nio.ch.DirectBuffer, + sun.nio.ByteBuffered; + + include sun.reflect.**; + + // protocol handlers + include sun.net.www.protocol.file.*, + sun.net.www.protocol.jar.*, + sun.net.www.protocol.http.*; + + include sun.net.*, + sun.net.spi.*, + sun.net.idn.*, + sun.net.util.*, + sun.net.www.*, + sun.net.www.http.*, + sun.net.spi.nameservice.*; + + // resource file for sun.net.idn + include sun/net/idn/*; + + // classes in net-compat + exclude sun.net.Telnet*, sun.net.TransferProtocolClient; + + // classes in deploy + exclude sun.net.www.protocol.http.AuthCacheBridge; + + // classes in security-jsse + exclude java.net.SecureCacheResponse; + + // launcher + include sun.launcher.LauncherHelper, sun.launcher.resources.launcher; + + include sun.misc.*; + exclude sun.misc.FIFOQueueEnumerator, + sun.misc.LIFOQueueEnumerator, + sun.misc.GC, + sun.misc.PerformanceLogger, + sun.misc.Queue, + sun.misc.QueueElement, + sun.misc.Ref, + sun.misc.VMSupport; + + // On Windows, OSEnvironment dependency + include sun.io.Win32ErrorMode; +} + +/**************************************************************************/ + +module charsets { + include sun.nio.cs.ext.**; + + include sun.nio.cs.AbstractCharsetProvider, + sun.nio.cs.CharsetMapping, + sun.nio.cs.IBM*, + sun.nio.cs.ISO*, + sun.nio.cs.KOI8_*, + sun.nio.cs.MS125*, + sun.nio.cs.SingleByte*, + sun.nio.cs.UTF_32*; + + exclude sun.nio.cs.ISO_8859_1, + sun.nio.cs.MS1252; + + // legacy sun.io converters + include sun.io.*; +} + +/**************************************************************************/ + +// For now, retains the current JRE extensions where localedata.jar in jre/lib/ext +module localedata { + include sun.util.resources.*_ar, + sun.util.resources.*_ar_*, + sun.util.resources.*_hi, + sun.util.resources.*_hi_*, + sun.util.resources.*_iw, + sun.util.resources.*_iw_*, + sun.util.resources.*_ja, + sun.util.resources.*_ja_*, + sun.util.resources.*_ko, + sun.util.resources.*_ko_*, + sun.util.resources.*_th, + sun.util.resources.*_th_*, + sun.util.resources.*_vi, + sun.util.resources.*_vi_*, + sun.util.resources.*_zh, + sun.util.resources.*_zh_*; + include sun.text.resources.*_ar, + sun.text.resources.*_ar_*, + sun.text.resources.*_hi, + sun.text.resources.*_hi_*, + sun.text.resources.*_iw, + sun.text.resources.*_iw_*, + sun.text.resources.*_ja, + sun.text.resources.*_ja_*, + sun.text.resources.*_ko, + sun.text.resources.*_ko_*, + sun.text.resources.*_th, + sun.text.resources.*_th_*, + sun.text.resources.*_vi, + sun.text.resources.*_vi_*, + sun.text.resources.*_zh, + sun.text.resources.*_zh_*; +} + +module resources { + include sun.text.resources.*, sun.util.resources.*, sun.misc.resources.*; +} + +/**************************************************************************/ + +module nio { + include java.nio.channels.**, java.nio.file.**, com.sun.nio.file.**; + + // this is excluded from base + include java.io.TempFileHelper; + + // provider implementations and their dependencies + include sun.nio.ch.*, sun.nio.fs.**; + exclude sun.nio.ch.Sctp*; +} + +/**************************************************************************/ + +module pack200 { + include java.util.jar.Pack200*, com.sun.java.util.jar.pack.**; +} + +/**************************************************************************/ + +module logging { + include java.util.logging.*, sun.util.logging.**; + exclude java.util.logging.PlatformLoggingMXBean; + + // Formatter for HTTP messages + include sun.net.www.protocol.http.logging.*; +} + +/**************************************************************************/ + +module management-snmp { + include com.sun.jmx.snmp.**, sun.management.snmp.**; +} + +module management-iiop { + include com.sun.jmx.remote.protocol.iiop.*; + + // stubs and ties + include javax.management.remote.rmi._*, + org.omg.stub.javax.management.remote.rmi.**; +} + +module management { + include java.lang.management.*, com.sun.management.**, sun.management.**; + include javax.management.**, com.sun.jmx.**; + + // other management interfaces + include java.nio.BufferPoolMXBean; + include java.util.logging.PlatformLoggingMXBean; + + // supporting classes in sun.misc + include sun.misc.VMSupport; +} + +/**************************************************************************/ + +module tracing { + // tracing + include com.sun.tracing.**, sun.tracing.**; +} + +module instrument { + // java.lang.instrument + include java.lang.instrument.*, sun.instrument.*; + + // HPROF support + include com.sun.demo.jvmti.hprof.*; + + include tracing; +} + +/**************************************************************************/ + +module rmi-activation { + include java.rmi.activation.**, + sun.rmi.server.Act*, + sun.rmi.server.InactiveGroupException; +} + +module rmic { + // rmic is included in tools + include sun.rmi.rmic.**; +} + +module rmi { + include java.rmi.**, sun.rmi.**, com.sun.rmi.**; + + // SSL factories are in rmi + include javax.rmi.ssl.**; + + // supporting classes in sun.misc and dependencies + include sun.misc.GC; +} + +/**************************************************************************/ + +module prefs { + include java.util.prefs.*; +} + +/**************************************************************************/ + +module security-jsse { + include javax.net.**, + javax.security.cert.*, + java.net.SecureCacheResponse, + com.sun.net.ssl.**, + com.sun.security.cert.internal.x509.*, + sun.security.ssl.*, + sun.net.www.protocol.https.**, + sun.security.internal.interfaces.Tls*, + sun.security.internal.spec.Tls*, + sun.security.util.HostnameChecker; +} + +module security-sunpkcs11 { + include sun.security.pkcs11.**; +} + +module security-sunjce { + include com.sun.crypto.provider.*; +} + +module security-sunec { + include sun.security.ec.*; +} + +module security-sunmscapi { + include sun.security.mscapi.*; +} + +module security-kerberos { + include javax.security.auth.kerberos.*, + com.sun.security.jgss.**, + com.sun.security.auth.module.Krb5LoginModule, + com.sun.security.sasl.gsskerb.**, // GSSAPI SASL mechanism + sun.security.jgss.**, + sun.security.ssl.krb5.**, + sun.security.krb5.**, + org.ietf.jgss.**, + sun.net.www.protocol.http.spnego.*; +} + +module security-sasl { + include javax.security.sasl.**, + com.sun.security.sasl.**; +} + +module security-xmldsig { + include javax.xml.crypto.**, + org.jcp.xml.dsig.**, + com.sun.org.apache.xml.internal.security.**; +} + +module security-smartcardio { + include javax.smartcardio.**, sun.security.smartcardio.**; +} + +module security-auth { + include com.sun.security.auth.**, sun.security.util.AuthResources_*; +} + +module security-misc { + include security-auth; + + include sun.security.pkcs.*, + sun.security.pkcs12.*; + + // this class is a candidate to be removed. + include sun.security.util.BigInt; +} + +module security-resources { + include sun.security.util.Resources_*; +} + +module security-compat { + include java.security.acl.*, sun.security.acl.*; +} + +/**************************************************************************/ + +module jndi-ldap { + include javax.naming.ldap.**, + com.sun.jndi.ldap.**, + com.sun.jndi.url.ldap.*, + com.sun.jndi.url.ldaps.*, + sun.security.provider.certpath.ldap.**; +} + +module jndi-rmiregistry { + include com.sun.jndi.rmi.**, com.sun.jndi.url.rmi.**; +} + +module jndi-dns { + include net-dns; + include com.sun.jndi.dns.**, com.sun.jndi.url.dns.**; +} + +module jndi-cosnaming { + include com.sun.jndi.cosnaming.**, + com.sun.jndi.toolkit.corba.**, + com.sun.jndi.url.corbaname.**, + com.sun.jndi.url.iiop.**, + com.sun.jndi.url.iiopname.**; +} + +// framework/API and classes used by providers +module jndi { + include javax.naming.**, + com.sun.naming.**, + com.sun.jndi.toolkit.ctx.**, + com.sun.jndi.toolkit.dir.**, + com.sun.jndi.toolkit.url.**; +} + +/**************************************************************************/ + +module jdbc-base { + include java.sql.**, javax.sql.*; + exclude javax.sql.XA*; +} + +module jdbc-enterprise { + include javax.sql.**, com.sun.rowset.**; +} + +module jdbc-odbc { + include sun.jdbc.odbc.**; +} + +/**************************************************************************/ + +module scripting { + include javax.script.**; + + // supporting classes for scripting engines + include com.sun.script.util.**; +} + +module scripting-rhino { + include com.sun.script.javascript.**, sun.org.mozilla.javascript.**; +} + +/**************************************************************************/ + +module httpserver { + include com.sun.net.httpserver.**, sun.net.httpserver.**; +} + +/**************************************************************************/ + +module sctp { + // API and dependencies + include com.sun.nio.sctp.**, sun.nio.ch.Sctp*; +} + +/**************************************************************************/ + +module langtools { + include javax.tools.**, javax.lang.model.**, javax.annotation.processing.**; + + // include mirror API for now + include com.sun.mirror.**; + + // include the JSR292 APIs for now + include java.dyn.**, sun.dyn.**; +} + +/**************************************************************************/ + +module beans { + include java.beans.**, com.sun.beans.**, sun.beans.**; +} + +/**************************************************************************/ + +module jaxp-parsers-api { + include javax.xml.*, javax.xml.parsers.**, + org.w3c.dom.**, org.w3c.sax.**, org.xml.sax.**; +} + +module jaxp-api { + include javax.xml.**; + exclude javax.xml.crypto.**, // XML-DSIG + javax.xml.bind.**, // JAX-WS + javax.xml.soap.**, + javax.xml.ws.**; +} + +module jaxp-xerces-impl { + include com.sun.org.apache.xerces.internal.**; + + // include in xerces-impl due to circular dependencies + include com.sun.org.apache.xml.internal.serialize.**, + com.sun.xml.internal.stream.**; + exclude com.sun.xml.internal.stream.buffer.**; // JAX-WS +} + +// required by Xerces and JAX-WS +module jaxp-xerces-resolver { + include com.sun.org.apache.xml.internal.resolver.**; +} + +module jaxp-xalan { + include com.sun.org.apache.xalan.internal.**, + com.sun.org.apache.xpath.internal.**, + com.sun.org.apache.xml.internal.dtm.**, + com.sun.org.apache.xml.internal.res.**, + com.sun.org.apache.xml.internal.serializer.**, + com.sun.org.apache.xml.internal.utils.**, + com.sun.org.apache.bcel.internal.**, + com.sun.org.apache.regexp.internal.**, + com.sun.java_cup.internal.**; +} + +/**************************************************************************/ + +module jaxws-tools { + include com.sun.codemodel.**, + com.sun.xml.internal.dtdparser.**, + com.sun.xml.internal.rngom.**, + com.sun.xml.internal.xsom.**, + com.sun.istack.internal.tools.**, + com.sun.istack.internal.ws.**, + com.sun.tools.internal.xjc.**, + com.sun.tools.internal.ws.**, + com.sun.tools.internal.jxc.**, + org.relaxng.datatype.**; +} + +module jaxws { + include javax.jws.**, + javax.xml.bind.**, + javax.xml.soap.**, + javax.xml.ws.**, + org.relaxng.**, + com.sun.istack.internal.*, + com.sun.istack.internal.localization.*, + com.sun.xml.internal.**; + + // include JAF in this module + include javax.activation.**, com.sun.activation.**; + + include META-INF/mailcap.default, + META-INF/mimetypes.default; +} + +/**************************************************************************/ +module enterprise-base { + include javax.transaction.**, // JTA + javax.annotation.*; // Common annotations (JSR-250) +} + +/**************************************************************************/ +module corba { + include javax.activity.**, + javax.rmi.*, + javax.rmi.CORBA.*, + javax.transaction.**, + com.sun.corba.**, + com.sun.org.omg.**, + org.omg.**, + sun.corba.**; + + // JMX remote API + exclude org.omg.stub.javax.management.**; +} + +/**************************************************************************/ + +module applet { + include java.applet.**, + sun.applet.**; +} + +module awt { + include java.awt.**, + sun.awt.**, + com.sun.awt.**; +} + +module font { + include sun.font.**; +} + +module imageio { + include javax.imageio.**, + com.sun.imageio.**; +} + +module java2d { + include sun.dc.**, + sun.java2d.**, + com.sun.image.**; +} + +module media { + include com.sun.media.**; +} + +module print { + include javax.print.**, + sun.print.**; +} + +module sound { + include javax.sound.**; +} + +module swing { + include javax.swing.**, + sun.swing.**, + // sajdi also contains classes in subpackages of com.sun.java.swing; + // so use '*' instead of '**' + com.sun.java.swing.*, + com.sun.java.swing.plaf.**, + com.sun.swing.**; +} + +module client { + include applet, + awt, + font, + imageio, + java2d, + media, + print, + sound, + swing; + + include javax.accessibility.*, + sun.audio.**, + com.sun.accessibility.**; + + // Bidi class in client module for now + include java.text.Bidi, sun.text.bidi.*; + + // PerformanceLogger and dependencies + include sun.misc.Ref, sun.misc.PerformanceLogger; + + // misc. dependencies that we need to examine + include sun.text.CodePointIterator, + sun.text.Char*, + sun.misc.Queue*, + sun.misc.FIFOQueueEnumerator, + sun.misc.LIFOQueueEnumerator; + + // content handlers + include sun.net.www.content.audio.**, + sun.net.www.content.image.**; +} + +/**************************************************************************/ + +module jkernel { + include sun.jkernel.*; +} + +module deploy { + include jkernel; + + // For now, all plugin and JNLP + include com.sun.java.browser.**, + netscape.**, + sun.plugin.**, + sun.plugin2.**,, + com.sun.deploy.**, + com.sun.javaws.**, + javax.jnlp.*, + com.sun.jnlp.*; + + // Hook for http authentication + include sun.net.www.protocol.http.AuthCacheBridge; +} + +/**************************************************************************/ + +module net-dns { + include sun.net.dns.**; // to access DNS config. + include sun.net.spi.nameservice.dns.**; // for DNS-only name service. +} + +module net-compat { + // NTLM authentication support + include sun.net.www.protocol.http.ntlm.*; + + // ftp and mail clients + include sun.net.ftp.**, sun.net.smtp.**; + + // Legacy protocol handlers + include sun.net.www.protocol.**; + + // Legacy content handlers + include sun.net.www.content.**; + + include sun.net.Telnet*, + sun.net.TransferProtocolClient; +} + +/**************************************************************************/ + +// jar-tool and security-tools are JRE tools +module jar-tool { + include sun.tools.jar.**; +} + +module security-tools { + include sun.security.tools.**; + + // Used by security tools + include sun.security.util.PathList, sun.security.x509.CertAndKeyGen; + + exclude sun.security.tools.JarBASE64Encoder, + sun.security.tools.JarSigner, + sun.security.tools.JarSignerParameters, + sun.security.tools.JarSignerResources*, + sun.security.tools.SignatureFile, + sun.security.tools.TimestampedSigner; +} + +module jconsole { + include sun.tools.jconsole.**, + com.sun.tools.jconsole.*; +} + +module serialver { + include sun.tools.serialver.**; +} + +module gui-tools { + include jconsole, + serialver; + + include com.sun.tools.example.debug.bdi.**, + com.sun.tools.example.debug.gui.**, + com.sun.tools.internal.xjc.**; +} + +module attach { + include com.sun.tools.attach.**, + sun.tools.attach.**; +} + +module debugging { + include com.sun.jdi.**, com.sun.tools.jdi.**; +} + +module jdb { + include com.sun.tools.example.debug.**; +} + +module sajdi { + include sun.jvm.hotspot.**, + com.sun.java.swing.ui.**, + com.sun.java.swing.action.**; + + include toolbarButtonGraphics/**; + include sa.properties; +} + +module tools { + include attach, + debugging, + jaxws-tools, + jdb, + rmic, + sajdi; + + // include gui-tools in tools module unless the tool binaries + // are modified to load the new gui-tools.jar + include gui-tools; + + include com.sun.tools.**, sun.tools.**, sun.security.tools.**, + com.sun.jarsigner.**, + com.sun.javac.**, + com.sun.javadoc.**, com.sun.source.**, + sun.jvmstat.**; +} + +/**************************************************************************/ + +module servicetag { + include com.sun.servicetag.**; +} + +/**************************************************************************/ + +// these classes will be removed from JRE - see 6909002 +module inputmethods-ext { + include com.sun.inputmethods.internal.**; +} + +/**************************************************************************/ + +// Workaround for US export and local policy files +// They are currently in signed jars under the jre/lib/security directory +module US_export_policy { + include default_US_export.policy; +} + +module local_policy { + include default_local.policy, + exempt_local.policy; +} + +/**************************************************************************/ + +module other { + include **; +} diff --git a/make/modules/modules.group b/make/modules/modules.group new file mode 100644 index 0000000000000000000000000000000000000000..64abd180718f7ecff8f22d8e37571b73dd9bcc6f --- /dev/null +++ b/make/modules/modules.group @@ -0,0 +1,29 @@ +/* + * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ + +/* + * Example: + * module jdbc { + * include jdbc-base, jdbc-enterprise, jdbc-odbc; + * } + */ diff --git a/make/modules/optional.depconfig b/make/modules/optional.depconfig new file mode 100644 index 0000000000000000000000000000000000000000..83f8bc79f91ee4e03abe187b752aa6683c843e4c --- /dev/null +++ b/make/modules/optional.depconfig @@ -0,0 +1,149 @@ +# +# Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. Sun designates this +# particular file as subject to the "Classpath" exception as provided +# by Sun in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, +# CA 95054 USA or visit www.sun.com if you need additional information or +# have any questions. +# + +# public final java.nio.channels.SocketChannel getChannel() +@Optional + sun.security.ssl.BaseSSLSocketImpl -> java.nio.channels.SocketChannel + +# public XMLDecoder(java.io.InputStream) +# public XMLDecoder(java.io.InputStream, java.lang.Object) +# public XMLDecoder(java.io.InputStream, java.lang.Object, java.beans.ExceptionListener) +# public XMLDecoder(java.io.InputStream, java.lang.Object, java.beans.ExceptionListener, java.lang.ClassLoader) +# public XMLDecoder(org.xml.sax.InputSource) +@Optional + java.beans.XMLDecoder -> com.sun.beans.decoder.DocumentHandler + java.beans.XMLDecoder -> org.xml.sax.InputSource + +# public static org.xml.sax.helpers.DefaultHandler createHandler(java.lang.Object, java.beans.ExceptionListener, java.lang.ClassLoader) +@Optional + java.beans.XMLDecoder -> com.sun.beans.decoder.DocumentHandler + java.beans.XMLDecoder -> org.xml.sax.helpers.DefaultHandler + +# public final java.nio.channels.FileChannel getChannel() +@Optional + java.net.SocketInputStream -> java.nio.channels.FileChannel + +# public final java.nio.channels.FileChannel getChannel() +@Optional + java.net.SocketOutputStream -> java.nio.channels.FileChannel + +# public Scanner(java.io.File) +# public Scanner(java.io.File, java.lang.String) +@Optional + java.util.Scanner -> java.nio.channels.ReadableByteChannel + java.util.Scanner -> java.nio.channels.Channels + +# public Scanner(java.nio.file.FileRef) +# public Scanner(java.nio.file.FileRef, java.lang.String) +@Optional + java.util.Scanner -> java.nio.file.FileRef + java.util.Scanner -> java.nio.file.OpenOption + +# public Scanner(java.nio.channels.ReadableByteChannel) +# public Scanner(java.nio.channels.ReadableByteChannel, java.lang.String) +@Optional + java.util.Scanner -> java.nio.channels.ReadableByteChannel + java.util.Scanner -> java.nio.channels.Channels + +# private static void loadSnmpAgent(java.lang.String, java.util.Properties) +@Optional + sun.management.Agent -> sun.management.snmp.AdaptorBootstrap + +# public void connect() +@Optional + sun.net.www.protocol.http.HttpURLConnection -> java.net.SecureCacheResponse + +# private static sun.security.util.PermissionFactory permissionFactory() +@Optional + sun.security.util.SecurityConstants$AWT -> sun.awt.AWTPermissionFactory + +# sun.util.logging.LoggingSupport +@Optional + sun.util.logging.LoggingSupport -> java.util.logging.LoggingProxyImpl + +# public java.nio.channels.DatagramChannel getChannel() +@Optional + java.net.DatagramSocket -> java.nio.channels.DatagramChannel + +# public java.nio.channels.SocketChannel getChannel() +@Optional + java.net.Socket -> java.nio.channels.SocketChannel + +# public java.nio.channels.ServerSocketChannel getChannel() +@Optional + java.net.ServerSocket -> java.nio.channels.ServerSocketChannel + +# public final java.nio.channels.FileChannel getChannel() +@Optional + java.io.RandomAccessFile -> java.nio.channels.FileChannel + java.io.RandomAccessFile -> sun.nio.ch.FileChannelImpl + +# public static sun.nio.cs.StreamDecoder forDecoder(java.nio.channels.ReadableByteChannel, java.nio.charset.CharsetDecoder, int) +@Optional + sun.nio.cs.StreamDecoder -> java.nio.channels.ReadableByteChannel + +# private static java.nio.channels.FileChannel getChannel(java.io.FileInputStream) +# StreamDecoder(java.io.InputStream, java.lang.Object, java.nio.charset.CharsetDecoder) +@Optional + sun.nio.cs.StreamDecoder -> java.nio.channels.FileChannel + +# StreamDecoder(java.nio.channels.ReadableByteChannel, java.nio.charset.CharsetDecoder, int) +@Optional + sun.nio.cs.StreamDecoder -> java.nio.channels.ReadableByteChannel + +# public static java.io.File createTemporaryFile(java.lang.String, java.lang.String, java.nio.file.attribute.FileAttribute[]) +@Optional + java.io.File -> java.io.TempFileHelper + java.io.File -> java.nio.file.attribute.FileAttribute + +# public java.nio.file.Path toPath() +@Optional + java.io.File -> java.nio.file.Paths + java.io.File -> java.nio.file.Path + +# public static sun.nio.cs.StreamEncoder forEncoder(java.nio.channels.WritableByteChannel, java.nio.charset.CharsetEncoder, int) +# private StreamEncoder(java.nio.channels.WritableByteChannel, java.nio.charset.CharsetEncoder, int) +@Optional + sun.nio.cs.StreamEncoder -> java.nio.channels.WritableByteChannel + +# public java.nio.channels.FileChannel getChannel() +@Optional + java.io.FileOutputStream -> java.nio.channels.FileChannel + java.io.FileOutputStream -> sun.nio.ch.FileChannelImpl + +# public java.nio.channels.FileChannel getChannel() +@Optional + java.io.FileInputStream -> java.nio.channels.FileChannel + java.io.FileInputStream -> sun.nio.ch.FileChannelImpl + +# public void loadFromXML(java.io.InputStream) +# public void storeToXML(java.io.OutputStream, java.lang.String, java.lang.String) +@Optional + java.util.Properties -> java.util.XMLUtils + +# public static java.nio.channels.Channel inheritedChannel() +@Optional + java.lang.System -> java.nio.channels.Channel + java.lang.System -> java.nio.channels.spi.SelectorProvider diff --git a/make/modules/tools/Makefile b/make/modules/tools/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..115411d360ae882fb2cad11e6a097f04183222fe --- /dev/null +++ b/make/modules/tools/Makefile @@ -0,0 +1,155 @@ +# +# Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. Sun designates this +# particular file as subject to the "Classpath" exception as provided +# by Sun in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, +# CA 95054 USA or visit www.sun.com if you need additional information or +# have any questions. +# + +# +# Makefile for building the classanalyzer tool +# + +BUILDDIR = ../.. +include $(BUILDDIR)/common/Defs.gmk + +PKGDIR = com/sun/classanalyzer +BUILDTOOL_SOURCE_ROOT = src +BUILDTOOL_MAIN = $(PKGDIR)/ClassAnalyzer.java +BUILTTOOL_MAINCLASS = $(subst /,.,$(BUILDTOOL_MAIN:%.java=%)) + +BUILDTOOL_MAIN_SOURCE_FILE = $(BUILDTOOL_SOURCE_ROOT)/$(BUILDTOOL_MAIN) +BUILDTOOL_MANIFEST_FILE = $(BUILDTOOLCLASSDIR)/classanalyzer_manifest.mf + +FILES_java := $(shell $(CD) $(BUILDTOOL_SOURCE_ROOT) \ + && $(FIND) $(PKGDIR) -type f -print) + +FILES_class = $(FILES_java:%.java=$(BUILDTOOLCLASSDIR)/%.class) + +CLASSANALYZER_JAR_FILE = $(BUILDTOOLJARDIR)/classanalyzer.jar + +# +# ClassAnalyzer depends on the com.sun.tools.classfile API. +# The tool is compiled with the latest version of the classfile +# library in the langtools repo to make sure that synchronized +# change is made if the classfile API is changed. +# +# If langtools repo exists, build its own copy of the +# classfile library and use it for compile time and runtime. +# If not exist (the top level repo is not a forest), use +# the built jdk tools that imports tools.jar from the latest +# promoted build. +# +# If the classfile API is changed but not yet in a promoted build, +# the build might fail and the tool would need the langtools repo +# to build in that case. +# +ifndef LANGTOOLS_TOPDIR + LANGTOOLS_TOPDIR=$(JDK_TOPDIR)/../langtools +endif + +LANGTOOLS_TOPDIR_EXISTS := $(shell \ + if [ -d $(LANGTOOLS_TOPDIR) ] ; then \ + echo true; \ + else \ + echo false; \ + fi) + +CLASSFILE_SRC = $(LANGTOOLS_TOPDIR)/src/share/classes +CLASSFILE_PKGDIR = com/sun/tools/classfile + +ifeq ($(LANGTOOLS_TOPDIR_EXISTS), true) + FILES_classfile_java := $(shell \ + $(CD) $(CLASSFILE_SRC) && \ + $(FIND) $(CLASSFILE_PKGDIR) -name '*.java' -print) + FILES_classfile_class = $(FILES_classfile_java:%.java=$(BUILDTOOLCLASSDIR)/%.class) + CLASSFILE_JAR_FILE = $(BUILDTOOLJARDIR)/classfile.jar + BUILDTOOL_JAVAC = $(BOOT_JAVAC_CMD) $(JAVAC_JVM_FLAGS) \ + $(BOOT_JAVACFLAGS) -classpath $(CLASSFILE_JAR_FILE) + BUILDTOOL_JAVA = $(BOOT_JAVA_CMD) $(JAVA_TOOLS_FLAGS) \ + -Xbootclasspath/p:$(CLASSFILE_JAR_FILE) +else + # if langtools doesn't exist, use tools from the built jdk + BUILDTOOL_JAVAC = $(BINDIR)/javac $(JAVAC_JVM_FLAGS) \ + $(BOOT_JAVACFLAGS) + BUILDTOOL_JAVA = $(BINDIR)/java $(JAVA_TOOLS_FLAGS) +endif + +# Location of the output modules.list, .classlist +# and other output files generated by the class analyzer tool. +# +MODULE_CLASSLIST = $(MODULES_TEMPDIR)/classlist + +all build: classanalyzer gen-classlist + +classanalyzer: $(CLASSFILE_JAR_FILE) $(CLASSANALYZER_JAR_FILE) + +gen-classlist: + @$(ECHO) ">>>Making "$@" @ `$(DATE)` ..." + @$(RM) -rf $(MODULE_CLASSLIST) + @$(MKDIR) -p $(MODULE_CLASSLIST) + $(BUILDTOOL_JAVA) \ + -Dclassanalyzer.debug \ + -jar $(CLASSANALYZER_JAR_FILE) \ + -jdkhome $(OUTPUTDIR) \ + -config ../modules.config \ + -config ../modules.group \ + -depconfig ../jdk7.depconfig \ + -depconfig ../optional.depconfig \ + -showdynamic \ + -output $(MODULE_CLASSLIST) + @$(ECHO) ">>>Finished making "$@" @ `$(DATE)` ..." + +$(BUILDTOOL_MANIFEST_FILE): $(BUILDTOOL_MAIN_SOURCE_FILE) + @$(prep-target) + $(ECHO) "Main-Class: $(BUILTTOOL_MAINCLASS)" > $@ + +$(BUILDTOOLCLASSDIR)/$(CLASSFILE_PKGDIR)/%.class : $(CLASSFILE_SRC)/$(CLASSFILE_PKGDIR)/%.java + @$(prep-target) + @$(BUILDTOOL_JAVAC) \ + -sourcepath $(CLASSFILE_SRC) \ + -d $(BUILDTOOLCLASSDIR) $< + +$(BUILDTOOLCLASSDIR)/%.class : $(BUILDTOOL_SOURCE_ROOT)/%.java + @$(prep-target) + $(BUILDTOOL_JAVAC) \ + -sourcepath $(BUILDTOOL_SOURCE_ROOT) \ + -d $(BUILDTOOLCLASSDIR) $< + +$(CLASSANALYZER_JAR_FILE): $(BUILDTOOL_MANIFEST_FILE) $(FILES_class) + @$(prep-target) + $(CD) $(BUILDTOOLCLASSDIR) && \ + $(BOOT_JAR_CMD) cfm $@ $(BUILDTOOL_MANIFEST_FILE) \ + $(PKGDIR) $(BOOT_JAR_JFLAGS) || $(RM) $@ + @$(java-vm-cleanup) + +$(BUILDTOOLJARDIR)/classfile.jar: $(FILES_classfile_class) + @$(prep-target) + $(CD) $(BUILDTOOLCLASSDIR) && \ + $(BOOT_JAR_CMD) cf $@ \ + $(CLASSFILE_PKGDIR) $(BOOT_JAR_JFLAGS) || $(RM) $@ + @$(java-vm-cleanup) + +clean clobber:: + @$(RM) -rf $(BUILDTOOLCLASSDIR)/$(PKGDIR) + @$(RM) -rf $(BUILDTOOLCLASSDIR)/$(CLASSFILE_PKGDIR) + @$(RM) $(BUILDTOOL_MANIFEST_FILE) + @$(RM) $(CLASSANALYZER_JAR_FILE) + @$(RM) $(CLASSFILE_JAR_FILE) diff --git a/make/modules/tools/build.xml b/make/modules/tools/build.xml new file mode 100644 index 0000000000000000000000000000000000000000..c52de21af900df298b4fb20605493942d5dcd8bc --- /dev/null +++ b/make/modules/tools/build.xml @@ -0,0 +1,29 @@ + + + + + + diff --git a/make/modules/tools/nbproject/project.properties b/make/modules/tools/nbproject/project.properties new file mode 100644 index 0000000000000000000000000000000000000000..84df879f82b281c8161ec128bff1a6408f8d1a96 --- /dev/null +++ b/make/modules/tools/nbproject/project.properties @@ -0,0 +1,86 @@ +# +# Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. Sun designates this +# particular file as subject to the "Classpath" exception as provided +# by Sun in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, +# CA 95054 USA or visit www.sun.com if you need additional information or +# have any questions. +# + +application.title=classanalyzer +application.vendor=mchung +build.classes.dir=${build.dir}/classes +build.classes.excludes=**/*.java,**/*.form + +# This directory is removed when the project is cleaned: +build.dir=build +build.generated.dir=${build.dir}/generated +build.generated.sources.dir=${build.dir}/generated-sources + +# Only compile against the classpath explicitly listed here: +build.sysclasspath=ignore +build.test.classes.dir=${build.dir}/test/classes +build.test.results.dir=${build.dir}/test/results + +cp.extra=${tools.jar} + +debug.classpath=\ + ${run.classpath} +debug.test.classpath=\ + ${run.test.classpath} + +# This directory is removed when the project is cleaned: +dist.dir=dist +dist.jar=${dist.dir}/classanalyzer.jar +dist.javadoc.dir=${dist.dir}/javadoc + +excludes= + +file.reference.tools.jar=${jdk.home}/lib/tools.jar +file.reference.tools-src=src +includes=** +jar.compress=false +javac.classpath=\ + ${file.reference.tools.jar} +javac.deprecation=false +javac.source=1.5 +javac.target=1.5 +javac.test.classpath= +javadoc.author=false +javadoc.noindex=false +javadoc.nonavbar=false +javadoc.notree=false +javadoc.private=false +javadoc.splitindex=false +javadoc.use=false +javadoc.version=false +main.class=com.sun.classanalyzer.ClassAnalyzer +manifest.file=manifest.mf +meta.inf.dir=${src.dir}/META-INF +platform.active=JDK_1.6 +run.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +# Space-separated list of JVM arguments used when running the project +# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value +# or test-sys-prop.name=value to set system properties for unit tests): +run.jvmargs=-Xmx256m +run.test.classpath= +source.encoding=UTF-8 +src.dir=${file.reference.tools-src} diff --git a/make/modules/tools/nbproject/project.xml b/make/modules/tools/nbproject/project.xml new file mode 100644 index 0000000000000000000000000000000000000000..bd83ccaeb9b215a8da7d2d1ec273d5093be0eb03 --- /dev/null +++ b/make/modules/tools/nbproject/project.xml @@ -0,0 +1,39 @@ + + + + + org.netbeans.modules.java.j2seproject + + + classanalyzer + + + + + + + + diff --git a/make/modules/tools/src/com/sun/classanalyzer/AnnotatedDependency.java b/make/modules/tools/src/com/sun/classanalyzer/AnnotatedDependency.java new file mode 100644 index 0000000000000000000000000000000000000000..72b21d9949eb362158a19e485906813b35d9c4c1 --- /dev/null +++ b/make/modules/tools/src/com/sun/classanalyzer/AnnotatedDependency.java @@ -0,0 +1,627 @@ +/* + * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + * + */ +package com.sun.classanalyzer; + +import java.io.BufferedReader; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Set; +import java.util.TreeSet; +import java.util.Map; + +import com.sun.classanalyzer.Module.Reference; +import java.util.LinkedList; +import java.util.TreeMap; + +/** + * + * @author Mandy Chung + */ +public abstract class AnnotatedDependency implements Comparable { + + final Klass from; + final List classes; + protected boolean optional; + String description; + Klass.Method method; + private List filters = null; + + public AnnotatedDependency(Klass klass) { + this(klass, false); + } + + public AnnotatedDependency(Klass klass, boolean optional) { + this.from = klass; + this.classes = new ArrayList(); + this.optional = optional; + } + + abstract String getTag(); + + abstract boolean isDynamic(); + + void setMethod(Klass.Method m) { + this.method = m; + } + + void addElement(String element, List value) { + if (element.equals("value")) { + addValue(value); + } else if (element.equals("description")) { + description = value.get(0); + } else if (element.equals("optional")) { + optional = value.get(0).equals("1") || Boolean.parseBoolean(value.get(0)); + } + } + + void addValue(List value) { + for (String s : value) { + if ((s = s.trim()).length() > 0) { + classes.add(s); + } + } + } + + List getValue() { + return classes; + } + + boolean isOptional() { + return optional; + } + + boolean isEmpty() { + return classes.isEmpty(); + } + + boolean matches(String classname) { + synchronized (this) { + // initialize filters + if (filters == null) { + filters = new ArrayList(); + for (String pattern : classes) { + filters.add(new Filter(pattern)); + } + + } + } + + for (Filter f : filters) { + if (f.matches(classname)) { + return true; + } + } + return false; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + for (String v : getValue()) { + if (sb.length() == 0) { + sb.append(getTag()); + sb.append("\n"); + } else { + sb.append("\n"); + } + sb.append(" "); + sb.append(from.getClassName()).append(" -> "); + sb.append(v); + } + return sb.toString(); + } + + @Override + public int compareTo(AnnotatedDependency o) { + if (from == o.from) { + if (this.getClass().getName().equals(o.getClass().getName())) { + String s1 = classes.isEmpty() ? "" : classes.get(0); + String s2 = o.classes.isEmpty() ? "" : o.classes.get(0); + return s1.compareTo(s2); + } else { + return this.getClass().getName().compareTo(o.getClass().getName()); + } + + } else { + return from.compareTo(o.from); + } + } + + @Override + public int hashCode() { + int hashcode = 7 + 73 * from.hashCode(); + for (String s : classes) { + hashcode ^= s.hashCode(); + } + return hashcode; + } + + @Override + public boolean equals(Object obj) { + if (!(obj instanceof AnnotatedDependency)) { + return false; + } + AnnotatedDependency other = (AnnotatedDependency) obj; + boolean ret = this.from.equals(other.from) && this.classes.size() == other.classes.size(); + if (ret == true) { + for (int i = 0; i < this.classes.size(); i++) { + ret = ret && this.classes.get(i).equals(other.classes.get(i)); + } + } + return ret; + } + + static class ClassForName extends AnnotatedDependency { + + public ClassForName(Klass klass, boolean optional) { + super(klass, optional); + } + + @Override + String getTag() { + if (this.optional) { + return TAG + "(optional)"; + } else { + return TAG; + } + } + + @Override + boolean isDynamic() { + return true; + } + static final String TYPE = "sun.annotation.ClassForName"; + static final String TAG = "@ClassForName"; + } + + static class NativeFindClass extends AnnotatedDependency { + + public NativeFindClass(Klass klass, boolean optional) { + super(klass, optional); + } + + @Override + String getTag() { + if (this.optional) { + return TAG + "(optional)"; + } else { + return TAG; + } + } + + @Override + boolean isDynamic() { + return true; + } + static final String TYPE = "sun.annotation.NativeFindClass"; + static final String TAG = "@NativeFindClass"; + } + + static class Provider extends AnnotatedDependency { + + private List services = new ArrayList(); + + Provider(Klass klass) { + super(klass, true); + } + + @Override + boolean isDynamic() { + return true; + } + + public List services() { + return services; + } + + @Override + void addElement(String element, List value) { + if (element.equals("service")) { + List configFiles = new ArrayList(); + for (String s : value) { + if ((s = s.trim()).length() > 0) { + configFiles.add(metaInfPath + s); + } + } + addValue(configFiles); + } + } + + @Override + void addValue(List value) { + for (String s : value) { + if ((s = s.trim()).length() > 0) { + if (s.startsWith("META-INF")) { + services.add(s); + readServiceConfiguration(s, classes); + } else { + throw new RuntimeException("invalid value" + s); + } + } + } + } + + boolean isEmpty() { + return services.isEmpty(); + } + static final String metaInfPath = + "META-INF" + File.separator + "services" + File.separator; + + static void readServiceConfiguration(String config, List names) { + BufferedReader br = null; + try { + InputStream is = ClassPath.open(config); + if (is != null) { + // Properties doesn't perserve the order of the input file + br = new BufferedReader(new InputStreamReader(is, "utf-8")); + int lc = 1; + while ((lc = parseLine(br, lc, names)) >= 0); + } + } catch (IOException ex) { + throw new RuntimeException(ex); + } finally { + if (br != null) { + try { + br.close(); + } catch (IOException ex) { + throw new RuntimeException(ex); + } + } + } + } + + // Parse a single line from the given configuration file, adding the name + // on the line to the names list. + // + private static int parseLine(BufferedReader r, int lc, List names) throws IOException { + String ln = r.readLine(); + if (ln == null) { + return -1; + } + int ci = ln.indexOf('#'); + if (ci >= 0) { + ln = ln.substring(0, ci); + } + ln = ln.trim(); + int n = ln.length(); + if (n != 0) { + if ((ln.indexOf(' ') >= 0) || (ln.indexOf('\t') >= 0)) { + throw new RuntimeException("Illegal configuration-file syntax"); + } + int cp = ln.codePointAt(0); + if (!Character.isJavaIdentifierStart(cp)) { + throw new RuntimeException("Illegal provider-class name: " + ln); + } + for (int i = Character.charCount(cp); i < n; i += Character.charCount(cp)) { + cp = ln.codePointAt(i); + if (!Character.isJavaIdentifierPart(cp) && (cp != '.')) { + throw new RuntimeException("Illegal provider-class name: " + ln); + } + } + if (!names.contains(ln)) { + names.add(ln); + } + } + return lc + 1; + } + + @Override + String getTag() { + return TAG; + } + + @Override + public boolean equals(Object obj) { + if (!(obj instanceof AnnotatedDependency)) { + return false; + } + Provider other = (Provider) obj; + boolean ret = this.from.equals(other.from) && + this.services.size() == other.services.size(); + if (ret == true) { + for (int i = 0; i < this.services.size(); i++) { + ret = ret && this.services.get(i).equals(other.services.get(i)); + } + } + return ret; + } + + @Override + public int hashCode() { + int hashcode = 7 + 73 * from.hashCode(); + for (String s : services) { + hashcode ^= s.hashCode(); + } + return hashcode; + } + + @Override + public List getValue() { + List result = new ArrayList(); + result.addAll(services); + return result; + } + static final String TYPE = "sun.annotation.Provider"; + static final String TAG = "@Provider"; + } + + static class OptionalDependency extends AnnotatedDependency { + + static boolean isOptional(Klass from, Klass to) { + synchronized (OptionalDependency.class) { + if (optionalDepsMap == null) { + // Build a map of classes to its optional dependencies + initDependencies(); + } + } + for (Reference ref : optionalDepsMap.keySet()) { + if (ref.referrer() == from && ref.referree() == to) { + return true; + } + } + return false; + } + + OptionalDependency(Klass klass) { + super(klass, true); + } + + @Override + boolean isDynamic() { + return false; + } + + @Override + String getTag() { + return TAG; + } + static final String TYPE = "sun.annotation.Optional"; + static final String TAG = "@Optional"; + } + + static class CompilerInline extends AnnotatedDependency { + + public CompilerInline(Klass klass) { + super(klass); + } + + @Override + String getTag() { + return TAG; + } + + @Override + boolean isDynamic() { + return false; + } + static final String TYPE = "sun.annotation.Inline"; + static final String TAG = "@Inline"; + } + + static class Filter { + + final String pattern; + final String regex; + + Filter(String pattern) { + this.pattern = pattern; + + boolean isRegex = false; + for (int i = 0; i < pattern.length(); i++) { + char p = pattern.charAt(i); + if (p == '*' || p == '[' || p == ']') { + isRegex = true; + break; + } + } + + if (isRegex) { + this.regex = convertToRegex(pattern); + } else { + this.regex = null; + } + } + + private String convertToRegex(String pattern) { + StringBuilder sb = new StringBuilder(); + int i = 0; + int index = 0; + int plen = pattern.length(); + while (i < plen) { + char p = pattern.charAt(i); + if (p == '*') { + sb.append("(").append(pattern.substring(index, i)).append(")"); + if (i + 1 < plen && pattern.charAt(i + 1) == '*') { + sb.append(".*"); + index = i + 2; + } else { + sb.append("[^\\.]*"); + index = i + 1; + } + } else if (p == '[') { + int j = i + 1; + while (j < plen) { + if (pattern.charAt(j) == ']') { + break; + } + j++; + } + if (j >= plen || pattern.charAt(j) != ']') { + throw new RuntimeException("Malformed pattern " + pattern); + } + sb.append("(").append(pattern.substring(index, i)).append(")"); + sb.append(pattern.substring(i, j + 1)); + index = j + 1; + i = j; + } + i++; + } + if (index < plen) { + sb.append("(").append(pattern.substring(index, plen)).append(")"); + } + return sb.toString(); + } + + boolean matches(String name) { + if (regex == null) { + // the pattern is not a regex + return name.equals(pattern); + } else { + return name.matches(regex); + } + } + } + + static boolean isValidType(String type) { + if (type.endsWith("(optional)")) { + int len = type.length() - "(optional)".length(); + type = type.substring(0, len); + } + return type.equals(ClassForName.TYPE) || type.equals(ClassForName.TAG) || + type.equals(NativeFindClass.TYPE) || type.equals(NativeFindClass.TAG) || + type.equals(Provider.TYPE) || type.equals(Provider.TAG) || + type.equals(CompilerInline.TYPE) || type.equals(CompilerInline.TAG) || + type.equals(OptionalDependency.TYPE) || type.equals(OptionalDependency.TAG); + } + + static AnnotatedDependency newAnnotatedDependency(String tag, String value, Klass klass) { + AnnotatedDependency dep = newAnnotatedDependency(tag, klass); + if (dep != null) { + dep.addValue(Collections.singletonList(value)); + } + return dep; + } + static List annotatedDependencies = new LinkedList(); + static List optionalDependencies = new LinkedList(); + + static AnnotatedDependency newAnnotatedDependency(String type, Klass klass) { + boolean optional = false; + if (type.endsWith("(optional)")) { + optional = true; + int len = type.length() - "(optional)".length(); + type = type.substring(0, len); + } + + if (type.equals(OptionalDependency.TYPE) || type.equals(OptionalDependency.TAG)) { + return newOptionalDependency(klass); + } + + AnnotatedDependency dep; + if (type.equals(ClassForName.TYPE) || type.equals(ClassForName.TAG)) { + dep = new ClassForName(klass, optional); + } else if (type.equals(NativeFindClass.TYPE) || type.equals(NativeFindClass.TAG)) { + dep = new NativeFindClass(klass, optional); + } else if (type.equals(Provider.TYPE) || type.equals(Provider.TAG)) { + dep = new Provider(klass); + } else if (type.equals(CompilerInline.TYPE) || type.equals(CompilerInline.TAG)) { + dep = new CompilerInline(klass); + } else { + return null; + } + klass.addAnnotatedDep(dep); + annotatedDependencies.add(dep); + return dep; + } + + static OptionalDependency newOptionalDependency(Klass klass) { + OptionalDependency dep = new OptionalDependency(klass); + optionalDependencies.add(dep); + return dep; + } + static Map> annotatedDepsMap = null; + static Map> optionalDepsMap = null; + + static Map> getReferences(Module m) { + // ensure it's initialized + initDependencies(); + + Map> result = new TreeMap>(); + for (Reference ref : annotatedDepsMap.keySet()) { + if (m.contains(ref.referrer()) && m.isModuleDependence(ref.referree())) { + result.put(ref, annotatedDepsMap.get(ref)); + } + } + return result; + } + + static Set getDependencies(Module m) { + // ensure it's initialized + initDependencies(); + + Set deps = new TreeSet(); + for (Reference ref : annotatedDepsMap.keySet()) { + if (m.contains(ref.referrer())) { + Module other = m.getModuleDependence(ref.referree()); + if (other != null) { + for (AnnotatedDependency ad : annotatedDepsMap.get(ref)) { + Module.Dependency d = new Module.Dependency(other, ad.isOptional(), ad.isDynamic()); + deps.add(d); + } + } + } + } + return deps; + } + + synchronized static void initDependencies() { + if (annotatedDepsMap != null) { + return; + } + + // Build a map of references to its dependencies + annotatedDepsMap = new TreeMap>(); + optionalDepsMap = new TreeMap>(); + + for (Klass k : Klass.getAllClasses()) { + for (AnnotatedDependency ad : annotatedDependencies) { + if (ad.matches(k.getClassName())) { + Reference ref = new Reference(ad.from, k); + Set set = annotatedDepsMap.get(ref); + if (set == null) { + set = new TreeSet(); + annotatedDepsMap.put(ref, set); + } + set.add(ad); + } + } + + for (AnnotatedDependency ad : optionalDependencies) { + if (ad.matches(k.getClassName())) { + Reference ref = new Reference(ad.from, k); + Set set = optionalDepsMap.get(ref); + if (set == null) { + set = new TreeSet(); + optionalDepsMap.put(ref, set); + } + set.add(ad); + } + } + } + } +} diff --git a/make/modules/tools/src/com/sun/classanalyzer/AnnotationParser.java b/make/modules/tools/src/com/sun/classanalyzer/AnnotationParser.java new file mode 100644 index 0000000000000000000000000000000000000000..7d984aa2e74b3a58ce6437c764d924105182ba0c --- /dev/null +++ b/make/modules/tools/src/com/sun/classanalyzer/AnnotationParser.java @@ -0,0 +1,293 @@ +/* + * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ +package com.sun.classanalyzer; + +import com.sun.tools.classfile.*; +import com.sun.tools.classfile.Annotation; +import com.sun.tools.classfile.ExtendedAnnotation; +import com.sun.tools.classfile.Annotation.Annotation_element_value; +import com.sun.tools.classfile.Annotation.Array_element_value; +import com.sun.tools.classfile.Annotation.Class_element_value; +import com.sun.tools.classfile.Annotation.Enum_element_value; +import com.sun.tools.classfile.Annotation.Primitive_element_value; +import com.sun.tools.classfile.ConstantPoolException; +import com.sun.tools.classfile.Descriptor; +import com.sun.tools.classfile.Descriptor.InvalidDescriptor; +import java.util.ArrayList; +import java.util.List; + +import com.sun.classanalyzer.AnnotatedDependency.*; +import java.io.File; +import java.io.PrintWriter; +import java.util.Map; +import java.util.Set; + +/** + * + * @author Mandy Chung + */ +public class AnnotationParser { + + static boolean parseAnnotation = false; + static void setParseAnnotation(boolean newValue) { + parseAnnotation = newValue; + } + + private final ClassFileParser cfparser; + public AnnotationParser(ClassFileParser cfparser) { + this.cfparser = cfparser; + } + + private AnnotatedDependency addAnnotation(Annotation annot, Klass.Method method) { + String type = getType(annot.type_index); + AnnotatedDependency dep = AnnotatedDependency.newAnnotatedDependency(type, cfparser.this_klass); + if (dep != null) { + for (int i = 0; i < annot.num_element_value_pairs; i++) { + Element element = getElement(annot.element_value_pairs[i]); + dep.addElement(element.name, element.value); + } + dep.setMethod(method); + } + return dep; + } + + private AnnotatedDependency addAnnotation(ExtendedAnnotation annot, Klass.Method method) { + return addAnnotation(annot.annotation, method); + } + + class Element { + + String name; + List value; + + Element(String name) { + this.name = name; + this.value = new ArrayList(); + } + + void add(String v) { + value.add(v); + } + } + + Element getElement(Annotation.element_value_pair pair) { + Element element = new Element(getName(pair.element_name_index)); + evp.parse(pair.value, element); + return element; + } + + private String getType(int index) { + try { + Descriptor d = new Descriptor(index); + return d.getFieldType(cfparser.classfile.constant_pool); + } catch (ConstantPoolException ignore) { + } catch (InvalidDescriptor ignore) { + } + return "Unknown"; + } + + private String getName(int index) { + return cfparser.constantPoolParser.stringValue(index); + } + element_value_Parser evp = new element_value_Parser(); + + class element_value_Parser implements Annotation.element_value.Visitor { + + public Void parse(Annotation.element_value value, Element element) { + value.accept(this, element); + return null; + } + + public Void visitPrimitive(Primitive_element_value ev, Element element) { + String value = getName(ev.const_value_index); + element.add(value); + return null; + } + + public Void visitEnum(Enum_element_value ev, Element element) { + String value = getName(ev.type_name_index) + "." + getName(ev.const_name_index); + element.add(value); + return null; + } + + public Void visitClass(Class_element_value ev, Element element) { + String value = getName(ev.class_info_index) + ".class"; + element.add(value); + return null; + } + + public Void visitAnnotation(Annotation_element_value ev, Element element) { + // AnnotationParser.this.addAnnotation(ev.annotation_value); + throw new UnsupportedOperationException("Not supported: " + ev); + } + + public Void visitArray(Array_element_value ev, Element element) { + for (int i = 0; i < ev.num_values; i++) { + parse(ev.values[i], element); + } + return null; + } + } + + void parseAttributes(Attributes attributes, Klass.Method method) { + if (!parseAnnotation) { + return; + } + + visitRuntimeAnnotations((RuntimeVisibleAnnotations_attribute) attributes.get(Attribute.RuntimeVisibleAnnotations), method); + visitRuntimeAnnotations((RuntimeInvisibleAnnotations_attribute) attributes.get(Attribute.RuntimeInvisibleAnnotations), method); + visitRuntimeTypeAnnotations((RuntimeVisibleTypeAnnotations_attribute) attributes.get(Attribute.RuntimeVisibleTypeAnnotations), method); + visitRuntimeTypeAnnotations((RuntimeInvisibleTypeAnnotations_attribute) attributes.get(Attribute.RuntimeInvisibleTypeAnnotations), method); + visitRuntimeParameterAnnotations((RuntimeVisibleParameterAnnotations_attribute) attributes.get(Attribute.RuntimeVisibleParameterAnnotations), method); + visitRuntimeParameterAnnotations((RuntimeInvisibleParameterAnnotations_attribute) attributes.get(Attribute.RuntimeInvisibleParameterAnnotations), method); + } + + public void visitRuntimeAnnotations(RuntimeAnnotations_attribute attr, Klass.Method method) { + if (attr == null) { + return; + } + + for (int i = 0; i < attr.annotations.length; i++) { + addAnnotation(attr.annotations[i], method); + } + } + + public void visitRuntimeTypeAnnotations(RuntimeTypeAnnotations_attribute attr, Klass.Method method) { + if (attr == null) { + return; + } + + for (int i = 0; i < attr.annotations.length; i++) { + addAnnotation(attr.annotations[i], method); + } + } + + public void visitRuntimeParameterAnnotations(RuntimeParameterAnnotations_attribute attr, Klass.Method method) { + if (attr == null) { + return; + } + + for (int param = 0; param < attr.parameter_annotations.length; param++) { + for (int i = 0; i < attr.parameter_annotations[param].length; i++) { + addAnnotation(attr.parameter_annotations[param][i], method); + } + } + } + + void parseAttributes(Attributes attributes) { + parseAttributes(attributes, null); + } + + public static void main(String[] args) throws Exception { + String jdkhome = null; + String output = "."; + + // process arguments + int i = 0; + while (i < args.length) { + String arg = args[i++]; + if (arg.equals("-jdkhome")) { + if (i < args.length) { + jdkhome = args[i++]; + } else { + usage(); + } + } else if (arg.equals("-output")) { + output = args[i++]; + } else { + usage(); + } + } + if (jdkhome == null) { + usage(); + } + + // parse annotation and code attribute to find all references + // to Class.forName etc + CodeAttributeParser.setParseCodeAttribute(true); + AnnotationParser.setParseAnnotation(true); + + ClassPath.setJDKHome(jdkhome); + ClassPath.parseAllClassFiles(); + + PrintWriter writer = new PrintWriter(new File(output, "jdk7.depconfig")); + + try { + for (Klass k : Klass.getAllClasses()) { + for (AnnotatedDependency dep : k.getAnnotatedDeps()) { + if (dep.isEmpty()) { + continue; + } + writer.format("# %s \n", dep.method == null ? dep.from : dep.method); + writer.format("%s\n\n", dep); + } + } + } finally { + writer.close(); + } + + writer = new PrintWriter(new File(output, "optional.depconfig")); + try { + AnnotatedDependency prev = null; + for (AnnotatedDependency dep : AnnotatedDependency.optionalDependencies) { + if (prev != null && !dep.equals(prev)) { + writer.format("%s\n\n", prev); + } + writer.format("# %s \n", dep.method == null ? dep.from : dep.method); + prev = dep; + } + if (prev != null) { + writer.format("%s\n\n", prev); + } + } finally { + writer.close(); + } + + writer = new PrintWriter(new File(output, "runtime.references")); + try { + for (Map.Entry> entry : CodeAttributeParser.runtimeReferences.entrySet()) { + writer.format("References to %s\n", entry.getKey()); + Klass prev = null; + for (Klass.Method m : entry.getValue()) { + if (prev == null || prev != m.getKlass()) { + writer.format(" %-50s # %s\n", m.getKlass(), m); + } else if (prev == m.getKlass()) { + writer.format(" %-50s # %s\n", "", m); + } + prev = m.getKlass(); + } + } + } finally { + writer.close(); + } + } + + private static void usage() { + System.out.println("Usage: AnnotationParser "); + System.out.println("Options: "); + System.out.println("\t-jdkhome where all jars will be parsed"); + System.out.println("\t-depconfig "); + System.out.println("\t-optional "); + System.exit(-1); + } +} diff --git a/make/modules/tools/src/com/sun/classanalyzer/BootAnalyzer.java b/make/modules/tools/src/com/sun/classanalyzer/BootAnalyzer.java new file mode 100644 index 0000000000000000000000000000000000000000..06e332ace7c372642cbc2f0f0904e67c31f7ce69 --- /dev/null +++ b/make/modules/tools/src/com/sun/classanalyzer/BootAnalyzer.java @@ -0,0 +1,819 @@ +/* + * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + * + */ +package com.sun.classanalyzer; + +import java.io.BufferedReader; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.PrintWriter; +import java.io.File; +import java.util.ArrayDeque; +import java.util.Deque; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.TreeSet; + +import com.sun.tools.classfile.*; +import com.sun.tools.classfile.ConstantPool.*; +import static com.sun.tools.classfile.ConstantPool.*; +import com.sun.tools.classfile.Instruction.TypeKind; +import com.sun.tools.classfile.Type.*; + +/** + * Generate the module config for the boot module with + * a given set of roots (classes or methods) and exclude list. + * + * This tool does method-level dependency analysis starting + * from the root set and follows references transitively as follows: + *
    + *
  • For a given class, it will parse the ClassFile to + * find its superclass and superinterfaces and also + * its static initializer <clinit>.
  • + *
  • For each method, it will parse its Code attribute + * to look for a Methodref, Fieldref, and InterfaceMethodref. + *
  • + *
  • For each Fieldref, it will include the type of + * the field in the dependency.
  • + *
  • For each MethodRef, it will follow all references in + * that method.
  • + *
  • For each InterfaceMethodref, it will follow all references in + * that method defined its implementation classes in + * the resulting dependency list.
  • + *
+ * + * Limitation: + *
    + *
  • For each Methodref, it only parses the method of + * the specified type. It doesn't analyze the class hierarchy + * and follow references of its subclasses since it ends up + * pulls in many unnecessary dependencies. For now, + * the list of subclasses and methods need to be listed in + * the root set.
  • + *
+ * + * @author Mandy Chung + */ +public class BootAnalyzer { + + public static void main(String[] args) throws Exception { + String jdkhome = null; + String config = null; + String output = "."; + boolean printClassList = false; + + // process arguments + int i = 0; + while (i < args.length) { + String arg = args[i++]; + if (arg.equals("-jdkhome")) { + if (i < args.length) { + jdkhome = args[i++]; + } else { + usage(); + } + } else if (arg.equals("-config")) { + config = args[i++]; + } else if (arg.equals("-output")) { + output = args[i++]; + } else if (arg.equals("-classlist")) { + printClassList = true; + } else { + usage(); + } + } + + + + if (jdkhome == null || config == null) { + usage(); + } + + File jre = new File(jdkhome, "jre"); + if (jre.exists()) { + ClassPath.setJDKHome(jdkhome); + } else { + File classes = new File(jdkhome, "classes"); + if (classes.exists()) { + ClassPath.setClassPath(classes.getCanonicalPath()); + } else { + throw new RuntimeException("Invalid jdkhome: " + jdkhome); + } + } + + parseConfigFile(config); + followRoots(); + + // create output directory if it doesn't exist + File dir = new File(output); + if (!dir.isDirectory()) { + if (!dir.exists()) { + boolean created = dir.mkdir(); + if (!created) { + throw new RuntimeException("Unable to create `" + dir + "'"); + } + } + } + + String bootmodule = "boot"; + String bootconfig = resolve(dir, bootmodule, "config"); + printBootConfig(bootconfig, bootmodule); + + List list = ModuleConfig.readConfigurationFile(bootconfig); + Module module = Module.addModule(list.get(0)); + for (Klass k : Klass.getAllClasses()) { + module.addKlass(k); + } + module.fixupDependencies(); + + if (printClassList) { + module.printClassListTo(resolve(dir, bootmodule, "classlist")); + module.printSummaryTo(resolve(dir, bootmodule, "summary")); + } + } + + // print boot.config file as an input to the ClassAnalyzer + private static void printBootConfig(String output, String bootmodule) throws IOException { + + File f = new File(output); + PrintWriter writer = new PrintWriter(f); + try { + int count = 0; + writer.format("module %s {%n", bootmodule); + for (Klass k : Klass.getAllClasses()) { + if (count++ == 0) { + writer.format("%4s%7s %s", "", "include", k); + } else { + writer.format(",%n"); + writer.format("%4s%7s %s", "", "", k); + } + } + writer.format(";%n}%n"); + } finally { + writer.close(); + } + } + + private static String resolve(File dir, String mname, String suffix) { + File f = new File(dir, mname + "." + suffix); + return f.toString(); + + } + static List methods = new LinkedList(); + static Deque pending = new ArrayDeque(); + static Deque interfaceMethodRefs = new ArrayDeque(); + static Filter filter = new Filter(); + + private static void followRoots() throws IOException { + MethodDescriptor md = null; + + while ((md = pending.poll()) != null) { + if (!methods.contains(md)) { + methods.add(md); + if (md.classname.isEmpty()) { + trace("Warning: class missing %s%n", md); + continue; + } + + if (filter.isExcluded(md.classname)) { + trace("excluded %s%n", md); + } else { + KlassInfo kinfo = getKlassInfo(md.classname); + if (kinfo.classname.contains("$")) { + int pos = kinfo.classname.lastIndexOf('$'); + String outer = kinfo.classname.substring(0, pos); + if (!cache.containsKey(outer)) { + trace(" include outer class %s%n", outer); + getKlassInfo(outer).ensureParse(); + } + } + + kinfo.ensureParse(); + if (md.methodname.length() > 0) { + if (filter.isExcluded(md.name)) { + trace("excluded %s%n", md); + } else { + if (md.interfaceMethodRef) { + trace("interface methodref %s%n", md); + interfaceMethodRefs.add(md); + } else { + List descriptors = kinfo.parse(md); + if (descriptors.isEmpty()) { + if (kinfo.getSuperclass() != null) { + String sn = kinfo.getSuperclass().classname; + MethodDescriptor superMD = new MethodDescriptor(sn + "." + md.methodname, md.descriptor, false); + if (!methods.contains(superMD) && !pending.contains(superMD)) { + trace(" delegated %s to %s%n", md, superMD); + pending.add(superMD); + } + } else if (kinfo.isClass()) { + trace(" %s (not found)%n", md); + } else { + trace(" %s (interface)%n", md); + } + } else { + if (md.descriptor.equals("*")) { + trace(" parsed %s : ", md.name); + for (String s : descriptors) { + trace(" %s", s); + } + trace("%n"); + } + } + } + } + } + } + } + if (pending.isEmpty()) { + for (Klass k : Klass.getAllClasses()) { + if (k.getFileSize() == 0) { + getKlassInfo(k.getClassName()).ensureParse(); + } + } + while ((md = interfaceMethodRefs.poll()) != null) { + addSubClassMethods(md); + } + } + } + } + + static void addSubClassMethods(MethodDescriptor md) throws IOException { + for (KlassInfo kinfo : getSubClasses(md.classname)) { + String methodname = kinfo.classname + "." + md.methodname; + MethodDescriptor other = new MethodDescriptor(methodname, md.descriptor, false); + if (!methods.contains(other) && !pending.contains(other)) { + trace("Warning: subclass from %s to %s%n", md.classname, other); + pending.add(other); + } + } + } + private final static String privilegedActionInterf = "java.security.PrivilegedAction"; + private final static String privilegedExceptionActionInterf = "java.security.PrivilegedExceptionAction"; + + static boolean isPrivilegedAction(String classname) { + if (classname.isEmpty()) { + return false; + } + KlassInfo kinfo = getKlassInfo(classname); + for (KlassInfo ki : kinfo.getInterfaces()) { + String interf = ki.classname; + if (interf.equals(privilegedActionInterf) || + interf.equals(privilegedExceptionActionInterf)) { + return true; + } + } + return false; + } + static Map cache = new HashMap(); + + static KlassInfo getKlassInfo(String classname) { + classname = classname.replace('/', '.'); + + KlassInfo kinfo = cache.get(classname); + if (kinfo == null) { + kinfo = new KlassInfo(classname); + cache.put(classname, kinfo); + } + return kinfo; + } + + static class KlassInfo { + + final String classname; + private ClassFileParser parser; + private KlassInfo superclass; + private List interfaces = new LinkedList(); + + KlassInfo(String classname) { + this.classname = classname; + } + + boolean isClass() { + ensureParse(); + return parser.classfile.isClass(); + } + + KlassInfo getSuperclass() { + ensureParse(); + return superclass; + } + + List getInterfaces() { + ensureParse(); + return java.util.Collections.unmodifiableList(interfaces); + } + + void ensureParse() { + try { + getClassFileParser(); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + synchronized ClassFileParser getClassFileParser() throws IOException { + if (parser == null) { + parser = ClassPath.parserForClass(classname); + if (parser != null) { + parseClassFile(); + List descriptors = parse(new MethodDescriptor(classname + ".", "()V", false)); + } + } + return parser; + } + + List parse(MethodDescriptor md) { + ensureParse(); + try { + List descriptors = new LinkedList(); + for (Method m : parser.classfile.methods) { + String name = m.getName(parser.classfile.constant_pool); + String desc = parser.constantPoolParser.getDescriptor(m.descriptor.index); + if (name.equals(md.methodname)) { + if (md.descriptor.equals("*") || md.descriptor.equals(desc)) { + parseMethod(parser, m); + descriptors.add(desc); + } + } + } + return descriptors; + } catch (ConstantPoolException ex) { + throw new RuntimeException(ex); + } + } + + private void parseClassFile() throws IOException { + parser.parseClassInfo(); + + ClassFile classfile = parser.classfile; + try { + if (classfile.super_class > 0) { + superclass = getKlassInfo(classfile.getSuperclassName()); + } + if (classfile.interfaces != null) { + for (int i = 0; i < classfile.interfaces.length; i++) { + interfaces.add(getKlassInfo(classfile.getInterfaceName(i))); + } + } + } catch (ConstantPoolException ex) { + throw new RuntimeException(ex); + } + } + } + + static List getSubClasses(String classname) throws IOException { + List result = new LinkedList(); + List list = new LinkedList(); + list.addAll(cache.values()); + for (KlassInfo kinfo : list) { + if (kinfo.getSuperclass() != null && classname.equals(kinfo.getSuperclass().classname)) { + result.add(kinfo); + } + for (KlassInfo interf : kinfo.getInterfaces()) { + if (classname.equals(interf.classname)) { + result.add(kinfo); + } + } + } + return result; + } + + private static void parseConfigFile(String config) throws IOException { + FileInputStream in = new FileInputStream(config); + try { + BufferedReader reader = new BufferedReader(new InputStreamReader(in)); + String line; + int lineNumber = 0; + while ((line = reader.readLine()) != null) { + lineNumber++; + if ((line = line.trim()).length() > 0) { + if (line.startsWith("#")) { + continue; + } + + String[] s = line.split("\\s+"); + if ("exclude".equals(s[0])) { + filter.exclude(s[1]); + } else { + String name = s[0].replace('/', '.'); + if (name.length() > 0) { + String classname = name.replace('/', '.'); + if (s.length == 2) { + // method name + int pos = classname.lastIndexOf('.'); + classname = classname.substring(0, pos); + } + + KlassInfo kinfo = getKlassInfo(classname); + if (kinfo.getClassFileParser() != null) { + // class exists + MethodDescriptor md = (s.length == 1) ? new MethodDescriptor(name) : new MethodDescriptor(name, s[1], false); + if (!pending.contains(md)) { + pending.add(md); + } + } else { + // class not found + trace("Class %s not found%n", classname); + } + } + } + } + } + + } finally { + in.close(); + } + } + + private static void parseMethod(ClassFileParser cfparser, Method m) { + Klass.Method kmethod = cfparser.parseMethod(m); + Code_attribute c_attr = (Code_attribute) m.attributes.get(Attribute.Code); + if (c_attr != null) { + LineNumberTable_attribute lineNumTable = + (LineNumberTable_attribute) c_attr.attributes.get(Attribute.LineNumberTable); + InstructorVisitor visitor = new InstructorVisitor(cfparser, lineNumTable); + trace("parseMethod %s %s %n", cfparser.this_klass, kmethod); + for (Instruction instr : c_attr.getInstructions()) { + try { + instr.accept(visitor, kmethod); + } catch (ArrayIndexOutOfBoundsException e) { + throw new RuntimeException("error at or after byte " + instr.getPC()); + } + + } + + if (c_attr.exception_table_langth > 0) { + for (int i = 0; i < + c_attr.exception_table.length; i++) { + Code_attribute.Exception_data handler = c_attr.exception_table[i]; + int catch_type = handler.catch_type; + if (catch_type > 0) { + visitor.addConstantPoolRef(catch_type, kmethod, handler.start_pc); + } + + } + } + } + } + + static class MethodDescriptor { + + final String name; + final String classname; + final String methodname; + final String descriptor; + final boolean interfaceMethodRef; + + MethodDescriptor(String classname) { + this.classname = classname.replace('/', '.'); + this.name = this.classname; + this.methodname = ""; + this.descriptor = ""; + this.interfaceMethodRef = false; + if (this.classname.length() == 1) { + throw new RuntimeException("invalid " + this); + } + } + + MethodDescriptor(String name, String descriptor, boolean interfaceMethodRef) { + name = name.replace('/', '.'); + this.name = name; + int pos = name.lastIndexOf('.'); + this.classname = name.substring(0, pos); + this.methodname = name.substring(pos + 1, name.length()); + this.descriptor = descriptor; + this.interfaceMethodRef = interfaceMethodRef; + if (this.classname.length() == 1) { + throw new RuntimeException("invalid " + this); + } + } + + @Override + public boolean equals(Object obj) { + MethodDescriptor m = (MethodDescriptor) obj; + + return this.name.equals(m.name) && + this.descriptor.equals(m.descriptor); + } + + @Override + public int hashCode() { + int hash = 7; + hash = 97 * hash + (this.name != null ? this.name.hashCode() : 0); + hash = 97 * hash + (this.descriptor != null ? this.descriptor.hashCode() : 0); + return hash; + } + + public String toString() { + if (descriptor.isEmpty()) { + return name; + } else { + return name + " : " + descriptor; + } + } + } + + static class Filter { + + private Set excludes = new TreeSet(); + + Filter exclude(String pattern) { + excludes.add(pattern); + return this; + } + + boolean isExcluded(String klass) { + for (String pattern : excludes) { + if (matches(klass, pattern)) { + return true; + } + } + return false; + } + + private boolean matches(String klass, String pattern) { + int pos = klass.lastIndexOf('.'); + String packageName = pos > 0 ? klass.substring(0, pos) : ""; + if (pattern.endsWith("**")) { + String p = pattern.substring(0, pattern.length() - 2); + return klass.startsWith(p); + } else if (pattern.endsWith("*")) { + pos = pattern.lastIndexOf('.'); + String pkg = pos > 0 ? pattern.substring(0, pos) : ""; + if (packageName.equals(pkg)) { + // package name has to be exact match + String p = pattern.substring(0, pattern.length() - 1); + return klass.startsWith(p); + } else { + return false; + } + } else { + // exact match or inner class + return klass.equals(pattern) || klass.startsWith(pattern + "$"); + } + } + } + + static class InstructorVisitor implements Instruction.KindVisitor { + + private final ClassFileParser parser; + private final LineNumberTable_attribute lineNumTable; + + InstructorVisitor(ClassFileParser parser, LineNumberTable_attribute lineNumTable) { + this.parser = parser; + this.lineNumTable = lineNumTable; + } + + int getLineNumber(int pc) { + if (lineNumTable != null) { + int start_pc = 0; + int lineno = 0; + for (int i = 0; i < lineNumTable.line_number_table_length; i++) { + int cur_start_pc = lineNumTable.line_number_table[i].start_pc; + if (pc == 0 && cur_start_pc == 0) { + return lineNumTable.line_number_table[i].line_number; + } else if (pc >= start_pc && pc < cur_start_pc) { + return lineno; + } + start_pc = cur_start_pc; + lineno = lineNumTable.line_number_table[i].line_number; + } + } + return 0; + } + + void addConstantPoolRef(int index, Klass.Method m, int pc) { + try { + CPInfo cpInfo = parser.classfile.constant_pool.get(index); + String name = cpInfo.accept(typeFinder, null); + if (name != null) { + trace(" %s %s at line %d%n", parser.constantPoolParser.tagName(index), name, getLineNumber(pc)); + } + } catch (InvalidIndex ex) { + throw new RuntimeException(ex); + } + } + + public Void visitNoOperands(Instruction instr, Klass.Method m) { + return null; + } + + public Void visitArrayType(Instruction instr, TypeKind kind, Klass.Method m) { + return null; + } + + public Void visitBranch(Instruction instr, int offset, Klass.Method m) { + return null; + } + + public Void visitConstantPoolRef(Instruction instr, int index, Klass.Method m) { + addConstantPoolRef(index, m, instr.getPC()); + return null; + } + + public Void visitConstantPoolRefAndValue(Instruction instr, int index, int value, Klass.Method m) { + addConstantPoolRef(index, m, instr.getPC()); + return null; + } + + public Void visitLocal(Instruction instr, int index, Klass.Method m) { + return null; + } + + public Void visitLocalAndValue(Instruction instr, int index, int value, Klass.Method m) { + return null; + } + + public Void visitLookupSwitch(Instruction instr, int default_, int npairs, int[] matches, int[] offsets, Klass.Method m) { + return null; + } + + public Void visitTableSwitch(Instruction instr, int default_, int low, int high, int[] offsets, Klass.Method m) { + return null; + } + + public Void visitValue(Instruction instr, int value, Klass.Method m) { + return null; + } + + public Void visitUnknown(Instruction instr, Klass.Method m) { + return null; + } + private ConstantPool.Visitor typeFinder = new ConstantPool.Visitor() { + + String getClassName(CPRefInfo info, Void p) { + try { + return parser.checkClassName(info.getClassName()).replace('/', '.'); + } catch (ConstantPoolException ex) { + throw new RuntimeException(ex); + } + } + + boolean addReferencedClass(String name) { + if (Klass.findKlass(name) == null) { + MethodDescriptor md = new MethodDescriptor(name); + if (!methods.contains(md) && !pending.contains(md)) { + pending.add(md); + } + return true; + } + return false; + } + private String privilegedActionClass = ""; + + void cachePrivilegedAction(String classname) { + trace(" found PrivilegedAction %s%n", classname); + privilegedActionClass = classname; + } + + void doPrivilegedCall(String method) { + if (privilegedActionClass.length() > 0) { + MethodDescriptor md = new MethodDescriptor(privilegedActionClass + ".run", "*", false); + if (!methods.contains(md) && !pending.contains(md)) { + trace(" doPrivileged %s%n", md); + pending.add(md); + } + } + } + + private String addMethodDescriptor(CPRefInfo info, Void p) { + try { + String classname = getClassName(info, null); + String method = classname + "." + info.getNameAndTypeInfo().getName(); + String descriptor = info.getNameAndTypeInfo().getType(); + + if (method.endsWith(".") && isPrivilegedAction(classname)) { + cachePrivilegedAction(classname); + } + if (method.equals("java.security.AccessController.doPrivileged")) { + doPrivilegedCall(method); + return method; + } + + boolean interfaceMethodRef = info instanceof CONSTANT_InterfaceMethodref_info; + MethodDescriptor md = new MethodDescriptor(method, descriptor, interfaceMethodRef); + if (!methods.contains(md) && !pending.contains(md)) { + pending.add(md); + } + return method; + } catch (ConstantPoolException e) { + throw new RuntimeException(e); + } + } + + public String visitClass(CONSTANT_Class_info info, Void p) { + try { + String classname = parser.checkClassName(info.getName()).replace('/', '.'); + if (classname.length() > 0) { + addReferencedClass(classname); + } + return classname; + } catch (ConstantPoolException ex) { + throw new RuntimeException(ex); + } + } + + public String visitDouble(CONSTANT_Double_info info, Void p) { + // skip + return null; + } + + public String visitFieldref(CONSTANT_Fieldref_info info, Void p) { + try { + String classname = getClassName(info, p); + if (classname.length() > 0) { + addReferencedClass(classname); + } + + String type = info.getNameAndTypeInfo().getType(); + String fieldType = parser.checkClassName(type).replace('/', '.'); + if (fieldType.length() > 0) { + addReferencedClass(classname); + } + return parser.constantPoolParser.stringValue(info); + } catch (ConstantPoolException e) { + throw new RuntimeException(e); + } + } + + public String visitFloat(CONSTANT_Float_info info, Void p) { + // skip + return null; + } + + public String visitInteger(CONSTANT_Integer_info info, Void p) { + // skip + return null; + } + + public String visitInterfaceMethodref(CONSTANT_InterfaceMethodref_info info, Void p) { + return addMethodDescriptor(info, p); + } + + public String visitLong(CONSTANT_Long_info info, Void p) { + // skip + return null; + } + + public String visitNameAndType(CONSTANT_NameAndType_info info, Void p) { + // skip + return null; + } + + public String visitMethodref(CONSTANT_Methodref_info info, Void p) { + return addMethodDescriptor(info, p); + } + + public String visitString(CONSTANT_String_info info, Void p) { + // skip + return null; + } + + public String visitUtf8(CONSTANT_Utf8_info info, Void p) { + return null; + } + }; + } + static boolean traceOn = System.getProperty("classanalyzer.debug") != null; + + private static void trace(String format, Object... args) { + if (traceOn) { + System.out.format(format, args); + } + } + + private static void usage() { + System.out.println("Usage: BootAnalyzer "); + System.out.println("Options: "); + System.out.println("\t-jdkhome where all jars will be parsed"); + System.out.println("\t-config "); + System.out.println("\t-output "); + System.out.println("\t-classlist print class list and summary"); + System.exit(-1); + } +} diff --git a/make/modules/tools/src/com/sun/classanalyzer/CheckDeps.java b/make/modules/tools/src/com/sun/classanalyzer/CheckDeps.java new file mode 100644 index 0000000000000000000000000000000000000000..ea73b43e3fc330ac338963091de6ab99764551ca --- /dev/null +++ b/make/modules/tools/src/com/sun/classanalyzer/CheckDeps.java @@ -0,0 +1,181 @@ +/* + * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ +package com.sun.classanalyzer; + +import java.io.*; +import java.util.*; + +/** + * A simple tool to check module dependencies against a known list of + * dependencies. The tool fails (by throwing a RuntimeException) is an + * unexpected dependency is detected. + */ + +public class CheckDeps { + + /** + * Represents a dependency from one module to another module. The dependency + * may be optional. + */ + static class Dependency { + private final String module; + private final String other; + private final boolean optional; + + private Dependency(String module, String other, boolean optional) { + this.module = module; + this.other = other; + this.optional = optional; + } + + String module() { return module; } + String other() { return other; } + boolean isOptional() { return optional; } + + /** + * Parses a dependency in one of the following forms: + * a -> b + * [optional] a -> b + */ + static Dependency fromString(String s) { + String[] components = s.split(" "); + int count = components.length; + if (count != 3 && count != 4) + throw new IllegalArgumentException(s); + boolean optional = (count == 4); + if (optional && !components[0].equals("[optional]")) + throw new IllegalArgumentException(s); + String arrow = optional ? components[2] : components[1]; + if (!arrow.equals("->")) + throw new IllegalArgumentException(s); + String module = optional ? components[1] : components[0]; + String other = optional ? components[3] : components[2]; + return new Dependency(module, other, optional); + } + + @Override public String toString() { + StringBuilder sb = new StringBuilder(); + if (optional) + sb.append("[optional] "); + sb.append(module); + sb.append(" -> "); + sb.append(other); + return sb.toString(); + } + } + + /** + * Represents the "tail" + */ + static class DependencyTail { + private final String module; + private final boolean optional; + + DependencyTail(String module, boolean optional) { + this.module = module; + this.optional = optional; + } + String module() { return module; } + boolean isOptional() { return optional; } + } + + static void usage() { + System.out.println("java CheckDeps file1 file2"); + System.out.println(" where file1 is the expected dependencies and file2 is"); + System.out.println(" the actual dependencies. Both files are assumed to be"); + System.out.println(" in modules.summary format (see ClassAnalyzer tool)."); + System.out.println(); + System.out.println("Example usages:"); + System.out.println(" java CheckDeps make/modules/modules.summary " + + "$(OUTPUTDIR)/modules.summary"); + System.exit(-1); + } + + public static void main(String[] args) throws IOException { + if (args.length != 2) + usage(); + + // maps a module to the list of modules that it depends on + Map> expected = + new HashMap>(); + + // parse the expected dependencies file + Scanner s; + s = new Scanner(new FileInputStream(args[0])); + try { + while (s.hasNextLine()) { + Dependency ref = Dependency.fromString(s.nextLine()); + if (ref != null) { + String module = ref.module(); + List list = expected.get(module); + if (list == null) { + list = new ArrayList(); + expected.put(module, list); + } + list.add(new DependencyTail(ref.other(), ref.isOptional())); + } + } + } finally { + s.close(); + } + + // parse the actual dependencies file, checking each dependency + // against the expected list. + boolean fail = false; + s = new Scanner(new FileInputStream(args[1])); + try { + while (s.hasNextLine()) { + Dependency dep = Dependency.fromString(s.nextLine()); + + // check if this dependency is expected + List list = expected.get(dep.module()); + DependencyTail tail = null; + if (list != null) { + for (DependencyTail t: list) { + if (t.module().equals(dep.other())) { + tail = t; + break; + } + } + } + if (tail == null) { + System.err.println("Unexpected dependency: " + dep); + fail = true; + } else { + // hard dependency when optional dependency is expected + if (tail.isOptional() != dep.isOptional()) { + if (tail.isOptional()) { + System.err.println("Unexpected dependency: " + dep); + fail = true; + } + } + } + } + } finally { + s.close(); + } + + if (fail) + throw new RuntimeException("Unexpected dependencies found"); + } +} diff --git a/make/modules/tools/src/com/sun/classanalyzer/ClassAnalyzer.java b/make/modules/tools/src/com/sun/classanalyzer/ClassAnalyzer.java new file mode 100644 index 0000000000000000000000000000000000000000..fd570a7c0b1373101c3e0325fefc055446752a5e --- /dev/null +++ b/make/modules/tools/src/com/sun/classanalyzer/ClassAnalyzer.java @@ -0,0 +1,354 @@ +/* + * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ +package com.sun.classanalyzer; + +import com.sun.classanalyzer.AnnotatedDependency.*; +import com.sun.classanalyzer.Module.Dependency; +import com.sun.classanalyzer.Module.PackageInfo; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.io.File; +import java.io.PrintWriter; +import java.util.Map; +import java.util.Set; +import java.util.TreeMap; +import java.util.TreeSet; + +/** + * + * @author Mandy Chung + */ +public class ClassAnalyzer { + + public static void main(String[] args) throws Exception { + String jdkhome = null; + String cpath = null; + List configs = new ArrayList(); + List depconfigs = new ArrayList(); + String output = "."; + boolean mergeModules = true; + boolean showDynamic = false; + + // process arguments + int i = 0; + while (i < args.length) { + String arg = args[i++]; + if (arg.equals("-jdkhome")) { + if (i < args.length) { + jdkhome = args[i++]; + } else { + usage(); + } + } else if (arg.equals("-cpath")) { + if (i < args.length) { + cpath = args[i++]; + } else { + usage(); + } + } else if (arg.equals("-config")) { + if (i < args.length) { + configs.add(args[i++]); + } else { + usage(); + } + } else if (arg.equals("-depconfig")) { + if (i < args.length) { + depconfigs.add(args[i++]); + } else { + usage(); + } + } else if (arg.equals("-output")) { + if (i < args.length) { + output = args[i++]; + } else { + usage(); + } + } else if (arg.equals("-base")) { + ModuleConfig.setBaseModule(args[i++]); + } else if (arg.equals("-nomerge")) { + // analyze the fine-grained module dependencies + mergeModules = false; + } else if (arg.equals("-showdynamic")) { + showDynamic = true; + } else { + System.err.println("Invalid option: " + arg); + usage(); + } + } + + if ((jdkhome == null && cpath == null) || (jdkhome != null && cpath != null)) { + usage(); + } + if (configs.isEmpty()) { + usage(); + } + + if (jdkhome != null) { + ClassPath.setJDKHome(jdkhome); + } else if (cpath != null) { + ClassPath.setClassPath(cpath); + } + + // create output directory if it doesn't exist + File dir = new File(output); + if (!dir.isDirectory()) { + if (!dir.exists()) { + boolean created = dir.mkdir(); + if (!created) { + throw new RuntimeException("Unable to create `" + dir + "'"); + } + } + } + + buildModules(configs, depconfigs, mergeModules); + + // generate output files + for (Module m : modules) { + // only generate reports for top-level modules + if (m.group() == m) { + m.printClassListTo(resolve(dir, m.name(), "classlist")); + m.printResourceListTo(resolve(dir, m.name(), "resources")); + m.printSummaryTo(resolve(dir, m.name(), "summary")); + m.printDependenciesTo(resolve(dir, m.name(), "dependencies"), showDynamic); + } + } + + // Generate other summary reports + printModulesSummary(dir, showDynamic); + printModulesDot(dir, showDynamic); + printModulesList(dir); + printPackagesSummary(dir); + } + private static List modules = new ArrayList(); + + static void buildModules(List configs, + List depconfigs, + boolean mergeModules) throws IOException { + // create modules based on the input config files + for (String file : configs) { + for (ModuleConfig mconfig : ModuleConfig.readConfigurationFile(file)) { + modules.add(Module.addModule(mconfig)); + } + } + + // parse class files + ClassPath.parseAllClassFiles(); + + // Add additional dependencies if specified + if (depconfigs != null && depconfigs.size() > 0) { + DependencyConfig.parse(depconfigs); + } + + // process the roots and dependencies to get the classes for each module + for (Module m : modules) { + m.processRootsAndReferences(); + } + + // update the dependencies for classes that were subsequently allocated + // to modules + for (Module m : modules) { + m.fixupDependencies(); + } + + if (mergeModules) { + Module.buildModuleMembers(); + } + } + + private static void printModulesSummary(File dir, boolean showDynamic) throws IOException { + // print summary of dependencies + PrintWriter writer = new PrintWriter(new File(dir, "modules.summary")); + try { + for (Module m : modules) { + // only show top-level module dependencies + if (m.group() == m) { + for (Dependency dep : m.dependents()) { + if (!showDynamic && dep.dynamic && dep.optional) { + continue; + } + if (dep.module == null || !dep.module.isBase()) { + + String prefix = ""; + if (dep.optional) { + if (dep.dynamic) { + prefix = "[dynamic] "; + } else { + prefix = "[optional] "; + } + } + + Module other = dep != null ? dep.module : null; + writer.format("%s%s -> %s%n", prefix, m, other); + } + } + } + } + } finally { + writer.close(); + } + } + + private static void printModulesDot(File dir, boolean showDynamic) throws IOException { + PrintWriter writer = new PrintWriter(new File(dir, "modules.dot")); + try { + writer.println("digraph jdk {"); + for (Module m : modules) { + if (m.group() == m) { + for (Dependency dep : m.dependents()) { + if (!showDynamic && dep.dynamic && dep.optional) { + continue; + } + if (dep.module == null || !dep.module.isBase()) { + String style = ""; + String color = ""; + String property = ""; + if (dep.optional) { + style = "style=dotted"; + } + if (dep.dynamic) { + color = "color=red"; + } + if (style.length() > 0 || color.length() > 0) { + String comma = ""; + if (style.length() > 0 && color.length() > 0) { + comma = ", "; + } + property = String.format(" [%s%s%s]", style, comma, color); + } + Module other = dep != null ? dep.module : null; + writer.format(" \"%s\" -> \"%s\"%s;%n", m, other, property); + } + } + } + } + writer.println("}"); + } finally { + writer.close(); + } + } + + private static void printMembers(Module m, PrintWriter writer) { + for (Module member : m.members()) { + if (!member.isEmpty()) { + writer.format("%s ", member); + printMembers(member, writer); + } + } + } + + private static void printModulesList(File dir) throws IOException { + // print module group / members relationship + PrintWriter writer = new PrintWriter(new File(dir, "modules.list")); + try { + for (Module m : modules) { + if (m.group() == m && !m.isEmpty()) { + writer.format("%s ", m); + printMembers(m, writer); + writer.println(); + } + } + } finally { + writer.close(); + } + } + + private static void printPackagesSummary(File dir) throws IOException { + // print package / module relationship + PrintWriter writer = new PrintWriter(new File(dir, "modules.pkginfo")); + try { + Map> packages = new TreeMap>(); + Set splitPackages = new TreeSet(); + + for (Module m : modules) { + if (m.group() == m) { + for (PackageInfo info : m.getPackageInfos()) { + Set value = packages.get(info.pkgName); + if (value == null) { + value = new TreeSet(); + packages.put(info.pkgName, value); + } else { + // package in more than one module + splitPackages.add(info.pkgName); + } + value.add(m); + } + } + } + + // packages that are splitted among multiple modules + writer.println("Packages splitted across modules:-\n"); + writer.format("%-60s %s\n", "Package", "Module"); + + for (String pkgname : splitPackages) { + writer.format("%-60s", pkgname); + for (Module m : packages.get(pkgname)) { + writer.format(" %s", m); + } + writer.println(); + } + + writer.println("\nPackage-private dependencies:-"); + for (String pkgname : splitPackages) { + for (Klass k : Klass.getAllClasses()) { + if (k.getPackageName().equals(pkgname)) { + Module m = k.getModule(); + // check if this klass references a package-private + // class that is in a different module + for (Klass other : k.getReferencedClasses()) { + if (other.getModule() != m && + !other.isPublic() && + other.getPackageName().equals(pkgname)) { + String from = k.getClassName() + " (" + m + ")"; + writer.format("%-60s -> %s (%s)\n", from, other, other.getModule()); + } + } + } + } + } + } finally { + writer.close(); + } + + } + + private static String resolve(File dir, String mname, String suffix) { + File f = new File(dir, mname + "." + suffix); + return f.toString(); + + } + + private static void usage() { + System.out.println("Usage: ClassAnalyzer "); + System.out.println("Options: "); + System.out.println("\t-jdkhome where all jars will be parsed"); + System.out.println("\t-cpath where classes and jars will be parsed"); + System.out.println("\t Either -jdkhome or -cpath option can be used."); + System.out.println("\t-config "); + System.out.println("\t This option can be repeated for multiple module config files"); + System.out.println("\t-output "); + System.out.println("\t-nomerge specify not to merge modules"); + System.out.println("\t-showdynamic show dynamic dependencies in the reports"); + System.exit(-1); + } +} diff --git a/make/modules/tools/src/com/sun/classanalyzer/ClassFileParser.java b/make/modules/tools/src/com/sun/classanalyzer/ClassFileParser.java new file mode 100644 index 0000000000000000000000000000000000000000..bbbeda7407f00c21a005662b0a359f6fe9640176 --- /dev/null +++ b/make/modules/tools/src/com/sun/classanalyzer/ClassFileParser.java @@ -0,0 +1,629 @@ +/* + * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + * + */ +package com.sun.classanalyzer; + +import com.sun.tools.classfile.*; +import com.sun.tools.classfile.Type.*; +import com.sun.tools.classfile.Descriptor.InvalidDescriptor; +import static com.sun.tools.classfile.AccessFlags.*; + +import java.io.BufferedInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.List; +import java.util.Set; +import java.util.TreeSet; + +/** + * + * @author Mandy Chung + */ +public class ClassFileParser { + + final Klass this_klass; + final ClassFile classfile; + final ConstantPoolParser constantPoolParser; + final AnnotationParser annotationParser; + final CodeAttributeParser codeAttributeParser; + private final boolean buildDeps; + + protected ClassFileParser(InputStream in, long size, boolean buildDeps) throws IOException { + try { + this.classfile = ClassFile.read(in); + this.this_klass = getKlass(this.classfile); + this.buildDeps = buildDeps; + this.constantPoolParser = new ConstantPoolParser(this); + this.annotationParser = new AnnotationParser(this); + this.codeAttributeParser = new CodeAttributeParser(this); + } catch (ConstantPoolException ex) { + throw new RuntimeException(ex); + } + } + + private Klass getKlass(ClassFile cf) throws ConstantPoolException { + Klass k = Klass.getKlass(cf.getName()); + k.setAccessFlags(cf.access_flags.flags); + k.setFileSize(cf.byteLength()); + return k; + } + + public static ClassFileParser newParser(InputStream in, long size, boolean buildDeps) throws IOException { + return new ClassFileParser(in, size, buildDeps); + } + + public static ClassFileParser newParser(String classPathname, boolean buildDeps) throws IOException { + return newParser(new File(classPathname), buildDeps); + } + + public static ClassFileParser newParser(File f, boolean buildDeps) throws IOException { + BufferedInputStream in = new BufferedInputStream(new FileInputStream(f)); + try { + return newParser(in, f.length(), buildDeps); + } finally { + in.close(); + } + } + + public void parseDependency(boolean publicAPIs) throws IOException { + if (publicAPIs && !classfile.access_flags.is(ACC_PUBLIC)) { + // process public APIs only + return; + } + + parseClassInfo(); + if (!publicAPIs) { + // parse all references in the classfile + constantPoolParser.parseDependency(); + } + parseMethods(publicAPIs); + parseFields(publicAPIs); + } + + void parseClassInfo() throws IOException { + ConstantPool cpool = classfile.constant_pool; + try { + Signature_attribute sigAttr = (Signature_attribute) classfile.attributes.get(Attribute.Signature); + if (sigAttr == null) { + // use info from class file header + if (classfile.isClass() && classfile.super_class != 0) { + String sn = classfile.getSuperclassName(); + addExtends(sn); + } + for (int i = 0; i < classfile.interfaces.length; i++) { + String interf = classfile.getInterfaceName(i); + if (classfile.isClass()) { + addImplements(interf); + } else { + addExtends(interf); + } + } + } else { + Type t = sigAttr.getParsedSignature().getType(cpool); + // The signature parser cannot disambiguate between a + // FieldType and a ClassSignatureType that only contains a superclass type. + if (t instanceof Type.ClassSigType) { + Type.ClassSigType cst = Type.ClassSigType.class.cast(t); + if (cst.superclassType != null) { + for (Klass k : getKlass(cst.superclassType)) { + addExtends(k); + } + } + if (cst.superinterfaceTypes != null) { + for (Type t1 : cst.superinterfaceTypes) { + for (Klass k : getKlass(t1)) { + addImplements(k); + } + } + } + } else { + for (Klass k : getKlass(t)) { + addExtends(k); + } + } + } + // parse attributes + annotationParser.parseAttributes(classfile.attributes); + } catch (ConstantPoolException ex) { + throw new RuntimeException(ex); + } + } + + private void parseFields(boolean publicAPIs) throws IOException { + ConstantPool cpool = classfile.constant_pool; + for (Field f : classfile.fields) { + try { + AccessFlags flags = f.access_flags; + if (publicAPIs && !flags.is(ACC_PUBLIC) && !flags.is(ACC_PROTECTED)) { + continue; + } + String fieldname = f.getName(cpool); + Signature_attribute sigAttr = (Signature_attribute) f.attributes.get(Attribute.Signature); + + if (sigAttr == null) { + Set types = parseDescriptor(f.descriptor); + String info = getFlag(flags) + " " + f.descriptor.getFieldType(cpool) + " " + fieldname; + addFieldTypes(types, info, flags); + } else { + Type t = sigAttr.getParsedSignature().getType(cpool); + String info = getFlag(flags) + " " + t + " " + fieldname; + addFieldTypes(getKlass(t), info, flags); + } + // parse attributes + annotationParser.parseAttributes(f.attributes); + } catch (ConstantPoolException ex) { + throw new RuntimeException(ex); + } catch (InvalidDescriptor ex) { + throw new RuntimeException(ex); + } + } + } + + private void parseMethods(boolean publicAPIs) { + for (Method m : classfile.methods) { + if (publicAPIs && !m.access_flags.is(ACC_PUBLIC) && !m.access_flags.is(ACC_PROTECTED)) { + // only interest in the API level + return; + } + + parseMethod(m); + } + } + + String checkClassName(String classname) { + int i = 0; + while (i < classname.length()) { + switch (classname.charAt(i)) { + case 'Z': + case 'B': + case 'C': + case 'S': + case 'I': + case 'J': + case 'F': + case 'D': + return ""; + case 'L': + if (!classname.endsWith(";")) { + throw new RuntimeException("Invalid classname " + classname); + } + return classname.substring(i + 1, classname.length() - 1); + case '[': + i++; + break; + default: + if (classname.endsWith(";")) { + throw new RuntimeException("Invalid classname " + classname); + } + return classname; + + } + } + throw new RuntimeException("Invalid classname " + classname); + } + + private void addExtends(String classname) throws IOException { + if (!buildDeps) { + return; + } + + addExtends(Klass.getKlass(classname)); + } + + private void addExtends(Klass k) { + if (!buildDeps) { + return; + } + + ResolutionInfo resInfo = ResolutionInfo.resolvedExtends(this_klass, k); + resInfo.setPublicAccess(classfile.access_flags.is(ACC_PUBLIC)); + this_klass.addDep(k, resInfo); + k.addReferrer(this_klass, resInfo); + } + + private void addImplements(String classname) throws IOException { + if (!buildDeps) { + return; + } + + addImplements(Klass.getKlass(classname)); + } + + private void addImplements(Klass k) { + if (!buildDeps) { + return; + } + + ResolutionInfo resInfo = ResolutionInfo.resolvedImplements(this_klass, k); + resInfo.setPublicAccess(classfile.access_flags.is(ACC_PUBLIC)); + + this_klass.addDep(k, resInfo); + + k.addReferrer(this_klass, resInfo); + } + + private Set getKlass(Type type) throws IOException { + Set refTypes = new TreeSet(); + if (!buildDeps) { + return refTypes; + } + + type.accept(typevisitor, refTypes); + return refTypes; + } + private Type.Visitor> typevisitor = new Type.Visitor>() { + + public Void visitSimpleType(SimpleType type, Set klasses) { + // nop + return null; + } + + public Void visitArrayType(ArrayType type, Set klasses) { + try { + klasses.addAll(getKlass(type.elemType)); + } catch (IOException ex) { + throw new RuntimeException(ex); + } + return null; + + } + + public Void visitMethodType(MethodType type, Set klasses) { + throw new InternalError("Unexpected type " + type); + } + + public Void visitClassSigType(ClassSigType type, Set klasses) { + try { + if (type.superclassType != null) { + klasses.addAll(getKlass(type.superclassType)); + } + if (type.superinterfaceTypes != null) { + for (Type t : type.superinterfaceTypes) { + klasses.addAll(getKlass(t)); + } + } + if (type.typeParamTypes != null) { + for (Type t : type.typeParamTypes) { + klasses.addAll(getKlass(t)); + } + } + } catch (IOException ex) { + throw new RuntimeException(ex); + } + return null; + } + + public Void visitClassType(ClassType type, Set klasses) { + klasses.add(Klass.getKlass(type.getBinaryName())); + if (type.typeArgs != null) { + for (Type t : type.typeArgs) { + try { + klasses.addAll(getKlass(t)); + } catch (IOException ex) { + throw new RuntimeException(ex); + } + } + } + return null; + + } + + public Void visitTypeParamType(TypeParamType type, Set klasses) { + try { + if (type.classBound != null) { + klasses.addAll(getKlass(type.classBound)); + } + if (type.interfaceBounds != null) { + for (Type t : type.interfaceBounds) { + klasses.addAll(getKlass(t)); + } + } + + } catch (IOException ex) { + throw new RuntimeException(ex); + } + + return null; + + } + + public Void visitWildcardType(WildcardType type, Set klasses) { + if (type.boundType != null) { + try { + klasses.addAll(getKlass(type.boundType)); + } catch (IOException ex) { + throw new RuntimeException(ex); + } + } + return null; + + } + }; + + private void printMethod(Method m) { + try { + System.out.println("parsing " + m.getName(classfile.constant_pool) + "(" + + m.descriptor.getParameterTypes(classfile.constant_pool) + ") return type " + + m.descriptor.getReturnType(classfile.constant_pool)); + + } catch (ConstantPoolException ex) { + } catch (InvalidDescriptor ex) { + } + } + + private static StringBuilder appendWord(StringBuilder sb, String word) { + if (sb.length() > 0) { + sb.append(" "); + } + sb.append(word); + return sb; + } + + private static String getFlag(AccessFlags flags) { + StringBuilder modifier = new StringBuilder(); + if (flags.is(ACC_PUBLIC)) { + modifier.append("public"); + } + if (flags.is(ACC_PRIVATE)) { + modifier.append("private"); + } + if (flags.is(ACC_PROTECTED)) { + modifier.append("protected"); + } + if (flags.is(ACC_STATIC)) { + appendWord(modifier, "static"); + } + if (flags.is(ACC_FINAL)) { + appendWord(modifier, "final"); + } + if (flags.is(ACC_SYNCHRONIZED)) { + // return "synchronized"; + } + if (flags.is(0x80)) { + // return (t == Type.Field ? "transient" : null); + // return "transient"; + } + if (flags.is(ACC_VOLATILE)) { + // return "volatile"; + } + if (flags.is(ACC_NATIVE)) { + // return "native"; + } + if (flags.is(ACC_ABSTRACT)) { + appendWord(modifier, "abstract"); + } + if (flags.is(ACC_STRICT)) { + // return "strictfp"; + } + if (flags.is(ACC_MODULE)) { + appendWord(modifier, "module"); + } + return modifier.toString(); + } + + private Klass.Method toKlassMethod(Method m, Descriptor d) { + try { + ConstantPool cpool = classfile.constant_pool; + String methodname = m.getName(cpool); + StringBuilder sb = new StringBuilder(); + sb.append(getFlag(m.access_flags)); + if (methodname.equals("")) { + String s = this_klass.getBasename() + d.getParameterTypes(cpool); + appendWord(sb, s); + } else if (methodname.equals("")) { + // + appendWord(sb, methodname); + } else { + String s = d.getReturnType(cpool) + " " + methodname + d.getParameterTypes(cpool); + appendWord(sb, s); + } + String signature = sb.toString().replace('/', '.'); + return this_klass.getMethod(methodname, signature); + } catch (ConstantPoolException ex) { + throw new RuntimeException(ex); + } catch (InvalidDescriptor ex) { + throw new RuntimeException(ex); + } + } + + Klass.Method parseMethod(Method m) { + AccessFlags flags = m.access_flags; + Descriptor d; + List methodExceptions = null; + try { + ConstantPool cpool = classfile.constant_pool; + Klass.Method kmethod; + Signature_attribute sigAttr = (Signature_attribute) m.attributes.get(Attribute.Signature); + if (sigAttr == null) { + d = m.descriptor; + Set types = parseDescriptor(d); + + kmethod = toKlassMethod(m, d); + addMethodTypes(types, kmethod, flags); + } else { + Type.MethodType methodType; + Signature methodSig = sigAttr.getParsedSignature(); + d = methodSig; + try { + kmethod = toKlassMethod(m, d); + methodType = (Type.MethodType) methodSig.getType(cpool); + addMethodTypes(getKlass(methodType.returnType), kmethod, flags); + if (methodType.paramTypes != null) { + for (Type t : methodType.paramTypes) { + addMethodTypes(getKlass(t), kmethod, flags); + } + } + if (methodType.typeParamTypes != null) { + for (Type t : methodType.typeParamTypes) { + addMethodTypes(getKlass(t), kmethod, flags); + } + } + + methodExceptions = methodType.throwsTypes; + if (methodExceptions != null) { + if (methodExceptions.size() == 0) { + methodExceptions = null; + } else { + for (Type t : methodExceptions) { + addCheckedExceptionTypes(getKlass(t), kmethod, flags); + } + } + } + } catch (ConstantPoolException e) { + throw new RuntimeException(e); + } + } + + Attribute e_attr = m.attributes.get(Attribute.Exceptions); + if (e_attr != null && methodExceptions == null) { + // if there are generic exceptions, there must be erased exceptions + if (e_attr instanceof Exceptions_attribute) { + Exceptions_attribute exceptions = (Exceptions_attribute) e_attr; + for (int i = 0; i < exceptions.number_of_exceptions; i++) { + String classname = checkClassName(exceptions.getException(i, classfile.constant_pool)); + if (classname.length() > 0 && buildDeps) { + Klass to = Klass.getKlass(classname); + ResolutionInfo resInfo = ResolutionInfo.resolvedCheckedException(this_klass, to, kmethod); + resInfo.setPublicAccess(flags.is(ACC_PUBLIC)); + + this_klass.addDep(to, resInfo); + to.addReferrer(this_klass, resInfo); + } + } + } else { + throw new RuntimeException("Invalid attribute: " + e_attr); + } + } + + Code_attribute c_attr = (Code_attribute) m.attributes.get(Attribute.Code); + if (c_attr != null) { + codeAttributeParser.parse(c_attr, kmethod); + } + kmethod.isAbstract = classfile.access_flags.is(ACC_ABSTRACT); + kmethod.setCodeLength(m.byteLength()); + + // parse annotation attributes + annotationParser.parseAttributes(m.attributes, kmethod); + return kmethod; + } catch (ConstantPoolException ex) { + throw new RuntimeException(ex); + } catch (IOException ex) { + throw new RuntimeException(ex); + } + } + + private void addFieldTypes(Set types, String info, AccessFlags flags) { + if (types.isEmpty() || !buildDeps) { + return; + } + + for (Klass to : types) { + ResolutionInfo resInfo = ResolutionInfo.resolvedField(this_klass, to, info); + resInfo.setPublicAccess(flags.is(ACC_PUBLIC)); + + this_klass.addDep(to, resInfo); + to.addReferrer(this_klass, resInfo); + } + } + + private void addReferencedTypes(Method m, Descriptor d, AccessFlags flags) { + Set types = parseDescriptor(d); + + Klass.Method method = toKlassMethod(m, d); + addMethodTypes(types, method, flags); + } + + private void addMethodTypes(Set types, Klass.Method method, AccessFlags flags) { + if (types.isEmpty() || !buildDeps) { + return; + } + for (Klass to : types) { + ResolutionInfo resInfo = ResolutionInfo.resolvedMethodSignature(this_klass, to, method); + resInfo.setPublicAccess(flags.is(ACC_PUBLIC)); + + this_klass.addDep(to, resInfo); + to.addReferrer(this_klass, resInfo); + } + } + + private void addCheckedExceptionTypes(Set types, Klass.Method method, AccessFlags flags) { + if (types.isEmpty() || !buildDeps) { + return; + } + for (Klass to : types) { + ResolutionInfo resInfo = ResolutionInfo.resolvedCheckedException(this_klass, to, method); + resInfo.setPublicAccess(flags.is(ACC_PUBLIC)); + + this_klass.addDep(to, resInfo); + to.addReferrer(this_klass, resInfo); + } + } + + private Set parseDescriptor(Descriptor d) { + Set types = new TreeSet(); + try { + String desc = d.getValue(classfile.constant_pool); + int p = 0; + while (p < desc.length()) { + String type; + char ch; + switch (ch = desc.charAt(p++)) { + case '(': + case ')': + case '[': + case 'B': + case 'C': + case 'D': + case 'F': + case 'I': + case 'J': + case 'S': + case 'Z': + case 'V': + continue; + case 'L': + int sep = desc.indexOf(';', p); + if (sep == -1) { + throw new RuntimeException("Invalid descriptor: " + (p - 1) + " " + desc); + } + type = checkClassName(desc.substring(p, sep)); + p = sep + 1; + break; + default: + throw new RuntimeException("Invalid descriptor: " + (p - 1) + " " + desc); + } + + if (!type.isEmpty() && buildDeps) { + Klass to = Klass.getKlass(type); + types.add(to); + + } + } + } catch (ConstantPoolException ex) { + throw new RuntimeException(ex); + } + return types; + } +} diff --git a/make/modules/tools/src/com/sun/classanalyzer/ClassPath.java b/make/modules/tools/src/com/sun/classanalyzer/ClassPath.java new file mode 100644 index 0000000000000000000000000000000000000000..bfdcdd97f5999c3dfc82e30af1a03fcbdc573154 --- /dev/null +++ b/make/modules/tools/src/com/sun/classanalyzer/ClassPath.java @@ -0,0 +1,275 @@ +/* + * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + * + */ +package com.sun.classanalyzer; + +import java.io.BufferedInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.Enumeration; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.jar.JarEntry; +import java.util.jar.JarFile; + +/** + * + * @author mchung + */ +public class ClassPath { + + public class FileInfo { + + File file; + JarFile jarfile; + int classCount; + long filesize; + + FileInfo(File f) throws IOException { + this.file = f; + this.classCount = 0; + if (file.getName().endsWith(".jar")) { + this.filesize = file.length(); + jarfile = new JarFile(f); + } + } + + File getFile() { + return file; + } + + JarFile getJarFile() { + return jarfile; + } + + String getName() throws IOException { + return file.getCanonicalPath(); + } + } + private List fileList = new ArrayList(); + private static ClassPath instance = new ClassPath(); + + static List getFileInfos() { + return instance.fileList; + } + + static ClassPath setJDKHome(String jdkhome) throws IOException { + List files = new ArrayList(); + File jre = new File(jdkhome, "jre"); + File lib = new File(jdkhome, "lib"); + if (jre.exists() && jre.isDirectory()) { + listFiles(new File(jre, "lib"), ".jar", files); + } else if (lib.exists() && lib.isDirectory()) { + // either a JRE or a jdk build image + listFiles(lib, ".jar", files); + + File classes = new File(jdkhome, "classes"); + if (classes.exists() && classes.isDirectory()) { + // jdk build outputdir + instance.add(classes); + } + } else { + throw new RuntimeException("\"" + jdkhome + "\" not a JDK home"); + } + + for (File f : files) { + instance.add(f); + } + return instance; + } + + static ClassPath setClassPath(String path) throws IOException { + if (path.endsWith(".class")) { + // one class file + File f = new File(path); + if (!f.exists()) { + throw new RuntimeException("Classfile \"" + f + "\" doesn't exist"); + } + + instance.add(f); + } else { + List jarFiles = new ArrayList(); + String[] locs = path.split(File.pathSeparator); + for (String p : locs) { + File f = new File(p); + if (!f.exists()) { + throw new RuntimeException("\"" + f + "\" doesn't exist"); + } + + if (f.isDirectory()) { + instance.add(f); // add the directory to look up .class files + listFiles(f, ".jar", jarFiles); + } else if (p.endsWith(".jar")) { + // jar files + jarFiles.add(f); + } else { + throw new RuntimeException("Invalid file \"" + f); + } + } + // add jarFiles if any + for (File f : jarFiles) { + instance.add(f); + } + } + + return instance; + } + + private void add(File f) throws IOException { + fileList.add(new FileInfo(f)); + } + + public static InputStream open(String pathname) throws IOException { + for (FileInfo fi : instance.fileList) { + if (fi.getName().endsWith(".jar")) { + String path = pathname.replace(File.separatorChar, '/'); + JarEntry e = fi.jarfile.getJarEntry(path); + if (e != null) { + return fi.jarfile.getInputStream(e); + } + } else if (fi.getFile().isDirectory()) { + File f = new File(fi.getFile(), pathname); + if (f.exists()) { + return new FileInputStream(f); + } + } else if (fi.file.isFile()) { + if (fi.getName().endsWith(File.separator + pathname)) { + return new FileInputStream(fi.file); + } + } + } + return null; + } + + static ClassFileParser parserForClass(String classname) throws IOException { + String pathname = classname.replace('.', File.separatorChar) + ".class"; + + ClassFileParser cfparser = null; + for (FileInfo fi : instance.fileList) { + if (fi.getName().endsWith(".class")) { + if (fi.getName().endsWith(File.separator + pathname)) { + cfparser = ClassFileParser.newParser(fi.getFile(), true); + break; + } + } else if (fi.getName().endsWith(".jar")) { + JarEntry e = fi.jarfile.getJarEntry(classname.replace('.', '/') + ".class"); + if (e != null) { + cfparser = ClassFileParser.newParser(fi.jarfile.getInputStream(e), e.getSize(), true); + break; + } + } else if (fi.getFile().isDirectory()) { + File f = new File(fi.getFile(), pathname); + if (f.exists()) { + cfparser = ClassFileParser.newParser(f, true); + break; + } + } + } + return cfparser; + } + + public static void parseAllClassFiles() throws IOException { + instance.parseFiles(); + } + + private void parseFiles() throws IOException { + Set classes = new HashSet(); + + int count = 0; + for (FileInfo fi : fileList) { + // filter out public generated classes (i.e. not public API) + // javax.management.remote.rmi._RMIConnectionImpl_Tie + // javax.management.remote.rmi._RMIServerImpl_Tie + if (fi.getName().endsWith(".class")) { + parseClass(fi); + } else if (fi.getName().endsWith(".jar")) { + Enumeration entries = fi.jarfile.entries(); + while (entries.hasMoreElements()) { + JarEntry e = entries.nextElement(); + if (e.getName().endsWith(".class")) { + ClassFileParser cfparser = ClassFileParser.newParser(fi.jarfile.getInputStream(e), e.getSize(), true); + cfparser.parseDependency(false); + fi.classCount++; + } else if (!e.isDirectory() && ResourceFile.isResource(e.getName())) { + ResourceFile.addResource(e.getName(), fi.jarfile.getInputStream(e)); + } + } + } else if (fi.getFile().isDirectory()) { + List files = new ArrayList(); + listFiles(fi.getFile(), "", files); + for (File f : files) { + if (f.getName().endsWith(".class")) { + parseClass(fi, f); + } else if (!f.isDirectory() && ResourceFile.isResource(f.getCanonicalPath())) { + String pathname = f.getCanonicalPath(); + String dir = fi.getName(); + if (!pathname.startsWith(dir)) { + throw new RuntimeException("Incorrect pathname " + pathname); + } + String name = pathname.substring(dir.length() + 1, pathname.length()); + BufferedInputStream in = new BufferedInputStream(new FileInputStream(f)); + try { + ResourceFile.addResource(name, in); + } finally { + in.close(); + } + } + } + } else { + // should not reach here + throw new RuntimeException("Unexpected class path: " + fi.getFile()); + } + } + } + + private void parseClass(FileInfo fi) throws IOException { + parseClass(fi, fi.getFile()); + } + + private void parseClass(FileInfo fi, File f) throws IOException { + ClassFileParser cfparser = ClassFileParser.newParser(f, true); + cfparser.parseDependency(false); + fi.classCount++; + // need to update the filesize for this directory + fi.filesize += fi.getFile().length(); + + } + + public static void listFiles(File path, String suffix, List result) { + if (path.isDirectory()) { + File[] children = path.listFiles(); + for (File c : children) { + listFiles(c, suffix, result); + } + + } else { + if (suffix.isEmpty() || path.getName().endsWith(suffix)) { + result.add(path); + } + } + } +} diff --git a/make/modules/tools/src/com/sun/classanalyzer/CodeAttributeParser.java b/make/modules/tools/src/com/sun/classanalyzer/CodeAttributeParser.java new file mode 100644 index 0000000000000000000000000000000000000000..98ff1a4927702b3d55e7909c1d9c663d1e416219 --- /dev/null +++ b/make/modules/tools/src/com/sun/classanalyzer/CodeAttributeParser.java @@ -0,0 +1,157 @@ +/* + * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + * + */ + +package com.sun.classanalyzer; + +import com.sun.classanalyzer.Klass.Method; + +import com.sun.tools.classfile.*; +import com.sun.tools.classfile.Instruction.*; + +import java.util.HashMap; +import java.util.Map; +import java.util.Set; +import java.util.TreeSet; + +/** + * + * @author Mandy Chung + */ +public class CodeAttributeParser { + private final ClassFileParser cfparser; + private final ConstantPool cpool; + private final ConstantPoolParser constantPoolParser; + + + static final Map> runtimeReferences = + new HashMap>(); + + + CodeAttributeParser(ClassFileParser parser) { + this.cfparser = parser; + this.cpool = cfparser.classfile.constant_pool; + this.constantPoolParser = cfparser.constantPoolParser; + } + + static boolean parseCodeAttribute = false; // by default don't parse code attribute + static void setParseCodeAttribute(boolean newValue) { + parseCodeAttribute = newValue; + } + + void parse(Code_attribute attr, Klass.Method method) { + if (!parseCodeAttribute) { + return; + } + + for (Instruction instr : attr.getInstructions()) { + try { + instr.accept(instructionVisitor, method); + } catch (ArrayIndexOutOfBoundsException e) { + throw new RuntimeException("error at or after byte " + instr.getPC()); + } + + } + + if (attr.exception_table_langth > 0) { + for (int i = 0; i < + attr.exception_table.length; i++) { + Code_attribute.Exception_data handler = attr.exception_table[i]; + int catch_type = handler.catch_type; + if (catch_type > 0) { + addMethodReference(catch_type, method); + } + + } + } + + } + + + private void addMethodReference(int index, Klass.Method m) { + String method = constantPoolParser.getMethodName(index); + + if (method != null && + (method.equals("java.lang.Class.forName") || + method.equals("java.lang.Class.loadClass") || + method.startsWith("java.util.ServiceLoader.load") || + method.equals("sun.misc.Service.providers"))) { + Set refs = runtimeReferences.get(method); + if (refs == null) { + refs = new TreeSet(); + runtimeReferences.put(method, refs); + } + refs.add(m); + } + } + + Instruction.KindVisitor instructionVisitor = + new Instruction.KindVisitor() { + + public Void visitNoOperands(Instruction instr, Klass.Method m) { + return null; + } + + public Void visitArrayType(Instruction instr, TypeKind kind, Klass.Method m) { + return null; + } + + public Void visitBranch(Instruction instr, int offset, Klass.Method m) { + return null; + } + + public Void visitConstantPoolRef(Instruction instr, int index, Klass.Method m) { + addMethodReference(index, m); + return null; + } + + public Void visitConstantPoolRefAndValue(Instruction instr, int index, int value, Klass.Method m) { + addMethodReference(index, m); + return null; + } + + public Void visitLocal(Instruction instr, int index, Klass.Method m) { + return null; + } + + public Void visitLocalAndValue(Instruction instr, int index, int value, Klass.Method m) { + return null; + } + + public Void visitLookupSwitch(Instruction instr, int default_, int npairs, int[] matches, int[] offsets, Klass.Method m) { + return null; + } + + public Void visitTableSwitch(Instruction instr, int default_, int low, int high, int[] offsets, Klass.Method m) { + return null; + } + + public Void visitValue(Instruction instr, int value, Klass.Method m) { + return null; + } + + public Void visitUnknown(Instruction instr, Klass.Method m) { + return null; + } + }; +} diff --git a/make/modules/tools/src/com/sun/classanalyzer/ConstantPoolAnalyzer.java b/make/modules/tools/src/com/sun/classanalyzer/ConstantPoolAnalyzer.java new file mode 100644 index 0000000000000000000000000000000000000000..f79f2bf6c36a6d891beec6a59465d2436444e50d --- /dev/null +++ b/make/modules/tools/src/com/sun/classanalyzer/ConstantPoolAnalyzer.java @@ -0,0 +1,60 @@ +/* + * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ + +package com.sun.classanalyzer; + +/** + * + * @author Mandy Chung + */ +public class ConstantPoolAnalyzer { + public static void main(String[] args) throws Exception { + String jdkhome = null; + + // process arguments + int i = 0; + while (i < args.length) { + String arg = args[i++]; + if (arg.equals("-jdkhome")) { + if (i < args.length) { + jdkhome = args[i++]; + } else { + usage(); + } + } + } + if (jdkhome == null) { + usage(); + } + ClassPath.setJDKHome(jdkhome); + ClassPath.parseAllClassFiles(); + } + + private static void usage() { + System.out.println("Usage: ConstantPoolAnalyzer "); + System.out.println("Options: "); + System.out.println("\t-jdkhome where all jars will be parsed"); + System.out.println("\t-cpath where classes and jars will be parsed"); + System.exit(-1); + } +} diff --git a/make/modules/tools/src/com/sun/classanalyzer/ConstantPoolParser.java b/make/modules/tools/src/com/sun/classanalyzer/ConstantPoolParser.java new file mode 100644 index 0000000000000000000000000000000000000000..33e593df875c8889a3949800f69b7157774bc418 --- /dev/null +++ b/make/modules/tools/src/com/sun/classanalyzer/ConstantPoolParser.java @@ -0,0 +1,377 @@ +/* + * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ +package com.sun.classanalyzer; + +import com.sun.tools.classfile.*; +import com.sun.tools.classfile.ConstantPool.*; +import static com.sun.tools.classfile.ConstantPool.*; + +/** + * + * @author Mandy Chung + */ +public class ConstantPoolParser { + + private final ClassFileParser cfparser; + private final StringValueVisitor visitor; + private final ConstantPool cpool; + + ConstantPoolParser(ClassFileParser parser) { + this.cfparser = parser; + this.cpool = cfparser.classfile.constant_pool; + this.visitor = new StringValueVisitor(); + } + + public String stringValue(CPInfo cpInfo) { + return visitor.visit(cpInfo); + } + + public String stringValue(int constant_pool_index) { + try { + return stringValue(cpool.get(constant_pool_index)); + } catch (ConstantPool.InvalidIndex e) { + throw new RuntimeException(e); + } + } + + public void parseDependency() { + ConstantPool.Visitor v = new ConstantPool.Visitor() { + + public Integer visitClass(CONSTANT_Class_info info, Void p) { + try { + String classname = cfparser.checkClassName(info.getName()); + if (classname.isEmpty()) { + return 1; + } + + Klass from = cfparser.this_klass; + Klass to = Klass.getKlass(classname); + ResolutionInfo resInfo = ResolutionInfo.resolvedConstantPool(from, to, info.name_index); + + from.addDep(to, resInfo); + to.addReferrer(from, resInfo); + } catch (ConstantPoolException ex) { + throw new RuntimeException(ex); + } + return 1; + } + + public Integer visitDouble(CONSTANT_Double_info info, Void p) { + // skip + return 2; + } + + public Integer visitFieldref(CONSTANT_Fieldref_info info, Void p) { + // skip + return 1; + } + + public Integer visitFloat(CONSTANT_Float_info info, Void p) { + // skip + return 1; + } + + public Integer visitInteger(CONSTANT_Integer_info info, Void p) { + // skip + return 1; + } + + public Integer visitInterfaceMethodref(CONSTANT_InterfaceMethodref_info info, Void p) { + // skip + return 1; + } + + public Integer visitLong(CONSTANT_Long_info info, Void p) { + // skip + return 2; + } + + public Integer visitNameAndType(CONSTANT_NameAndType_info info, Void p) { + // skip + return 1; + } + + public Integer visitMethodref(CONSTANT_Methodref_info info, Void p) { + // skip + return 1; + } + + public Integer visitString(CONSTANT_String_info info, Void p) { + // skip + return 1; + } + + public Integer visitUtf8(CONSTANT_Utf8_info info, Void p) { + // skip + return 1; + } + }; + int cpx = 1; + while (cpx < cpool.size()) { + try { + CPInfo cpInfo = cpool.get(cpx); + cpx += cpInfo.accept(v, null); + } catch (ConstantPool.InvalidIndex ex) { + throw new RuntimeException(ex); + } + } + } + + int getTag(int index) { + try { + return cpool.get(index).getTag(); + } catch (ConstantPoolException ex) { + throw new RuntimeException(ex); + } + } + + String getDescriptor(int index) { + CPInfo cpInfo; + try { + cpInfo = cpool.get(index); + } catch (ConstantPoolException ex) { + throw new RuntimeException(ex); + } + + int tag = cpInfo.getTag(); + switch (tag) { + case CONSTANT_Methodref: + case CONSTANT_InterfaceMethodref: + case CONSTANT_Fieldref: + // simplify references within this class + CPRefInfo ref = (CPRefInfo) cpInfo; + try { + return ref.getNameAndTypeInfo().getType(); + } catch (ConstantPoolException ex) { + } + } + return stringValue(cpInfo); + } + + String getMethodName(int index) { + try { + CPInfo cpInfo = cpool.get(index); + if (cpInfo.getTag() == CONSTANT_Methodref || + cpInfo.getTag() == CONSTANT_InterfaceMethodref) { + + // simplify references within this class + CPRefInfo ref = (CPRefInfo) cpInfo; + String classname; + if (ref.class_index == cfparser.classfile.this_class) { + classname = cfparser.this_klass.getClassName(); + } else { + classname = cfparser.checkClassName(ref.getClassName()).replace('/', '.'); + } + String methodname = ref.getNameAndTypeInfo().getName(); + return classname + "." + methodname; + } else { + return null; + } + } catch (InvalidIndex ex) { + throw new RuntimeException(ex); + } catch (ConstantPoolException ex) { + throw new RuntimeException(ex); + } + + } + + class StringValueVisitor implements ConstantPool.Visitor { + + public StringValueVisitor() { + } + + public String visit(CPInfo info) { + return info.accept(this, null); + } + + public String visitClass(CONSTANT_Class_info info, Void p) { + return getCheckedName(info); + } + + String getCheckedName(CONSTANT_Class_info info) { + try { + return checkName(info.getName()); + } catch (ConstantPoolException e) { + throw new RuntimeException(e); + } + } + + public String visitDouble(CONSTANT_Double_info info, Void p) { + return info.value + "d"; + } + + public String visitFieldref(CONSTANT_Fieldref_info info, Void p) { + return visitRef(info, p); + } + + public String visitFloat(CONSTANT_Float_info info, Void p) { + return info.value + "f"; + } + + public String visitInteger(CONSTANT_Integer_info info, Void p) { + return String.valueOf(info.value); + } + + public String visitInterfaceMethodref(CONSTANT_InterfaceMethodref_info info, Void p) { + return visitRef(info, p); + } + + public String visitLong(CONSTANT_Long_info info, Void p) { + return info.value + "l"; + } + + public String visitNameAndType(CONSTANT_NameAndType_info info, Void p) { + return getCheckedName(info) + ":" + getType(info); + } + + String getCheckedName(CONSTANT_NameAndType_info info) { + try { + return checkName(info.getName()); + } catch (ConstantPoolException e) { + throw new RuntimeException(e); + } + } + + String getType(CONSTANT_NameAndType_info info) { + try { + return info.getType(); + } catch (ConstantPoolException e) { + throw new RuntimeException(e); + } + } + + public String visitMethodref(CONSTANT_Methodref_info info, Void p) { + return visitRef(info, p); + } + + public String visitString(CONSTANT_String_info info, Void p) { + try { + int string_index = info.string_index; + return cpool.getUTF8Info(string_index).accept(this, p); + } catch (ConstantPoolException e) { + throw new RuntimeException(e); + } + } + + public String visitUtf8(CONSTANT_Utf8_info info, Void p) { + String s = info.value; + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < s.length(); i++) { + char c = s.charAt(i); + switch (c) { + case '\t': + sb.append('\\').append('t'); + break; + case '\n': + sb.append('\\').append('n'); + break; + case '\r': + sb.append('\\').append('r'); + break; + case '\"': + sb.append('\\').append('\"'); + break; + default: + sb.append(c); + } + } + return sb.toString(); + } + + String visitRef(CPRefInfo info, Void p) { + String cn = getCheckedClassName(info); + String nat; + try { + nat = info.getNameAndTypeInfo().accept(this, p); + } catch (ConstantPoolException e) { + nat = e.getMessage(); + } + return cn + "." + nat; + } + + String getCheckedClassName(CPRefInfo info) { + try { + return checkName(info.getClassName()); + } catch (ConstantPoolException e) { + throw new RuntimeException(e); + } + } + } + /* If name is a valid binary name, return it; otherwise quote it. */ + + private static String checkName(String name) { + if (name == null) { + return "null"; + } + + int len = name.length(); + if (len == 0) { + return "\"\""; + } + + int cc = '/'; + int cp; + for (int k = 0; k < len; k += Character.charCount(cp)) { + cp = name.codePointAt(k); + if ((cc == '/' && !Character.isJavaIdentifierStart(cp)) || (cp != '/' && !Character.isJavaIdentifierPart(cp))) { + return "\"" + name + "\""; + } + cc = cp; + } + return name; + } + + String tagName(int index) { + try { + int tag = cpool.get(index).getTag(); + switch (tag) { + case CONSTANT_Utf8: + return "Utf8"; + case CONSTANT_Integer: + return "int"; + case CONSTANT_Float: + return "float"; + case CONSTANT_Long: + return "long"; + case CONSTANT_Double: + return "double"; + case CONSTANT_Class: + return "class"; + case CONSTANT_String: + return "String"; + case CONSTANT_Fieldref: + return "Field"; + case CONSTANT_Methodref: + return "Method"; + case CONSTANT_InterfaceMethodref: + return "InterfaceMethod"; + case CONSTANT_NameAndType: + return "NameAndType"; + default: + return "(unknown tag)"; + } + } catch (InvalidIndex e) { + throw new RuntimeException(e); + } + } +} diff --git a/make/modules/tools/src/com/sun/classanalyzer/DependencyConfig.java b/make/modules/tools/src/com/sun/classanalyzer/DependencyConfig.java new file mode 100644 index 0000000000000000000000000000000000000000..107e1d10c85d82baffb61161390ba112529db924 --- /dev/null +++ b/make/modules/tools/src/com/sun/classanalyzer/DependencyConfig.java @@ -0,0 +1,99 @@ +/* + * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ +package com.sun.classanalyzer; + +import java.io.BufferedReader; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStreamReader; +import java.util.List; + +/** + * Config file specifying additional dependency + * Each line consists of: + * -> + * where can be: + * @ClassForName and is its dependency + * @Provider and is the service name + * @Providers and is the list of the service names + * + * @author Mandy Chung + */ +public class DependencyConfig { + private DependencyConfig() { + } + + static void parse(List configs) throws IOException { + for (String s : configs) { + parse(s); + } + } + + private static void parse(String config) throws IOException { + // parse configuration file + FileInputStream in = new FileInputStream(config); + try { + BufferedReader reader = new BufferedReader(new InputStreamReader(in)); + String line; + int lineNumber = 0; + String type = null; + while ((line = reader.readLine()) != null) { + lineNumber++; + line = line.trim(); + if (line.length() == 0 || line.charAt(0) == '#') { + continue; + } + if (line.charAt(0) == '@') { + if (AnnotatedDependency.isValidType(line)) { + type = line; + continue; + } else { + throw new RuntimeException(config + ", line " + + lineNumber + ", invalid annotation type."); + } + } + String[] s = line.split("\\s+"); + if (s.length < 3 || !s[1].equals("->")) { + throw new RuntimeException(config + ", line " + + lineNumber + ", is malformed"); + } + String classname = s[0].trim(); + String value = s[2].trim(); + + Klass k = Klass.findKlass(classname); + if (k == null) { + // System.out.println("Warning: " + classname + " cannot be found"); + continue; + } + AnnotatedDependency dep = AnnotatedDependency.newAnnotatedDependency(type, value, k); + if (dep == null) { + throw new RuntimeException(config + ", line " + + lineNumber + ", is malformed. Fail to construct the dependency."); + } + } + + } finally { + in.close(); + } + } +} diff --git a/make/modules/tools/src/com/sun/classanalyzer/Klass.java b/make/modules/tools/src/com/sun/classanalyzer/Klass.java new file mode 100644 index 0000000000000000000000000000000000000000..a4d2eb277755dc4cc80170af102f7dcfbe6a1dc6 --- /dev/null +++ b/make/modules/tools/src/com/sun/classanalyzer/Klass.java @@ -0,0 +1,357 @@ +/* + * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + * + */ + +package com.sun.classanalyzer; + +import java.io.File; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.SortedMap; +import java.util.TreeMap; +import java.util.TreeSet; + +import com.sun.tools.classfile.AccessFlags; + +/** + * + * @author Mandy Chung + */ +public class Klass implements Comparable { + private final String classname; + private final String packagename; + private Module module; + private boolean isJavaLangObject; + private String[] paths; + private Map> methods; + private AccessFlags accessFlags; + private long filesize; + + private SortedMap> deps; + private SortedMap> referrers; + private List annotatedDeps; + private Set classForNameRefs; + + private Klass(String classname) { + this.classname = classname; + this.paths = classname.replace('.', '/').split("/"); + this.isJavaLangObject = classname.equals("java.lang.Object"); + this.deps = new TreeMap>(); + this.referrers = new TreeMap>(); + this.methods = new HashMap>(); + this.annotatedDeps = new ArrayList(); + this.classForNameRefs = new TreeSet(); + + int pos = classname.lastIndexOf('.'); + this.packagename = (pos > 0) ? classname.substring(0, pos) : ""; + } + + String getBasename() { + return paths[paths.length - 1]; + } + + String getClassName() { + return classname; + } + + String getPackageName() { + return packagename; + } + + String getClassFilePathname() { + StringBuilder sb = new StringBuilder(paths[0]); + for (int i = 1; i < paths.length; i++) { + String p = paths[i]; + sb.append(File.separator).append(p); + } + return sb.append(".class").toString(); + } + + boolean isPublic() { + return accessFlags == null || accessFlags.is(AccessFlags.ACC_PUBLIC); + } + + Module getModule() { + return module; + } + + void setModule(Module m) { + if (module != null) { + throw new RuntimeException("Module for " + this + " already set"); + } + this.module = m; + } + + Set getReferencedClasses() { + return deps.keySet(); + } + + Set getReferencingClasses() { + return referrers.keySet(); + } + + void setAccessFlags(int flags) { + this.accessFlags = new AccessFlags(flags); + } + + void setFileSize(long size) { + this.filesize = size; + } + + long getFileSize() { + return this.filesize; + } + + boolean exists() { + return filesize > 0; + } + + boolean skip(Klass k) { + // skip if either class is a root or same class + return k.isJavaLangObject || this == k || k.classname.equals(classname); + } + + void addDep(Method callee, ResolutionInfo resInfo) { + addDep(callee.getKlass(), resInfo); + } + + void addDep(Klass ref, ResolutionInfo ri) { + if (skip(ref)) { + return; + } + Set resInfos; + if (!deps.containsKey(ref)) { + resInfos = new TreeSet(); + deps.put(ref, resInfos); + } else { + resInfos = deps.get(ref); + } + resInfos.add(ri); + } + + void addReferrer(Method caller, ResolutionInfo resInfo) { + addReferrer(caller.getKlass(), resInfo); + } + + void addReferrer(Klass k, ResolutionInfo ri) { + if (skip(k)) { + return; + } + Set resInfos; + if (!referrers.containsKey(k)) { + resInfos = new TreeSet(); + referrers.put(k, resInfos); + } else { + resInfos = referrers.get(k); + } + resInfos.add(ri); + } + + Method getMethod(String name) { + return getMethod(name, ""); + } + + Method getMethod(String name, String signature) { + Set set; + if (methods.containsKey(name)) { + set = methods.get(name); + } else { + set = new TreeSet(); + methods.put(name, set); + } + + for (Method m : set) { + if (m.getName().equals(name) && m.getSignature().equals(signature)) { + return m; + } + } + Method m = new Method(this, name, signature); + set.add(m); + return m; + } + + @Override + public String toString() { + return classname; + } + + @Override + public int compareTo(Klass o) { + return classname.compareTo(o.classname); + } + + void addAnnotatedDep(AnnotatedDependency dep) { + annotatedDeps.add(dep); + } + + void addClassForNameReference(String method) { + classForNameRefs.add(method); + } + + List getAnnotatedDeps() { + return annotatedDeps; + } + + private static Map classes = new TreeMap(); + static Set getAllClasses() { + return new TreeSet(classes.values()); + } + + static Klass findKlassFromPathname(String filename) { + String name = filename; + if (filename.endsWith(".class")) { + name = filename.substring(0, filename.length() - 6); + } + + // trim ".class" + name = name.replace('/', '.'); + for (Klass k : classes.values()) { + if (name.endsWith(k.getClassName())) { + return k; + } + } + return null; + } + + static Klass findKlass(String classname) { + return classes.get(classname); + } + + static Klass getKlass(String name) { + Klass k; + String classname = name.replace('/', '.'); + if (classname.charAt(classname.length() - 1) == ';') { + classname = classname.substring(0, classname.length() - 1); + } + if (classes.containsKey(classname)) { + k = classes.get(classname); + } else { + k = new Klass(classname); + classes.put(classname, k); + } + return k; + } + + public class Method implements Comparable { + + private final Klass k; + private final String method; + private final String signature; + private long codeLength; + // non-primitive types only + private final List argTypes; + private final Klass returnType; + boolean isAbstract = false; + boolean marked = false; + + public Method(Klass k, String method, String signature) { + this(k, method, signature, null, null); + } + + public Method(Klass k, String method, String signature, Klass returnType, List argTypes) { + this.k = k; + this.method = method; + this.signature = signature; + this.argTypes = argTypes; + this.returnType = returnType; + this.codeLength = 0; + } + + public Klass getKlass() { + return k; + } + + public String getName() { + return method; + } + + public String getSignature() { + return signature; + } + + public Klass getReturnType() { + return returnType; + } + + public List argTypes() { + return argTypes; + } + + public void setCodeLength(long len) { + this.codeLength = len; + } + + public long getCodeLength() { + return codeLength; + } + + @Override + public boolean equals(Object o) { + if (o instanceof Method) { + return compareTo((Method) o) == 0; + } else { + return false; + } + } + + @Override + public int hashCode() { + int hash = 3; + hash = 71 * hash + (this.k != null ? this.k.hashCode() : 0); + hash = 71 * hash + (this.method != null ? this.method.hashCode() : 0); + return hash; + } + + @Override + public String toString() { + if (signature.isEmpty()) { + return k.classname + "." + method; + } else { + return signature; + } + } + + public String toHtmlString() { + return toString().replace("<", "<").replace(">", ">"); + } + + boolean isClinit() { + return method.equals(""); + } + + public int compareTo(Method m) { + if (k == m.getKlass()) { + if (method.equals(m.method)) { + return signature.compareTo(m.signature); + } else { + return method.compareTo(m.method); + } + } else { + return k.compareTo(m.getKlass()); + } + } + } +} diff --git a/make/modules/tools/src/com/sun/classanalyzer/Module.java b/make/modules/tools/src/com/sun/classanalyzer/Module.java new file mode 100644 index 0000000000000000000000000000000000000000..0fdc5b145fa3044219bbdb0899667d3ba4c3a2bf --- /dev/null +++ b/make/modules/tools/src/com/sun/classanalyzer/Module.java @@ -0,0 +1,693 @@ +/* + * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + * + */ +package com.sun.classanalyzer; + +import com.sun.classanalyzer.AnnotatedDependency.OptionalDependency; +import java.io.IOException; +import java.io.PrintWriter; +import java.util.ArrayDeque; +import java.util.Collection; +import java.util.Collections; +import java.util.Deque; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Set; +import java.util.TreeMap; +import java.util.TreeSet; + +/** + * + * @author Mandy Chung + */ +public class Module implements Comparable { + + private static Map modules = new LinkedHashMap(); + + public static Module addModule(ModuleConfig config) { + String name = config.module; + if (modules.containsKey(name)) { + throw new RuntimeException("module \"" + name + "\" already exists"); + } + + Module m = new Module(config); + modules.put(name, m); + return m; + } + + public static Module findModule(String name) { + return modules.get(name); + } + + static Collection getAllModules() { + return Collections.unmodifiableCollection(modules.values()); + } + private final String name; + private final ModuleConfig config; + private final Set classes; + private final Set resources; + private final Set unresolved; + private final Set dependents; + private final Map packages; + private final Set members; + private Module group; + private boolean isBaseModule; + + private Module(ModuleConfig config) { + this.name = config.module; + this.isBaseModule = config.isBase; + this.classes = new TreeSet(); + this.resources = new TreeSet(); + this.config = config; + this.unresolved = new HashSet(); + this.dependents = new TreeSet(); + this.packages = new TreeMap(); + this.members = new TreeSet(); + this.group = this; // initialize to itself + } + + String name() { + return name; + } + + Module group() { + return group; + } + + boolean isBase() { + return isBaseModule; + } + + Set members() { + return members; + } + + boolean contains(Klass k) { + return k != null && classes.contains(k); + } + + boolean isEmpty() { + return classes.isEmpty() && resources.isEmpty(); + } + + /** + * Returns an Iterable of Dependency, only one for each dependent + * module of the strongest dependency (i.e. + * hard static > hard dynamic > optional static > optional dynamic + */ + Iterable dependents() { + Map deps = new LinkedHashMap(); + for (Dependency dep : dependents) { + Dependency d = deps.get(dep.module); + if (d == null || dep.compareTo(d) > 0) { + deps.put(dep.module, dep); + } + } + return deps.values(); + } + + @Override + public int compareTo(Module o) { + if (o == null) { + return -1; + } + return name.compareTo(o.name); + } + + @Override + public String toString() { + return name; + } + + void addKlass(Klass k) { + classes.add(k); + k.setModule(this); + + // update package statistics + String pkg = k.getPackageName(); + PackageInfo pkginfo = packages.get(pkg); + if (pkginfo == null) { + pkginfo = new PackageInfo(pkg); + packages.put(pkg, pkginfo); + } + if (k.exists()) { + // only count the class that is parsed + pkginfo.add(k.getFileSize()); + } + } + + void addResource(ResourceFile res) { + resources.add(res); + res.setModule(this); + } + + void processRootsAndReferences() { + // start with the root set + Deque pending = new ArrayDeque(); + for (Klass k : Klass.getAllClasses()) { + if (k.getModule() != null) { + continue; + } + String classname = k.getClassName(); + if (config.matchesRoot(classname) && !config.isExcluded(classname)) { + addKlass(k); + pending.add(k); + } + } + + // follow all references + Klass k; + while ((k = pending.poll()) != null) { + if (!classes.contains(k)) { + addKlass(k); + } + for (Klass other : k.getReferencedClasses()) { + Module otherModule = other.getModule(); + if (otherModule != null && otherModule != this) { + // this module is dependent on otherModule + addDependency(k, other); + continue; + } + + if (!classes.contains(other)) { + if (config.isExcluded(other.getClassName())) { + // reference to an excluded class + unresolved.add(new Reference(k, other)); + } else { + pending.add(other); + } + } + } + } + + // add other matching classes that don't require dependency analysis + for (Klass c : Klass.getAllClasses()) { + if (c.getModule() == null) { + String classname = c.getClassName(); + if (config.matchesIncludes(classname) && !config.isExcluded(classname)) { + addKlass(c); + // dependencies + for (Klass other : c.getReferencedClasses()) { + Module otherModule = other.getModule(); + if (otherModule == null) { + unresolved.add(new Reference(c, other)); + } else { + if (otherModule != this) { + // this module is dependent on otherModule + addDependency(c, other); + } + } + } + } + } + } + + + // add other matching classes that don't require dependency analysis + for (ResourceFile res : ResourceFile.getAllResources()) { + if (res.getModule() == null) { + String name = res.getName(); + if (config.matchesIncludes(name) && !config.isExcluded(name)) { + addResource(res); + } + } + } + } + + void addDependency(Klass from, Klass to) { + Dependency dep = new Dependency(from, to); + dependents.add(dep); + } + + void fixupDependencies() { + // update dependencies for classes that were allocated to modules after + // this module was processed. + for (Reference ref : unresolved) { + Module m = ref.referree().getModule(); + if (m == null || m != this) { + addDependency(ref.referrer, ref.referree); + } + } + + fixupAnnotatedDependencies(); + } + + private void fixupAnnotatedDependencies() { + // add dependencies that this klass may depend on due to the AnnotatedDependency + dependents.addAll(AnnotatedDependency.getDependencies(this)); + } + + boolean isModuleDependence(Klass k) { + Module m = k.getModule(); + return m == null || (!classes.contains(k) && !m.isBase()); + } + + Module getModuleDependence(Klass k) { + if (isModuleDependence(k)) { + Module m = k.getModule(); + if (group == this && m != null) { + // top-level module + return m.group; + } else { + return m; + } + } + return null; + } + +

void visit(Set visited, Visitor

visitor, P p) { + if (!visited.contains(this)) { + visited.add(this); + visitor.preVisit(this, p); + for (Module m : members) { + m.visit(visited, visitor, p); + visitor.postVisit(this, m, p); + } + } else { + throw new RuntimeException("Cycle detected: module " + this.name); + } + } + + void addMember(Module m) { + // merge class list + for (Klass k : m.classes) { + classes.add(k); + } + + // merge resource list + for (ResourceFile res : m.resources) { + resources.add(res); + } + + // merge the package statistics + for (PackageInfo pinfo : m.getPackageInfos()) { + String packageName = pinfo.pkgName; + PackageInfo pkginfo = packages.get(packageName); + if (pkginfo == null) { + pkginfo = new PackageInfo(packageName); + packages.put(packageName, pkginfo); + } + pkginfo.add(pinfo); + } + } + + static void buildModuleMembers() { + // set up module member relationship + for (Module m : modules.values()) { + m.group = m; // initialize to itself + for (String name : m.config.members()) { + Module member = modules.get(name); + if (member == null) { + throw new RuntimeException("module \"" + name + "\" doesn't exist"); + } + m.members.add(member); + } + } + + // set up the top-level module + Visitor groupSetter = new Visitor() { + + public void preVisit(Module m, Module p) { + m.group = p; + if (p.isBaseModule) { + // all members are also base + m.isBaseModule = true; + } + } + + public void postVisit(Module m, Module child, Module p) { + // nop - breadth-first search + } + }; + + // propagate the top-level module to all its members + for (Module p : modules.values()) { + for (Module m : p.members) { + if (m.group == m) { + m.visit(new TreeSet(), groupSetter, p); + } + } + } + + Visitor mergeClassList = new Visitor() { + + public void preVisit(Module m, Module p) { + // nop - depth-first search + } + + public void postVisit(Module m, Module child, Module p) { + m.addMember(child); + } + }; + + Set visited = new TreeSet(); + for (Module m : modules.values()) { + if (m.group() == m) { + if (m.members().size() > 0) { + // merge class list from all its members + m.visit(visited, mergeClassList, m); + } + + // clear the dependencies before fixup + m.dependents.clear(); + + // fixup dependencies + for (Klass k : m.classes) { + for (Klass other : k.getReferencedClasses()) { + if (m.isModuleDependence(other)) { + // this module is dependent on otherModule + m.addDependency(k, other); + } + } + } + + // add dependencies that this klass may depend on due to the AnnotatedDependency + m.fixupAnnotatedDependencies(); + } + } + } + + class PackageInfo implements Comparable { + + final String pkgName; + int count; + long filesize; + + PackageInfo(String name) { + this.pkgName = name; + this.count = 0; + this.filesize = 0; + } + + void add(PackageInfo pkg) { + this.count += pkg.count; + this.filesize += pkg.filesize; + } + + void add(long size) { + count++; + filesize += size; + + } + + @Override + public int compareTo(Object o) { + return pkgName.compareTo(((PackageInfo) o).pkgName); + } + } + + Set getPackageInfos() { + return new TreeSet(packages.values()); + } + + void printSummaryTo(String output) throws IOException { + PrintWriter writer = new PrintWriter(output); + try { + long total = 0L; + int count = 0; + writer.format("%10s\t%10s\t%s\n", "Bytes", "Classes", "Package name"); + for (String pkg : packages.keySet()) { + PackageInfo info = packages.get(pkg); + if (info.count > 0) { + writer.format("%10d\t%10d\t%s\n", info.filesize, info.count, pkg); + total += info.filesize; + count += info.count; + } + } + + writer.format("\nTotal: %d bytes (uncompressed) %d classes\n", total, count); + } finally { + writer.close(); + } + + } + + void printClassListTo(String output) throws IOException { + // no file created if the module doesn't have any class nor resource + if (isEmpty()) { + return; + } + + PrintWriter writer = new PrintWriter(output); + try { + for (Klass c : classes) { + if (c.exists()) { + writer.format("%s\n", c.getClassFilePathname()); + } else { + trace("%s in module %s missing\n", c, this); + } + } + + } finally { + writer.close(); + } + } + + void printResourceListTo(String output) throws IOException { + // no file created if the module doesn't have any resource file + if (resources.isEmpty()) { + return; + } + + PrintWriter writer = new PrintWriter(output); + try { + for (ResourceFile res : resources) { + writer.format("%s\n", res.getPathname()); + } + } finally { + writer.close(); + } + } + + void printDependenciesTo(String output, boolean showDynamic) throws IOException { + // no file created if the module doesn't have any class + if (isEmpty()) { + return; + } + + PrintWriter writer = new PrintWriter(output); + try { + // classes that this klass may depend on due to the AnnotatedDependency + Map> annotatedDeps = AnnotatedDependency.getReferences(this); + + for (Klass klass : classes) { + Set references = klass.getReferencedClasses(); + for (Klass other : references) { + String classname = klass.getClassName(); + boolean optional = OptionalDependency.isOptional(klass, other); + if (optional) { + classname = "[optional] " + classname; + } + + Module m = getModuleDependence(other); + if (m != null || other.getModule() == null) { + writer.format("%-40s -> %s (%s)", classname, other, m); + Reference ref = new Reference(klass, other); + if (annotatedDeps.containsKey(ref)) { + for (AnnotatedDependency ad : annotatedDeps.get(ref)) { + writer.format(" %s", ad.getTag()); + } + // printed; so remove the dependency from the annotated deps list + annotatedDeps.remove(ref); + } + writer.format("\n"); + } + } + } + + + // print remaining dependencies specified in AnnotatedDependency list + if (annotatedDeps.size() > 0) { + for (Map.Entry> entry : annotatedDeps.entrySet()) { + Reference ref = entry.getKey(); + Module m = getModuleDependence(ref.referree); + if (m != null || ref.referree.getModule() == null) { + String classname = ref.referrer.getClassName(); + boolean optional = true; + boolean dynamic = true; + String tag = ""; + for (AnnotatedDependency ad : entry.getValue()) { + if (optional && !ad.isOptional()) { + optional = false; + tag = ad.getTag(); + } + if (!ad.isDynamic()) { + dynamic = false; + } + } + if (!showDynamic && optional && dynamic) { + continue; + } + if (optional) { + if (dynamic) { + classname = "[dynamic] " + classname; + } else { + classname = "[optional] " + classname; + } + } + writer.format("%-40s -> %s (%s) %s%n", classname, ref.referree, m, tag); + } + } + } + + } finally { + writer.close(); + } + } + + static class Dependency implements Comparable { + + final Module module; + final boolean optional; + final boolean dynamic; + + Dependency(Klass from, Klass to) { + // static dependency + this.module = to.getModule() != null ? to.getModule().group() : null; + this.optional = OptionalDependency.isOptional(from, to); + this.dynamic = false; + } + + Dependency(Module m, boolean optional, boolean dynamic) { + this.module = m != null ? m.group() : null; + this.optional = optional; + this.dynamic = dynamic; + } + + @Override + public boolean equals(Object obj) { + if (!(obj instanceof Dependency)) { + return false; + } + if (this == obj) { + return true; + } + + Dependency d = (Dependency) obj; + if (this.module != d.module) { + return false; + } else { + return this.optional == d.optional && this.dynamic == d.dynamic; + } + } + + @Override + public int hashCode() { + int hash = 3; + hash = 19 * hash + (this.module != null ? this.module.hashCode() : 0); + hash = 19 * hash + (this.optional ? 1 : 0); + hash = 19 * hash + (this.dynamic ? 1 : 0); + return hash; + } + + @Override + public int compareTo(Dependency d) { + if (this.equals(d)) { + return 0; + } + + // Hard static > hard dynamic > optional static > optional dynamic + if (this.module == d.module) { + if (this.optional == d.optional) { + return this.dynamic ? -1 : 1; + } else { + return this.optional ? -1 : 1; + } + } else if (this.module != null && d.module != null) { + return (this.module.compareTo(d.module)); + } else { + return (this.module == null) ? -1 : 1; + } + } + + @Override + public String toString() { + String s = module.name(); + if (dynamic && optional) { + s += " (dynamic)"; + } else if (optional) { + s += " (optional)"; + } + return s; + } + } + + static class Reference implements Comparable { + + private final Klass referrer, referree; + + Reference(Klass referrer, Klass referree) { + this.referrer = referrer; + this.referree = referree; + } + + Klass referrer() { + return referrer; + } + + Klass referree() { + return referree; + } + + @Override + public int hashCode() { + return referrer.hashCode() ^ referree.hashCode(); + } + + @Override + public boolean equals(Object obj) { + if (!(obj instanceof Reference)) { + return false; + } + if (this == obj) { + return true; + } + + Reference r = (Reference) obj; + return (this.referrer.equals(r.referrer) && + this.referree.equals(r.referree)); + } + + @Override + public int compareTo(Reference r) { + int ret = referrer.compareTo(r.referrer); + if (ret == 0) { + ret = referree.compareTo(r.referree); + } + return ret; + } + } + + interface Visitor

{ + + public void preVisit(Module m, P param); + + public void postVisit(Module m, Module child, P param); + } + private static boolean traceOn = System.getProperty("classanalyzer.debug") != null; + + private static void trace(String format, Object... params) { + System.err.format(format, params); + } +} diff --git a/make/modules/tools/src/com/sun/classanalyzer/ModuleConfig.java b/make/modules/tools/src/com/sun/classanalyzer/ModuleConfig.java new file mode 100644 index 0000000000000000000000000000000000000000..d5ead840e01b5eea3e03a35328b65f870e5ddb69 --- /dev/null +++ b/make/modules/tools/src/com/sun/classanalyzer/ModuleConfig.java @@ -0,0 +1,562 @@ +/* + * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ +package com.sun.classanalyzer; + +import java.io.BufferedReader; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStreamReader; +import java.util.ArrayList; +import java.util.Collection; +import java.util.LinkedList; +import java.util.List; +import java.util.Set; +import java.util.TreeSet; +import java.util.regex.Pattern; + +/** + * + * @author Mandy Chung + */ +public class ModuleConfig { + + private static String baseModuleName = "base"; + private final Set roots; + private final Set includes; + private final Filter filter; + private List members; + final String module; + final boolean isBase; + + private ModuleConfig(String name) throws IOException { + this.roots = new TreeSet(); + this.includes = new TreeSet(); + this.module = name; + this.isBase = name.equals(baseModuleName); + this.filter = new Filter(this); + } + + List members() { + if (members == null) { + members = new LinkedList(); + + for (String s : includes) { + if (!s.contains("*") && Module.findModule(s) != null) { + // module member + members.add(s); + } + } + } + return members; + } + + boolean matchesRoot(String name) { + for (String pattern : roots) { + if (matches(name, pattern)) { + return true; + } + } + return false; + } + + boolean matchesIncludes(String name) { + for (String pattern : includes) { + if (matches(name, pattern)) { + return true; + } + } + return false; + } + + boolean isExcluded(String name) { + return filter.isExcluded(name); + } + + boolean matchesPackage(String packageName, String pattern) { + int pos = pattern.lastIndexOf('.'); + String pkg = pos > 0 ? pattern.substring(0, pos) : ""; + return packageName.equals(pkg); + } + + + boolean matches(String name, String pattern) { + if (pattern.contains("**") && !pattern.endsWith("**")) { + throw new UnsupportedOperationException("Not yet implemented"); + } + + String javaName = name; + + boolean isResourceFile = name.indexOf('/') >= 0; + if (isResourceFile) { + // it's a resource file; convert the name as a java + javaName = name.replace('/', '.'); + } + if (pattern.indexOf('/') < 0) { + // if the pattern doesn't contain '/ + return matchesJavaName(javaName, pattern); + } else { + if (isResourceFile) { + // the pattern is for matching resource file + return matchesNameWithSlash(name, pattern); + } else { + return false; + } + } + } + + boolean matchesJavaName(String name, String pattern) { + int pos = name.lastIndexOf('.'); + String packageName = pos > 0 ? name.substring(0, pos) : ""; + if (pattern.endsWith("**")) { + String p = pattern.substring(0, pattern.length() - 2); + return name.startsWith(p); + } else if (pattern.endsWith("*") && pattern.indexOf('*') == pattern.lastIndexOf('*')) { + if (matchesPackage(packageName, pattern)) { + // package name has to be exact match + String p = pattern.substring(0, pattern.length() - 1); + return name.startsWith(p); + } else { + return false; + } + } else if (pattern.contains("*")) { + String basename = pos > 0 ? name.substring(pos + 1, name.length()) : name; + pos = pattern.indexOf('*'); + String prefix = pattern.substring(0, pos); + String suffix = pattern.substring(pos + 1, pattern.length()); + if (name.startsWith(prefix) && matchesPackage(packageName, prefix)) { + // package name has to be exact match + if (suffix.contains("*")) { + return name.matches(convertToRegex(pattern)); + } else { + return basename.endsWith(suffix); + } + } else { + // we don't support wildcard be used in the package name + return false; + } + } else { + // exact match or inner class + return name.equals(pattern) || name.startsWith(pattern + "$"); + } + } + + boolean matchesNameWithSlash(String name, String pattern) { + if (pattern.endsWith("**")) { + String p = pattern.substring(0, pattern.length() - 2); + return name.startsWith(p); + } else if (pattern.contains("*")) { + int pos = pattern.indexOf('*'); + String prefix = pattern.substring(0, pos); + String suffix = pattern.substring(pos + 1, pattern.length()); + String tail = name.substring(pos, name.length()); + + if (!name.startsWith(prefix)) { + // prefix has to exact match + return false; + } + + if (pattern.indexOf('*') == pattern.lastIndexOf('*')) { + // exact match prefix with no '/' in the tail string + String wildcard = tail.substring(0, tail.length() - suffix.length()); + return tail.indexOf('/') < 0 && tail.endsWith(suffix); + } + + if (suffix.contains("*")) { + return matchesNameWithSlash(tail, suffix); + } else { + // tail ends with the suffix while no '/' in the wildcard matched string + String any = tail.substring(0, tail.length() - suffix.length()); + return tail.endsWith(suffix) && any.indexOf('/') < 0; + } + } else { + // exact match + return name.equals(pattern); + } + } + + private String convertToRegex(String pattern) { + StringBuilder sb = new StringBuilder(); + int i = 0; + int index = 0; + int plen = pattern.length(); + while (i < plen) { + char p = pattern.charAt(i); + if (p == '*') { + sb.append("(").append(pattern.substring(index, i)).append(")"); + if (i + 1 < plen && pattern.charAt(i + 1) == '*') { + sb.append(".*"); + index = i + 2; + } else { + sb.append("[^\\.]*"); + index = i + 1; + } + } + i++; + } + if (index < plen) { + sb.append("(").append(pattern.substring(index, plen)).append(")"); + } + return sb.toString(); + } + + static class Filter { + + final ModuleConfig config; + final Set exclude = new TreeSet(); + final Set allow = new TreeSet(); + + Filter(ModuleConfig config) { + this.config = config; + } + + Filter exclude(String pattern) { + exclude.add(pattern); + return this; + } + + Filter allow(String pattern) { + allow.add(pattern); + return this; + } + + String allowedBy(String name) { + String allowedBy = null; + for (String pattern : allow) { + if (config.matches(name, pattern)) { + if (name.equals(pattern)) { + return pattern; // exact match + } + if (allowedBy == null) { + allowedBy = pattern; + } else { + if (pattern.length() > allowedBy.length()) { + allowedBy = pattern; + } + } + } + } + return allowedBy; + } + + String excludedBy(String name) { + String allowedBy = allowedBy(name); + String excludedBy = null; + + if (allowedBy != null && name.equals(allowedBy)) { + return null; // exact match + } + for (String pattern : exclude) { + if (config.matches(name, pattern)) { + // not matched by allowed rule or exact match + if (allowedBy == null || name.equals(pattern)) { + return pattern; + } + if (excludedBy == null) { + excludedBy = pattern; + } else { + if (pattern.length() > excludedBy.length()) { + excludedBy = pattern; + } + } + } + } + return excludedBy; + } + + boolean isExcluded(String name) { + String allowedBy = allowedBy(name); + String excludedBy = excludedBy(name); + + if (excludedBy == null) { + return false; + } + // not matched by allowed rule or exact match + if (allowedBy == null || name.equals(excludedBy)) { + return true; + } + + if (allowedBy == null) { + return true; + } + if (allowedBy != null && + excludedBy.length() > allowedBy.length()) { + return true; + } + return false; + } + } + + private static String trimComment(String line) { + StringBuilder sb = new StringBuilder(); + + int pos = 0; + while (pos >= 0 && pos < line.length()) { + int c1 = line.indexOf("//", pos); + if (c1 > 0 && !Character.isWhitespace(line.charAt(c1-1))) { + // not a comment + c1 = -1; + } + + int c2 = line.indexOf("/*", pos); + if (c2 > 0 && !Character.isWhitespace(line.charAt(c2-1))) { + // not a comment + c2 = -1; + } + + int c = line.length(); + int n = line.length(); + if (c1 >= 0 || c2 >= 0) { + if (c1 >= 0) { + c = c1; + } + if (c2 >= 0 && c2 < c) { + c = c2; + } + int c3 = line.indexOf("*/", c2 + 2); + if (c == c2 && c3 > c2) { + n = c3 + 2; + } + } + if (c > 0) { + if (sb.length() > 0) { + // add a whitespace if multiple comments on one line + sb.append(" "); + } + sb.append(line.substring(pos, c)); + } + pos = n; + } + return sb.toString(); + } + + private static boolean beginBlockComment(String line) { + int pos = 0; + while (pos >= 0 && pos < line.length()) { + int c = line.indexOf("/*", pos); + if (c < 0) { + return false; + } + + if (c > 0 && !Character.isWhitespace(line.charAt(c-1))) { + return false; + } + + int c1 = line.indexOf("//", pos); + if (c1 >= 0 && c1 < c) { + return false; + } + + int c2 = line.indexOf("*/", c + 2); + if (c2 < 0) { + return true; + } + pos = c + 2; + } + return false; + } + + static void setBaseModule(String name) { + baseModuleName = name; + } + // TODO: we shall remove "-" from the regex once we define + // the naming convention for the module names without dashes + static final Pattern classNamePattern = Pattern.compile("[\\w\\.\\*_$-/]+"); + + static List readConfigurationFile(String file) throws IOException { + List result = new ArrayList(); + // parse configuration file + FileInputStream in = new FileInputStream(file); + try { + BufferedReader reader = new BufferedReader(new InputStreamReader(in)); + String line; + + int lineNumber = 0; + boolean inRoots = false; + boolean inIncludes = false; + boolean inAllows = false; + boolean inExcludes = false; + boolean inBlockComment = false; + ModuleConfig config = null; + + while ((line = reader.readLine()) != null) { + lineNumber++; + + if (inBlockComment) { + int c = line.indexOf("*/"); + if (c >= 0) { + line = line.substring(c + 2, line.length()); + inBlockComment = false; + } else { + // skip lines until end of comment block + continue; + } + } + + inBlockComment = beginBlockComment(line); + + line = trimComment(line).trim(); + // ignore empty lines + if (line.length() == 0) { + continue; + } + + String values; + if (inRoots || inIncludes || inExcludes || inAllows) { + values = line; + } else { + String[] s = line.split("\\s+"); + String keyword = s[0].trim(); + if (keyword.equals("module")) { + if (s.length != 3 || !s[2].trim().equals("{")) { + throw new RuntimeException(file + ", line " + + lineNumber + ", is malformed"); + } + config = new ModuleConfig(s[1].trim()); + result.add(config); + // switch to a new module; so reset the flags + inRoots = false; + inIncludes = false; + inExcludes = false; + inAllows = false; + continue; + } else if (keyword.equals("roots")) { + inRoots = true; + } else if (keyword.equals("include")) { + inIncludes = true; + } else if (keyword.equals("exclude")) { + inExcludes = true; + } else if (keyword.equals("allow")) { + inAllows = true; + } else if (keyword.equals("}")) { + if (config == null || s.length != 1) { + throw new RuntimeException(file + ", line " + + lineNumber + ", is malformed"); + } else { + // end of a module + config = null; + continue; + } + } else { + throw new RuntimeException(file + ", \"" + keyword + "\" on line " + + lineNumber + ", is not recognized"); + } + values = line.substring(keyword.length(), line.length()).trim(); + } + + if (config == null) { + throw new RuntimeException(file + ", module not specified"); + } + + int len = values.length(); + if (len == 0) { + continue; + } + char lastchar = values.charAt(len - 1); + if (lastchar != ',' && lastchar != ';') { + throw new RuntimeException(file + ", line " + + lineNumber + ", is malformed:" + + " ',' or ';' is missing."); + } + + values = values.substring(0, len - 1); + // parse the values specified for a keyword specified + for (String s : values.split(",")) { + s = s.trim(); + if (s.length() > 0) { + if (!classNamePattern.matcher(s).matches()) { + throw new RuntimeException(file + ", line " + + lineNumber + ", is malformed: \"" + s + "\""); + } + if (inRoots) { + config.roots.add(s); + } else if (inIncludes) { + config.includes.add(s); + } else if (inExcludes) { + config.filter.exclude(s); + } else if (inAllows) { + config.filter.allow(s); + } + + } + } + if (lastchar == ';') { + inRoots = false; + inIncludes = false; + inExcludes = false; + inAllows = false; + } + } + + if (inBlockComment) { + throw new RuntimeException(file + ", line " + + lineNumber + ", missing \"*/\" to end a block comment"); + } + if (config != null) { + throw new RuntimeException(file + ", line " + + lineNumber + ", missing \"}\" to end module definition" + + " for \"" + config.module + "\""); + } + + } finally { + in.close(); + } + + return result; + } + + private String format(String keyword, Collection values) { + if (values.size() == 0) { + return ""; + } + + StringBuilder sb = new StringBuilder(); + String format = "%4s%-9s"; + String spaces = String.format(format, "", ""); + sb.append(String.format(format, "", keyword)); + int count = 0; + for (String s : values) { + if (count > 0) { + sb.append(",\n").append(spaces); + } else if (count++ > 0) { + sb.append(", "); + } + sb.append(s); + } + if (count > 0) { + sb.append(";\n"); + } + return sb.toString(); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("module " + module).append(" {\n"); + sb.append(format("include", includes)); + sb.append(format("root", roots)); + sb.append(format("allow", filter.allow)); + sb.append(format("exclude", filter.exclude)); + sb.append("}\n"); + return sb.toString(); + } +} diff --git a/make/modules/tools/src/com/sun/classanalyzer/ResolutionInfo.java b/make/modules/tools/src/com/sun/classanalyzer/ResolutionInfo.java new file mode 100644 index 0000000000000000000000000000000000000000..19746a49648b415d064a745d31902e35ae873a8c --- /dev/null +++ b/make/modules/tools/src/com/sun/classanalyzer/ResolutionInfo.java @@ -0,0 +1,201 @@ +/* + * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + * + */ + +package com.sun.classanalyzer; + +import com.sun.classanalyzer.Klass.Method; + +/** + * + * @author mchung + */ +public class ResolutionInfo implements Comparable { + + enum Type { + + REFLECTION("reflection", true), + NATIVE("native", true), + INTERFACE("interface", false), + SUPER("super", false), + EXPLICIT("explicit", false), + VERIFICATION("verification", false), + METHODTRACE("method trace", true), + CONSTANT_POOL("constant pool", true), + CHECKED_EXCEPTION("throws", true), + METHOD("method", true), + FIELD("field", true), + EXTENDS("extends", true), + IMPLEMENTS("implements", true), + NOINFO("No info", false); + + private final String name; + private final boolean hasInfo; + + private Type(String name, boolean hasInfo) { + this.name = name; + this.hasInfo = hasInfo; + } + + public String getName() { + return name; + } + + public boolean hasInfo() { + return hasInfo; + } + + public static Type getType(String s) { + if (s.isEmpty()) { + return NOINFO; + } + for (Type t : values()) { + if (s.equals(t.name)) { + return t; + } + } + // Need to fix the VM output to add "native" + // throw new IllegalArgumentException("Invalid ResolutionInfo.type \"" + s + "\""); + System.out.println("WARNING: Invalid ResolutionInfo.type \"" + s + "\""); + return null; + } + } + final Klass fromClass; + final Method method; + final Klass toClass; + final int linenumber; + final Type type; + final String info; + private boolean isPublic = false; + + private ResolutionInfo(Klass from, Klass to, int linenumber, Type type, String info) { + this.fromClass = from; + this.method = null; + this.toClass = to; + this.linenumber = linenumber; + this.type = type; + this.info = info; + } + + private ResolutionInfo(Klass from, Method m, Klass to, int linenumber, Type type) { + this.fromClass = from; + this.method = m; + this.toClass = to; + this.linenumber = linenumber; + this.type = type; + this.info = m.toString(); + } + + public boolean isPublic() { + return isPublic; + } + + public void setPublicAccess(boolean value) { + isPublic = value; + } + static ResolutionInfo resolved(Klass from, Klass to) { + return new ResolutionInfo(from, to, 0, Type.NOINFO, ""); + } + + static ResolutionInfo resolved(Klass from, Klass to, int linenumber) { + return new ResolutionInfo(from, to, linenumber, Type.NOINFO, ""); + } + + static ResolutionInfo resolved(Klass from, Klass to, int linenumber, String reason) { + String[] ss = reason.split("\\s+"); + Type type; + String info; + if (linenumber == -1) { + type = Type.NATIVE; + info = ss[0]; // native method name + } else { + info = ss.length == 2 ? ss[1] : ""; + type = Type.getType(ss[0]); + if (type == null) { + if (reason.isEmpty()) { + throw new IllegalArgumentException("Invalid type: " + reason + " (" + ss[0] + ")" + ss.length); + } + // assume it's native + type = Type.NATIVE; + info = reason.isEmpty() ? ss[0] : reason; + } + } + + return new ResolutionInfo(from, to, linenumber, type, info); + } + + static ResolutionInfo resolved(Klass from, Klass to, Method callee) { + return new ResolutionInfo(from, callee, to, 0, Type.METHODTRACE); + } + + static ResolutionInfo resolvedConstantPool(Klass from, Klass to, int index) { + return new ResolutionInfo(from, to, 0, Type.CONSTANT_POOL, "#" + index); + } + + static ResolutionInfo resolvedField(Klass from, Klass to, String fieldname) { + return new ResolutionInfo(from, to, 0, Type.FIELD, fieldname); + } + + static ResolutionInfo resolvedMethodSignature(Klass from, Klass to, Method m) { + return new ResolutionInfo(from, m, to, 0, Type.METHOD); + } + + static ResolutionInfo resolvedCheckedException(Klass from, Klass to, Method m) { + return new ResolutionInfo(from, m, to, 0, Type.CHECKED_EXCEPTION); + } + + static ResolutionInfo resolvedExtends(Klass from, Klass to) { + String info = from.getClassName() + " implements " + to.getClassName(); + return new ResolutionInfo(from, to, 0, Type.EXTENDS, info); + } + + static ResolutionInfo resolvedImplements(Klass from, Klass to) { + String info = from.getClassName() + " implements " + to.getClassName(); + return new ResolutionInfo(from, to, 0, Type.IMPLEMENTS, info); + } + + @Override + public int compareTo(ResolutionInfo ri) { + if (this.fromClass == ri.fromClass && + this.toClass == ri.toClass && + this.linenumber == ri.linenumber && + this.type == ri.type && + this.info.equals(ri.info)) { + return 0; + } else if (this.fromClass == ri.fromClass) { + if (this.linenumber > ri.linenumber) { + return 1; + } else if (this.linenumber < ri.linenumber) { + return -1; + } else if (this.type != ri.type) { + return this.type.getName().compareTo(ri.type.getName()); + } else if (this.toClass != ri.toClass) { + return this.toClass.compareTo(ri.toClass); + } else { + return this.info.compareTo(ri.info); + } + } else { + return this.fromClass.compareTo(ri.fromClass); + } + } +} diff --git a/make/modules/tools/src/com/sun/classanalyzer/ResourceFile.java b/make/modules/tools/src/com/sun/classanalyzer/ResourceFile.java new file mode 100644 index 0000000000000000000000000000000000000000..8c6714085a63f9269fe45ba8e0b9030c7377888e --- /dev/null +++ b/make/modules/tools/src/com/sun/classanalyzer/ResourceFile.java @@ -0,0 +1,186 @@ +/* + * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + * + */ +package com.sun.classanalyzer; + +import java.io.BufferedReader; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Set; +import java.util.TreeSet; + +/** + * + * @author Mandy Chung + */ +public class ResourceFile implements Comparable { + + private final String pathname; + private Module module; + + ResourceFile(String pathname) { + this.pathname = pathname.replace(File.separatorChar, '/'); + } + + Module getModule() { + return module; + } + + void setModule(Module m) { + if (module != null) { + throw new RuntimeException("Module for " + this + " already set"); + } + this.module = m; + } + + String getName() { + return pathname; + } + + String getPathname() { + return pathname; + } + + @Override + public String toString() { + return pathname; + } + + @Override + public int compareTo(ResourceFile o) { + return pathname.compareTo(o.pathname); + } + static Set resources = new TreeSet(); + + static boolean isResource(String pathname) { + String name = pathname.replace(File.separatorChar, '/'); + + if (name.endsWith("META-INF/MANIFEST.MF")) { + return false; + } + if (name.contains("META-INF/JCE_RSA.")) { + return false; + } + + return true; + } + + static void addResource(String name, InputStream in) { + ResourceFile res; + name = name.replace(File.separatorChar, '/'); + if (name.startsWith("META-INF/services")) { + res = new ServiceProviderConfigFile(name, in); + } else { + res = new ResourceFile(name); + } + resources.add(res); + } + + static Set getAllResources() { + return Collections.unmodifiableSet(resources); + } + + static class ServiceProviderConfigFile extends ResourceFile { + + private final List providers = new ArrayList(); + private final String service; + ServiceProviderConfigFile(String pathname, InputStream in) { + super(pathname); + readServiceConfiguration(in, providers); + this.service = pathname.substring("META-INF/services".length() + 1, pathname.length()); + } + + @Override + String getName() { + if (providers.isEmpty()) { + return service; + } else { + // just use the first one for matching + return providers.get(0); + } + } + + @SuppressWarnings("empty-statement") + void readServiceConfiguration(InputStream in, List names) { + BufferedReader br = null; + try { + if (in != null) { + // Properties doesn't perserve the order of the input file + br = new BufferedReader(new InputStreamReader(in, "utf-8")); + int lc = 1; + while ((lc = parseLine(br, lc, names)) >= 0); + } + } catch (IOException ex) { + throw new RuntimeException(ex); + } finally { + if (br != null) { + try { + br.close(); + } catch (IOException ex) { + throw new RuntimeException(ex); + } + } + } + } + + // Parse a single line from the given configuration file, adding the name + // on the line to the names list. + // + private int parseLine(BufferedReader r, int lc, List names) throws IOException { + String ln = r.readLine(); + if (ln == null) { + return -1; + } + int ci = ln.indexOf('#'); + if (ci >= 0) { + ln = ln.substring(0, ci); + } + ln = ln.trim(); + int n = ln.length(); + if (n != 0) { + if ((ln.indexOf(' ') >= 0) || (ln.indexOf('\t') >= 0)) { + throw new RuntimeException("Illegal configuration-file syntax"); + } + int cp = ln.codePointAt(0); + if (!Character.isJavaIdentifierStart(cp)) { + throw new RuntimeException("Illegal provider-class name: " + ln); + } + for (int i = Character.charCount(cp); i < n; i += Character.charCount(cp)) { + cp = ln.codePointAt(i); + if (!Character.isJavaIdentifierPart(cp) && (cp != '.')) { + throw new RuntimeException("Illegal provider-class name: " + ln); + } + } + if (!names.contains(ln)) { + names.add(ln); + } + } + return lc + 1; + } + } +} diff --git a/make/modules/tools/src/com/sun/classanalyzer/ShowDeps.java b/make/modules/tools/src/com/sun/classanalyzer/ShowDeps.java new file mode 100644 index 0000000000000000000000000000000000000000..ce585553ba6941f23d827dcdaf87a1b46da7ea02 --- /dev/null +++ b/make/modules/tools/src/com/sun/classanalyzer/ShowDeps.java @@ -0,0 +1,100 @@ +/* + * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ +package com.sun.classanalyzer; + +import java.io.File; +import java.io.IOException; +import java.util.*; + +/** + * A simple tool to print out the static dependencies for a given set of JAR, + * class files, or combinations of. The tools supports an -ignore option to + * ignore references to classes listed in the file (including .classlists + * created by the ClassAnalyzer tool). + */ + +public class ShowDeps { + + static void usage() { + System.out.println("java ShowDeps [-ignore ] file..."); + System.out.println(" where is a class or JAR file, or a directory"); + System.out.println(); + System.out.println("Example usages:"); + System.out.println(" java ShowDeps Foo.jar"); + System.out.println(" java ShowDeps -ignore base.classlist Foo.jar"); + System.out.println(" java ShowDeps -ignore base.classlist -ignore " + + "jaxp-parsers.classlist

"); + System.exit(-1); + } + + public static void main(String[] args) throws IOException { + // process -ignore options + int argi = 0; + Set ignore = new HashSet(); + while (argi < args.length && args[argi].equals("-ignore")) { + argi++; + Scanner s = new Scanner(new File(args[argi++])); + try { + while (s.hasNextLine()) { + String line = s.nextLine(); + if (!line.endsWith(".class")) + continue; + int len = line.length(); + // convert to class names + String clazz = line.replace('\\', '.').replace('/', '.') + .substring(0, len-6); + ignore.add(clazz); + } + } finally { + s.close(); + } + } + + if (argi >= args.length) + usage(); + + // parse all classes + while (argi < args.length) + ClassPath.setClassPath(args[argi++]); + ClassPath.parseAllClassFiles(); + + // find the classes that don't exist + Set unresolved = new TreeSet(); + for (Klass k : Klass.getAllClasses()) { + if (k.getFileSize() == 0) + unresolved.add(k); + } + + // print references to classes that don't exist + for (Klass k: Klass.getAllClasses()) { + for (Klass other : k.getReferencedClasses()) { + if (unresolved.contains(other)) { + String name = other.toString(); + if (!ignore.contains(name)) { + System.out.format("%s -> %s\n", k, other); + } + } + } + } + } +} diff --git a/make/sun/applet/Makefile b/make/sun/applet/Makefile index 415db17ddfbe42a3b4df078f157f2b78902e5297..83902ab7d86be5350d90dded69b9658e51f2e06d 100644 --- a/make/sun/applet/Makefile +++ b/make/sun/applet/Makefile @@ -28,6 +28,7 @@ # BUILDDIR = ../.. +MODULE = applet PACKAGE = sun.applet PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk diff --git a/make/sun/awt/Makefile b/make/sun/awt/Makefile index c3c1745ff54993decc7759eced0d5bb81ce782b3..0a8ad9c5fe16854b3086214e28709e9c68272b6c 100644 --- a/make/sun/awt/Makefile +++ b/make/sun/awt/Makefile @@ -24,6 +24,7 @@ # BUILDDIR = ../.. +MODULE = awt PACKAGE = sun.awt LIBRARY = awt PRODUCT = sun @@ -312,15 +313,15 @@ dgalibs: $(DGALIBS) $(LIBDIR)/$(LIBARCH)/libxinerama.so: $(CLOSED_SRC)/solaris/lib/$(ARCH)/libxinerama.so $(install-file) - $(CHMOD) a+x $@ + $(call chmod-file, a+x) $(LIBDIR)/$(LIBARCH)/libjdgaSUNW%.so: $(CLOSED_SRC)/solaris/lib/$(ARCH)/libjdgaSUNW%.so $(install-file) - $(CHMOD) a+x $@ + $(call chmod-file, a+x) $(LIBDIR)/$(LIBARCH)/libjdgaSUNWafb.so: $(LIBDIR)/$(LIBARCH)/libjdgaSUNWffb.so $(prep-target) - $(LN) -s libjdgaSUNWffb.so $(LIBDIR)/$(LIBARCH)/libjdgaSUNWafb.so + $(call install-sym-link, libjdgaSUNWffb.so) clean:: dgalib.clean @@ -404,7 +405,8 @@ $(LIBDIR)/%.bfc: $(FONTCONFIGS_SRC)/$(FONTCONFIGS_SRC_PREFIX)%.properties \ $(COMPILEFONTCONFIG_JARFILE) $(prep-target) $(BOOT_JAVA_CMD) -jar $(COMPILEFONTCONFIG_JARFILE) $< $@ - $(CHMOD) 444 $(@) + $(install-module-file) + $(call chmod-file, 444) @$(java-vm-cleanup) fontconfigs.clean : diff --git a/make/sun/cmm/Makefile b/make/sun/cmm/Makefile index bbed857654cb74f4e37f0f7148b24bfa38376880..dc8a87b6e69d82eecad234fbf38efc470e79faa0 100644 --- a/make/sun/cmm/Makefile +++ b/make/sun/cmm/Makefile @@ -24,6 +24,7 @@ # BUILDDIR = ../.. +MODULE = java2d PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk @@ -45,34 +46,24 @@ iccprofiles: $(ICCPROFILE_DEST_DIR)/sRGB.pf $(ICCPROFILE_DEST_DIR)/GRAY.pf \ $(ICCPROFILE_DEST_DIR)/LINEAR_RGB.pf $(ICCPROFILE_DEST_DIR)/sRGB.pf: $(ICCPROFILE_SRC_DIR)/sRGB.pf - $(RM) $(ICCPROFILE_DEST_DIR)/sRGB.pf - -$(MKDIR) -p $(ICCPROFILE_DEST_DIR) - $(CP) $(ICCPROFILE_SRC_DIR)/sRGB.pf $(ICCPROFILE_DEST_DIR) - $(CHMOD) 444 $(ICCPROFILE_DEST_DIR)/sRGB.pf + $(install-file) + $(call chmod-file, 444) $(ICCPROFILE_DEST_DIR)/GRAY.pf: $(ICCPROFILE_SRC_DIR)/GRAY.pf - $(RM) $(ICCPROFILE_DEST_DIR)/GRAY.pf - -$(MKDIR) -p $(ICCPROFILE_DEST_DIR) - $(CP) $(ICCPROFILE_SRC_DIR)/GRAY.pf $(ICCPROFILE_DEST_DIR) - $(CHMOD) 444 $(ICCPROFILE_DEST_DIR)/GRAY.pf + $(install-file) + $(call chmod-file, 444) $(ICCPROFILE_DEST_DIR)/CIEXYZ.pf: $(ICCPROFILE_SRC_DIR)/CIEXYZ.pf - $(RM) $(ICCPROFILE_DEST_DIR)/CIEXYZ.pf - -$(MKDIR) -p $(ICCPROFILE_DEST_DIR) - $(CP) $(ICCPROFILE_SRC_DIR)/CIEXYZ.pf $(ICCPROFILE_DEST_DIR) - $(CHMOD) 444 $(ICCPROFILE_DEST_DIR)/CIEXYZ.pf + $(install-file) + $(call chmod-file, 444) $(ICCPROFILE_DEST_DIR)/PYCC.pf: $(ICCPROFILE_SRC_DIR)/PYCC.pf - $(RM) $(ICCPROFILE_DEST_DIR)/PYCC.pf - -$(MKDIR) -p $(ICCPROFILE_DEST_DIR) - $(CP) $(ICCPROFILE_SRC_DIR)/PYCC.pf $(ICCPROFILE_DEST_DIR) - $(CHMOD) 444 $(ICCPROFILE_DEST_DIR)/PYCC.pf + $(install-file) + $(call chmod-file, 444) $(ICCPROFILE_DEST_DIR)/LINEAR_RGB.pf: $(ICCPROFILE_SRC_DIR)/LINEAR_RGB.pf - $(RM) $(ICCPROFILE_DEST_DIR)/LINEAR_RGB.pf - -$(MKDIR) -p $(ICCPROFILE_DEST_DIR) - $(CP) $(ICCPROFILE_SRC_DIR)/LINEAR_RGB.pf $(ICCPROFILE_DEST_DIR) - $(CHMOD) 444 $(ICCPROFILE_DEST_DIR)/LINEAR_RGB.pf + $(install-file) + $(call chmod-file, 444) iccprofiles.clean: $(RM) -r $(ICCPROFILE_DEST_DIR) diff --git a/make/sun/cmm/kcms/Makefile b/make/sun/cmm/kcms/Makefile index 10ff72b4f57638754b0eb448fcfa3545dd43c5ad..a7250f74b8780021f15efe18146ca568856941a4 100644 --- a/make/sun/cmm/kcms/Makefile +++ b/make/sun/cmm/kcms/Makefile @@ -24,6 +24,7 @@ # BUILDDIR = ../../.. +MODULE = java2d PACKAGE = sun.java2d.cmm.kcms LIBRARY = kcms PRODUCT = sun diff --git a/make/sun/cmm/lcms/Makefile b/make/sun/cmm/lcms/Makefile index ba595507b7ab341c89d9223a09c6919af2994eb1..ac8746af7b2c3c8a832fc66ec4bc79927bccab71 100644 --- a/make/sun/cmm/lcms/Makefile +++ b/make/sun/cmm/lcms/Makefile @@ -24,6 +24,7 @@ # BUILDDIR = ../../.. +MODULE = java2d PACKAGE = sun.java2d.cmm.lcms LIBRARY = lcms PRODUCT = sun diff --git a/make/sun/dcpr/Makefile b/make/sun/dcpr/Makefile index e49db2af23a5c21f7eea7800f6796c330cfaa895..4dc39f93b9fbf561f7615ee9aba456278b02a635 100644 --- a/make/sun/dcpr/Makefile +++ b/make/sun/dcpr/Makefile @@ -26,6 +26,7 @@ # WARNING: Make sure the OPENJDK plugs are up-to-date, see make/common/internal/BinaryPlugs.gmk BUILDDIR = ../.. +MODULE = java2d PACKAGE = sun.dc LIBRARY = dcpr PRODUCT = sun diff --git a/make/sun/font/Makefile b/make/sun/font/Makefile index f513a64bd4620e05218444b9c9a404f434f043bc..c95e52f458e110a5b0a3a0e35e0ff496e51cd2f4 100644 --- a/make/sun/font/Makefile +++ b/make/sun/font/Makefile @@ -28,6 +28,7 @@ # BUILDDIR = ../.. +MODULE = font PACKAGE = sun.font LIBRARY = fontmanager PRODUCT = sun @@ -121,16 +122,21 @@ FILES_m=mapfile-vers.openjdk # #TODO: rework this to avoid hardcoding library name in the makefile # -library:: $(LIB_LOCATION)/$(LIB_PREFIX)freetype.$(LIBRARY_SUFFIX) - -$(LIB_LOCATION)/$(LIB_PREFIX)freetype.$(LIBRARY_SUFFIX): ifeq ($(PLATFORM), windows) - $(CP) $(FREETYPE_LIB_PATH)/$(LIB_PREFIX)freetype.$(LIBRARY_SUFFIX) $@ + FREETYPE_LIB = $(LIB_LOCATION)/$(LIB_PREFIX)freetype.$(LIBRARY_SUFFIX) + OTHER_LDLIBS += $(FREETYPE_LIB_PATH)/freetype.lib else ifeq ($(USING_SYSTEM_FT_LIB), false) - $(CP) $(FREETYPE_LIB_PATH)/$(LIB_PREFIX)freetype.$(LIBRARY_SUFFIX) $@.6 + FREETYPE_LIB = $(LIB_LOCATION)/$(LIB_PREFIX)freetype.$(LIBRARY_SUFFIX).6 endif + OTHER_LDLIBS += -L$(FREETYPE_LIB_PATH) -lfreetype endif + +library:: $(FREETYPE_LIB) + +$(FREETYPE_LIB): + $(CP) $(FREETYPE_LIB_PATH)/$(LIB_PREFIX)freetype.$(LIBRARY_SUFFIX) $@ + $(install-module-file) endif #ifeq ($(PLATFORM), solaris) @@ -158,7 +164,6 @@ ifndef OPENJDK CPPFLAGS += -I$(CLOSED_SRC)/share/native/$(PKGDIR)/t2k else CPPFLAGS += -I$(FREETYPE_HEADERS_PATH) -I$(FREETYPE_HEADERS_PATH)/freetype2 - OTHER_LDLIBS += $(FREETYPE_LIB) endif ifeq ($(PLATFORM), windows) diff --git a/make/sun/font/t2k/Makefile b/make/sun/font/t2k/Makefile index d01e825159b0ba730ae7463194ddaaf675157b84..651eea84d2c70e85422e2f6d82f673d7e3bcff8f 100644 --- a/make/sun/font/t2k/Makefile +++ b/make/sun/font/t2k/Makefile @@ -30,6 +30,7 @@ # BUILDDIR = ../../.. +MODULE = font PACKAGE = sun.font LIBRARY = t2k PRODUCT = sun diff --git a/make/sun/headless/Makefile b/make/sun/headless/Makefile index b1e1ebf6d5be2911bc8e61c24bbaa9f01b3acf2c..ee853eae746b36df233011030a5552d2e1e635eb 100644 --- a/make/sun/headless/Makefile +++ b/make/sun/headless/Makefile @@ -30,6 +30,7 @@ MOTIF_VERSION = none MOTIF_VERSION_STRING=none LIB_LOCATION = $(LIBDIR)/$(LIBARCH)/headless +MODULE = awt PACKAGE = sun.awt LIBRARY = mawt LIBRARY_OUTPUT = headless diff --git a/make/sun/image/generic/Makefile b/make/sun/image/generic/Makefile index 5caedf6d7d0662488a873edd182a76178011e40d..446209f866701970a7abe2bf7e449c84e8d74132 100644 --- a/make/sun/image/generic/Makefile +++ b/make/sun/image/generic/Makefile @@ -28,6 +28,7 @@ # BUILDDIR = ../../.. +MODULE = media PACKAGE = sun.awt.medialib LIBRARY = mlib_image PRODUCT = sun diff --git a/make/sun/image/vis/Makefile b/make/sun/image/vis/Makefile index b0e399b08787d49a38402ede7b26377580c8a0a4..2bc891a5cf6aee047a0e7372a8122428b3b0a84a 100644 --- a/make/sun/image/vis/Makefile +++ b/make/sun/image/vis/Makefile @@ -27,6 +27,7 @@ # Makefile for building the VIS (solaris-only) version of medialib # BUILDDIR = ../../.. +MODULE = media PACKAGE = sun.awt.medialib LIBRARY = mlib_image_v PRODUCT = sun diff --git a/make/sun/jar/Makefile b/make/sun/jar/Makefile index b90d738900cde0d4f638db44d473d268ec69527c..7dd586e2ff76ed387c8599bb35777abbae94a17d 100644 --- a/make/sun/jar/Makefile +++ b/make/sun/jar/Makefile @@ -28,6 +28,7 @@ # BUILDDIR = ../.. +MODULE = jar-tool PACKAGE = sun.tools PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk diff --git a/make/sun/javazic/Makefile b/make/sun/javazic/Makefile index 96a2df1e0d92b32964f096d2271ac0786580890c..10c2b1a85654f5dc9061ba928d222dc940a0dc22 100644 --- a/make/sun/javazic/Makefile +++ b/make/sun/javazic/Makefile @@ -27,6 +27,7 @@ BUILDDIR = ../.. +MODULE = base PACKAGE = sun.javazic PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk @@ -69,6 +70,7 @@ $(INSTALLDIR)/$(MAPFILE): $(WORKDIR)/$(MAPFILE) $(RM) -r $(@D) $(prep-target) $(CP) -r $(WORKDIR)/* $(@D) + $(install-module-dir) clean clobber:: $(RM) -r $(TEMPDIR) $(INSTALLDIR) diff --git a/make/sun/jawt/Makefile b/make/sun/jawt/Makefile index 45d337258a48aff2344ada14bc0e607a3358323f..424a20d1c41db378a0f1aeeae827e9e98d1c5d1b 100644 --- a/make/sun/jawt/Makefile +++ b/make/sun/jawt/Makefile @@ -24,6 +24,7 @@ # BUILDDIR = ../.. +MODULE = awt PACKAGE = sun.awt LIBRARY = jawt PRODUCT = sun diff --git a/make/sun/jconsole/Makefile b/make/sun/jconsole/Makefile index dc61227fe62d3ab8201f547818e0a7cd784ddc8d..42f624e38b2341e04db9ad00cfb0893775cbb3d6 100644 --- a/make/sun/jconsole/Makefile +++ b/make/sun/jconsole/Makefile @@ -28,6 +28,7 @@ # BUILDDIR = ../.. +MODULE = jconsole PACKAGE = sun.tools.jconsole PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk @@ -79,7 +80,7 @@ $(CLASSBINDIR)/$(PKGDIR)/resources/%: $(SHARE_SRC)/classes/$(PKGDIR)/resources/% $(install-file) $(TEMPDIR)/manifest: $(SHARE_SRC)/classes/$(PKGDIR)/manifest - $(install-file) + $(install-manifest-file) # # Extra rule to build jconsole.jar diff --git a/make/sun/jdbc/Makefile b/make/sun/jdbc/Makefile index d7e7eaf1530e434476cae9dbba1835ba320d23ea..4b241b9174e8178390d90813ff068716d90283aa 100644 --- a/make/sun/jdbc/Makefile +++ b/make/sun/jdbc/Makefile @@ -33,6 +33,7 @@ # BUILDDIR = ../.. +MODULE = jdbc-odbc PACKAGE = sun.jdbc.odbc LIBRARY = JdbcOdbc PRODUCT = sun diff --git a/make/sun/jdga/Makefile b/make/sun/jdga/Makefile index 257996d77216db53cec4bc29ac044a0dd672e94f..d9a6db65565647d6b7918c0c2c99f4f11b34cd42 100644 --- a/make/sun/jdga/Makefile +++ b/make/sun/jdga/Makefile @@ -25,6 +25,7 @@ BUILDDIR = ../.. +MODULE = java2d PACKAGE = sun.jdga LIBRARY = sunwjdga PRODUCT = sun diff --git a/make/sun/jkernel/Makefile b/make/sun/jkernel/Makefile index 97f2f38aca5e1080b8ee744d47bd6582c03bc9ed..7a7a6a3645fc87f8a97b63f1205683b92fbd3d47 100644 --- a/make/sun/jkernel/Makefile +++ b/make/sun/jkernel/Makefile @@ -24,6 +24,7 @@ # BUILDDIR = ../.. +MODULE = jkernel PACKAGE = sun.jkernel LIBRARY = jkernel PRODUCT = sun diff --git a/make/sun/jpeg/Makefile b/make/sun/jpeg/Makefile index f97e2cd08b850503f0b4b13d9865057c72282524..99d36a9b25780de83bf77e2e4460513a86759715 100644 --- a/make/sun/jpeg/Makefile +++ b/make/sun/jpeg/Makefile @@ -24,6 +24,7 @@ # BUILDDIR = ../.. +MODULE = java2d PACKAGE = sun.awt LIBRARY = jpeg PRODUCT = sun diff --git a/make/sun/launcher/Makefile b/make/sun/launcher/Makefile index 1346bc4e20005611d933c3ea42950196004236ae..32b2ec7aa1b82a17f0e388ed30c7266eb005e4e8 100644 --- a/make/sun/launcher/Makefile +++ b/make/sun/launcher/Makefile @@ -24,6 +24,7 @@ # BUILDDIR = ../.. +MODULE = base PACKAGE = sun.launcher PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk diff --git a/make/sun/management/Makefile b/make/sun/management/Makefile index bb7ad8935c94fd655cf31e37293a7cfa485d2189..a54b1dd0be9fcd7140bd4722659d4a25c40e3c1f 100644 --- a/make/sun/management/Makefile +++ b/make/sun/management/Makefile @@ -28,6 +28,8 @@ # BUILDDIR = ../.. +MODULE = management + include $(BUILDDIR)/common/Defs.gmk MGMT_LIBDIR = $(LIBDIR)/management @@ -56,17 +58,17 @@ jmxremotefiles: $(MGMT_LIBDIR)/jmxremote.password.template $(MGMT_LIBDIR)/jmxrem $(MGMT_LIBDIR)/management.properties: $(MGMT_LIB_SRC)/management.properties $(install-file) - $(CHMOD) 644 $@ + $(call chmod-file, 644) $(MGMT_LIBDIR)/snmp.acl.template: $(MGMT_LIB_SRC)/snmp.acl.template $(install-file) - $(CHMOD) 444 $@ + $(call chmod-file, 444) $(MGMT_LIBDIR)/jmxremote.password.template: $(MGMT_LIB_SRC)/jmxremote.password.template $(install-file) - $(CHMOD) 444 $@ + $(call chmod-file, 444) $(MGMT_LIBDIR)/jmxremote.access: $(MGMT_LIB_SRC)/jmxremote.access $(install-file) - $(CHMOD) 644 $@ + $(call chmod-file, 644) diff --git a/make/sun/native2ascii/Makefile b/make/sun/native2ascii/Makefile index 766e90fc545bc7ac51f9a8ca8e0584576e2a89d9..1cd1ab9b155453b7c1d45fcec8a91575d2f5179e 100644 --- a/make/sun/native2ascii/Makefile +++ b/make/sun/native2ascii/Makefile @@ -28,6 +28,7 @@ # BUILDDIR = ../.. +MODULE = tools PACKAGE = sun.tools.native2ascii PRODUCT = sun OTHER_JAVACFLAGS += -Xlint:serial -Werror diff --git a/make/sun/net/others/Makefile b/make/sun/net/others/Makefile index 2adf6048b7b94ff70add3251123536272de27f7f..0896c7ef6798826ed1f5c77429c3c61c7717a7ae 100644 --- a/make/sun/net/others/Makefile +++ b/make/sun/net/others/Makefile @@ -24,6 +24,7 @@ # BUILDDIR = ../../.. +MODULE = base PACKAGE = sun.net PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk diff --git a/make/sun/net/spi/nameservice/dns/Makefile b/make/sun/net/spi/nameservice/dns/Makefile index d86a3c69f00d6287e667b552e109d2770ec3e4be..746f168b45785558939ad092f3bf7385b167f74d 100644 --- a/make/sun/net/spi/nameservice/dns/Makefile +++ b/make/sun/net/spi/nameservice/dns/Makefile @@ -28,6 +28,9 @@ # BUILDDIR = ../../../../.. + +# dns should probably be its own module +MODULE = net-dns PACKAGE = sun.net.spi.nameservice.dns PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk diff --git a/make/sun/nio/Makefile b/make/sun/nio/Makefile index 4b46a1fb76d0b82c58e2c762943ed70909ba8c77..76051c1b17acd9883aeec341ba86fac7eb5c1b61 100644 --- a/make/sun/nio/Makefile +++ b/make/sun/nio/Makefile @@ -1,5 +1,5 @@ # -# Copyright 1996-2008 Sun Microsystems, Inc. All Rights Reserved. +# Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -23,88 +23,12 @@ # have any questions. # -# -# Makefile for character converters. -# - BUILDDIR = ../.. - PACKAGE = sun.nio PRODUCT = sun - -# This re-directs all the class files to a separate location -CLASSDESTDIR = $(TEMPDIR)/classes - -OTHER_JAVACFLAGS += -Xlint:serial -Werror include $(BUILDDIR)/common/Defs.gmk -# -# Files -# -include FILES_java.gmk -AUTO_FILES_JAVA_DIRS = sun/nio/cs/ext - -# For Cygwin, command line arguments that are paths must be converted to -# windows style paths. These paths cannot be used as targets, however, because -# the ":" in them will interfere with GNU Make rules, generating "multiple -# target pattern" errors. - -# this define is for the rule: -CHARSETS_JAR = $(LIBDIR)/charsets.jar - -# extcs -FILES_genout_extcs = $(FILES_gen_extcs:%.java=$(GENSRCDIR)/%.java) - -# -# Rules -# -include $(BUILDDIR)/common/Classes.gmk - -build: $(FILES_genout_extcs) $(CHARSETS_JAR) - -# -# Extra rules to build character converters. - -SERVICE_DESCRIPTION = java.nio.charset.spi.CharsetProvider -SERVICE_DESCRIPTION_PATH = META-INF/services/$(SERVICE_DESCRIPTION) - -GENCSDATASRC = $(BUILDDIR)/tools/CharsetMapping -GENCSSRCDIR = $(BUILDDIR)/tools/src/build/tools/charsetmapping -GENCSEXT = $(GENSRCDIR)/sun/nio/cs/ext - -FILES_MAP = $(GENCSDATASRC)/sjis0213.map -FILES_DAT = $(CLASSDESTDIR)/sun/nio/cs/ext/sjis0213.dat -CHARSETMAPPING_JARFILE = $(BUILDTOOLJARDIR)/charsetmapping.jar - -$(FILES_DAT): $(FILES_MAP) - @$(prep-target) - $(BOOT_JAVA_CMD) -jar $(CHARSETMAPPING_JARFILE) \ - $(FILES_MAP) $(FILES_DAT) sjis0213 - - -$(FILES_genout_extcs): \ - $(GENCSDATASRC)/SingleByte-X.java.template \ - $(GENCSDATASRC)/DoubleByte-X.java.template \ - $(GENCSDATASRC)/extsbcs $(GENCSDATASRC)/dbcs - @$(prep-target) - $(RM) -r $(GENCSEXT) - $(MKDIR) -p $(GENCSEXT) - $(BOOT_JAVA_CMD) -jar $(CHARSETMAPPING_JARFILE) $(GENCSDATASRC) $(GENCSEXT) extsbcs - $(BOOT_JAVA_CMD) -jar $(CHARSETMAPPING_JARFILE) $(GENCSDATASRC) $(GENCSEXT) euctw \ - $(GENCSSRCDIR)/GenerateEUC_TW.java - $(BOOT_JAVA_CMD) -jar $(CHARSETMAPPING_JARFILE) $(GENCSDATASRC) $(GENCSEXT) dbcs - -$(CLASSDESTDIR)/$(SERVICE_DESCRIPTION_PATH): \ - $(SHARE_SRC)/classes/sun/nio/cs/ext/$(SERVICE_DESCRIPTION_PATH) - $(install-file) - -$(CHARSETS_JAR): $(FILES_class) $(CLASSDESTDIR)/$(SERVICE_DESCRIPTION_PATH) $(FILES_DAT) - $(BOOT_JAR_CMD) cf0 $(CHARSETS_JAR) \ - -C $(CLASSDESTDIR) sun \ - -C $(CLASSDESTDIR) $(SERVICE_DESCRIPTION_PATH) \ - $(BOOT_JAR_JFLAGS) - @$(java-vm-cleanup) +SUBDIRS = cs +all build clean clobber:: + $(SUBDIRS-loop) -clean:: - $(RM) -r $(CLASSDESTDIR) - $(RM) $(CHARSETS_JAR) diff --git a/make/sun/nio/FILES_java.gmk b/make/sun/nio/cs/FILES_java.gmk similarity index 100% rename from make/sun/nio/FILES_java.gmk rename to make/sun/nio/cs/FILES_java.gmk diff --git a/make/sun/nio/cs/Makefile b/make/sun/nio/cs/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..c2e9c0b8ef24e2019aee5e012356a62270224b9d --- /dev/null +++ b/make/sun/nio/cs/Makefile @@ -0,0 +1,112 @@ +# +# Copyright 1996-2008 Sun Microsystems, Inc. All Rights Reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. Sun designates this +# particular file as subject to the "Classpath" exception as provided +# by Sun in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, +# CA 95054 USA or visit www.sun.com if you need additional information or +# have any questions. +# + +# +# Makefile for character converters. +# + +BUILDDIR = ../../.. + +# charsets should be separated from nio module +MODULE = charsets +PACKAGE = sun.nio +PRODUCT = sun + +# This re-directs all the class files to a separate location +CLASSDESTDIR = $(TEMPDIR)/classes + +OTHER_JAVACFLAGS += -Xlint:serial -Werror +include $(BUILDDIR)/common/Defs.gmk + +# +# Files +# +include FILES_java.gmk +AUTO_FILES_JAVA_DIRS = sun/nio/cs/ext + +# For Cygwin, command line arguments that are paths must be converted to +# windows style paths. These paths cannot be used as targets, however, because +# the ":" in them will interfere with GNU Make rules, generating "multiple +# target pattern" errors. + +# this define is for the rule: +CHARSETS_JAR = $(LIBDIR)/charsets.jar + +# extcs +FILES_genout_extcs = $(FILES_gen_extcs:%.java=$(GENSRCDIR)/%.java) + +# +# Rules +# +include $(BUILDDIR)/common/Classes.gmk + +build: $(FILES_genout_extcs) $(CHARSETS_JAR) + +# +# Extra rules to build character converters. + +SERVICE_DESCRIPTION = java.nio.charset.spi.CharsetProvider +SERVICE_DESCRIPTION_PATH = META-INF/services/$(SERVICE_DESCRIPTION) + +GENCSDATASRC = $(BUILDDIR)/tools/CharsetMapping +GENCSSRCDIR = $(BUILDDIR)/tools/src/build/tools/charsetmapping +GENCSEXT = $(GENSRCDIR)/sun/nio/cs/ext + +FILES_MAP = $(GENCSDATASRC)/sjis0213.map +FILES_DAT = $(CLASSDESTDIR)/sun/nio/cs/ext/sjis0213.dat +CHARSETMAPPING_JARFILE = $(BUILDTOOLJARDIR)/charsetmapping.jar + +$(FILES_DAT): $(FILES_MAP) + @$(prep-target) + $(BOOT_JAVA_CMD) -jar $(CHARSETMAPPING_JARFILE) \ + $(FILES_MAP) $(FILES_DAT) sjis0213 + + +$(FILES_genout_extcs): \ + $(GENCSDATASRC)/SingleByte-X.java.template \ + $(GENCSDATASRC)/DoubleByte-X.java.template \ + $(GENCSDATASRC)/extsbcs $(GENCSDATASRC)/dbcs + @$(prep-target) + $(RM) -r $(GENCSEXT) + $(MKDIR) -p $(GENCSEXT) + $(BOOT_JAVA_CMD) -jar $(CHARSETMAPPING_JARFILE) $(GENCSDATASRC) $(GENCSEXT) extsbcs + $(BOOT_JAVA_CMD) -jar $(CHARSETMAPPING_JARFILE) $(GENCSDATASRC) $(GENCSEXT) euctw \ + $(GENCSSRCDIR)/GenerateEUC_TW.java + $(BOOT_JAVA_CMD) -jar $(CHARSETMAPPING_JARFILE) $(GENCSDATASRC) $(GENCSEXT) dbcs + +$(CLASSDESTDIR)/$(SERVICE_DESCRIPTION_PATH): \ + $(SHARE_SRC)/classes/sun/nio/cs/ext/$(SERVICE_DESCRIPTION_PATH) + $(install-file) + +$(CHARSETS_JAR): $(FILES_class) $(CLASSDESTDIR)/$(SERVICE_DESCRIPTION_PATH) $(FILES_DAT) + $(BOOT_JAR_CMD) cf0 $(CHARSETS_JAR) \ + -C $(CLASSDESTDIR) sun \ + -C $(CLASSDESTDIR) $(SERVICE_DESCRIPTION_PATH) \ + $(BOOT_JAR_JFLAGS) + @$(java-vm-cleanup) + +clean:: + $(RM) -r $(CLASSDESTDIR) + $(RM) $(CHARSETS_JAR) diff --git a/make/sun/org/mozilla/javascript/Makefile b/make/sun/org/mozilla/javascript/Makefile index 2e74c02fdd51dceb070d83ce22e094c837e8f9ad..1750fadc6cbcada3c71939ae10cc1e66bbcd9c9d 100644 --- a/make/sun/org/mozilla/javascript/Makefile +++ b/make/sun/org/mozilla/javascript/Makefile @@ -28,6 +28,7 @@ # BUILDDIR = ../../../.. +MODULE = scripting-rhino PACKAGE = sun.org.mozilla.javascript.internal PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk diff --git a/make/sun/pisces/Makefile b/make/sun/pisces/Makefile index 3f3a3228b958705d61416d4838439596ff497eaf..73f07f5090b922a1a5b5cb605ea109f0b0c346ae 100644 --- a/make/sun/pisces/Makefile +++ b/make/sun/pisces/Makefile @@ -24,6 +24,7 @@ # BUILDDIR = ../.. +MODULE = java2d PACKAGE = sun.pisces PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk diff --git a/make/sun/rmi/cgi/Makefile b/make/sun/rmi/cgi/Makefile index 0ed90ca2bd544dff8f384343690fe307fe384bd0..4b69bc0a523c48c697b990fd955ba57d9e50cadb 100644 --- a/make/sun/rmi/cgi/Makefile +++ b/make/sun/rmi/cgi/Makefile @@ -28,6 +28,8 @@ # BUILDDIR = ../../.. +# java-rmi.cgi is a JDK tool +MODULE = tools PACKAGE = sun.rmi PRODUCT = sun PROGRAM = java-rmi diff --git a/make/sun/rmi/oldtools/Makefile b/make/sun/rmi/oldtools/Makefile index ad610ffca41c6fe1564d64d4b5f40e3524e763c9..b59d4fcf077d9b8572a5a7be1c440370d4908eed 100644 --- a/make/sun/rmi/oldtools/Makefile +++ b/make/sun/rmi/oldtools/Makefile @@ -28,6 +28,7 @@ # BUILDDIR = ../../.. +MODULE = oldjavac PRODUCT = oldjavac include $(BUILDDIR)/common/Defs.gmk diff --git a/make/sun/rmi/registry/Makefile b/make/sun/rmi/registry/Makefile index c5254a7f3c975dddf95aae13c4a6e13ff0b1a4c6..bfb6cb55ed85e839299f7a464a3cc2f53c6c6e33 100644 --- a/make/sun/rmi/registry/Makefile +++ b/make/sun/rmi/registry/Makefile @@ -28,6 +28,7 @@ # BUILDDIR = ../../.. +MODULE = rmi PACKAGE = sun.rmi.registry PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk @@ -48,3 +49,7 @@ RESOURCE_BUNDLES_UNCOMPILED_PROPERTIES = $(PKGDIR)/resources/rmiregistry.propert # include $(BUILDDIR)/common/Classes.gmk +build: rmiregistry + +rmiregistry: + $(call make-launcher, rmiregistry, sun.rmi.registry.RegistryImpl, , ) diff --git a/make/sun/rmi/rmi/Makefile b/make/sun/rmi/rmi/Makefile index c351d87f0eb8b6f51b85a52444ad20e0bbfc52f1..844f51bcc3489ee1a49049b38e1d9c3701545524 100644 --- a/make/sun/rmi/rmi/Makefile +++ b/make/sun/rmi/rmi/Makefile @@ -28,6 +28,7 @@ # BUILDDIR = ../../.. +MODULE = rmi PACKAGE = sun.rmi PRODUCT = sun LIBRARY = rmi @@ -124,7 +125,7 @@ bin: $(BINDIR)/java-rmi.cgi $(BINDIR)/java-rmi.cgi: $(PLATFORM_SRC)/bin/java-rmi.cgi.sh $(install-file) - $(CHMOD) a+x $@ + $(call chmod-file, a+x) bin.clean: $(RM) $(BINDIR)/java-rmi.cgi diff --git a/make/sun/rmi/rmic/Makefile b/make/sun/rmi/rmic/Makefile index a09a170f86f0305f4bab91be869e7ba423abb20c..ae73a2d28e37730efa82ad35629de080b37ddb91 100644 --- a/make/sun/rmi/rmic/Makefile +++ b/make/sun/rmi/rmic/Makefile @@ -28,6 +28,7 @@ # BUILDDIR = ../../.. +MODULE = rmic PACKAGE = sun.rmi.rmic PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk diff --git a/make/sun/rmi/rmid/Makefile b/make/sun/rmi/rmid/Makefile index 845b103220df57295c724cc2c0c55bd6bc9d09d6..23f223ec66b8f01b0e8ddd5866413a9014d61249 100644 --- a/make/sun/rmi/rmid/Makefile +++ b/make/sun/rmi/rmid/Makefile @@ -29,11 +29,12 @@ # BUILDDIR = ../../.. +MODULE = rmi-activation PACKAGE = sun.rmi.activation PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk -build: stubs +build: stubs rmid # # Resources @@ -75,4 +76,5 @@ stubs: $(FILES_stubs) # include $(BUILDDIR)/common/Classes.gmk - +rmid: + $(call make-launcher, rmid, sun.rmi.server.Activation, , ) diff --git a/make/sun/security/ec/Makefile b/make/sun/security/ec/Makefile index 53a3e3e9e51a16cd311deae0768090187ecb0219..95b9e8d30d667d03a107bbf585652f5033b337fb 100644 --- a/make/sun/security/ec/Makefile +++ b/make/sun/security/ec/Makefile @@ -89,6 +89,7 @@ # BUILDDIR = ../../.. +MODULE = security-sunec PACKAGE = sun.security.ec PRODUCT = sun @@ -308,7 +309,7 @@ $(JAR_DESTFILE): $(UNSIGNED_DIR)/sunec.jar else $(JAR_DESTFILE): $(SIGNED_DIR)/sunec.jar endif - $(install-file) + $(install-non-module-file) ifndef OPENJDK install-prebuilt: diff --git a/make/sun/security/jgss/wrapper/Makefile b/make/sun/security/jgss/wrapper/Makefile index f5b75dbeb48b4552c3f6b5886f18610a5fcc05c4..8be00aa6c20ec1c270f44e72d106b88e3d130bc2 100644 --- a/make/sun/security/jgss/wrapper/Makefile +++ b/make/sun/security/jgss/wrapper/Makefile @@ -24,6 +24,7 @@ # BUILDDIR = ../../../.. +MODULE = security-kerberos PACKAGE = sun.security.jgss.wrapper PRODUCT = sun diff --git a/make/sun/security/krb5/Makefile b/make/sun/security/krb5/Makefile index aac29eb5611d45c8ebf4040b8c772fa9c5f5b144..c835666ea9e0b5c1b33886c34d29db0f562ac0e6 100644 --- a/make/sun/security/krb5/Makefile +++ b/make/sun/security/krb5/Makefile @@ -24,6 +24,7 @@ # BUILDDIR = ../../.. +MODULE = security-kerberos PACKAGE = sun.security.krb5 PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk @@ -77,3 +78,10 @@ ifeq ($(PLATFORM), windows) else OTHER_LDLIBS = -ldl $(JVMLIB) endif + +build: +ifeq ($(PLATFORM),windows) + $(call make-launcher, kinit, sun.security.krb5.internal.tools.Kinit, , ) + $(call make-launcher, klist, sun.security.krb5.internal.tools.Klist, , ) + $(call make-launcher, ktab, sun.security.krb5.internal.tools.Ktab, , ) +endif diff --git a/make/sun/security/mscapi/Makefile b/make/sun/security/mscapi/Makefile index c16d130504f044c7b0989e2bd5e7847ac40cb124..2cc8ea536144082860eb63b28849b4f4f1ecda16 100644 --- a/make/sun/security/mscapi/Makefile +++ b/make/sun/security/mscapi/Makefile @@ -89,6 +89,7 @@ # BUILDDIR = ../../.. +MODULE = security-sunmscapi PACKAGE = sun.security.mscapi LIBRARY = sunmscapi PRODUCT = sun @@ -271,7 +272,7 @@ $(JAR_DESTFILE): $(UNSIGNED_DIR)/sunmscapi.jar else $(JAR_DESTFILE): $(SIGNED_DIR)/sunmscapi.jar endif - $(install-file) + $(install-non-module-file) ifndef OPENJDK install-prebuilt: diff --git a/make/sun/security/pkcs11/Makefile b/make/sun/security/pkcs11/Makefile index 9a4a4089be4e3a08ce18ade8e1612500ebb8aabe..f4be8d7a50700b166fab9ecc01bdc75b24da1d43 100644 --- a/make/sun/security/pkcs11/Makefile +++ b/make/sun/security/pkcs11/Makefile @@ -89,6 +89,7 @@ # BUILDDIR = ../../.. +MODULE = security-sunpkcs11 PACKAGE = sun.security.pkcs11 LIBRARY = j2pkcs11 PRODUCT = sun @@ -161,6 +162,16 @@ else OTHER_LDLIBS = -ldl $(JVMLIB) endif +# Other config files +SUNPKCS11_CFG = + +ifeq ($(PLATFORM), solaris) +SUNPKCS11_CFG = sunpkcs11-cfg +endif # PLATFORM + +SUNPKCS11_CFG_SRC = $(TOPDIR)/src/share/lib/security/sunpkcs11-solaris.cfg +SUNPKCS11_CFG_BUILD = $(LIBDIR)/security/sunpkcs11-solaris.cfg + # # We use a variety of subdirectories in the $(TEMPDIR) depending on what # part of the build we're doing. Both OPENJDK/JDK builds are initially @@ -174,12 +185,17 @@ UNSIGNED_DIR = $(TEMPDIR)/unsigned # ifdef OPENJDK -all: build-jar install-jar +all: $(SUNPKCS11_CFG) build-jar install-jar else -all: build-jar install-prebuilt +all: $(SUNPKCS11_CFG) build-jar install-prebuilt $(build-warning) endif +sunpkcs11-cfg: $(SUNPKCS11_CFG_BUILD) + +$(SUNPKCS11_CFG_BUILD): $(SUNPKCS11_CFG_SRC) + $(install-file) + include $(BUILDDIR)/javax/crypto/Defs-jce.gmk @@ -271,7 +287,7 @@ $(JAR_DESTFILE): $(UNSIGNED_DIR)/sunpkcs11.jar else $(JAR_DESTFILE): $(SIGNED_DIR)/sunpkcs11.jar endif - $(install-file) + $(install-non-module-file) ifndef OPENJDK install-prebuilt: @@ -287,6 +303,7 @@ endif clobber clean:: $(RM) -r $(JAR_DESTFILE) $(TEMPDIR) $(JCE_BUILD_DIR) + $(RM) $(SUNPKCS11_CFG_BUILD) .PHONY: build-jar jar install-jar ifndef OPENJDK diff --git a/make/sun/security/smartcardio/Makefile b/make/sun/security/smartcardio/Makefile index 556864119679f4386ba502793b5a3577794a23ca..097cd40c7a9a14b8b702b6cd4cf6d1cf8a3db96e 100644 --- a/make/sun/security/smartcardio/Makefile +++ b/make/sun/security/smartcardio/Makefile @@ -24,6 +24,7 @@ # BUILDDIR = ../../.. +MODULE = security-smartcardio PACKAGE = sun.security.smartcardio LIBRARY = j2pcsc PRODUCT = sun diff --git a/make/sun/security/tools/Makefile b/make/sun/security/tools/Makefile index 0a8ffabe15c0b4166fbcbf85d35f9140c75b2881..3380d20e6d8557915e7f0cfe1422dc45b2d4fbd3 100644 --- a/make/sun/security/tools/Makefile +++ b/make/sun/security/tools/Makefile @@ -24,6 +24,7 @@ # BUILDDIR = ../../.. +MODULE = security-tools PACKAGE = sun.security.tools PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk @@ -44,3 +45,7 @@ RESOURCE_BUNDLES_JAVA = sun/security/tools/JarSignerResources.java # include $(BUILDDIR)/common/Classes.gmk +build: + $(call make-launcher, keytool, sun.security.tools.KeyTool, , ) + $(call make-launcher, policytool, sun.security.tools.PolicyTool, , ) + diff --git a/make/sun/serialver/Makefile b/make/sun/serialver/Makefile index 0906d3e3e14007dc346f4f04777b500d3340bda6..29c3cceba48b630e2509a57beff0cf451e9ea27a 100644 --- a/make/sun/serialver/Makefile +++ b/make/sun/serialver/Makefile @@ -28,6 +28,7 @@ # BUILDDIR = ../.. +MODULE = serialver PACKAGE = sun.tools.serialver PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk diff --git a/make/sun/splashscreen/Makefile b/make/sun/splashscreen/Makefile index 305df2fc2e01df037a45e57e4e6d623924cde0ee..65b3fc388cc124e517d2625d604bce2468d04f83 100644 --- a/make/sun/splashscreen/Makefile +++ b/make/sun/splashscreen/Makefile @@ -24,6 +24,7 @@ # BUILDDIR = ../.. +MODULE = awt PACKAGE = sun.awt LIBRARY = splashscreen PRODUCT = sun diff --git a/make/sun/text/Makefile b/make/sun/text/Makefile index 37b8522156af51236a9533960fecf1883b8eda84..005587df7a174902387b755278e84870d6200456 100644 --- a/make/sun/text/Makefile +++ b/make/sun/text/Makefile @@ -29,6 +29,7 @@ BUILDDIR = ../.. +MODULE = localedata PACKAGE = sun.text PRODUCT = sun diff --git a/make/sun/tools/Makefile b/make/sun/tools/Makefile index 3c4d4c98d7d5847f75409dff017764addb897f1e..a6e926daf4012612d3b458186ab2aac767d9fd54 100644 --- a/make/sun/tools/Makefile +++ b/make/sun/tools/Makefile @@ -28,6 +28,7 @@ # BUILDDIR = ../.. +MODULE = tools PACKAGE = sun.tools PRODUCT = sun include $(BUILDDIR)/common/Defs.gmk diff --git a/make/sun/tracing/dtrace/Makefile b/make/sun/tracing/dtrace/Makefile index cf0dc9a978f01be80705342199540cbdd227c143..16f09e719782c7b2e41e2ffad113a6b5c32fb4b6 100644 --- a/make/sun/tracing/dtrace/Makefile +++ b/make/sun/tracing/dtrace/Makefile @@ -27,6 +27,7 @@ # Makefile for building dtrace extension # BUILDDIR = ../../.. +MODULE = tracing PACKAGE = sun.tracing.dtrace LIBRARY = jsdt PRODUCT = sun diff --git a/make/sun/xawt/Makefile b/make/sun/xawt/Makefile index 3cb408d99075248f42631d3a843b33a2a8db2d0e..f9636cd3e6677b594c0fb03bffe75647883aff60 100644 --- a/make/sun/xawt/Makefile +++ b/make/sun/xawt/Makefile @@ -24,6 +24,7 @@ # BUILDDIR = ../.. +MODULE = awt PACKAGE = sun.awt.X11 LIBRARY = mawt LIBRARY_OUTPUT = xawt diff --git a/src/share/bin/java.c b/src/share/bin/java.c index 2494ce1ea2e5a1d4e246d296d53c1e81c585933a..8f9d2edee1c53a6b3cafb027ad50996adec84976 100644 --- a/src/share/bin/java.c +++ b/src/share/bin/java.c @@ -93,6 +93,7 @@ static int numOptions, maxOptions; * Prototypes for functions internal to launcher. */ static void SetClassPath(const char *s); +static void SetModulesBootClassPath(const char *s); static void SelectVersion(int argc, char **argv, char **main_class); static jboolean ParseArguments(int *pargc, char ***pargv, char **pjarfile, char **pclassname, int *pret, const char *jvmpath); @@ -277,6 +278,9 @@ JLI_Launch(int argc, char ** argv, /* main argc, argc */ return(ret); } + /* Set bootclasspath for modules */ + SetModulesBootClassPath(jrepath); + /* Override class path if -jar flag was specified */ if (jarfile != 0) { SetClassPath(jarfile); @@ -693,6 +697,44 @@ SetClassPath(const char *s) JLI_MemFree((char *) s); } +/* + * Set the bootclasspath for modules. + * A temporary workaround until jigsaw is integrated into JDK 7. + */ +static void +SetModulesBootClassPath(const char *jrepath) +{ + char *def, *s; + char pathname[MAXPATHLEN]; + const char separator[] = { FILE_SEPARATOR, '\0' }; + const char *orig = jrepath; + static const char format[] = "-Xbootclasspath/p:%s"; + struct stat statbuf; + + /* return if jre/lib/rt.jar exists */ + sprintf(pathname, "%s%slib%srt.jar", jrepath, separator, separator); + if (stat(pathname, &statbuf) == 0) { + return; + } + + /* return if jre/classes exists */ + sprintf(pathname, "%s%sclasses", jrepath, separator); + if (stat(pathname, &statbuf) == 0) { + return; + } + + /* modularized jre */ + sprintf(pathname, "%s%slib%s*", jrepath, separator, separator); + s = (char *) JLI_WildcardExpandClasspath(pathname); + def = JLI_MemAlloc(sizeof(format) + - 2 /* strlen("%s") */ + + JLI_StrLen(s)); + sprintf(def, format, s); + AddOption(def, NULL); + if (s != orig) + JLI_MemFree((char *) s); +} + /* * The SelectVersion() routine ensures that an appropriate version of * the JRE is running. The specification for the appropriate version diff --git a/src/share/classes/com/sun/jndi/toolkit/corba/CorbaUtils.java b/src/share/classes/com/sun/jndi/toolkit/corba/CorbaUtils.java index 00cdf1ee6a74a921615fd08008d503f340ec98d4..b56aea82e42319d999f6c753291329bc7e6bec49 100644 --- a/src/share/classes/com/sun/jndi/toolkit/corba/CorbaUtils.java +++ b/src/share/classes/com/sun/jndi/toolkit/corba/CorbaUtils.java @@ -33,10 +33,10 @@ import java.lang.reflect.InvocationTargetException; import java.util.Hashtable; import java.util.Properties; import java.util.Enumeration; -import java.applet.Applet; import org.omg.CORBA.ORB; +import javax.naming.Context; import javax.naming.ConfigurationException; /** @@ -191,16 +191,48 @@ public class CorbaUtils { } // Get Applet from environment - Applet applet = null; if (env != null) { - applet = (Applet) env.get("java.naming.applet"); + Object applet = env.get(Context.APPLET); + if (applet != null) { + // Create ORBs for an applet + return initAppletORB(applet, orbProp); + } } - // Create ORBs using applet and orbProp - if (applet != null) { - return ORB.init(applet, orbProp); - } else { - return ORB.init(new String[0], orbProp); + // Create ORBs using orbProp for a standalone application + return ORB.init(new String[0], orbProp); + } + + /** + * This method returns a new ORB instance for the given applet + * without creating a static dependency on java.applet. + */ + private static ORB initAppletORB(Object applet, Properties orbProp) { + try { + Class appletClass = Class.forName("java.applet.Applet", true, null); + if (!appletClass.isInstance(applet)) { + throw new ClassCastException(applet.getClass().getName()); + } + + // invoke the static method ORB.init(applet, orbProp); + Method method = ORB.class.getMethod("init", appletClass, Properties.class); + return (ORB) method.invoke(null, applet, orbProp); + } catch (ClassNotFoundException e) { + // java.applet.Applet doesn't exist and the applet parameter is + // non-null; so throw CCE + throw new ClassCastException(applet.getClass().getName()); + } catch (NoSuchMethodException e) { + throw new AssertionError(e); + } catch (InvocationTargetException e) { + Throwable cause = e.getCause(); + if (cause instanceof RuntimeException) { + throw (RuntimeException) cause; + } else if (cause instanceof Error) { + throw (Error) cause; + } + throw new AssertionError(e); + } catch (IllegalAccessException iae) { + throw new AssertionError(iae); } } diff --git a/src/share/classes/java/dyn/CallSite.java b/src/share/classes/java/dyn/CallSite.java index 34624a5a170b9064b0f3055a53b5b160e5564ad3..b0e5b91557980f2f0beacbdd6ad5644eac1fff35 100644 --- a/src/share/classes/java/dyn/CallSite.java +++ b/src/share/classes/java/dyn/CallSite.java @@ -26,6 +26,9 @@ package java.dyn; import sun.dyn.util.BytecodeName; +import sun.dyn.Access; +import sun.dyn.CallSiteImpl; +import sun.dyn.MethodHandleImpl; /** * An {@code invokedynamic} call site, as reified by the @@ -52,15 +55,25 @@ import sun.dyn.util.BytecodeName; * @see Linkage#registerBootstrapMethod(java.lang.Class, java.dyn.MethodHandle) * @author John Rose, JSR 292 EG */ -public class CallSite { +public class CallSite + // Note: This is an implementation inheritance hack, and will be removed + // with a JVM change which moves the required hidden state onto this class. + extends CallSiteImpl +{ + private static final Access IMPL_TOKEN = Access.getToken(); + + /* + // Fields used only by the JVM. Do not use or change. private Object vmmethod; int callerMID, callerBCI; // supplied by the JVM - MethodHandle target; + private MethodHandle target; + final Object caller; // usually a class final String name; final MethodType type; + */ /** * Make a call site given the parameters from a call to the bootstrap method. @@ -72,16 +85,21 @@ public class CallSite { * @param type the method handle type derived from descriptor of the {@code invokedynamic} instruction */ public CallSite(Object caller, String name, MethodType type) { - this.caller = caller; - this.name = name; - this.type = type; + super(IMPL_TOKEN, caller, name, type); } private static void privateInitializeCallSite(CallSite site, int callerMID, int callerBCI) { site.callerMID = callerMID; site.callerBCI = callerBCI; - if (site.target == null) - site.setTarget(site.initialTarget()); + site.ensureTarget(); + } + private void ensureTarget() { + // Note use of super, which accesses the field directly, + // without deferring to possible subclass overrides. + if (super.getTarget() == null) { + super.setTarget(this.initialTarget()); + super.getTarget().type(); // provoke NPE if still null + } } /** @@ -102,10 +120,11 @@ public class CallSite { /** * Report the current linkage state of the call site. (This is mutable.) - * The value maybe null only if the call site is currently unlinked. - * When a linked call site is invoked, the target method is used directly. - * When an unlinked call site is invoked, its bootstrap method receives - * the call, as if via {@link Linkage#bootstrapInvokeDynamic}. + * The value may not be null after the {@code CallSite} object is returned + * from the bootstrap method of the {@code invokedynamic} instruction. + * When an {@code invokedynamic} instruction is executed, the target method + * of its associated {@code call site} object is invoked directly, + * as if via {@link MethodHandle}{@code .invoke}. *

* The interactions of {@code getTarget} with memory are the same * as of a read from an ordinary variable, such as an array element or a @@ -118,7 +137,7 @@ public class CallSite { * @see #setTarget */ public MethodHandle getTarget() { - return target; + return super.getTarget(); } /** @@ -140,13 +159,13 @@ public class CallSite { */ public void setTarget(MethodHandle target) { checkTarget(target); - this.target = target; + super.setTarget(target); } protected void checkTarget(MethodHandle target) { target.type(); // provoke NPE if (!canSetTarget(target)) - throw new WrongMethodTypeException(String.valueOf(target)); + throw new WrongMethodTypeException(String.valueOf(target)+target.type()+" should be of type "+type()); } protected boolean canSetTarget(MethodHandle target) { @@ -219,6 +238,10 @@ public class CallSite { @Override public String toString() { - return "CallSite#"+hashCode()+"["+name+type+" => "+target+"]"; + return "CallSite#"+hashCode()+"["+name+type+" => "+getTarget()+"]"; } + + // Package-local constant: + static final MethodHandle GET_TARGET = MethodHandleImpl.getLookup(IMPL_TOKEN). + findVirtual(CallSite.class, "getTarget", MethodType.methodType(MethodHandle.class)); } diff --git a/src/share/classes/java/dyn/InvokeDynamic.java b/src/share/classes/java/dyn/InvokeDynamic.java index 2bec7b7dfe6a115c24086f052ad4c3a53eac16a4..bd92f8c54467976e750922132483feec2677ec6b 100644 --- a/src/share/classes/java/dyn/InvokeDynamic.java +++ b/src/share/classes/java/dyn/InvokeDynamic.java @@ -45,6 +45,24 @@ package java.dyn; * class or interface supertype, or an object type; it can never be instantiated. * Logically, it denotes a source of all dynamically typed methods. * It may be viewed as a pure syntactic marker (an importable one) of static calls. + *

+ * Here are some examples of usage: + *

+ * Object x; String s; int i;
+ * x = InvokeDynamic.greet("world"); // greet(Ljava/lang/String;)Ljava/lang/Object;
+ * s = InvokeDynamic.<String>hail(x); // hail(Ljava/lang/Object;)Ljava/lang/String;
+ * InvokeDynamic.<void>cogito(); // cogito()V
+ * i = InvokeDynamic.<int>#"op:+"(2, 3); // "op:+"(II)I
+ * 
+ * Each of the above calls generates a single invokedynamic instruction + * with the name-and-type descriptors indicated in the comments. + * The argument types are taken directly from the actual arguments, + * while the return type is taken from the type parameter. + * (This type parameter may be a primtive, and it defaults to {@code Object}.) + * The final example uses a special syntax for uttering non-Java names. + * Any name legal to the JVM may be given between the double quotes. + * None of these calls is complete without a bootstrap method, + * which must be registered by the static initializer of the enclosing class. * @author John Rose, JSR 292 EG */ public final class InvokeDynamic { diff --git a/src/share/classes/java/dyn/InvokeDynamicBootstrapError.java b/src/share/classes/java/dyn/InvokeDynamicBootstrapError.java index 975ba7d3a2dbbd4349eef78f19b2dd13df098a97..b6678c386ee7e52c89343e929878fb6968745d56 100644 --- a/src/share/classes/java/dyn/InvokeDynamicBootstrapError.java +++ b/src/share/classes/java/dyn/InvokeDynamicBootstrapError.java @@ -52,4 +52,16 @@ public class InvokeDynamicBootstrapError extends LinkageError { public InvokeDynamicBootstrapError(String s) { super(s); } + + /** + * Constructs a {@code InvokeDynamicBootstrapError} with the specified + * detail message and cause. + * + * @param s the detail message. + * @param cause the cause. + */ + public InvokeDynamicBootstrapError(String s, Throwable cause) { + super(s); + this.initCause(cause); + } } diff --git a/src/share/classes/java/dyn/JavaMethodHandle.java b/src/share/classes/java/dyn/JavaMethodHandle.java index b7432a7752149d09014545c1eccb6d7b44b0d41e..4c883a53c91513037cf46aa1fef0c13e17a92d3a 100644 --- a/src/share/classes/java/dyn/JavaMethodHandle.java +++ b/src/share/classes/java/dyn/JavaMethodHandle.java @@ -25,6 +25,8 @@ package java.dyn; +import sun.dyn.Access; + /** * A Java method handle extends the basic method handle type with additional * programmer defined methods and fields. @@ -39,31 +41,105 @@ package java.dyn; * of the entry point method handle, with the leading parameter type * omitted. *

- * Here is an example of usage: + * Here is an example of usage, creating a hybrid object/functional datum: + *

+ * class Greeter extends JavaMethodHandle {
+ *     private String greeting = "hello";
+ *     public void setGreeting(String s) { greeting = s; }
+ *     public void run() { System.out.println(greeting+", "+greetee); }
+ *     private final String greetee;
+ *     Greeter(String greetee) {
+ *         super(RUN); // alternatively, super("run")
+ *         this.greetee = greetee;
+ *     }
+ *     // the entry point function is computed once:
+ *     private static final MethodHandle RUN
+ *         = MethodHandles.lookup().findVirtual(Greeter.class, "run",
+ *               MethodType.make(void.class));
+ * }
+ * // class Main { public static void main(String... av) { ...
+ * Greeter greeter = new Greeter("world");
+ * greeter.run();  // prints "hello, world"
+ * // Statically typed method handle invocation (most direct):
+ * MethodHandle mh = greeter;
+ * mh.<void>invoke();  // also prints "hello, world"
+ * // Dynamically typed method handle invocation:
+ * MethodHandles.invoke(greeter);  // also prints "hello, world"
+ * greeter.setGreeting("howdy");
+ * mh.invoke();  // prints "howdy, world" (object-like mutable behavior)
+ * 
+ *

+ * In the example of {@code Greeter}, the method {@code run} provides the entry point. + * The entry point need not be a constant value; it may be independently + * computed in each call to the constructor. The entry point does not + * even need to be a method on the {@code Greeter} class, though + * that is the typical case. + *

+ * The entry point may also be provided symbolically, in which case the the + * {@code JavaMethodHandle} constructor performs the lookup of the entry point. + * This makes it possible to use {@code JavaMethodHandle} to create an anonymous + * inner class: *

- *     class Greeter extends JavaMethodHandle {
+ * // We can also do this with symbolic names and/or inner classes:
+ * MethodHandles.invoke(new JavaMethodHandle("yow") {
+ *     void yow() { System.out.println("yow, world"); }
+ * });
+ * 
+ *

+ * Here is similar lower-level code which works in terms of a bound method handle. + *

+ *     class Greeter {
  *         public void run() { System.out.println("hello, "+greetee); }
  *         private final String greetee;
- *         Greeter(String greetee) {
- *             super(RUN);
- *             this.greetee = greetee;
- *         }
+ *         Greeter(String greetee) { this.greetee = greetee; }
  *         // the entry point function is computed once:
  *         private static final MethodHandle RUN
- *             = MethodHandles.findVirtual(MyMethodHandle.class, "run",
+ *             = MethodHandles.findVirtual(Greeter.class, "run",
  *                   MethodType.make(void.class));
  *     }
+ *     // class Main { public static void main(String... av) { ...
  *     Greeter greeter = new Greeter("world");
  *     greeter.run();  // prints "hello, world"
- *     MethodHandle mh = greeter;
+ *     MethodHandle mh = MethodHanndles.insertArgument(Greeter.RUN, 0, greeter);
  *     mh.invoke();  // also prints "hello, world"
  * 
+ * Note that the method handle must be separately created as a view on the base object. + * This increases footprint, complexity, and dynamic indirections. *

- * In this example, the method {@code run} provides the entry point. - * The entry point need not be a constant value; it may be independently - * computed in each call to the constructor. The entry point does not - * even need to be a method on the Java method handle class, though - * that is the typical case. + * Here is a pure functional value expressed most concisely as an anonymous inner class: + *

+ *     // class Main { public static void main(String... av) { ...
+ *     final String greetee = "world";
+ *     MethodHandle greeter = new JavaMethodHandle("run") {
+ *         private void run() { System.out.println("hello, "+greetee); }
+ *     }
+ *     greeter.invoke();  // prints "hello, world"
+ * 
+ *

+ * Here is an abstract parameterized lvalue, efficiently expressed as a subtype of MethodHandle, + * and instantiated as an anonymous class. The data structure is a handle to 1-D array, + * with a specialized index type (long). It is created by inner class, and uses + * signature-polymorphic APIs throughout. + *

+ *     abstract class AssignableMethodHandle extends JavaMethodHandle {
+ *       private final MethodHandle setter;
+ *       public MethodHandle setter() { return setter; }
+ *       public AssignableMethodHandle(String get, String set) {
+ *         super(get);
+ *         MethodType getType = this.type();
+ *         MethodType setType = getType.insertParameterType(getType.parameterCount(), getType.returnType()).changeReturnType(void.class);
+ *         this.setter = MethodHandles.publicLookup().bind(this, set, setType);
+ *       }
+ *     }
+ *     // class Main { public static void main(String... av) { ...
+ *     final Number[] stuff = { 123, 456 };
+ *     AssignableMethodHandle stuffPtr = new AssignableMethodHandle("get", "set") {
+ *         public Number get(long i)           { return stuff[(int)i]; }
+ *         public void   set(long i, Object x) {        stuff[(int)i] = x; }
+ *     }
+ *     int x = (Integer) stuffPtr.<Number>invoke(1L);  // 456
+ *     stuffPtr.setter().<void>invoke(0L, (Number) 789);  // replaces 123 with 789
+ * 
* @see MethodHandle * @author John Rose, JSR 292 EG */ @@ -72,12 +148,87 @@ public abstract class JavaMethodHandle // with a JVM change which moves the required hidden behavior onto this class. extends sun.dyn.BoundMethodHandle { + private static final Access IMPL_TOKEN = Access.getToken(); + /** - * When creating a, pass in {@code entryPoint}, any method handle which - * can take the current object - * @param entryPoint + * When creating a {@code JavaMethodHandle}, the actual method handle + * invocation behavior will be delegated to the specified {@code entryPoint}. + * This may be any method handle which can take the newly constructed object + * as a leading parameter. + *

+ * The method handle type of {@code this} (i.e, the fully constructed object) + * will be {@code entryPoint}, minus the leading argument. + * The leading argument will be bound to {@code this} on every method + * handle invocation. + * @param entryPoint the method handle to handle calls */ protected JavaMethodHandle(MethodHandle entryPoint) { - super(entryPoint, 0); + super(entryPoint); + } + + /** + * Create a method handle whose entry point is a non-static method + * visible in the exact (most specific) class of + * the newly constructed object. + *

+ * The method is specified by name and type, as if via this expression: + * {@code MethodHandles.lookup().findVirtual(this.getClass(), name, type)}. + * The class defining the method might be an anonymous inner class. + *

+ * The method handle type of {@code this} (i.e, the fully constructed object) + * will be the given method handle type. + * A call to {@code this} will invoke the selected method. + * The receiver argument will be bound to {@code this} on every method + * handle invocation. + *

+ * Rationale: + * Although this constructor may seem to be a mere luxury, + * it is not subsumed by the more general constructor which + * takes any {@code MethodHandle} as the entry point argument. + * In order to convert an entry point name to a method handle, + * the self-class of the object is required (in order to do + * the lookup). The self-class, in turn, is generally not + * available at the time of the constructor invocation, + * due to the rules of Java and the JVM verifier. + * One cannot call {@code this.getClass()}, because + * the value of {@code this} is inaccessible at the point + * of the constructor call. (Changing this would require + * change to the Java language, verifiers, and compilers.) + * In particular, this constructor allows {@code JavaMethodHandle}s + * to be created in combination with the anonymous inner class syntax. + * @param entryPointName the name of the entry point method + * @param type (optional) the desired type of the method handle + */ + protected JavaMethodHandle(String entryPointName, MethodType type) { + super(entryPointName, type, true); + + } + + /** + * Create a method handle whose entry point is a non-static method + * visible in the exact (most specific) class of + * the newly constructed object. + *

+ * The method is specified only by name. + * There must be exactly one method of that name visible in the object class, + * either inherited or locally declared. + * (That is, the method must not be overloaded.) + *

+ * The method handle type of {@code this} (i.e, the fully constructed object) + * will be the same as the type of the selected non-static method. + * The receiver argument will be bound to {@code this} on every method + * handle invocation. + *

ISSUE: This signature wildcarding feature does not correspond to + * any MethodHandles.Lookup API element. Can we eliminate it? + * Alternatively, it is useful for naming non-overloaded methods. + * Shall we make type arguments optional in the Lookup methods, + * throwing an error in cases of ambiguity? + *

+ * For this method's rationale, see the documentation + * for {@link #JavaMethodHandle(String,MethodType)}. + * @param entryPointName the name of the entry point method + */ + protected JavaMethodHandle(String entryPointName) { + super(entryPointName, (MethodType) null, false); } } diff --git a/src/share/classes/java/dyn/Linkage.java b/src/share/classes/java/dyn/Linkage.java index cbeeb3351deb62695758f16e625f7f54c73e8c21..ed3e35e9594d9b37ce91f91383b99f84ae1317db 100644 --- a/src/share/classes/java/dyn/Linkage.java +++ b/src/share/classes/java/dyn/Linkage.java @@ -25,7 +25,9 @@ package java.dyn; +import java.dyn.MethodHandles.Lookup; import java.util.WeakHashMap; +import sun.dyn.Access; import sun.reflect.Reflection; import static sun.dyn.util.VerifyAccess.checkBootstrapPrivilege; @@ -34,6 +36,8 @@ import static sun.dyn.util.VerifyAccess.checkBootstrapPrivilege; * @author John Rose, JSR 292 EG */ public class Linkage { + private static final Access IMPL_TOKEN = Access.getToken(); + private Linkage() {} // do not instantiate /** @@ -53,19 +57,23 @@ public class Linkage { * call to this method. *

  • The given class is already fully initialized. *
  • The given class is in the process of initialization, in another thread. + *
  • The same {@code CallSite} object has already been returned from + * a bootstrap method call to another {@code invokedynamic} call site. * * Because of these rules, a class may install its own bootstrap method in * a static initializer. + * @param callerClass a class that may have {@code invokedynamic} sites + * @param bootstrapMethod the method to use to bootstrap all such sites */ public static - void registerBootstrapMethod(Class callerClass, MethodHandle mh) { + void registerBootstrapMethod(Class callerClass, MethodHandle bootstrapMethod) { Class callc = Reflection.getCallerClass(2); checkBootstrapPrivilege(callc, callerClass, "registerBootstrapMethod"); - checkBSM(mh); + checkBSM(bootstrapMethod); synchronized (bootstrapMethods) { if (bootstrapMethods.containsKey(callerClass)) throw new IllegalStateException("bootstrap method already declared in "+callerClass); - bootstrapMethods.put(callerClass, mh); + bootstrapMethods.put(callerClass, bootstrapMethod); } } @@ -88,8 +96,9 @@ public class Linkage { public static void registerBootstrapMethod(Class runtime, String name) { Class callc = Reflection.getCallerClass(2); + Lookup lookup = new Lookup(IMPL_TOKEN, callc); MethodHandle bootstrapMethod = - MethodHandles.findStaticFrom(callc, runtime, name, BOOTSTRAP_METHOD_TYPE); + lookup.findStatic(runtime, name, BOOTSTRAP_METHOD_TYPE); // FIXME: exception processing wrong here checkBSM(bootstrapMethod); Linkage.registerBootstrapMethod(callc, bootstrapMethod); @@ -106,8 +115,9 @@ public class Linkage { public static void registerBootstrapMethod(String name) { Class callc = Reflection.getCallerClass(2); + Lookup lookup = new Lookup(IMPL_TOKEN, callc); MethodHandle bootstrapMethod = - MethodHandles.findStaticFrom(callc, callc, name, BOOTSTRAP_METHOD_TYPE); + lookup.findStatic(callc, name, BOOTSTRAP_METHOD_TYPE); // FIXME: exception processing wrong here checkBSM(bootstrapMethod); Linkage.registerBootstrapMethod(callc, bootstrapMethod); @@ -116,8 +126,7 @@ public class Linkage { /** * PROVISIONAL API, WORK IN PROGRESS: * Report the bootstrap method registered for a given class. - * Returns null if the class has never yet registered a bootstrap method, - * or if the class has explicitly registered a null bootstrap method. + * Returns null if the class has never yet registered a bootstrap method. * Only callers privileged to set the bootstrap method may inquire * about it, because a bootstrap method is potentially a back-door entry * point into its class. @@ -137,12 +146,12 @@ public class Linkage { * {@code (Class, String, MethodType)} returning a {@code CallSite}. */ public static final MethodType BOOTSTRAP_METHOD_TYPE - = MethodType.make(CallSite.class, - Class.class, String.class, MethodType.class); + = MethodType.methodType(CallSite.class, + Class.class, String.class, MethodType.class); private static final MethodType OLD_BOOTSTRAP_METHOD_TYPE - = MethodType.make(Object.class, - CallSite.class, Object[].class); + = MethodType.methodType(Object.class, + CallSite.class, Object[].class); private static final WeakHashMap bootstrapMethods = new WeakHashMap(); @@ -173,8 +182,8 @@ public class Linkage { /** * PROVISIONAL API, WORK IN PROGRESS: - * Invalidate all invokedynamic call sites associated - * with the given class. + * Invalidate all invokedynamic call sites in the bytecodes + * of any methods of the given class. * (These are exactly those sites which report the given class * via the {@link CallSite#callerClass()} method.) *

    diff --git a/src/share/classes/java/dyn/LinkagePermission.java b/src/share/classes/java/dyn/LinkagePermission.java index 6ea86f8b55539d2277038bd366891f4fda54d917..b2b2031272d51ebd29f9a2ec851e1329185a680c 100644 --- a/src/share/classes/java/dyn/LinkagePermission.java +++ b/src/share/classes/java/dyn/LinkagePermission.java @@ -88,7 +88,7 @@ public final class LinkagePermission extends BasicPermission { /** * Create a new LinkagePermission with the given name. * The name is the symbolic name of the LinkagePermission, such as - * "registerBootstrapMethod", "invalidateClass.*", etc. An asterisk + * "registerBootstrapMethod", "invalidateCallerClass.*", etc. An asterisk * may appear at the end of the name, following a ".", or by itself, to * signify a wildcard match. * diff --git a/src/share/classes/java/dyn/MethodHandle.java b/src/share/classes/java/dyn/MethodHandle.java index 688a9d3fd706d955827e4002f7563589ae4480df..25aa9862e4c19b1add101a4c6c4872b049cfaa66 100644 --- a/src/share/classes/java/dyn/MethodHandle.java +++ b/src/share/classes/java/dyn/MethodHandle.java @@ -30,6 +30,9 @@ package java.dyn; import sun.dyn.Access; import sun.dyn.MethodHandleImpl; +import static java.dyn.MethodHandles.invokers; // package-private API +import static sun.dyn.MemberName.newIllegalArgumentException; // utility + /** * A method handle is a typed reference to the entry point of a method. *

    @@ -45,8 +48,9 @@ import sun.dyn.MethodHandleImpl; * Every method handle appears as an object containing a method named * invoke, whose signature exactly matches * the method handle's type. - * A normal Java method call (using the invokevirtual instruction) - * can invoke this method from Java source code (if language support is present). + * A Java method call expression, which compiles to an + * invokevirtual instruction, + * can invoke this method from Java source code. *

    * Every call to a method handle specifies an intended method type, * which must exactly match the type of the method handle. @@ -57,6 +61,10 @@ import sun.dyn.MethodHandleImpl; * The call fails with a {@link WrongMethodTypeException} * if the method does not exist, even if there is an invoke * method of a closely similar signature. + * As with other kinds + * of methods in the JVM, signature matching during method linkage + * is exact, and does not allow for language-level implicit conversions + * such as {@code String} to {@code Object} or {@code short} to {@code int}. *

    * A method handle is an unrestricted capability to call a method. * A method handle can be formed on a non-public method by a class @@ -74,6 +82,15 @@ import sun.dyn.MethodHandleImpl; * (after resolving symbolic type names) must exactly match the method type * of the target method. *

    + * Every invoke method always throws {@link Exception}, + * which is to say that there is no static restriction on what a method handle + * can throw. Since the JVM does not distinguish between checked + * and unchecked exceptions (other than by their class, of course), + * there is no particular effect on bytecode shape from ascribing + * checked exceptions to method handle invocations. But in Java source + * code, methods which perform method handle calls must either explicitly + * throw {@code Exception}, or else must catch all checked exceptions locally. + *

    * Bytecode in an extended JVM can directly obtain a method handle * for any accessible method from a ldc instruction * which refers to a CONSTANT_Methodref or @@ -97,6 +114,59 @@ import sun.dyn.MethodHandleImpl; * can also be created. These do not perform virtual lookup based on * receiver type. Such a method handle simulates the effect of * an invokespecial instruction to the same method. + *

    + * Here are some examples of usage: + *

    + * Object x, y; String s; int i;
    + * MethodType mt; MethodHandle mh;
    + * MethodHandles.Lookup lookup = MethodHandles.lookup();
    + * // mt is {(char,char) => String}
    + * mt = MethodType.make(String.class, char.class, char.class);
    + * mh = lookup.findVirtual(String.class, "replace", mt);
    + * // (Ljava/lang/String;CC)Ljava/lang/String;
    + * s = mh.<String>invoke("daddy",'d','n');
    + * assert(s.equals("nanny"));
    + * // weakly typed invocation (using MHs.invoke)
    + * s = (String) MethodHandles.invoke(mh, "sappy", 'p', 'v');
    + * assert(s.equals("savvy"));
    + * // mt is {Object[] => List}
    + * mt = MethodType.make(java.util.List.class, Object[].class);
    + * mh = lookup.findStatic(java.util.Arrays.class, "asList", mt);
    + * // mt is {(Object,Object,Object) => Object}
    + * mt = MethodType.makeGeneric(3);
    + * mh = MethodHandles.collectArguments(mh, mt);
    + * // mt is {(Object,Object,Object) => Object}
    + * // (Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
    + * x = mh.invoke((Object)1, (Object)2, (Object)3);
    + * assert(x.equals(java.util.Arrays.asList(1,2,3)));
    + * // mt is { => int}
    + * mt = MethodType.make(int.class);
    + * mh = lookup.findVirtual(java.util.List.class, "size", mt);
    + * // (Ljava/util/List;)I
    + * i = mh.<int>invoke(java.util.Arrays.asList(1,2,3));
    + * assert(i == 3);
    + * 
    + * Each of the above calls generates a single invokevirtual instruction + * with the name {@code invoke} and the type descriptors indicated in the comments. + * The argument types are taken directly from the actual arguments, + * while the return type is taken from the type parameter. + * (This type parameter may be a primitive, and it defaults to {@code Object}.) + *

    + * A note on generic typing: Method handles do not represent + * their function types in terms of Java parameterized (generic) types, + * because there are three mismatches between function types and parameterized + * Java types. + *

      + *
    1. Method types range over all possible arities, + * from no arguments to an arbitrary number of arguments. + * Generics are not variadic, and so cannot represent this.
    2. + *
    3. Method types can specify arguments of primitive types, + * which Java generic types cannot range over.
    4. + *
    5. Higher order functions over method handles (combinators) are + * often generic across a wide range of function types, including + * those of multiple arities. It is impossible to represent such + * genericity with a Java type parameter.
    6. + *
    * * @see MethodType * @see MethodHandles @@ -107,17 +177,19 @@ public abstract class MethodHandle // with a JVM change which moves the required hidden state onto this class. extends MethodHandleImpl { - // interface MethodHandle> - // { T type(); public R invoke(A...); } + private static Access IMPL_TOKEN = Access.getToken(); - final private MethodType type; + // interface MethodHandle + // { MethodType type(); public R invoke(A...) throws X; } + + private MethodType type; /** * Report the type of this method handle. * Every invocation of this method handle must exactly match this type. * @return the method handle type */ - public MethodType type() { + public final MethodType type() { return type; } @@ -130,6 +202,369 @@ public abstract class MethodHandle */ protected MethodHandle(Access token, MethodType type) { super(token); + Access.check(token); + this.type = type; + } + + private void initType(MethodType type) { + type.getClass(); // elicit NPE + if (this.type != null) throw new InternalError(); this.type = type; } + + static { + // This hack allows the implementation package special access to + // the internals of MethodHandle. In particular, the MTImpl has all sorts + // of cached information useful to the implementation code. + MethodHandleImpl.setMethodHandleFriend(IMPL_TOKEN, new MethodHandleImpl.MethodHandleFriend() { + public void initType(MethodHandle mh, MethodType type) { mh.initType(type); } + }); + } + + /** The string of a direct method handle is the simple name of its target method. + * The string of an adapter or bound method handle is the string of its + * target method handle. + * The string of a Java method handle is the string of its entry point method, + * unless the Java method handle overrides the toString method. + */ + @Override + public String toString() { + return MethodHandleImpl.getNameString(IMPL_TOKEN, this); + } + + //// First draft of the "Method Handle Kernel API" discussed at the JVM Language Summit, 9/2009. + //// Implementations here currently delegate to statics in MethodHandles. Some of those statics + //// will be deprecated. Others will be kept as "algorithms" to supply degrees of freedom + //// not present in the Kernel API. + + /** + * PROVISIONAL API, WORK IN PROGRESS: + * Perform an exact invocation. The signature at the call site of {@code invokeExact} must + * exactly match this method handle's {@code type}. + * No conversions are allowed on arguments or return values. + * This is not yet implemented, pending required compiler and JVM support. + */ + public final T invokeExact(Object... arguments) throws Throwable { + // This is an approximate implementation, which discards the caller's signature and refuses the call. + throw new InternalError("not yet implemented"); + } + + /** + * PROVISIONAL API, WORK IN PROGRESS: + * Perform a generic invocation. The signature at the call site of {@code invokeExact} must + * have the same arity as this method handle's {@code type}. + * The same conversions are allowed on arguments or return values as are supported by + * by {@link MethodHandles#convertArguments}. + * If the call site signature exactly matches this method handle's {@code type}, + * the call proceeds as if by {@link #invokeExact}. + * This is not fully implemented, pending required compiler and JVM support. + */ + // This is an approximate implementation, which discards the caller's signature. + // When it is made signature polymorphic, the overloadings will disappear. + public final T invokeGeneric() throws Throwable { + MethodHandle invoker = invokers(this.type()).genericInvoker(); + return invoker.invoke(this); + } + public final T invokeGeneric(Object a0) throws Throwable { + MethodHandle invoker = invokers(this.type()).genericInvoker(); + return invoker.invoke(this, a0); + } + public final T invokeGeneric(Object a0, Object a1) throws Throwable { + MethodHandle invoker = invokers(this.type()).genericInvoker(); + return invoker.invoke(this, a0, a1); + } + public final T invokeGeneric(Object a0, Object a1, Object a2) throws Throwable { + MethodHandle invoker = invokers(this.type()).genericInvoker(); + return invoker.invoke(this, a0, a1, a2); + } + public final T invokeGeneric(Object a0, Object a1, Object a2, Object a3) throws Throwable { + MethodHandle invoker = invokers(this.type()).genericInvoker(); + return invoker.invoke(this, a0, a1, a2, a3); + } + public final T invokeGeneric(Object a0, Object a1, Object a2, Object a3, + Object a4) throws Throwable { + MethodHandle invoker = invokers(this.type()).genericInvoker(); + return invoker.invoke(this, a0, a1, a2, a3, a4); + } + public final T invokeGeneric(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5) throws Throwable { + MethodHandle invoker = invokers(this.type()).genericInvoker(); + return invoker.invoke(this, a0, a1, a2, a3, a4, a5); + } + public final T invokeGeneric(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6) throws Throwable { + MethodHandle invoker = invokers(this.type()).genericInvoker(); + return invoker.invoke(this, a0, a1, a2, a3, a4, a5, a6); + } + public final T invokeGeneric(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7) throws Throwable { + MethodHandle invoker = invokers(this.type()).genericInvoker(); + return invoker.invoke(this, a0, a1, a2, a3, a4, a5, a6, a7); + } + public final T invokeGeneric(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, Object a8) throws Throwable { + MethodHandle invoker = invokers(this.type()).genericInvoker(); + return invoker.invoke(this, a0, a1, a2, a3, a4, a5, a6, a7, a8); + } + public final T invokeGeneric(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, Object a8, Object a9) throws Throwable { + MethodHandle invoker = invokers(this.type()).genericInvoker(); + return invoker.invoke(this, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); + } + + /** + * PROVISIONAL API, WORK IN PROGRESS: + * Perform a varargs invocation, passing the arguments in the given array + * to the method handle, as if via {@link #invokeGeneric} from a call site + * which mentions only the type {@code Object}, and whose arity is the length + * of the argument array. + *

    + * The length of the arguments array must equal the parameter count + * of the target's type. + * The arguments array is spread into separate arguments. + *

    + * In order to match the type of the target, the following argument + * conversions are applied as necessary: + *

      + *
    • reference casting + *
    • unboxing + *
    + * The following conversions are not applied: + *
      + *
    • primitive conversions (e.g., {@code byte} to {@code int} + *
    • varargs conversions other than the initial spread + *
    • any application-specific conversions (e.g., string to number) + *
    + * The result returned by the call is boxed if it is a primitive, + * or forced to null if the return type is void. + *

    + * This call is equivalent to the following code: + *

    +     *   MethodHandle invoker = MethodHandles.genericInvoker(this.type(), 0, true);
    +     *   Object result = invoker.invoke(this, arguments);
    +     * 
    + * @param arguments the arguments to pass to the target + * @return the result returned by the target + * @see MethodHandles#genericInvoker + */ + public final Object invokeVarargs(Object[] arguments) throws Throwable { + int argc = arguments == null ? 0 : arguments.length; + MethodType type = type(); + if (argc <= 10) { + MethodHandle invoker = MethodHandles.invokers(type).genericInvoker(); + switch (argc) { + case 0: return invoker.invoke(this); + case 1: return invoker.invoke(this, + arguments[0]); + case 2: return invoker.invoke(this, + arguments[0], arguments[1]); + case 3: return invoker.invoke(this, + arguments[0], arguments[1], arguments[2]); + case 4: return invoker.invoke(this, + arguments[0], arguments[1], arguments[2], + arguments[3]); + case 5: return invoker.invoke(this, + arguments[0], arguments[1], arguments[2], + arguments[3], arguments[4]); + case 6: return invoker.invoke(this, + arguments[0], arguments[1], arguments[2], + arguments[3], arguments[4], arguments[5]); + case 7: return invoker.invoke(this, + arguments[0], arguments[1], arguments[2], + arguments[3], arguments[4], arguments[5], + arguments[6]); + case 8: return invoker.invoke(this, + arguments[0], arguments[1], arguments[2], + arguments[3], arguments[4], arguments[5], + arguments[6], arguments[7]); + case 9: return invoker.invoke(this, + arguments[0], arguments[1], arguments[2], + arguments[3], arguments[4], arguments[5], + arguments[6], arguments[7], arguments[8]); + case 10: return invoker.invoke(this, + arguments[0], arguments[1], arguments[2], + arguments[3], arguments[4], arguments[5], + arguments[6], arguments[7], arguments[8], + arguments[9]); + } + } + + // more than ten arguments get boxed in a varargs list: + MethodHandle invoker = MethodHandles.invokers(type).varargsInvoker(0); + return invoker.invoke(this, arguments); + } + /** Equivalent to {@code invokeVarargs(arguments.toArray())}. */ + public final Object invokeVarargs(java.util.List arguments) throws Throwable { + return invokeVarargs(arguments.toArray()); + } + + /* --- this is intentionally NOT a javadoc yet --- + * PROVISIONAL API, WORK IN PROGRESS: + * Produce an adapter method handle which adapts the type of the + * current method handle to a new type by pairwise argument conversion. + * The original type and new type must have the same number of arguments. + * The resulting method handle is guaranteed to confess a type + * which is equal to the desired new type. + *

    + * If the original type and new type are equal, returns {@code this}. + *

    + * The following conversions are applied as needed both to + * arguments and return types. Let T0 and T1 be the differing + * new and old parameter types (or old and new return types) + * for corresponding values passed by the new and old method types. + * Given those types T0, T1, one of the following conversions is applied + * if possible: + *

      + *
    • If T0 and T1 are references, and T1 is not an interface type, + * then a cast to T1 is applied. + * (The types do not need to be related in any particular way.) + *
    • If T0 and T1 are references, and T1 is an interface type, + * then the value of type T0 is passed as a T1 without a cast. + * (This treatment of interfaces follows the usage of the bytecode verifier.) + *
    • If T0 and T1 are primitives, then a Java casting + * conversion (JLS 5.5) is applied, if one exists. + *
    • If T0 and T1 are primitives and one is boolean, + * the boolean is treated as a one-bit unsigned integer. + * (This treatment follows the usage of the bytecode verifier.) + * A conversion from another primitive type behaves as if + * it first converts to byte, and then masks all but the low bit. + *
    • If T0 is a primitive and T1 a reference, a boxing + * conversion is applied if one exists, possibly followed by + * an reference conversion to a superclass. + * T1 must be a wrapper class or a supertype of one. + * If T1 is a wrapper class, T0 is converted if necessary + * to T1's primitive type by one of the preceding conversions. + * Otherwise, T0 is boxed, and its wrapper converted to T1. + *
    • If T0 is a reference and T1 a primitive, an unboxing + * conversion is applied if one exists, possibly preceded by + * a reference conversion to a wrapper class. + * T0 must be a wrapper class or a supertype of one. + * If T0 is a wrapper class, its primitive value is converted + * if necessary to T1 by one of the preceding conversions. + * Otherwise, T0 is converted directly to the wrapper type for T1, + * which is then unboxed. + *
    • If the return type T1 is void, any returned value is discarded + *
    • If the return type T0 is void and T1 a reference, a null value is introduced. + *
    • If the return type T0 is void and T1 a primitive, a zero value is introduced. + *
    + *

    + */ + /** + * PROVISIONAL API, WORK IN PROGRESS: + * Produce an adapter method handle which adapts the type of the + * current method handle to a new type by pairwise argument conversion. + * The original type and new type must have the same number of arguments. + * The resulting method handle is guaranteed to confess a type + * which is equal to the desired new type. + *

    + * If the original type and new type are equal, returns {@code this}. + *

    + * This method is equivalent to {@link MethodHandles#convertArguments}. + * @param newType the expected type of the new method handle + * @return a method handle which delegates to {@code this} after performing + * any necessary argument conversions, and arranges for any + * necessary return value conversions + * @throws IllegalArgumentException if the conversion cannot be made + * @see MethodHandles#convertArguments + */ + public final MethodHandle asType(MethodType newType) { + return MethodHandles.convertArguments(this, newType); + } + + /** + * PROVISIONAL API, WORK IN PROGRESS: + * Produce a method handle which adapts, as its target, + * the current method handle. The type of the adapter will be + * the same as the type of the target, except that all but the first + * {@code keepPosArgs} parameters of the target's type are replaced + * by a single array parameter of type {@code Object[]}. + * Thus, if {@code keepPosArgs} is zero, the adapter will take all + * arguments in a single object array. + *

    + * When called, the adapter replaces a trailing array argument + * by the array's elements, each as its own argument to the target. + * (The order of the arguments is preserved.) + * They are converted pairwise by casting and/or unboxing + * (as if by {@link MethodHandles#convertArguments}) + * to the types of the trailing parameters of the target. + * Finally the target is called. + * What the target eventually returns is returned unchanged by the adapter. + *

    + * Before calling the target, the adapter verifies that the array + * contains exactly enough elements to provide a correct argument count + * to the target method handle. + * (The array may also be null when zero elements are required.) + * @param keepPosArgs the number of leading positional arguments to preserve + * @return a new method handle which spreads its final argument, + * before calling the original method handle + * @throws IllegalArgumentException if target does not have at least + * {@code keepPosArgs} parameter types + */ + public final MethodHandle asSpreader(int keepPosArgs) { + MethodType oldType = type(); + int nargs = oldType.parameterCount(); + MethodType newType = oldType.dropParameterTypes(keepPosArgs, nargs); + newType = newType.insertParameterTypes(keepPosArgs, Object[].class); + return MethodHandles.spreadArguments(this, newType); + } + + /** + * PROVISIONAL API, WORK IN PROGRESS: + * Produce a method handle which adapts, as its target, + * the current method handle. The type of the adapter will be + * the same as the type of the target, except that a single trailing + * array parameter of type {@code Object[]} is replaced by + * {@code spreadArrayArgs} parameters of type {@code Object}. + *

    + * When called, the adapter replaces its trailing {@code spreadArrayArgs} + * arguments by a single new {@code Object} array, whose elements + * comprise (in order) the replaced arguments. + * Finally the target is called. + * What the target eventually returns is returned unchanged by the adapter. + *

    + * (The array may also be a shared constant when {@code spreadArrayArgs} is zero.) + * @param spreadArrayArgs the number of arguments to spread from the trailing array + * @return a new method handle which collects some trailing argument + * into an array, before calling the original method handle + * @throws IllegalArgumentException if the last argument of the target + * is not {@code Object[]} + * @throws IllegalArgumentException if {@code spreadArrayArgs} is not + * a legal array size + * @deprecated Provisional and unstable; use {@link MethodHandles#collectArguments}. + */ + public final MethodHandle asCollector(int spreadArrayArgs) { + MethodType oldType = type(); + int nargs = oldType.parameterCount(); + MethodType newType = oldType.dropParameterTypes(nargs-1, nargs); + newType = newType.insertParameterTypes(nargs-1, MethodType.genericMethodType(spreadArrayArgs).parameterArray()); + return MethodHandles.collectArguments(this, newType); + } + + /** + * PROVISIONAL API, WORK IN PROGRESS: + * Produce a method handle which binds the given argument + * to the current method handle as target. + * The type of the bound handle will be + * the same as the type of the target, except that a single leading + * reference parameter will be omitted. + *

    + * When called, the bound handle inserts the given value {@code x} + * as a new leading argument to the target. The other arguments are + * also passed unchanged. + * What the target eventually returns is returned unchanged by the bound handle. + *

    + * The reference {@code x} must be convertible to the first parameter + * type of the target. + * @param x the value to bind to the first argument of the target + * @return a new method handle which collects some trailing argument + * into an array, before calling the original method handle + * @throws IllegalArgumentException if the target does not have a + * leading parameter type that is a reference type + * @throws ClassCastException if {@code x} cannot be converted + * to the leading parameter type of the target + * @deprecated Provisional and unstable; use {@link MethodHandles#insertArguments}. + */ + public final MethodHandle bindTo(Object x) { + return MethodHandles.insertArguments(this, 0, x); + } } diff --git a/src/share/classes/java/dyn/MethodHandles.java b/src/share/classes/java/dyn/MethodHandles.java index 3a9f7ed3e972eb106955f7a30529f279f7bad591..06ac809a97466c17db6bd2fe9350d1752c08c08c 100644 --- a/src/share/classes/java/dyn/MethodHandles.java +++ b/src/share/classes/java/dyn/MethodHandles.java @@ -34,6 +34,7 @@ import sun.dyn.util.Wrapper; import java.lang.reflect.Field; import java.lang.reflect.Method; import java.lang.reflect.Modifier; +import java.util.List; import java.util.ArrayList; import java.util.Arrays; import sun.dyn.Invokers; @@ -44,17 +45,14 @@ import static sun.dyn.MemberName.newNoAccessException; /** * Fundamental operations and utilities for MethodHandle. + * They fall into several categories: + *

      + *
    • Reifying methods and fields. This is subject to access checks. + *
    • Invoking method handles on dynamically typed arguments and/or varargs arrays. + *
    • Combining or transforming pre-existing method handles into new ones. + *
    • Miscellaneous emulation of common JVM operations or control flow patterns. + *
    *

    - * API Note: The matching of method types in this API cannot - * be completely checked by Java's generic type system for three reasons: - *

      - *
    1. Method types range over all possible arities, - * from no arguments to an arbitrary number of arguments. - * Generics are not variadic, and so cannot represent this.
    2. - *
    3. Method types can specify arguments of primitive types, - * which Java generic types cannot range over.
    4. - *
    5. Method types can optionally specify varargs (ellipsis).
    6. - *
    * @author John Rose, JSR 292 EG */ public class MethodHandles { @@ -68,12 +66,22 @@ public class MethodHandles { //// Method handle creation from ordinary methods. + /** Create a {@link Lookup} lookup object on the caller. + * + */ public static Lookup lookup() { return new Lookup(); } + /** Version of lookup which is trusted minimally. + * It can only be used to create method handles to + * publicly accessible members. + */ + public static Lookup publicLookup() { + return Lookup.PUBLIC_LOOKUP; + } + /** - * PROVISIONAL API, WORK IN PROGRESS: * A factory object for creating method handles, when the creation * requires access checking. Method handles do not perform * access checks when they are called; this is a major difference @@ -121,7 +129,8 @@ public class MethodHandles { /** Which class is performing the lookup? It is this class against * which checks are performed for visibility and access permissions. *

    - * This value is null if and only if this lookup is {@link #PUBLIC_LOOKUP}. + * This value is null if and only if this lookup was produced + * by {@link MethodHandles#publicLookup}. */ public Class lookupClass() { return lookupClass; @@ -135,23 +144,46 @@ public class MethodHandles { * an access$N method. */ Lookup() { - Class caller = getCallerClassAtEntryPoint(); - // make sure we haven't accidentally picked up this class: - checkUnprivilegedlookupClass(caller); - this.lookupClass = caller; + this(IMPL_TOKEN, getCallerClassAtEntryPoint()); + } + + Lookup(Access token, Class lookupClass) { + // make sure we haven't accidentally picked up a privileged class: + checkUnprivilegedlookupClass(lookupClass); + this.lookupClass = lookupClass; + } + + /** + * Create a lookup on the specified class. + * The result is guaranteed to have no more access privileges + * than the original. + */ + public Lookup in(Class newLookupClass) { + if (this == PUBLIC_LOOKUP) return PUBLIC_LOOKUP; + if (newLookupClass == null) return PUBLIC_LOOKUP; + if (newLookupClass == lookupClass) return this; + if (this != IMPL_LOOKUP) { + if (!VerifyAccess.isSamePackage(lookupClass, newLookupClass)) + throw newNoAccessException(new MemberName(newLookupClass), this); + checkUnprivilegedlookupClass(newLookupClass); + } + return new Lookup(newLookupClass); } private Lookup(Class lookupClass) { this.lookupClass = lookupClass; } + // Make sure outer class is initialized first. + static { IMPL_TOKEN.getClass(); } + private static final Class PUBLIC_ONLY = sun.dyn.empty.Empty.class; /** Version of lookup which is trusted minimally. * It can only be used to create method handles to * publicly accessible members. */ - public static final Lookup PUBLIC_LOOKUP = new Lookup(PUBLIC_ONLY); + static final Lookup PUBLIC_LOOKUP = new Lookup(PUBLIC_ONLY); /** Package-private version of lookup which is trusted. */ static final Lookup IMPL_LOOKUP = new Lookup(null); @@ -178,12 +210,16 @@ public class MethodHandles { // 0: Reflection.getCC, 1: getCallerClassAtEntryPoint, // 2: Lookup., 3: MethodHandles.*, 4: caller // Note: This should be the only use of getCallerClass in this file. + assert(Reflection.getCallerClass(CALLER_DEPTH-1) == MethodHandles.class); return Reflection.getCallerClass(CALLER_DEPTH); } /** * Produce a method handle for a static method. * The type of the method handle will be that of the method. + * (Since static methods do not take receivers, there is no + * additional receiver argument inserted into the method handle type, + * as there would be with {@linkplain #findVirtual} or {@linkplain #findSpecial}.) * The method and all its argument types must be accessible to the lookup class. * If the method's class has not yet been initialized, that is done * immediately, before the method handle is returned. @@ -196,10 +232,11 @@ public class MethodHandles { */ public MethodHandle findStatic(Class defc, String name, MethodType type) throws NoAccessException { - MemberName method = IMPL_NAMES.resolveOrFail(new MemberName(defc, name, type, Modifier.STATIC), true, lookupClass); - checkStatic(true, method, lookupClass); + MemberName method = IMPL_NAMES.resolveOrFail(new MemberName(defc, name, type, Modifier.STATIC), true, lookupClass()); + VerifyAccess.checkName(method, this); + checkStatic(true, method, this); //throw NoSuchMethodException - return MethodHandleImpl.findMethod(IMPL_TOKEN, method, false, lookupClass); + return MethodHandleImpl.findMethod(IMPL_TOKEN, method, false, lookupClass()); } /** @@ -228,9 +265,10 @@ public class MethodHandles { * @exception NoAccessException if the method does not exist or access checking fails */ public MethodHandle findVirtual(Class defc, String name, MethodType type) throws NoAccessException { - MemberName method = IMPL_NAMES.resolveOrFail(new MemberName(defc, name, type), true, lookupClass); - checkStatic(false, method, lookupClass); - return MethodHandleImpl.findMethod(IMPL_TOKEN, method, true, lookupClass); + MemberName method = IMPL_NAMES.resolveOrFail(new MemberName(defc, name, type), true, lookupClass()); + VerifyAccess.checkName(method, this); + checkStatic(false, method, this); + return MethodHandleImpl.findMethod(IMPL_TOKEN, method, true, lookupClass()); } /** @@ -259,15 +297,17 @@ public class MethodHandles { */ public MethodHandle findSpecial(Class defc, String name, MethodType type, Class specialCaller) throws NoAccessException { - checkSpecialCaller(specialCaller, lookupClass); - MemberName method = IMPL_NAMES.resolveOrFail(new MemberName(defc, name, type), false, specialCaller); - checkStatic(false, method, lookupClass); + checkSpecialCaller(specialCaller, this); + Lookup slookup = this.in(specialCaller); + MemberName method = IMPL_NAMES.resolveOrFail(new MemberName(defc, name, type), false, slookup.lookupClass()); + VerifyAccess.checkName(method, this); + checkStatic(false, method, this); if (name.equals("")) { throw newNoAccessException("cannot directly invoke a constructor", method, null); } else if (defc.isInterface() || !defc.isAssignableFrom(specialCaller)) { - throw newNoAccessException("method must be in a superclass of lookup class", method, lookupClass); + throw newNoAccessException("method must be in a superclass of lookup class", method, slookup.lookupClass()); } - return MethodHandleImpl.findMethod(IMPL_TOKEN, method, false, specialCaller); + return MethodHandleImpl.findMethod(IMPL_TOKEN, method, false, slookup.lookupClass()); } /** @@ -275,13 +315,19 @@ public class MethodHandles { * The receiver must have a supertype {@code defc} in which a method * of the given name and type is accessible to the lookup class. * The method and all its argument types must be accessible to the lookup class. - * The type of the method handle will be that of the method. - * The given receiver will be bound into the method handle. + * The type of the method handle will be that of the method, + * without any insertion of an additional receiver parameter. + * The given receiver will be bound into the method handle, + * so that every call to the method handle will invoke the + * requested method on the given receiver. *

    - * Equivalent to the following expression: + * This is equivalent to the following expression: * - * {@link #insertArgument}({@link #findVirtual}(defc, name, type), receiver) + * {@link #insertArguments}({@link #findVirtual}(defc, name, type), receiver) * + * where {@code defc} is either {@code receiver.getClass()} or a super + * type of that class, in which the requested method is accessible + * to the lookup class. * @param receiver the object from which the method is accessed * @param name the name of the method * @param type the type of the method, with the receiver argument omitted @@ -292,16 +338,18 @@ public class MethodHandles { public MethodHandle bind(Object receiver, String name, MethodType type) throws NoAccessException { Class rcvc = receiver.getClass(); // may get NPE MemberName reference = new MemberName(rcvc, name, type); - MemberName method = IMPL_NAMES.resolveOrFail(reference, true, lookupClass); - checkStatic(false, method, lookupClass); - MethodHandle dmh = MethodHandleImpl.findMethod(IMPL_TOKEN, method, true, lookupClass); + MemberName method = IMPL_NAMES.resolveOrFail(reference, true, lookupClass()); + VerifyAccess.checkName(method, this); + checkStatic(false, method, this); + MethodHandle dmh = MethodHandleImpl.findMethod(IMPL_TOKEN, method, true, lookupClass()); MethodHandle bmh = MethodHandleImpl.bindReceiver(IMPL_TOKEN, dmh, receiver); if (bmh == null) - throw newNoAccessException(method, lookupClass); + throw newNoAccessException(method, this); return bmh; } /** + * PROVISIONAL API, WORK IN PROGRESS: * Make a direct method handle to m, if the lookup class has permission. * If m is non-static, the receiver argument is treated as an initial argument. * If m is virtual, overriding is respected on every call. @@ -316,10 +364,11 @@ public class MethodHandles { * @exception NoAccessException if access checking fails */ public MethodHandle unreflect(Method m) throws NoAccessException { - return unreflectImpl(new MemberName(m), m.isAccessible(), true, lookupClass); + return unreflectImpl(new MemberName(m), m.isAccessible(), true, false, this); } /** + * PROVISIONAL API, WORK IN PROGRESS: * Produce a method handle for a reflected method. * It will bypass checks for overriding methods on the receiver, * as if by the {@code invokespecial} instruction. @@ -333,37 +382,41 @@ public class MethodHandles { * @exception NoAccessException if access checking fails */ public MethodHandle unreflectSpecial(Method m, Class specialCaller) throws NoAccessException { - checkSpecialCaller(specialCaller, lookupClass); + checkSpecialCaller(specialCaller, this); + Lookup slookup = this.in(specialCaller); MemberName mname = new MemberName(m); - checkStatic(false, mname, lookupClass); - return unreflectImpl(mname, m.isAccessible(), false, specialCaller); + checkStatic(false, mname, this); + return unreflectImpl(mname, m.isAccessible(), false, false, slookup); } /** + * PROVISIONAL API, WORK IN PROGRESS: * Produce a method handle for a reflected constructor. - * The type of the method handle will be that of the constructor. + * The type of the method handle will be that of the constructor, + * with the return type changed to the declaring class. * The method handle will perform a {@code newInstance} operation, * creating a new instance of the constructor's class on the * arguments passed to the method handle. *

    * If the constructor's {@code accessible} flag is not set, - * access checking is performed immediately on behalf of the lookup class, - * as if {@code invokespecial} instruction were being linked. + * access checking is performed immediately on behalf of the lookup class. * @param ctor the reflected constructor * @return a method handle which can invoke the reflected constructor * @exception NoAccessException if access checking fails */ public MethodHandle unreflectConstructor(Constructor ctor) throws NoAccessException { MemberName m = new MemberName(ctor); - return unreflectImpl(m, ctor.isAccessible(), false, lookupClass); + return unreflectImpl(m, ctor.isAccessible(), false, false, this); } /** * PROVISIONAL API, WORK IN PROGRESS: * Produce a method handle giving read access to a reflected field. * The type of the method handle will have a return type of the field's - * value type. Its sole argument will be the field's containing class - * (but only if it is non-static). + * value type. + * If the field is static, the method handle will take no arguments. + * Otherwise, its single argument will be the instance containing + * the field. * If the method's {@code accessible} flag is not set, * access checking is performed immediately on behalf of the lookup class. * @param f the reflected field @@ -371,16 +424,18 @@ public class MethodHandles { * @exception NoAccessException if access checking fails */ public MethodHandle unreflectGetter(Field f) throws NoAccessException { - return MethodHandleImpl.accessField(IMPL_TOKEN, new MemberName(f), false, lookupClass); + MemberName m = new MemberName(f); + return unreflectImpl(m, f.isAccessible(), false, false, this); } /** * PROVISIONAL API, WORK IN PROGRESS: * Produce a method handle giving write access to a reflected field. * The type of the method handle will have a void return type. - * Its last argument will be the field's value type. - * Its other argument will be the field's containing class - * (but only if it is non-static). + * If the field is static, the method handle will take a single + * argument, of the field's value type, the value to be stored. + * Otherwise, the two arguments will be the instance containing + * the field, and the value to be stored. * If the method's {@code accessible} flag is not set, * access checking is performed immediately on behalf of the lookup class. * @param f the reflected field @@ -388,59 +443,75 @@ public class MethodHandles { * @exception NoAccessException if access checking fails */ public MethodHandle unreflectSetter(Field f) throws NoAccessException { - return MethodHandleImpl.accessField(IMPL_TOKEN, new MemberName(f), true, lookupClass); + MemberName m = new MemberName(f); + return unreflectImpl(m, f.isAccessible(), false, true, this); } } static /*must not be public*/ - MethodHandle findStaticFrom(Class lookupClass, + MethodHandle findStaticFrom(Lookup lookup, Class defc, String name, MethodType type) throws NoAccessException { - MemberName method = IMPL_NAMES.resolveOrFail(new MemberName(defc, name, type, Modifier.STATIC), true, lookupClass); - checkStatic(true, method, lookupClass); - return MethodHandleImpl.findMethod(IMPL_TOKEN, method, false, lookupClass); + MemberName method = IMPL_NAMES.resolveOrFail(new MemberName(defc, name, type, Modifier.STATIC), true, lookup.lookupClass()); + VerifyAccess.checkName(method, lookup); + checkStatic(true, method, lookup); + return MethodHandleImpl.findMethod(IMPL_TOKEN, method, false, lookup.lookupClass()); } - static void checkStatic(boolean wantStatic, MemberName m, Class lookupClass) { + static void checkStatic(boolean wantStatic, MemberName m, Lookup lookup) { if (wantStatic != m.isStatic()) { String message = wantStatic ? "expected a static method" : "expected a non-static method"; - throw newNoAccessException(message, m, lookupClass); + throw newNoAccessException(message, m, lookup.lookupClass()); } } - static void checkSpecialCaller(Class specialCaller, Class lookupClass) { - if (lookupClass == Lookup.IMPL_LOOKUP.lookupClass()) + static void checkSpecialCaller(Class specialCaller, Lookup lookup) { + if (lookup == Lookup.IMPL_LOOKUP) return; // privileged action - if (lookupClass == null || // public-only access - !VerifyAccess.isSamePackageMember(specialCaller, lookupClass)) - throw newNoAccessException("no private access", new MemberName(specialCaller), lookupClass); + assert(lookup.lookupClass() != null); + if (!VerifyAccess.isSamePackageMember(specialCaller, lookup.lookupClass())) + throw newNoAccessException("no private access", new MemberName(specialCaller), lookup.lookupClass()); } // Helper for creating handles on reflected methods and constructors. static MethodHandle unreflectImpl(MemberName m, boolean isAccessible, - boolean doDispatch, Class lookupClass) { - MethodType mtype = m.getInvocationType(); + boolean doDispatch, boolean isSetter, Lookup lookup) { + MethodType narrowMethodType = null; Class defc = m.getDeclaringClass(); + boolean isSpecialInvoke = m.isInvocable() && !doDispatch; int mods = m.getModifiers(); if (m.isStatic()) { if (!isAccessible && - VerifyAccess.isAccessible(defc, mods, false, lookupClass) == null) - throw newNoAccessException(m, lookupClass); + VerifyAccess.isAccessible(defc, mods, lookup.lookupClass(), false) == null) + throw newNoAccessException(m, lookup); } else { Class constraint; if (isAccessible) { // abbreviated access check for "unlocked" method - constraint = doDispatch ? defc : lookupClass; + constraint = doDispatch ? defc : lookup.lookupClass(); } else { - constraint = VerifyAccess.isAccessible(defc, mods, doDispatch, lookupClass); + constraint = VerifyAccess.isAccessible(defc, mods, lookup.lookupClass(), isSpecialInvoke); + } + if (constraint == null) { + throw newNoAccessException(m, lookup); } if (constraint != defc && !constraint.isAssignableFrom(defc)) { if (!defc.isAssignableFrom(constraint)) - throw newNoAccessException("receiver must be in caller class", m, lookupClass); - mtype = mtype.changeParameterType(0, constraint); + throw newNoAccessException("receiver must be in caller class", m, lookup.lookupClass()); + if (m.isInvocable()) + narrowMethodType = m.getInvocationType().changeParameterType(0, constraint); + else if (m.isField()) + narrowMethodType = (!isSetter + ? MethodType.methodType(m.getFieldType(), constraint) + : MethodType.methodType(void.class, constraint, m.getFieldType())); } } - return MethodHandleImpl.findMethod(IMPL_TOKEN, m, doDispatch, lookupClass); + if (m.isInvocable()) + return MethodHandleImpl.findMethod(IMPL_TOKEN, m, doDispatch, lookup.lookupClass()); + else if (m.isField()) + return MethodHandleImpl.accessField(IMPL_TOKEN, m, isSetter, lookup.lookupClass()); + else + throw new InternalError(); } /** @@ -472,138 +543,104 @@ public class MethodHandles { return MethodHandleImpl.accessArrayElement(IMPL_TOKEN, arrayClass, true); } - /// method handle invocation (reflective style) /** - * PROVISIONAL API, WORK IN PROGRESS: - * Call the {@code invoke} method of a given method handle, - * with arguments that exactly match the parameter types of the method handle. - * The length of the arguments array must equal the parameter count - * of the target's type. - * The arguments array is spread into separate arguments, and - * basic reference and unboxing conversions are applied. - *

    - * In order to match the type of the target, the following argument - * conversions are applied as necessary: - *

      - *
    • reference casting - *
    • unboxing - *
    - * The following conversions are not applied: - *
      - *
    • primitive conversions (e.g., {@code byte} to {@code int} - *
    • varargs conversions other than the initial spread - *
    • any application-specific conversions (e.g., string to number) - *
    - * The result returned by the call is boxed if it is a primitive, - * or forced to null if the return type is void. - *

    - * This call is a convenience method for the following code: - *

    -     *   MethodHandle invoker = MethodHandles.genericInvoker(target.type(), 0, true);
    -     *   Object result = invoker.invoke(arguments);
    -     * 
    - * @param target the method handle to invoke - * @param arguments the arguments to pass to the target - * @return the result returned by the target + * @deprecated Alias for MethodHandle.invokeVarargs. */ + @Deprecated public static - Object invoke(MethodHandle target, Object... arguments) { - int argc = arguments == null ? 0 : arguments.length; - MethodType type = target.type(); - if (argc <= 4) { - MethodHandle invoker = invokers(type).genericInvoker(); - switch (argc) { - case 0: return invoker.invoke(target); - case 1: return invoker.invoke(target, - arguments[0]); - case 2: return invoker.invoke(target, - arguments[0], arguments[1]); - case 3: return invoker.invoke(target, - arguments[0], arguments[1], arguments[2]); - case 4: return invoker.invoke(target, - arguments[0], arguments[1], arguments[2], arguments[3]); - } - } - MethodHandle invoker = invokers(type).varargsInvoker(); - return invoker.invoke(target, arguments); + Object invokeVarargs(MethodHandle target, Object... arguments) throws Throwable { + return target.invokeVarargs(arguments); } + /** + * @deprecated Alias for MethodHandle.invokeVarargs. + */ + @Deprecated public static - Object invoke_0(MethodHandle target) { - MethodHandle invoker = invokers(target.type()).genericInvoker(); - return invoker.invoke(target); - } - public static - Object invoke_1(MethodHandle target, Object a0) { - MethodHandle invoker = invokers(target.type()).genericInvoker(); - return invoker.invoke(target, a0); - } - public static - Object invoke_2(MethodHandle target, Object a0, Object a1) { - MethodHandle invoker = invokers(target.type()).genericInvoker(); - return invoker.invoke(target, a0, a1); - } - public static - Object invoke_3(MethodHandle target, Object a0, Object a1, Object a2) { - MethodHandle invoker = invokers(target.type()).genericInvoker(); - return invoker.invoke(target, a0, a1, a2); - } - public static - Object invoke_4(MethodHandle target, Object a0, Object a1, Object a2, Object a3) { - MethodHandle invoker = invokers(target.type()).genericInvoker(); - return invoker.invoke(target, a0, a1, a2, a3); + Object invoke(MethodHandle target, Object... arguments) throws Throwable { + return target.invokeVarargs(arguments); } /** * PROVISIONAL API, WORK IN PROGRESS: - * Give a method handle which will invoke any method handle of the + * Produce a method handle which will invoke any method handle of the * given type on a standard set of {@code Object} type arguments. - * The the resulting invoker will be a method handle with the following + * The resulting invoker will be a method handle with the following * arguments: *
      *
    • a single {@code MethodHandle} target - *
    • zero or more {@code Object} values - *
    • an optional {@code Object[]} array containing more arguments + *
    • zero or more {@code Object} values (one for each argument in {@code type}) *
    - * The invoker will spread the varargs array (if present), apply - * reference casts as necessary, and unbox primitive arguments. + * The invoker will apply reference casts as necessary and unbox primitive arguments, + * as if by {@link #convertArguments}. * The return value of the invoker will be an {@code Object} reference, * boxing a primitive value if the original type returns a primitive, * and always null if the original type returns void. *

    - * This is a convenience method equivalent to the following code: - *

    +     * This method is equivalent to the following code (though it may be more efficient):
    +     * 

          * MethodHandle invoker = exactInvoker(type);
    -     * MethodType genericType = MethodType.makeGeneric(objectArgCount, varargs);
    +     * MethodType genericType = type.generic();
          * genericType = genericType.insertParameterType(0, MethodHandle.class);
    -     * if (!varargs)
    -     *     return convertArguments(invoker, genericType);
    -     * else
    -     *     return spreadArguments(invoker, genericType);
    -     * 
    + * return convertArguments(invoker, genericType); + *
    + * @param type the type of target methods which the invoker will apply to + * @return a method handle suitable for invoking any method handle of the given type + */ + static public + MethodHandle genericInvoker(MethodType type) { + return invokers(type).genericInvoker(); + } + + /** + * PROVISIONAL API, WORK IN PROGRESS: + * Produce a method handle which will invoke any method handle of the + * given type on a standard set of {@code Object} type arguments + * and a single trailing {@code Object[]} array. + * The resulting invoker will be a method handle with the following + * arguments: + *
      + *
    • a single {@code MethodHandle} target + *
    • zero or more {@code Object} values (counted by {@code objectArgCount}) + *
    • an {@code Object[]} array containing more arguments + *
    + * The invoker will spread the varargs array, apply + * reference casts as necessary, and unbox primitive arguments. + * The return value of the invoker will be an {@code Object} reference, + * boxing a primitive value if the original type returns a primitive, + * and always null if the original type returns void. + *

    + * This method is equivalent to the following code (though it may be more efficient): + *

    +     * MethodHandle invoker = exactInvoker(type);
    +     * MethodType vaType = MethodType.makeGeneric(objectArgCount, true);
    +     * vaType = vaType.insertParameterType(0, MethodHandle.class);
    +     * return spreadArguments(invoker, vaType);
    +     * 
    * @param type the desired target type * @param objectArgCount number of fixed (non-varargs) {@code Object} arguments - * @param varargs if true, the invoker will accept a final {@code Object[]} argument * @return a method handle suitable for invoking any method handle of the given type */ static public - MethodHandle genericInvoker(MethodType type, int objectArgCount, boolean varargs) { - return invokers(type).genericInvoker(); + MethodHandle varargsInvoker(MethodType type, int objectArgCount) { + if (objectArgCount < 0 || objectArgCount > type.parameterCount()) + throw new IllegalArgumentException("bad argument count "+objectArgCount); + return invokers(type).varargsInvoker(objectArgCount); } /** * PROVISIONAL API, WORK IN PROGRESS: - * Give a method handle which will take a invoke any method handle of the + * Produce a method handle which will take a invoke any method handle of the * given type. The resulting invoker will have a type which is * exactly equal to the desired type, except that it will accept * an additional leading argument of type {@code MethodHandle}. *

    - * This is a convenience method equivalent to the following code: - *

    -     *     MethodHandles.lookup().findVirtual(MethodHandle.class, "invoke", type);
    -     * 
    + * This method is equivalent to the following code (though it may be more efficient): + *

    +     * lookup().findVirtual(MethodHandle.class, "invoke", type);
    +     * 
    * @param type the desired target type * @return a method handle suitable for invoking any method handle of the given type */ @@ -612,7 +649,30 @@ public class MethodHandles { return invokers(type).exactInvoker(); } - static private Invokers invokers(MethodType type) { + /** + * PROVISIONAL API, WORK IN PROGRESS: + * Produce a method handle equivalent to an invokedynamic instruction + * which has been linked to the given call site. + * Along with {@link Lookup#findVirtual}, {@link Lookup#findStatic}, + * and {@link Lookup#findSpecial}, this completes the emulation + * of the JVM's {@code invoke} instructions. + *

    This method is equivalent to the following code: + *

    +     * MethodHandle getTarget, invoker, result;
    +     * getTarget = lookup().bind(site, "getTarget", methodType(MethodHandle.class));
    +     * invoker = exactInvoker(site.type());
    +     * result = foldArguments(invoker, getTarget)
    +     * 
    + * @return a method handle which always invokes the call site's target + */ + public static + MethodHandle dynamicInvoker(CallSite site) { + MethodHandle getTarget = MethodHandleImpl.bindReceiver(IMPL_TOKEN, CallSite.GET_TARGET, site); + MethodHandle invoker = exactInvoker(site.type()); + return foldArguments(invoker, getTarget); + } + + static Invokers invokers(MethodType type) { return MethodTypeImpl.invokers(IMPL_TOKEN, type); } @@ -688,14 +748,11 @@ public class MethodHandles { /// method handle modification (creation from other method handles) /** - * PROVISIONAL API, WORK IN PROGRESS: * Produce a method handle which adapts the type of the - * given method handle to a new type, by pairwise argument conversion, - * and/or varargs conversion. - * The original type and new type must have the same number of - * arguments, or else one or both them the must be varargs types. + * given method handle to a new type by pairwise argument conversion. + * The original type and new type must have the same number of arguments. * The resulting method handle is guaranteed to confess a type - * which is equal to the desired new type, with any varargs property erased. + * which is equal to the desired new type. *

    * If the original type and new type are equal, returns target. *

    @@ -703,26 +760,15 @@ public class MethodHandles { * arguments and return types. Let T0 and T1 be the differing * new and old parameter types (or old and new return types) * for corresponding values passed by the new and old method types. - *

    - * If an ordinary (non-varargs) parameter of the new type is - * to be boxed in a varargs parameter of the old type of type T1[], - * then T1 is the element type of the varargs array. - * Otherwise, if a varargs parameter of the new type of type T0[] - * is to be spread into one or more outgoing old type parameters, - * then T0 is the element type of the - * If the new type is varargs and the old type is not, the varargs - * argument will be checked and must be a non-null array of exactly - * the right length. If there are no parameters in the old type - * corresponding to the new varargs parameter, the varargs argument - * is also allowed to be null. - *

    * Given those types T0, T1, one of the following conversions is applied * if possible: *

      - *
    • If T0 and T1 are references, then a cast to T2 is applied, - * where T2 is Object if T1 is an interface, else T1. - * (The types do not need to be related in any particular way. - * The treatment of interfaces follows the usage of the bytecode verifier.) + *
    • If T0 and T1 are references, and T1 is not an interface type, + * then a cast to T1 is applied. + * (The types do not need to be related in any particular way.) + *
    • If T0 and T1 are references, and T1 is an interface type, + * then the value of type T0 is passed as a T1 without a cast. + * (This treatment of interfaces follows the usage of the bytecode verifier.) *
    • If T0 and T1 are primitives, then a Java casting * conversion (JLS 5.5) is applied, if one exists. *
    • If T0 and T1 are primitives and one is boolean, @@ -745,16 +791,17 @@ public class MethodHandles { * if necessary to T1 by one of the preceding conversions. * Otherwise, T0 is converted directly to the wrapper type for T1, * which is then unboxed. - *
    • If T1 is void, any returned value is discarded - *
    • If T0 is void and T1 a reference, a null value is introduced. - *
    • If T0 is void and T1 a primitive, a zero value is introduced. + *
    • If the return type T1 is void, any returned value is discarded + *
    • If the return type T0 is void and T1 a reference, a null value is introduced. + *
    • If the return type T0 is void and T1 a primitive, a zero value is introduced. *
    * @param target the method handle to invoke after arguments are retyped * @param newType the expected type of the new method handle * @return a method handle which delegates to {@code target} after performing * any necessary argument conversions, and arranges for any * necessary return value conversions - * @throws WrongMethodTypeException if the conversion cannot be made + * @throws IllegalArgumentException if the conversion cannot be made + * @see MethodHandle#asType */ public static MethodHandle convertArguments(MethodHandle target, MethodType newType) { @@ -872,23 +919,17 @@ public class MethodHandles { * PROVISIONAL API, WORK IN PROGRESS: * Produce a method handle which adapts the type of the * given method handle to a new type, by collecting a series of - * trailing arguments into an array. - * The resulting method handle is guaranteed to confess a type - * which is equal to the desired new type. + * trailing arguments as elements to a single argument array. *

    - * This method is inverse to {@link #spreadArguments}. + * This method may be used as an inverse to {@link #spreadArguments}. * The final parameter type of the old type must be an array type T[], * which is the type of what is called the spread argument. * The trailing arguments of the new type which correspond to * the spread argument are all converted to type T and collected * into an array before the original method is called. - *

    - * ISSUE: Unify this with combineArguments. CollectArguments - * is combineArguments with (a) new Object[]{...} as a combiner, - * and (b) the combined arguments dropped, in favor of the combined result. * @param target the method handle to invoke after the argument is prepended * @param newType the expected type of the new method handle - * @return a new method handle which collects some trailings argument + * @return a new method handle which collects some trailing argument * into an array, before calling the original method handle */ public static @@ -900,50 +941,72 @@ public class MethodHandles { int numCollect = (inargs - collectPos); if (collectPos < 0 || numCollect < 0) throw newIllegalArgumentException("wrong number of arguments"); - return MethodHandleImpl.collectArguments(IMPL_TOKEN, target, newType, collectPos); + MethodHandle res = MethodHandleImpl.collectArguments(IMPL_TOKEN, target, newType, collectPos, null); + if (res == null) { + throw newIllegalArgumentException("cannot collect from "+newType+" to " +oldType); + } + return res; } /** * PROVISIONAL API, WORK IN PROGRESS: - * Produce a method handle which calls the original method handle, - * after inserting the given argument at the given position. - * The type of the new method handle will drop the corresponding argument - * type from the original handle's type. + * Produce a method handle which calls the original method handle {@code target}, + * after inserting the given argument(s) at the given position. + * The formal parameters to {@code target} which will be supplied by those + * arguments are called bound parameters, because the new method + * will contain bindings for those parameters take from {@code values}. + * The type of the new method handle will drop the types for the bound + * parameters from the original target type, since the new method handle + * will no longer require those arguments to be supplied by its callers. *

    - * The given argument object must match the dropped argument type. - * If the dropped argument type is a primitive, the argument object - * must be a wrapper, and is unboxed to produce the primitive. + * Each given argument object must match the corresponding bound parameter type. + * If a bound parameter type is a primitive, the argument object + * must be a wrapper, and will be unboxed to produce the primitive value. *

    * The pos may range between zero and N (inclusively), - * where N is the number of argument types in target, - * meaning to insert the new argument as the first or last (respectively), - * or somewhere in between. + * where N is the number of argument types in resulting method handle + * (after bound parameter types are dropped). * @param target the method handle to invoke after the argument is inserted * @param pos where to insert the argument (zero for the first) - * @param value the argument to insert + * @param values the series of arguments to insert * @return a new method handle which inserts an additional argument, * before calling the original method handle */ public static - MethodHandle insertArgument(MethodHandle target, int pos, Object value) { + MethodHandle insertArguments(MethodHandle target, int pos, Object... values) { + int insCount = values.length; MethodType oldType = target.type(); ArrayList> ptypes = new ArrayList>(oldType.parameterList()); int outargs = oldType.parameterCount(); - int inargs = outargs - 1; - if (pos < 0 || pos >= outargs) + int inargs = outargs - insCount; + if (inargs < 0) + throw newIllegalArgumentException("too many values to insert"); + if (pos < 0 || pos > inargs) throw newIllegalArgumentException("no argument type to append"); - Class valueType = ptypes.remove(pos); - value = checkValue(valueType, value); - if (pos == 0 && !valueType.isPrimitive()) { - // At least for now, make bound method handles a special case. - // This lets us get by with minimal JVM support, at the expense - // of generating signature-specific adapters as Java bytecodes. - MethodHandle bmh = MethodHandleImpl.bindReceiver(IMPL_TOKEN, target, value); - if (bmh != null) return bmh; - // else fall through to general adapter machinery + MethodHandle result = target; + for (int i = 0; i < insCount; i++) { + Object value = values[i]; + Class valueType = oldType.parameterType(pos+i); + value = checkValue(valueType, value); + if (pos == 0 && !valueType.isPrimitive()) { + // At least for now, make bound method handles a special case. + MethodHandle bmh = MethodHandleImpl.bindReceiver(IMPL_TOKEN, result, value); + if (bmh != null) { + result = bmh; + continue; + } + // else fall through to general adapter machinery + } + result = MethodHandleImpl.bindArgument(IMPL_TOKEN, result, pos, value); } - return MethodHandleImpl.bindArgument(IMPL_TOKEN, target, pos, value); + return result; + } + + @Deprecated // "use MethodHandles.insertArguments instead" + public static + MethodHandle insertArgument(MethodHandle target, int pos, Object value) { + return insertArguments(target, pos, value); } /** @@ -953,10 +1016,25 @@ public class MethodHandles { * The type of the new method handle will insert the given argument * type(s), at that position, into the original handle's type. *

    - * The pos may range between zero and N-1, + * The pos may range between zero and N, * where N is the number of argument types in target, * meaning to drop the first or last argument (respectively), * or an argument somewhere in between. + *

    + * Example: + *

    +     *   MethodHandle cat = MethodHandles.lookup().
    +     *     findVirtual(String.class, "concat", String.class, String.class);
    +     *   System.out.println(cat.<String>invoke("x", "y")); // xy
    +     *   MethodHandle d0 = dropArguments(cat, 0, String.class);
    +     *   System.out.println(d0.<String>invoke("x", "y", "z")); // xy
    +     *   MethodHandle d1 = dropArguments(cat, 1, String.class);
    +     *   System.out.println(d1.<String>invoke("x", "y", "z")); // xz
    +     *   MethodHandle d2 = dropArguments(cat, 2, String.class);
    +     *   System.out.println(d2.<String>invoke("x", "y", "z")); // yz
    +     *   MethodHandle d12 = dropArguments(cat, 1, String.class, String.class);
    +     *   System.out.println(d12.<String>invoke("w", "x", "y", "z")); // wz
    +     * 
    * @param target the method handle to invoke after the argument is dropped * @param valueTypes the type(s) of the argument to drop * @param pos which argument to drop (zero for the first) @@ -964,20 +1042,150 @@ public class MethodHandles { * before calling the original method handle */ public static - MethodHandle dropArguments(MethodHandle target, int pos, Class... valueTypes) { - if (valueTypes.length == 0) return target; + MethodHandle dropArguments(MethodHandle target, int pos, List> valueTypes) { + if (valueTypes.size() == 0) return target; MethodType oldType = target.type(); int outargs = oldType.parameterCount(); - int inargs = outargs + valueTypes.length; + int inargs = outargs + valueTypes.size(); if (pos < 0 || pos >= inargs) throw newIllegalArgumentException("no argument type to remove"); ArrayList> ptypes = new ArrayList>(oldType.parameterList()); - ptypes.addAll(pos, Arrays.asList(valueTypes)); - MethodType newType = MethodType.make(oldType.returnType(), ptypes); + ptypes.addAll(pos, valueTypes); + MethodType newType = MethodType.methodType(oldType.returnType(), ptypes); return MethodHandleImpl.dropArguments(IMPL_TOKEN, target, newType, pos); } + public static + MethodHandle dropArguments(MethodHandle target, int pos, Class... valueTypes) { + return dropArguments(target, pos, Arrays.asList(valueTypes)); + } + + /** + * PROVISIONAL API, WORK IN PROGRESS: + * Adapt a target method handle {@code target} by pre-processing + * one or more of its arguments, each with its own unary filter function, + * and then calling the target with each pre-processed argument + * replaced by the result of its corresponding filter function. + *

    + * The pre-processing is performed by one or more method handles, + * specified in the non-null elements of the {@code filters} array. + * (If there are no such elements, the original target is returned.) + * Each filter (that is, each non-null element of {@code filters}) + * is applied to the corresponding argument of the adapter. + *

    + * If a filter {@code F} applies to the {@code N}th argument of + * the method handle, then {@code F} must be a method handle which + * takes exactly one argument. The type of {@code F}'s sole argument + * replaces the corresponding argument type of the target + * in the resulting adapted method handle. + * The return type of {@code F} must be identical to the corresponding + * parameter type of the target. + *

    + * It is an error if there are non-null elements of {@code filters} + * which do not correspond to argument positions in the target. + * The actual length of the target array may be any number, it need + * not be the same as the parameter count of the target type. + * (This provides an easy way to filter just the first argument or two + * of a target method handle.) + *

    Here is pseudocode for the resulting adapter: + *

    +     * // there are N arguments in the A sequence
    +     * T target(A[N]...);
    +     * [i<N] V[i] filter[i](B[i]) = filters[i] ?: identity;
    +     * T adapter(B[N]... b) {
    +     *   A[N] a...;
    +     *   [i<N] a[i] = filter[i](b[i]);
    +     *   return target(a...);
    +     * }
    +     * 
    + * @param target the method handle to invoke after arguments are filtered + * @param filters method handles to call initially on filtered arguments + * @return method handle which incorporates the specified argument filtering logic + * @throws IllegalArgumentException if a non-null element of {@code filters} + * does not match a corresponding argument type of {@code target} + */ + public static + MethodHandle filterArguments(MethodHandle target, MethodHandle... filters) { + MethodType targetType = target.type(); + MethodHandle adapter = target; + MethodType adapterType = targetType; + int pos = -1, maxPos = targetType.parameterCount(); + for (MethodHandle filter : filters) { + pos += 1; + if (filter == null) continue; + if (pos >= maxPos) + throw newIllegalArgumentException("too many filters"); + MethodType filterType = filter.type(); + if (filterType.parameterCount() != 1 + || filterType.returnType() != targetType.parameterType(pos)) + throw newIllegalArgumentException("target and filter types do not match"); + adapterType = adapterType.changeParameterType(pos, filterType.parameterType(0)); + adapter = MethodHandleImpl.filterArgument(IMPL_TOKEN, adapter, pos, filter); + } + MethodType midType = adapter.type(); + if (midType != adapterType) + adapter = MethodHandleImpl.convertArguments(IMPL_TOKEN, adapter, adapterType, midType, null); + return adapter; + } + + /** + * PROVISIONAL API, WORK IN PROGRESS: + * Adapt a target method handle {@code target} by pre-processing + * some of its arguments, and then calling the target with + * the result of the pre-processing, plus all original arguments. + *

    + * The pre-processing is performed by a second method handle, the {@code combiner}. + * The first {@code N} arguments passed to the adapter, + * are copied to the combiner, which then produces a result. + * (Here, {@code N} is defined as the parameter count of the adapter.) + * After this, control passes to the {@code target}, with both the result + * of the combiner, and all the original incoming arguments. + *

    + * The first argument type of the target must be identical with the + * return type of the combiner. + * The resulting adapter is the same type as the target, except that the + * initial argument type of the target is dropped. + *

    + * (Note that {@link #dropArguments} can be used to remove any arguments + * that either the {@code combiner} or {@code target} does not wish to receive. + * If some of the incoming arguments are destined only for the combiner, + * consider using {@link #collectArguments} instead, since those + * arguments will not need to be live on the stack on entry to the + * target.) + *

    + * The first argument of the target must be identical with the + * return value of the combiner. + *

    Here is pseudocode for the resulting adapter: + *

    +     * // there are N arguments in the A sequence
    +     * T target(V, A[N]..., B...);
    +     * V combiner(A...);
    +     * T adapter(A... a, B... b) {
    +     *   V v = combiner(a...);
    +     *   return target(v, a..., b...);
    +     * }
    +     * 
    + * @param target the method handle to invoke after arguments are combined + * @param combiner method handle to call initially on the incoming arguments + * @return method handle which incorporates the specified argument folding logic + * @throws IllegalArgumentException if the first argument type of + * {@code target} is not the same as {@code combiner}'s return type, + * or if the next {@code foldArgs} argument types of {@code target} + * are not identical with the argument types of {@code combiner} + */ + public static + MethodHandle foldArguments(MethodHandle target, MethodHandle combiner) { + MethodType targetType = target.type(); + MethodType combinerType = combiner.type(); + int foldArgs = combinerType.parameterCount(); + boolean ok = (targetType.parameterCount() >= 1 + foldArgs); + if (!ok) + throw misMatchedTypes("target and combiner types", targetType, combinerType); + MethodType newType = targetType.dropParameterTypes(0, 1); + return MethodHandleImpl.foldArguments(IMPL_TOKEN, target, newType, combiner); + } + /** * PROVISIONAL API, WORK IN PROGRESS: * Make a method handle which adapts a target method handle, @@ -985,18 +1193,18 @@ public class MethodHandles { * If the guard fails, a fallback handle is called instead. * All three method handles must have the same corresponding * argument and return types, except that the return type - * of the test must be boolean. + * of the test must be boolean, and the test is allowed + * to have fewer arguments than the other two method handles. *

    Here is pseudocode for the resulting adapter: *

    -     * signature T(A...);
          * boolean test(A...);
    -     * T target(A...);
    -     * T fallback(A...);
    -     * T adapter(A... a) {
    +     * T target(A...,B...);
    +     * T fallback(A...,B...);
    +     * T adapter(A... a,B... b) {
          *   if (test(a...))
    -     *     return target(a...);
    +     *     return target(a..., b...);
          *   else
    -     *     return fallback(a...);
    +     *     return fallback(a..., b...);
          * }
          * 
    * @param test method handle used for test, must return boolean @@ -1011,10 +1219,23 @@ public class MethodHandles { MethodHandle guardWithTest(MethodHandle test, MethodHandle target, MethodHandle fallback) { - if (target.type() != fallback.type()) - throw newIllegalArgumentException("target and fallback types do not match"); - if (target.type().changeReturnType(boolean.class) != test.type()) - throw newIllegalArgumentException("target and test types do not match"); + MethodType gtype = test.type(); + MethodType ttype = target.type(); + MethodType ftype = fallback.type(); + if (ttype != ftype) + throw misMatchedTypes("target and fallback types", ttype, ftype); + MethodType gtype2 = ttype.changeReturnType(boolean.class); + if (gtype2 != gtype) { + if (gtype.returnType() != boolean.class) + throw newIllegalArgumentException("guard type is not a predicate "+gtype); + int gpc = gtype.parameterCount(), tpc = ttype.parameterCount(); + if (gpc < tpc) { + test = dropArguments(test, gpc, ttype.parameterList().subList(gpc, tpc)); + gtype = test.type(); + } + if (gtype2 != gtype) + throw misMatchedTypes("target and test types", ttype, gtype); + } /* { MethodHandle invoke = findVirtual(MethodHandle.class, "invoke", target.type()); static MethodHandle choose(boolean z, MethodHandle t, MethodHandle f) { @@ -1027,7 +1248,7 @@ public class MethodHandles { } // choose = \z.(z ? target : fallback) MethodHandle choose = findVirtual(MethodHandles.class, "choose", - MethodType.make(boolean.class, MethodHandle.class, MethodHandle.class)); + MethodType.methodType(boolean.class, MethodHandle.class, MethodHandle.class)); choose = appendArgument(choose, target); choose = appendArgument(choose, fallback); MethodHandle dispatch = compose(choose, test); @@ -1038,67 +1259,88 @@ public class MethodHandles { return MethodHandleImpl.makeGuardWithTest(IMPL_TOKEN, test, target, fallback); } + static RuntimeException misMatchedTypes(String what, MethodType t1, MethodType t2) { + return newIllegalArgumentException(what + " must match: " + t1 + " != " + t2); + } + /** * PROVISIONAL API, WORK IN PROGRESS: - * Adapt a target method handle {@code target} by first processing - * its arguments, and then calling the target. - * The initial processing is performed by a second method handle, the {@code combiner}. - * After this, control passes to the {@code target}, with the same arguments. - *

    - * The return value of the {@code combiner} is inserted into the argument list - * for the {@code target} at the indicated position {@code pos}, if it is non-negative. - * Except for this inserted argument (if any), the argument types of - * the target {@code target} and the {@code combiner} must be identical. - *

    - * (Note that {@link #dropArguments} can be used to remove any arguments - * that either the {@code combiner} or {@code target} does not wish to receive.) + * Make a method handle which adapts a target method handle, + * by running it inside an exception handler. + * If the target returns normally, the adapter returns that value. + * If an exception matching the specified type is thrown, the fallback + * handle is called instead on the exception, plus the original arguments. *

    - * The combiner handle must have the same argument types as the - * target handle, but must return {@link MethodHandle} instead of - * the ultimate return type. The returned method handle, in turn, - * is required to have exactly the given final method type. + * The handler must have leading parameter of {@code exType} or a supertype, + * followed by arguments which correspond (how? TBD) to + * all the parameters of the target. + * The target and handler must return the same type. *

    Here is pseudocode for the resulting adapter: *

    -     * signature V(A[pos]..., B...);
    -     * signature T(A[pos]..., V, B...);
    -     * T target(A... a, V v, B... b);
    -     * V combiner(A..., B...);
    -     * T adapter(A... a, B... b) {
    -     *   V v = combiner(a..., b...);
    -     *   return target(a..., v, b...);
    +     * T target(A...);
    +     * T handler(ExType, A...);
    +     * T adapter(A... a) {
    +     *   try {
    +     *     return target(a...);
    +     *   } catch (ExType ex) {
    +     *     return handler(ex, a...);
    +     *   }
          * }
          * 
    - * @param target the method handle to invoke after arguments are combined - * @param pos where the return value of {@code combiner} is to - * be inserted as an argument to {@code target} - * @param combiner method handle to call initially on the incoming arguments - * @return method handle which incorporates the specified dispatch logic - * @throws IllegalArgumentException if {@code combiner} does not itself - * return either void or the {@code pos}-th argument of {@code target}, - * or does not have the same argument types as {@code target} - * (minus the inserted argument) + * @param target method handle to call + * @param exType the type of exception which the handler will catch + * @param handler method handle to call if a matching exception is thrown + * @return method handle which incorporates the specified try/catch logic + * @throws IllegalArgumentException if {@code handler} does not accept + * the given exception type, or if the method handle types do + * not match in their return types and their + * corresponding parameters */ public static - MethodHandle combineArguments(MethodHandle target, int pos, MethodHandle combiner) { - MethodType mhType = target.type(); - Class combineType = combiner.type().returnType(); - MethodType incomingArgs; - if (pos < 0) { - // No inserted argument; target & combiner must have same argument types. - incomingArgs = mhType; - if (!incomingArgs.changeReturnType(combineType).equals(combiner.type())) - throw newIllegalArgumentException("target and combiner types do not match"); - } else { - // Inserted argument. - if (pos >= mhType.parameterCount() - || mhType.parameterType(pos) != combineType) - throw newIllegalArgumentException("inserted combiner argument does not match target"); - incomingArgs = mhType.dropParameterType(pos); - } - if (!incomingArgs.changeReturnType(combineType).equals(combiner.type())) { - throw newIllegalArgumentException("target and combiner types do not match"); - } - return MethodHandleImpl.combineArguments(IMPL_TOKEN, target, combiner, pos); + MethodHandle catchException(MethodHandle target, + Class exType, + MethodHandle handler) { + MethodType targetType = target.type(); + MethodType handlerType = handler.type(); + boolean ok = (targetType.parameterCount() == + handlerType.parameterCount() - 1); +// for (int i = 0; ok && i < numExArgs; i++) { +// if (targetType.parameterType(i) != handlerType.parameterType(1+i)) +// ok = false; +// } + if (!ok) + throw newIllegalArgumentException("target and handler types do not match"); + return MethodHandleImpl.makeGuardWithCatch(IMPL_TOKEN, target, exType, handler); } + /** + * Produce a method handle which will throw exceptions of the given {@code exType}. + * The method handle will accept a single argument of {@code exType}, + * and immediately throw it as an exception. + * The method type will nominally specify a return of {@code returnType}. + * The return type may be anything convenient: It doesn't matter to the + * method handle's behavior, since it will never return normally. + */ + public static + MethodHandle throwException(Class returnType, Class exType) { + return MethodHandleImpl.throwException(IMPL_TOKEN, MethodType.methodType(returnType, exType)); + } + + /** Alias for {@link MethodType#methodType}. */ + @Deprecated // "use MethodType.methodType instead" + public static MethodType methodType(Class rtype) { + return MethodType.methodType(rtype); + } + + /** Alias for {@link MethodType#methodType}. */ + @Deprecated // "use MethodType.methodType instead" + public static MethodType methodType(Class rtype, Class ptype) { + return MethodType.methodType(rtype, ptype); + } + + /** Alias for {@link MethodType#methodType}. */ + @Deprecated // "use MethodType.methodType instead" + public static MethodType methodType(Class rtype, Class ptype0, Class... ptypes) { + return MethodType.methodType(rtype, ptype0, ptypes); + } } diff --git a/src/share/classes/java/dyn/MethodType.java b/src/share/classes/java/dyn/MethodType.java index 8e340de18f0da2f2c77a6fb96bbf8e2d9a329052..2ca02089d20589b6d9f3bb6bdb13e48abb95306e 100644 --- a/src/share/classes/java/dyn/MethodType.java +++ b/src/share/classes/java/dyn/MethodType.java @@ -32,7 +32,7 @@ import java.util.List; import sun.dyn.Access; import sun.dyn.Invokers; import sun.dyn.MethodTypeImpl; -import sun.dyn.util.BytecodeSignature; +import sun.dyn.util.BytecodeDescriptor; import static sun.dyn.MemberName.newIllegalArgumentException; /** @@ -63,7 +63,7 @@ class MethodType { static { // This hack allows the implementation package special access to - // the internals of MethodType. In particular, the Form has all sorts + // the internals of MethodType. In particular, the MTImpl has all sorts // of cached information useful to the implementation code. MethodTypeImpl.setMethodTypeFriend(IMPL_TOKEN, new MethodTypeImpl.MethodTypeFriend() { public Class[] ptypes(MethodType mt) { return mt.ptypes; } @@ -114,51 +114,76 @@ class MethodType { * @throws IllegalArgumentException if any of the ptypes is void */ public static - MethodType make(Class rtype, Class[] ptypes) { + MethodType methodType(Class rtype, Class[] ptypes) { return makeImpl(rtype, ptypes, false); } + @Deprecated public static + MethodType make(Class rtype, Class[] ptypes) { + return methodType(rtype, ptypes); + } - /** Convenience method for {@link #make(java.lang.Class, java.lang.Class[])}. */ + /** Convenience method for {@link #methodType(java.lang.Class, java.lang.Class[])}. */ public static + MethodType methodType(Class rtype, List> ptypes) { + boolean notrust = false; // random List impl. could return evil ptypes array + return makeImpl(rtype, ptypes.toArray(NO_PTYPES), notrust); + } + @Deprecated public static MethodType make(Class rtype, List> ptypes) { - return makeImpl(rtype, ptypes.toArray(NO_PTYPES), true); + return methodType(rtype, ptypes); } - /** Convenience method for {@link #make(java.lang.Class, java.lang.Class[])}. + /** Convenience method for {@link #methodType(java.lang.Class, java.lang.Class[])}. * The leading parameter type is prepended to the remaining array. */ public static - MethodType make(Class rtype, Class ptype0, Class... ptypes) { + MethodType methodType(Class rtype, Class ptype0, Class... ptypes) { Class[] ptypes1 = new Class[1+ptypes.length]; ptypes1[0] = ptype0; System.arraycopy(ptypes, 0, ptypes1, 1, ptypes.length); return makeImpl(rtype, ptypes1, true); } + @Deprecated public static + MethodType make(Class rtype, Class ptype0, Class... ptypes) { + return methodType(rtype, ptype0, ptypes); + } - /** Convenience method for {@link #make(java.lang.Class, java.lang.Class[])}. + /** Convenience method for {@link #methodType(java.lang.Class, java.lang.Class[])}. * The resulting method has no parameter types. */ public static - MethodType make(Class rtype) { + MethodType methodType(Class rtype) { return makeImpl(rtype, NO_PTYPES, true); } + @Deprecated public static + MethodType make(Class rtype) { + return methodType(rtype); + } - /** Convenience method for {@link #make(java.lang.Class, java.lang.Class[])}. + /** Convenience method for {@link #methodType(java.lang.Class, java.lang.Class[])}. * The resulting method has the single given parameter type. */ public static - MethodType make(Class rtype, Class ptype0) { + MethodType methodType(Class rtype, Class ptype0) { return makeImpl(rtype, new Class[]{ ptype0 }, true); } + @Deprecated public static + MethodType make(Class rtype, Class ptype0) { + return methodType(rtype, ptype0); + } - /** Convenience method for {@link #make(java.lang.Class, java.lang.Class[])}. + /** Convenience method for {@link #methodType(java.lang.Class, java.lang.Class[])}. * The resulting method has the same parameter types as {@code ptypes}, * and the specified return type. */ public static - MethodType make(Class rtype, MethodType ptypes) { + MethodType methodType(Class rtype, MethodType ptypes) { return makeImpl(rtype, ptypes.ptypes, true); } + @Deprecated public static + MethodType make(Class rtype, MethodType ptypes) { + return methodType(rtype, ptypes); + } /** * Sole factory method to find or create an interned method type. @@ -202,15 +227,16 @@ class MethodType { private static final MethodType[] objectOnlyTypes = new MethodType[20]; /** - * Convenience method for {@link #make(java.lang.Class, java.lang.Class[], boolean)}. - * All parameters and the return type will be Object, except the final varargs parameter if any. + * Convenience method for {@link #methodType(java.lang.Class, java.lang.Class[])}. + * All parameters and the return type will be {@code Object}, + * except the final varargs parameter if any, which will be {@code Object[]}. * @param objectArgCount number of parameters (excluding the varargs parameter if any) - * @param varargs whether there will be a varargs parameter, of type Object[] + * @param varargs whether there will be a varargs parameter, of type {@code Object[]} * @return a totally generic method type, given only its count of parameters and varargs - * @see #makeGeneric(int) + * @see #genericMethodType(int) */ public static - MethodType makeGeneric(int objectArgCount, boolean varargs) { + MethodType genericMethodType(int objectArgCount, boolean varargs) { MethodType mt; int ivarargs = (!varargs ? 0 : 1); int ootIndex = objectArgCount*2 + ivarargs; @@ -227,19 +253,27 @@ class MethodType { } return mt; } + @Deprecated public static + MethodType makeGeneric(int objectArgCount, boolean varargs) { + return genericMethodType(objectArgCount, varargs); + } /** * All parameters and the return type will be Object. * @param objectArgCount number of parameters * @return a totally generic method type, given only its count of parameters - * @see #makeGeneric(int, boolean) + * @see #genericMethodType(int, boolean) */ public static + MethodType genericMethodType(int objectArgCount) { + return genericMethodType(objectArgCount, false); + } + @Deprecated public static MethodType makeGeneric(int objectArgCount) { - return makeGeneric(objectArgCount, false); + return genericMethodType(objectArgCount); } - /** Convenience method for {@link #make(java.lang.Class, java.lang.Class[], boolean)}. + /** Convenience method for {@link #methodType(java.lang.Class, java.lang.Class[])}. * @param num the index (zero-based) of the parameter type to change * @param nptype a new parameter type to replace the old one with * @return the same type, except with the selected parameter changed @@ -251,11 +285,10 @@ class MethodType { return makeImpl(rtype, nptypes, true); } - /** Convenience method for {@link #make(java.lang.Class, java.lang.Class[], boolean)}. - * @param num the position (zero-based) of the inserted parameter type - * @param nptype a new parameter type to insert into the parameter list - * @return the same type, except with the selected parameter inserted + /** Convenience method for {@link #insertParameterTypes}. + * @deprecated Use {@link #insertParameterTypes} instead. */ + @Deprecated public MethodType insertParameterType(int num, Class nptype) { int len = ptypes.length; Class[] nptypes = Arrays.copyOfRange(ptypes, 0, len+1); @@ -264,23 +297,73 @@ class MethodType { return makeImpl(rtype, nptypes, true); } - /** Convenience method for {@link #make(java.lang.Class, java.lang.Class[], boolean)}. - * @param num the index (zero-based) of the parameter type to remove - * @return the same type, except with the selected parameter removed + /** Convenience method for {@link #methodType(java.lang.Class, java.lang.Class[])}. + * @param num the position (zero-based) of the inserted parameter type(s) + * @param ptypesToInsert zero or more a new parameter types to insert into the parameter list + * @return the same type, except with the selected parameter(s) inserted */ - public MethodType dropParameterType(int num) { + public MethodType insertParameterTypes(int num, Class... ptypesToInsert) { + int len = ptypes.length; + if (num < 0 || num > len) + throw newIllegalArgumentException("num="+num); //SPECME + int ilen = ptypesToInsert.length; + if (ilen == 0) return this; + Class[] nptypes = Arrays.copyOfRange(ptypes, 0, len+ilen); + System.arraycopy(nptypes, num, nptypes, num+ilen, len-num); + System.arraycopy(ptypesToInsert, 0, nptypes, num, ilen); + return makeImpl(rtype, nptypes, true); + } + + /** Convenience method for {@link #methodType(java.lang.Class, java.lang.Class[])}. + * @param num the position (zero-based) of the inserted parameter type(s) + * @param ptypesToInsert zero or more a new parameter types to insert into the parameter list + * @return the same type, except with the selected parameter(s) inserted + */ + public MethodType insertParameterTypes(int num, List> ptypesToInsert) { + return insertParameterTypes(num, ptypesToInsert.toArray(NO_PTYPES)); + } + + /** Convenience method for {@link #methodType(java.lang.Class, java.lang.Class[])}. + * @param start the index (zero-based) of the first parameter type to remove + * @param end the index (greater than {@code start}) of the first parameter type after not to remove + * @return the same type, except with the selected parameter(s) removed + */ + public MethodType dropParameterTypes(int start, int end) { int len = ptypes.length; + if (!(0 <= start && start <= end && end <= len)) + throw newIllegalArgumentException("start="+start+" end="+end); //SPECME + if (start == end) return this; Class[] nptypes; - if (num == 0) { - nptypes = Arrays.copyOfRange(ptypes, 1, len); + if (start == 0) { + if (end == len) { + // drop all parameters + nptypes = NO_PTYPES; + } else { + // drop initial parameter(s) + nptypes = Arrays.copyOfRange(ptypes, end, len); + } } else { - nptypes = Arrays.copyOfRange(ptypes, 0, len-1); - System.arraycopy(ptypes, num+1, nptypes, num, (len-1)-num); + if (end == len) { + // drop trailing parameter(s) + nptypes = Arrays.copyOfRange(ptypes, 0, start); + } else { + int tail = len - end; + nptypes = Arrays.copyOfRange(ptypes, 0, start + tail); + System.arraycopy(ptypes, end, nptypes, start, tail); + } } return makeImpl(rtype, nptypes, true); } - /** Convenience method for {@link #make(java.lang.Class, java.lang.Class[], boolean)}. + /** Convenience method for {@link #dropParameterTypes}. + * @deprecated Use {@link #dropParameterTypes} instead. + */ + @Deprecated + public MethodType dropParameterType(int num) { + return dropParameterTypes(num, num+1); + } + + /** Convenience method for {@link #methodType(java.lang.Class, java.lang.Class[])}. * @param nrtype a return parameter type to replace the old one with * @return the same type, except with the return type change */ @@ -291,6 +374,7 @@ class MethodType { /** Convenience method. * Report if this type contains a primitive argument or return value. + * The return type {@code void} counts as a primitive. * @return true if any of the types are primitives */ public boolean hasPrimitives() { @@ -300,39 +384,47 @@ class MethodType { /** Convenience method. * Report if this type contains a wrapper argument or return value. * Wrappers are types which box primitive values, such as {@link Integer}. + * The reference type {@code java.lang.Void} counts as a wrapper. * @return true if any of the types are wrappers */ public boolean hasWrappers() { return unwrap() != this; } - /** Convenience method for {@link #make(java.lang.Class, java.lang.Class[])}. - * Erase all reference types to Object. + /** Convenience method for {@link #methodType(java.lang.Class, java.lang.Class[])}. + * Erase all reference types to {@code Object}. + * All primitive types (including {@code void}) will remain unchanged. * @return a version of the original type with all reference types replaced */ public MethodType erase() { return form.erasedType(); } - /** Convenience method for {@link #makeGeneric(int)}. - * Convert all types, both reference and primitive, to Object. + /** Convenience method for {@link #genericMethodType(int)}. + * Convert all types, both reference and primitive, to {@code Object}. + * The expression {@code type.wrap().erase()} produces the same value + * as {@code type.generic()}. * @return a version of the original type with all types replaced */ public MethodType generic() { - return makeGeneric(parameterCount()); + return genericMethodType(parameterCount()); } - /** Convenience method for {@link #make(java.lang.Class, java.lang.Class[])}. + /** Convenience method for {@link #methodType(java.lang.Class, java.lang.Class[])}. * Convert all primitive types to their corresponding wrapper types. + * All reference types (including wrapper types) will remain unchanged. * A {@code void} return type is changed to the type {@code java.lang.Void}. + * The expression {@code type.wrap().erase()} produces the same value + * as {@code type.generic()}. * @return a version of the original type with all primitive types replaced */ public MethodType wrap() { return hasPrimitives() ? wrapWithPrims(this) : this; } - /** Convenience method for {@link #make(java.lang.Class, java.lang.Class[])}. + /** Convenience method for {@link #methodType(java.lang.Class, java.lang.Class[])}. * Convert all wrapper types to their corresponding primitive types. + * All primitive types (including {@code void}) will remain unchanged. * A return type of {@code java.lang.Void} is changed to {@code void}. * @return a version of the original type with all wrapper types replaced */ @@ -391,6 +483,7 @@ class MethodType { /** * Convenience method to present the arguments as an array. + * Changes to the array will not result in changes to the type. * @return the parameter types (as a fresh copy if necessary) */ public Class[] parameterArray() { @@ -491,7 +584,7 @@ class MethodType { return form.parameterSlotCount(); } - /** Number of JVM stack slots which carry all parameters after + /** Number of JVM stack slots which carry all parameters including and after * the given position, which must be in the range of 0 to * {@code parameterCount} inclusive. Successive parameters are * more shallowly stacked, and parameters are indexed in the bytecodes @@ -532,7 +625,7 @@ class MethodType { return form.returnSlotCount(); } - /** Convenience method for {@link #make(java.lang.Class, java.lang.Class[])}. + /** Convenience method for {@link #methodType(java.lang.Class, java.lang.Class[])}. * Find or create an instance (interned) of the given method type. * Any class or interface name embedded in the signature string * will be resolved by calling {@link ClassLoader#loadClass(java.lang.String)} @@ -544,16 +637,16 @@ class MethodType { *

    * This method is included for the benfit of applications that must * generate bytecodes that process method handles and invokedynamic. - * @param bytecodeSignature a bytecode-level signature string "(T...)T" + * @param descriptor a bytecode-level signature string "(T...)T" * @param loader the class loader in which to look up the types * @return a method type matching the bytecode-level signature * @throws IllegalArgumentException if the string is not well-formed * @throws TypeNotPresentException if a named type cannot be found */ - public static MethodType fromBytecodeString(String bytecodeSignature, ClassLoader loader) + public static MethodType fromMethodDescriptorString(String descriptor, ClassLoader loader) throws IllegalArgumentException, TypeNotPresentException { - List> types = BytecodeSignature.parseMethod(bytecodeSignature, loader); + List> types = BytecodeDescriptor.parseMethod(descriptor, loader); Class rtype = types.remove(types.size() - 1); Class[] ptypes = types.toArray(NO_PTYPES); return makeImpl(rtype, ptypes, true); @@ -565,11 +658,21 @@ class MethodType { *

    * This method is included for the benfit of applications that must * generate bytecodes that process method handles and invokedynamic. - * {@link #fromBytecodeString(java.lang.String, java.lang.ClassLoader)}, + * {@link #fromMethodDescriptorString(java.lang.String, java.lang.ClassLoader)}, * because the latter requires a suitable class loader argument. * @return the bytecode signature representation */ + public String toMethodDescriptorString() { + return BytecodeDescriptor.unparse(this); + } + + /** Temporary alias for toMethodDescriptorString; delete after M3. */ public String toBytecodeString() { - return BytecodeSignature.unparse(this); + return toMethodDescriptorString(); + } + /** Temporary alias for fromMethodDescriptorString; delete after M3. */ + public static MethodType fromBytecodeString(String descriptor, ClassLoader loader) + throws IllegalArgumentException, TypeNotPresentException { + return fromMethodDescriptorString(descriptor, loader); } } diff --git a/src/share/classes/java/dyn/package-info.java b/src/share/classes/java/dyn/package-info.java index 858d0e9bcbfe35bafc35bae2a98ec7c8e7cb7c14..df82633c211a471be7d6a29aa13ae5fb85f53d11 100644 --- a/src/share/classes/java/dyn/package-info.java +++ b/src/share/classes/java/dyn/package-info.java @@ -24,6 +24,7 @@ */ /** + * PROVISIONAL API, WORK IN PROGRESS: * This package contains dynamic language support provided directly by * the Java core class libraries and virtual machine. * @author John Rose, JSR 292 EG diff --git a/src/share/classes/java/lang/Deprecated.java b/src/share/classes/java/lang/Deprecated.java index 427b77baac8264c0f2f1f492102d5c296ad4bb94..28909e19e77655fd51c67c2d9ad1270c980cdf1e 100644 --- a/src/share/classes/java/lang/Deprecated.java +++ b/src/share/classes/java/lang/Deprecated.java @@ -26,6 +26,7 @@ package java.lang; import java.lang.annotation.*; +import static java.lang.annotation.ElementType.*; /** * A program element annotated @Deprecated is one that programmers @@ -38,5 +39,6 @@ import java.lang.annotation.*; */ @Documented @Retention(RetentionPolicy.RUNTIME) +@Target(value={CONSTRUCTOR, FIELD, LOCAL_VARIABLE, METHOD, PACKAGE, PARAMETER, TYPE}) public @interface Deprecated { } diff --git a/src/share/classes/java/lang/Error.java b/src/share/classes/java/lang/Error.java index c1ab7a89297fbd96df482be25443803312d2c0a7..a5af32668e82c3d4924f972ba5893945987a0202 100644 --- a/src/share/classes/java/lang/Error.java +++ b/src/share/classes/java/lang/Error.java @@ -26,27 +26,31 @@ package java.lang; /** - * An Error is a subclass of Throwable + * An {@code Error} is a subclass of {@code Throwable} * that indicates serious problems that a reasonable application * should not try to catch. Most such errors are abnormal conditions. - * The ThreadDeath error, though a "normal" condition, - * is also a subclass of Error because most applications + * The {@code ThreadDeath} error, though a "normal" condition, + * is also a subclass of {@code Error} because most applications * should not try to catch it. *

    - * A method is not required to declare in its throws - * clause any subclasses of Error that might be thrown + * A method is not required to declare in its {@code throws} + * clause any subclasses of {@code Error} that might be thrown * during the execution of the method but not caught, since these * errors are abnormal conditions that should never occur. * + * That is, {@code Error} and its subclasses are regarded as unchecked + * exceptions for the purposes of compile-time checking of exceptions. + * * @author Frank Yellin * @see java.lang.ThreadDeath + * @jls3 11.2 Compile-Time Checking of Exceptions * @since JDK1.0 */ public class Error extends Throwable { static final long serialVersionUID = 4980196508277280342L; /** - * Constructs a new error with null as its detail message. + * Constructs a new error with {@code null} as its detail message. * The cause is not initialized, and may subsequently be initialized by a * call to {@link #initCause}. */ @@ -69,7 +73,7 @@ public class Error extends Throwable { /** * Constructs a new error with the specified detail message and * cause.

    Note that the detail message associated with - * cause is not automatically incorporated in + * {@code cause} is not automatically incorporated in * this error's detail message. * * @param message the detail message (which is saved for later retrieval diff --git a/src/share/classes/java/lang/Exception.java b/src/share/classes/java/lang/Exception.java index 70b99ae9be65907ed4249212468c188117d63577..bdb1c7d368799a8d79e41cdd87ebaa0bed8d127e 100644 --- a/src/share/classes/java/lang/Exception.java +++ b/src/share/classes/java/lang/Exception.java @@ -26,19 +26,27 @@ package java.lang; /** - * The class Exception and its subclasses are a form of - * Throwable that indicates conditions that a reasonable + * The class {@code Exception} and its subclasses are a form of + * {@code Throwable} that indicates conditions that a reasonable * application might want to catch. * + *

    The class {@code Exception} and any subclasses that are not also + * subclasses of {@link RuntimeException} are checked + * exceptions. Checked exceptions need to be declared in a + * method or constructor's {@code throws} clause if they can be thrown + * by the execution of the method or constructor and propagate outside + * the method or constructor boundary. + * * @author Frank Yellin * @see java.lang.Error + * @jls3 11.2 Compile-Time Checking of Exceptions * @since JDK1.0 */ public class Exception extends Throwable { static final long serialVersionUID = -3387516993124229948L; /** - * Constructs a new exception with null as its detail message. + * Constructs a new exception with {@code null} as its detail message. * The cause is not initialized, and may subsequently be initialized by a * call to {@link #initCause}. */ @@ -61,7 +69,7 @@ public class Exception extends Throwable { /** * Constructs a new exception with the specified detail message and * cause.

    Note that the detail message associated with - * cause is not automatically incorporated in + * {@code cause} is not automatically incorporated in * this exception's detail message. * * @param message the detail message (which is saved for later retrieval diff --git a/src/share/classes/java/lang/RuntimeException.java b/src/share/classes/java/lang/RuntimeException.java index e3378485bdf47566e6ff9e8da1496d2cfefb5d63..d510e2c58989570f59ed536caafce79fd71a6798 100644 --- a/src/share/classes/java/lang/RuntimeException.java +++ b/src/share/classes/java/lang/RuntimeException.java @@ -26,22 +26,24 @@ package java.lang; /** - * RuntimeException is the superclass of those + * {@code RuntimeException} is the superclass of those * exceptions that can be thrown during the normal operation of the * Java Virtual Machine. - *

    - * A method is not required to declare in its throws - * clause any subclasses of RuntimeException that might - * be thrown during the execution of the method but not caught. * + *

    {@code RuntimeException} and its subclasses are unchecked + * exceptions. Unchecked exceptions do not need to be + * declared in a method or constructor's {@code throws} clause if they + * can be thrown by the execution of the method or constructor and + * propagate outside the method or constructor boundary. * * @author Frank Yellin + * @jls3 11.2 Compile-Time Checking of Exceptions * @since JDK1.0 */ public class RuntimeException extends Exception { static final long serialVersionUID = -7034897190745766939L; - /** Constructs a new runtime exception with null as its + /** Constructs a new runtime exception with {@code null} as its * detail message. The cause is not initialized, and may subsequently be * initialized by a call to {@link #initCause}. */ @@ -63,7 +65,7 @@ public class RuntimeException extends Exception { /** * Constructs a new runtime exception with the specified detail message and * cause.

    Note that the detail message associated with - * cause is not automatically incorporated in + * {@code cause} is not automatically incorporated in * this runtime exception's detail message. * * @param message the detail message (which is saved for later retrieval diff --git a/src/share/classes/java/lang/StrictMath.java b/src/share/classes/java/lang/StrictMath.java index dad91405741c53b6d072f3ae4562e530ca608a8f..704be3e310ed7fc726421b3a3c06d42646734043 100644 --- a/src/share/classes/java/lang/StrictMath.java +++ b/src/share/classes/java/lang/StrictMath.java @@ -26,6 +26,7 @@ package java.lang; import java.util.Random; import sun.misc.FpUtils; +import sun.misc.DoubleConsts; /** * The class {@code StrictMath} contains methods for performing basic @@ -316,7 +317,9 @@ public final class StrictMath { * floating-point value that is greater than or equal to * the argument and is equal to a mathematical integer. */ - public static native double ceil(double a); + public static double ceil(double a) { + return floorOrCeil(a, -0.0, 1.0, 1.0); + } /** * Returns the largest (closest to positive infinity) @@ -333,7 +336,54 @@ public final class StrictMath { * floating-point value that less than or equal to the argument * and is equal to a mathematical integer. */ - public static native double floor(double a); + public static double floor(double a) { + return floorOrCeil(a, -1.0, 0.0, -1.0); + } + + /** + * Internal method to share logic between floor and ceil. + * + * @param a the value to be floored or ceiled + * @param negativeBoundary result for values in (-1, 0) + * @param positiveBoundary result for values in (0, 1) + * @param increment value to add when the argument is non-integral + */ + private static double floorOrCeil(double a, + double negativeBoundary, + double positiveBoundary, + double sign) { + int exponent = Math.getExponent(a); + + if (exponent < 0) { + /* + * Absolute value of argument is less than 1. + * floorOrceil(-0.0) => -0.0 + * floorOrceil(+0.0) => +0.0 + */ + return ((a == 0.0) ? a : + ( (a < 0.0) ? negativeBoundary : positiveBoundary) ); + } else if (exponent >= 52) { + /* + * Infinity, NaN, or a value so large it must be integral. + */ + return a; + } + // Else the argument is either an integral value already XOR it + // has to be rounded to one. + assert exponent >= 0 && exponent <= 51; + + long doppel = Double.doubleToRawLongBits(a); + long mask = DoubleConsts.SIGNIF_BIT_MASK >> exponent; + + if ( (mask & doppel) == 0L ) + return a; // integral value + else { + double result = Double.longBitsToDouble(doppel & (~mask)); + if (sign*a > 0.0) + result = result + sign; + return result; + } + } /** * Returns the {@code double} value that is closest in value diff --git a/src/share/classes/java/lang/SuppressWarnings.java b/src/share/classes/java/lang/SuppressWarnings.java index b999bce2685152e1e63b0545ded39ec97ce9c529..cc98d68b1c08615ae03d10e5cfd91def345be5a7 100644 --- a/src/share/classes/java/lang/SuppressWarnings.java +++ b/src/share/classes/java/lang/SuppressWarnings.java @@ -26,7 +26,6 @@ package java.lang; import java.lang.annotation.*; -import java.lang.annotation.ElementType; import static java.lang.annotation.ElementType.*; /** @@ -45,7 +44,7 @@ import static java.lang.annotation.ElementType.*; * @since 1.5 * @author Josh Bloch */ -@Target({TYPE, FIELD, METHOD, PARAMETER, CONSTRUCTOR, LOCAL_VARIABLE}) +@Target({TYPE, FIELD, METHOD, PARAMETER, CONSTRUCTOR, LOCAL_VARIABLE, TYPE_PARAMETER}) @Retention(RetentionPolicy.SOURCE) public @interface SuppressWarnings { /** diff --git a/src/share/classes/java/lang/Throwable.java b/src/share/classes/java/lang/Throwable.java index c4e75d250ff9914b0095f0ebc7d4264d05743ae9..ebc7fe7ceaba9e945a05a3d502f33243b9bcbf80 100644 --- a/src/share/classes/java/lang/Throwable.java +++ b/src/share/classes/java/lang/Throwable.java @@ -34,6 +34,11 @@ import java.io.*; * this class or one of its subclasses can be the argument type in a * catch clause. * + * For the purposes of compile-time checking of exceptions, {@code + * Throwable} and any subclass of {@code Throwable} that is not also a + * subclass of either {@link RuntimeException} or {@link Error} are + * regarded as checked exceptions. + * *

    Instances of two subclasses, {@link java.lang.Error} and * {@link java.lang.Exception}, are conventionally used to indicate * that exceptional situations have occurred. Typically, these instances @@ -142,6 +147,7 @@ import java.io.*; * @author unascribed * @author Josh Bloch (Added exception chaining and programmatic access to * stack trace in 1.4.) + * @jls3 11.2 Compile-Time Checking of Exceptions * @since JDK1.0 */ public class Throwable implements Serializable { diff --git a/src/share/classes/java/lang/management/PlatformManagedObject.java b/src/share/classes/java/lang/management/PlatformManagedObject.java index 5f68635d4fe8c57e76d04e7d9f2e7e75fd216c73..ca5edbeb51834de70cf68fe6123d2ef9c052c969 100644 --- a/src/share/classes/java/lang/management/PlatformManagedObject.java +++ b/src/share/classes/java/lang/management/PlatformManagedObject.java @@ -32,7 +32,7 @@ import javax.management.ObjectName; * for monitoring and managing a component in the Java platform. * Each platform managed object has a unique * object name - * for the {@linkplain ManagementFactory.getPlatformMBeanServer + * for the {@linkplain ManagementFactory#getPlatformMBeanServer * platform MBeanServer} access. * All platform MXBeans will implement this interface. * diff --git a/src/share/classes/java/nio/X-Buffer.java.template b/src/share/classes/java/nio/X-Buffer.java.template index 9fc8185b646ef0387d26889e548ba1bf99cab1f7..e3431a02dfec700e36a8f8b4ff585898a839cc7d 100644 --- a/src/share/classes/java/nio/X-Buffer.java.template +++ b/src/share/classes/java/nio/X-Buffer.java.template @@ -32,24 +32,24 @@ import java.io.IOException; #end[char] /** - * $A$ $fulltype$ buffer. + * $A$ $type$ buffer. * *

    This class defines {#if[byte]?six:four} categories of operations upon - * $fulltype$ buffers: + * $type$ buffers: * *

      * *
    • Absolute and relative {@link #get() get} and * {@link #put($type$) put} methods that read and write - * single $fulltype$s;

    • + * single $type$s;

      * *
    • Relative {@link #get($type$[]) bulk get} - * methods that transfer contiguous sequences of $fulltype$s from this buffer + * methods that transfer contiguous sequences of $type$s from this buffer * into an array; {#if[!byte]?and}

    • * *
    • Relative {@link #put($type$[]) bulk put} - * methods that transfer contiguous sequences of $fulltype$s from $a$ - * $fulltype$ array{#if[char]?, a string,} or some other $fulltype$ + * methods that transfer contiguous sequences of $type$s from $a$ + * $type$ array{#if[char]?, a string,} or some other $type$ * buffer into this buffer;{#if[!byte]? and}

    • * #if[byte] @@ -67,22 +67,22 @@ import java.io.IOException; * *
    • Methods for {@link #compact compacting}, {@link * #duplicate duplicating}, and {@link #slice - * slicing} $a$ $fulltype$ buffer.

    • + * slicing} $a$ $type$ buffer.

      * *
    * - *

    $Fulltype$ buffers can be created either by {@link #allocate + *

    $Type$ buffers can be created either by {@link #allocate * allocation}, which allocates space for the buffer's * #if[byte] * * content, or by {@link #wrap($type$[]) wrapping} an - * existing $fulltype$ array {#if[char]?or string} into a buffer. + * existing $type$ array {#if[char]?or string} into a buffer. * #else[byte] * * content, by {@link #wrap($type$[]) wrapping} an existing - * $fulltype$ array {#if[char]?or string} into a buffer, or by creating a + * $type$ array {#if[char]?or string} into a buffer, or by creating a * view of an existing byte buffer. * #end[byte] @@ -189,12 +189,12 @@ import java.io.IOException; * #if[!byte] * - *

    Like a byte buffer, $a$ $fulltype$ buffer is either Like a byte buffer, $a$ $type$ buffer is either direct or non-direct. A - * $fulltype$ buffer created via the wrap methods of this class will - * be non-direct. $A$ $fulltype$ buffer created as a view of a byte buffer will + * $type$ buffer created via the wrap methods of this class will + * be non-direct. $A$ $type$ buffer created as a view of a byte buffer will * be direct if, and only if, the byte buffer itself is direct. Whether or not - * $a$ $fulltype$ buffer is direct may be determined by invoking the {@link + * $a$ $type$ buffer is direct may be determined by invoking the {@link * #isDirect isDirect} method.

    * #end[!byte] @@ -287,7 +287,7 @@ public abstract class $Type$Buffer #if[byte] /** - * Allocates a new direct $fulltype$ buffer. + * Allocates a new direct $type$ buffer. * *

    The new buffer's position will be zero, its limit will be its * capacity, its mark will be undefined, and each of its elements will be @@ -295,9 +295,9 @@ public abstract class $Type$Buffer * {@link #hasArray backing array} is unspecified. * * @param capacity - * The new buffer's capacity, in $fulltype$s + * The new buffer's capacity, in $type$s * - * @return The new $fulltype$ buffer + * @return The new $type$ buffer * * @throws IllegalArgumentException * If the capacity is a negative integer @@ -309,7 +309,7 @@ public abstract class $Type$Buffer #end[byte] /** - * Allocates a new $fulltype$ buffer. + * Allocates a new $type$ buffer. * *

    The new buffer's position will be zero, its limit will be its * capacity, its mark will be undefined, and each of its elements will be @@ -318,9 +318,9 @@ public abstract class $Type$Buffer * offset} will be zero. * * @param capacity - * The new buffer's capacity, in $fulltype$s + * The new buffer's capacity, in $type$s * - * @return The new $fulltype$ buffer + * @return The new $type$ buffer * * @throws IllegalArgumentException * If the capacity is a negative integer @@ -332,9 +332,9 @@ public abstract class $Type$Buffer } /** - * Wraps $a$ $fulltype$ array into a buffer. + * Wraps $a$ $type$ array into a buffer. * - *

    The new buffer will be backed by the given $fulltype$ array; + *

    The new buffer will be backed by the given $type$ array; * that is, modifications to the buffer will cause the array to be modified * and vice versa. The new buffer's capacity will be * array.length, its position will be offset, its limit @@ -356,7 +356,7 @@ public abstract class $Type$Buffer * array.length - offset. * The new buffer's limit will be set to offset + length. * - * @return The new $fulltype$ buffer + * @return The new $type$ buffer * * @throws IndexOutOfBoundsException * If the preconditions on the offset and length @@ -373,9 +373,9 @@ public abstract class $Type$Buffer } /** - * Wraps $a$ $fulltype$ array into a buffer. + * Wraps $a$ $type$ array into a buffer. * - *

    The new buffer will be backed by the given $fulltype$ array; + *

    The new buffer will be backed by the given $type$ array; * that is, modifications to the buffer will cause the array to be modified * and vice versa. The new buffer's capacity and limit will be * array.length, its position will be zero, and its mark will be @@ -386,7 +386,7 @@ public abstract class $Type$Buffer * @param array * The array that will back this buffer * - * @return The new $fulltype$ buffer + * @return The new $type$ buffer */ public static $Type$Buffer wrap($type$[] array) { return wrap(array, 0, array.length); @@ -486,7 +486,7 @@ public abstract class $Type$Buffer #end[char] /** - * Creates a new $fulltype$ buffer whose content is a shared subsequence of + * Creates a new $type$ buffer whose content is a shared subsequence of * this buffer's content. * *

    The content of the new buffer will start at this buffer's current @@ -495,17 +495,17 @@ public abstract class $Type$Buffer * values will be independent. * *

    The new buffer's position will be zero, its capacity and its limit - * will be the number of $fulltype$s remaining in this buffer, and its mark + * will be the number of $type$s remaining in this buffer, and its mark * will be undefined. The new buffer will be direct if, and only if, this * buffer is direct, and it will be read-only if, and only if, this buffer * is read-only.

    * - * @return The new $fulltype$ buffer + * @return The new $type$ buffer */ public abstract $Type$Buffer slice(); /** - * Creates a new $fulltype$ buffer that shares this buffer's content. + * Creates a new $type$ buffer that shares this buffer's content. * *

    The content of the new buffer will be that of this buffer. Changes * to this buffer's content will be visible in the new buffer, and vice @@ -517,12 +517,12 @@ public abstract class $Type$Buffer * and only if, this buffer is direct, and it will be read-only if, and * only if, this buffer is read-only.

    * - * @return The new $fulltype$ buffer + * @return The new $type$ buffer */ public abstract $Type$Buffer duplicate(); /** - * Creates a new, read-only $fulltype$ buffer that shares this buffer's + * Creates a new, read-only $type$ buffer that shares this buffer's * content. * *

    The content of the new buffer will be that of this buffer. Changes @@ -537,7 +537,7 @@ public abstract class $Type$Buffer *

    If this buffer is itself read-only then this method behaves in * exactly the same way as the {@link #duplicate duplicate} method.

    * - * @return The new, read-only $fulltype$ buffer + * @return The new, read-only $type$ buffer */ public abstract $Type$Buffer asReadOnlyBuffer(); @@ -545,10 +545,10 @@ public abstract class $Type$Buffer // -- Singleton get/put methods -- /** - * Relative get method. Reads the $fulltype$ at this buffer's + * Relative get method. Reads the $type$ at this buffer's * current position, and then increments the position.

    * - * @return The $fulltype$ at the buffer's current position + * @return The $type$ at the buffer's current position * * @throws BufferUnderflowException * If the buffer's current position is not smaller than its limit @@ -558,11 +558,11 @@ public abstract class $Type$Buffer /** * Relative put method  (optional operation). * - *

    Writes the given $fulltype$ into this buffer at the current + *

    Writes the given $type$ into this buffer at the current * position, and then increments the position.

    * * @param $x$ - * The $fulltype$ to be written + * The $type$ to be written * * @return This buffer * @@ -575,13 +575,13 @@ public abstract class $Type$Buffer public abstract $Type$Buffer put($type$ $x$); /** - * Absolute get method. Reads the $fulltype$ at the given + * Absolute get method. Reads the $type$ at the given * index.

    * * @param index - * The index from which the $fulltype$ will be read + * The index from which the $type$ will be read * - * @return The $fulltype$ at the given index + * @return The $type$ at the given index * * @throws IndexOutOfBoundsException * If index is negative @@ -592,14 +592,14 @@ public abstract class $Type$Buffer /** * Absolute put method  (optional operation). * - *

    Writes the given $fulltype$ into this buffer at the given + *

    Writes the given $type$ into this buffer at the given * index.

    * * @param index - * The index at which the $fulltype$ will be written + * The index at which the $type$ will be written * * @param $x$ - * The $fulltype$ value to be written + * The $type$ value to be written * * @return This buffer * @@ -618,14 +618,14 @@ public abstract class $Type$Buffer /** * Relative bulk get method. * - *

    This method transfers $fulltype$s from this buffer into the given - * destination array. If there are fewer $fulltype$s remaining in the + *

    This method transfers $type$s from this buffer into the given + * destination array. If there are fewer $type$s remaining in the * buffer than are required to satisfy the request, that is, if * length > remaining(), then no - * $fulltype$s are transferred and a {@link BufferUnderflowException} is + * $type$s are transferred and a {@link BufferUnderflowException} is * thrown. * - *

    Otherwise, this method copies length $fulltype$s from this + *

    Otherwise, this method copies length $type$s from this * buffer into the given array, starting at the current position of this * buffer and at the given offset in the array. The position of this * buffer is then incremented by length. @@ -638,26 +638,26 @@ public abstract class $Type$Buffer * for (int i = off; i < off + len; i++) * dst[i] = src.get(); * - * except that it first checks that there are sufficient $fulltype$s in + * except that it first checks that there are sufficient $type$s in * this buffer and it is potentially much more efficient.

    * * @param dst - * The array into which $fulltype$s are to be written + * The array into which $type$s are to be written * * @param offset - * The offset within the array of the first $fulltype$ to be + * The offset within the array of the first $type$ to be * written; must be non-negative and no larger than * dst.length * * @param length - * The maximum number of $fulltype$s to be written to the given + * The maximum number of $type$s to be written to the given * array; must be non-negative and no larger than * dst.length - offset * * @return This buffer * * @throws BufferUnderflowException - * If there are fewer than length $fulltype$s + * If there are fewer than length $type$s * remaining in this buffer * * @throws IndexOutOfBoundsException @@ -677,7 +677,7 @@ public abstract class $Type$Buffer /** * Relative bulk get method. * - *

    This method transfers $fulltype$s from this buffer into the given + *

    This method transfers $type$s from this buffer into the given * destination array. An invocation of this method of the form * src.get(a) behaves in exactly the same way as the invocation * @@ -687,7 +687,7 @@ public abstract class $Type$Buffer * @return This buffer * * @throws BufferUnderflowException - * If there are fewer than length $fulltype$s + * If there are fewer than length $type$s * remaining in this buffer */ public $Type$Buffer get($type$[] dst) { @@ -700,15 +700,15 @@ public abstract class $Type$Buffer /** * Relative bulk put method  (optional operation). * - *

    This method transfers the $fulltype$s remaining in the given source - * buffer into this buffer. If there are more $fulltype$s remaining in the + *

    This method transfers the $type$s remaining in the given source + * buffer into this buffer. If there are more $type$s remaining in the * source buffer than in this buffer, that is, if * src.remaining() > remaining(), - * then no $fulltype$s are transferred and a {@link + * then no $type$s are transferred and a {@link * BufferOverflowException} is thrown. * *

    Otherwise, this method copies - * n = src.remaining() $fulltype$s from the given + * n = src.remaining() $type$s from the given * buffer into this buffer, starting at each buffer's current position. * The positions of both buffers are then incremented by n. * @@ -723,14 +723,14 @@ public abstract class $Type$Buffer * buffer and it is potentially much more efficient.

    * * @param src - * The source buffer from which $fulltype$s are to be read; + * The source buffer from which $type$s are to be read; * must not be this buffer * * @return This buffer * * @throws BufferOverflowException * If there is insufficient space in this buffer - * for the remaining $fulltype$s in the source buffer + * for the remaining $type$s in the source buffer * * @throws IllegalArgumentException * If the source buffer is this buffer @@ -752,14 +752,14 @@ public abstract class $Type$Buffer /** * Relative bulk put method  (optional operation). * - *

    This method transfers $fulltype$s into this buffer from the given - * source array. If there are more $fulltype$s to be copied from the array + *

    This method transfers $type$s into this buffer from the given + * source array. If there are more $type$s to be copied from the array * than remain in this buffer, that is, if * length > remaining(), then no - * $fulltype$s are transferred and a {@link BufferOverflowException} is + * $type$s are transferred and a {@link BufferOverflowException} is * thrown. * - *

    Otherwise, this method copies length $fulltype$s from the + *

    Otherwise, this method copies length $type$s from the * given array into this buffer, starting at the given offset in the array * and at the current position of this buffer. The position of this buffer * is then incremented by length. @@ -776,14 +776,14 @@ public abstract class $Type$Buffer * buffer and it is potentially much more efficient.

    * * @param src - * The array from which $fulltype$s are to be read + * The array from which $type$s are to be read * * @param offset - * The offset within the array of the first $fulltype$ to be read; + * The offset within the array of the first $type$ to be read; * must be non-negative and no larger than array.length * * @param length - * The number of $fulltype$s to be read from the given array; + * The number of $type$s to be read from the given array; * must be non-negative and no larger than * array.length - offset * @@ -813,7 +813,7 @@ public abstract class $Type$Buffer * Relative bulk put method  (optional operation). * *

    This method transfers the entire content of the given source - * $fulltype$ array into this buffer. An invocation of this method of the + * $type$ array into this buffer. An invocation of this method of the * form dst.put(a) behaves in exactly the same way as the * invocation * @@ -837,15 +837,15 @@ public abstract class $Type$Buffer /** * Relative bulk put method  (optional operation). * - *

    This method transfers $fulltype$s from the given string into this - * buffer. If there are more $fulltype$s to be copied from the string than + *

    This method transfers $type$s from the given string into this + * buffer. If there are more $type$s to be copied from the string than * remain in this buffer, that is, if * end - start > remaining(), - * then no $fulltype$s are transferred and a {@link + * then no $type$s are transferred and a {@link * BufferOverflowException} is thrown. * *

    Otherwise, this method copies - * n = end - start $fulltype$s + * n = end - start $type$s * from the given string into this buffer, starting at the given * start index and at the current position of this buffer. The * position of this buffer is then incremented by n. @@ -862,15 +862,15 @@ public abstract class $Type$Buffer * buffer and it is potentially much more efficient.

    * * @param src - * The string from which $fulltype$s are to be read + * The string from which $type$s are to be read * * @param start - * The offset within the string of the first $fulltype$ to be read; + * The offset within the string of the first $type$ to be read; * must be non-negative and no larger than * string.length() * * @param end - * The offset within the string of the last $fulltype$ to be read, + * The offset within the string of the last $type$ to be read, * plus one; must be non-negative and no larger than * string.length() * @@ -921,7 +921,7 @@ public abstract class $Type$Buffer // -- Other stuff -- /** - * Tells whether or not this buffer is backed by an accessible $fulltype$ + * Tells whether or not this buffer is backed by an accessible $type$ * array. * *

    If this method returns true then the {@link #array() array} @@ -936,7 +936,7 @@ public abstract class $Type$Buffer } /** - * Returns the $fulltype$ array that backs this + * Returns the $type$ array that backs this * buffer  (optional operation). * *

    Modifications to this buffer's content will cause the returned @@ -993,17 +993,17 @@ public abstract class $Type$Buffer /** * Compacts this buffer  (optional operation). * - *

    The $fulltype$s between the buffer's current position and its limit, + *

    The $type$s between the buffer's current position and its limit, * if any, are copied to the beginning of the buffer. That is, the - * $fulltype$ at index p = position() is copied - * to index zero, the $fulltype$ at index p + 1 is copied - * to index one, and so forth until the $fulltype$ at index + * $type$ at index p = position() is copied + * to index zero, the $type$ at index p + 1 is copied + * to index one, and so forth until the $type$ at index * limit() - 1 is copied to index * n = limit() - 1 - p. * The buffer's position is then set to n+1 and its limit is set to * its capacity. The mark, if defined, is discarded. * - *

    The buffer's position is set to the number of $fulltype$s copied, + *

    The buffer's position is set to the number of $type$s copied, * rather than to zero, so that an invocation of this method can be * followed immediately by an invocation of another relative put * method.

    @@ -1032,7 +1032,7 @@ public abstract class $Type$Buffer public abstract $Type$Buffer compact(); /** - * Tells whether or not this $fulltype$ buffer is direct.

    + * Tells whether or not this $type$ buffer is direct.

    * * @return true if, and only if, this buffer is direct */ @@ -1098,6 +1098,13 @@ public abstract class $Type$Buffer * *
  • The two sequences of remaining elements, considered * independently of their starting positions, are pointwise equal. +#if[floatingPointType] + * This method considers two $type$ elements {@code a} and {@code b} + * to be equal if + * {@code (a == b) || ($Fulltype$.isNaN(a) && $Fulltype$.isNaN(b))}. + * The values {@code -0.0} and {@code +0.0} are considered to be + * equal, unlike {@link $Fulltype$#equals(Object)}. +#end[floatingPointType] *

  • * * @@ -1118,24 +1125,37 @@ public abstract class $Type$Buffer if (this.remaining() != that.remaining()) return false; int p = this.position(); - for (int i = this.limit() - 1, j = that.limit() - 1; i >= p; i--, j--) { - $type$ v1 = this.get(i); - $type$ v2 = that.get(j); - if (v1 != v2) { - if ((v1 != v1) && (v2 != v2)) // For float and double - continue; + for (int i = this.limit() - 1, j = that.limit() - 1; i >= p; i--, j--) + if (!equals(this.get(i), that.get(j))) return false; - } - } return true; } + private static boolean equals($type$ x, $type$ y) { +#if[floatingPointType] + return (x == y) || ($Fulltype$.isNaN(x) && $Fulltype$.isNaN(y)); +#else[floatingPointType] + return x == y; +#end[floatingPointType] + } + /** * Compares this buffer to another. * *

    Two $type$ buffers are compared by comparing their sequences of * remaining elements lexicographically, without regard to the starting * position of each sequence within its corresponding buffer. +#if[floatingPointType] + * Pairs of {@code $type$} elements are compared as if by invoking + * {@link $Fulltype$#compare($type$,$type$)}, except that + * {@code -0.0} and {@code 0.0} are considered to be equal. + * {@code $Fulltype$.NaN} is considered by this method to be equal + * to itself and greater than all other {@code $type$} values + * (including {@code $Fulltype$.POSITIVE_INFINITY}). +#else[floatingPointType] + * Pairs of {@code $type$} elements are compared as if by invoking + * {@link $Fulltype$#compare($type$,$type$)}. +#end[floatingPointType] * *

    A $type$ buffer is not comparable to any other type of object. * @@ -1145,20 +1165,23 @@ public abstract class $Type$Buffer public int compareTo($Type$Buffer that) { int n = this.position() + Math.min(this.remaining(), that.remaining()); for (int i = this.position(), j = that.position(); i < n; i++, j++) { - $type$ v1 = this.get(i); - $type$ v2 = that.get(j); - if (v1 == v2) - continue; - if ((v1 != v1) && (v2 != v2)) // For float and double - continue; - if (v1 < v2) - return -1; - return +1; + int cmp = compare(this.get(i), that.get(j)); + if (cmp != 0) + return cmp; } return this.remaining() - that.remaining(); } - + private static int compare($type$ x, $type$ y) { +#if[floatingPointType] + return ((x < y) ? -1 : + (x > y) ? +1 : + (x == y) ? 0 : + $Fulltype$.isNaN(x) ? ($Fulltype$.isNaN(y) ? 0 : +1) : -1); +#else[floatingPointType] + return $Fulltype$.compare(x, y); +#end[floatingPointType] + } // -- Other char stuff -- @@ -1326,7 +1349,7 @@ public abstract class $Type$Buffer } /** - * Appends the specified $fulltype$ to this + * Appends the specified $type$ to this * buffer  (optional operation). * *

    An invocation of this method of the form dst.append($x$) @@ -1336,7 +1359,7 @@ public abstract class $Type$Buffer * dst.put($x$) * * @param $x$ - * The 16-bit $fulltype$ to append + * The 16-bit $type$ to append * * @return This buffer * @@ -1362,10 +1385,10 @@ public abstract class $Type$Buffer /** * Retrieves this buffer's byte order. * - *

    The byte order of $a$ $fulltype$ buffer created by allocation or by + *

    The byte order of $a$ $type$ buffer created by allocation or by * wrapping an existing $type$ array is the {@link * ByteOrder#nativeOrder native order} of the underlying - * hardware. The byte order of $a$ $fulltype$ buffer created as a view of a byte buffer is that of the * byte buffer at the moment that the view is created.

    * diff --git a/src/share/classes/java/rmi/activation/Activatable.java b/src/share/classes/java/rmi/activation/Activatable.java index 07879812774dd75abcdf82d22a5ed2432260b2a7..de02b0d6e31e274ac5774dcd4e200b0601dbfc9d 100644 --- a/src/share/classes/java/rmi/activation/Activatable.java +++ b/src/share/classes/java/rmi/activation/Activatable.java @@ -73,7 +73,7 @@ public abstract class Activatable extends RemoteServer { * can be handled properly. * *

    This method invokes the {@link - * exportObject(Remote,String,MarshalledObject,boolean,port) + * #exportObject(Remote,String,MarshalledObject,boolean,int) * exportObject} method with this object, and the specified location, * data, restart mode, and port. Subsequent calls to {@link #getID} * will return the activation identifier returned from the call to @@ -120,7 +120,7 @@ public abstract class Activatable extends RemoteServer { * can be handled properly. * *

    This method invokes the {@link - * exportObject(Remote,String,MarshalledObject,boolean,port,RMIClientSocketFactory,RMIServerSocketFactory) + * #exportObject(Remote,String,MarshalledObject,boolean,int,RMIClientSocketFactory,RMIServerSocketFactory) * exportObject} method with this object, and the specified location, * data, restart mode, port, and client and server socket factories. * Subsequent calls to {@link #getID} will return the activation @@ -312,7 +312,7 @@ public abstract class Activatable extends RemoteServer { * separately, so that exceptions can be handled properly. * *

    This method invokes the {@link - * exportObject(Remote,String,MarshalledObject,boolean,port,RMIClientSocketFactory,RMIServerSocketFactory) + * #exportObject(Remote,String,MarshalledObject,boolean,int,RMIClientSocketFactory,RMIServerSocketFactory) * exportObject} method with the specified object, location, data, * restart mode, and port, and null for both client and * server socket factories, and then returns the resulting activation diff --git a/src/share/classes/java/rmi/registry/LocateRegistry.java b/src/share/classes/java/rmi/registry/LocateRegistry.java index d32e40357493ab5df6b37203a0089add1223d10f..b65feca8c80bd2ac0ac05a34def3e1a1370e7da6 100644 --- a/src/share/classes/java/rmi/registry/LocateRegistry.java +++ b/src/share/classes/java/rmi/registry/LocateRegistry.java @@ -187,7 +187,7 @@ public final class LocateRegistry { * host that accepts requests on the specified port. * *

    The Registry instance is exported as if the static - * {@link UnicastRemoteObject.exportObject(Remote,int) + * {@link UnicastRemoteObject#exportObject(Remote,int) * UnicastRemoteObject.exportObject} method is invoked, passing the * Registry instance and the specified port as * arguments, except that the Registry instance is @@ -213,7 +213,7 @@ public final class LocateRegistry { * *

    The Registry instance is exported as if * the static {@link - * UnicastRemoteObject.exportObject(Remote,int,RMIClientSocketFactory,RMIServerSocketFactory) + * UnicastRemoteObject#exportObject(Remote,int,RMIClientSocketFactory,RMIServerSocketFactory) * UnicastRemoteObject.exportObject} method is invoked, passing the * Registry instance, the specified port, the * specified RMIClientSocketFactory, and the specified diff --git a/src/share/classes/java/rmi/server/RemoteObjectInvocationHandler.java b/src/share/classes/java/rmi/server/RemoteObjectInvocationHandler.java index 59de6cfad0204ace772f657a09973d55eba1f32c..06647bac951f181d98429ba3cac811e73a591788 100644 --- a/src/share/classes/java/rmi/server/RemoteObjectInvocationHandler.java +++ b/src/share/classes/java/rmi/server/RemoteObjectInvocationHandler.java @@ -138,7 +138,6 @@ public class RemoteObjectInvocationHandler * instance * @throws Throwable the exception to throw from the method invocation * on the proxy instance - * @see **/ public Object invoke(Object proxy, Method method, Object[] args) throws Throwable diff --git a/src/share/classes/java/security/cert/CertPathValidatorException.java b/src/share/classes/java/security/cert/CertPathValidatorException.java index c1ca1d2b8de4cfdb2f41bbd8f58fb01e7a2e14c5..86b0b45e276ef0ca2a77d925dd907362ce3c9225 100644 --- a/src/share/classes/java/security/cert/CertPathValidatorException.java +++ b/src/share/classes/java/security/cert/CertPathValidatorException.java @@ -216,7 +216,7 @@ public class CertPathValidatorException extends GeneralSecurityException { /** * Returns the reason that the validation failed. The reason is * associated with the index of the certificate returned by - * {@link getIndex}. + * {@link #getIndex}. * * @return the reason that the validation failed, or * BasicReason.UNSPECIFIED if a reason has not been diff --git a/src/share/classes/java/text/Bidi.java b/src/share/classes/java/text/Bidi.java index e4db4b2d08625872b1ab34be30952b3e4adbd068..504021ff143062d35f9eba5a6976acf8da57981a 100644 --- a/src/share/classes/java/text/Bidi.java +++ b/src/share/classes/java/text/Bidi.java @@ -121,9 +121,9 @@ public final class Bidi { * * @param paragraph a paragraph of text with optional character and paragraph attribute information * - * @see TextAttribute#BIDI_EMBEDDING - * @see TextAttribute#NUMERIC_SHAPING - * @see TextAttribute#RUN_DIRECTION + * @see java.awt.font.TextAttribute#BIDI_EMBEDDING + * @see java.awt.font.TextAttribute#NUMERIC_SHAPING + * @see java.awt.font.TextAttribute#RUN_DIRECTION */ public Bidi(AttributedCharacterIterator paragraph) { if (paragraph == null) { diff --git a/src/share/classes/java/util/NavigableMap.java b/src/share/classes/java/util/NavigableMap.java index 592a20dbe6d931af4efc5f733fc1fe86013f8415..7761b0742c5e080f8640676dde59929b1c329ce2 100644 --- a/src/share/classes/java/util/NavigableMap.java +++ b/src/share/classes/java/util/NavigableMap.java @@ -298,7 +298,7 @@ public interface NavigableMap extends SortedMap { * Returns a view of the portion of this map whose keys range from * {@code fromKey} to {@code toKey}. If {@code fromKey} and * {@code toKey} are equal, the returned map is empty unless - * {@code fromExclusive} and {@code toExclusive} are both true. The + * {@code fromInclusive} and {@code toInclusive} are both true. The * returned map is backed by this map, so changes in the returned map are * reflected in this map, and vice-versa. The returned map supports all * optional map operations that this map supports. diff --git a/src/share/classes/java/util/NavigableSet.java b/src/share/classes/java/util/NavigableSet.java index b96299e1547c370bc7201479f91eba1f150499a5..d4f0b2ccd7cf0cb902bdb8166c20bf6394133037 100644 --- a/src/share/classes/java/util/NavigableSet.java +++ b/src/share/classes/java/util/NavigableSet.java @@ -192,7 +192,7 @@ public interface NavigableSet extends SortedSet { * Returns a view of the portion of this set whose elements range from * {@code fromElement} to {@code toElement}. If {@code fromElement} and * {@code toElement} are equal, the returned set is empty unless {@code - * fromExclusive} and {@code toExclusive} are both true. The returned set + * fromInclusive} and {@code toInclusive} are both true. The returned set * is backed by this set, so changes in the returned set are reflected in * this set, and vice-versa. The returned set supports all optional set * operations that this set supports. diff --git a/src/share/classes/java/util/Objects.java b/src/share/classes/java/util/Objects.java index 3ef61bde98d528ac65384c85395019e95960aaec..8b009243eb938db4acc80b13424c009d09828b84 100644 --- a/src/share/classes/java/util/Objects.java +++ b/src/share/classes/java/util/Objects.java @@ -119,7 +119,7 @@ public final class Objects { * * @param values the values to be hashed * @return a hash value of the sequence of input values - * @see Arrays#hashCode + * @see Arrays#hashCode(Object[]) * @see List#hashCode */ public static int hash(Object... values) { diff --git a/src/share/classes/java/util/logging/PlatformLoggingMXBean.java b/src/share/classes/java/util/logging/PlatformLoggingMXBean.java index f994e285bcd0a3c19786d9e49d63303e5c8a15e0..b27339461cb19c852f07014c2b1fd413a1abb721 100644 --- a/src/share/classes/java/util/logging/PlatformLoggingMXBean.java +++ b/src/share/classes/java/util/logging/PlatformLoggingMXBean.java @@ -51,7 +51,7 @@ import java.lang.management.PlatformManagedObject; * The {@link PlatformManagedObject#getObjectName} method * can be used to obtain its {@code ObjectName}. * - * @See java.lang.management.PlatformManagedObject + * @see java.lang.management.PlatformManagedObject * * @author Mandy Chung * @since 1.7 diff --git a/src/share/classes/javax/accessibility/AccessibleContext.java b/src/share/classes/javax/accessibility/AccessibleContext.java index fbe7e9b1d6f6429a76aec01c47457b0a8f00810f..d4a093f72ecd22c2d05a3c6db921e811f1f78c5a 100644 --- a/src/share/classes/javax/accessibility/AccessibleContext.java +++ b/src/share/classes/javax/accessibility/AccessibleContext.java @@ -296,7 +296,7 @@ public abstract class AccessibleContext { * * @see #getAccessibleText * @see #addPropertyChangeListener - * @see #AccessibleText.AccessibleTextSequence + * @see AccessibleTextSequence */ public static final String ACCESSIBLE_TEXT_PROPERTY = "AccessibleText"; @@ -311,7 +311,7 @@ public abstract class AccessibleContext { * * @see #getAccessibleText * @see #addPropertyChangeListener - * @see #AccessibleText.AccessibleTextSequence + * @see AccessibleTextSequence * * @since 1.5 */ @@ -334,7 +334,7 @@ public abstract class AccessibleContext { * * @see #getAccessibleText * @see #addPropertyChangeListener - * @see #AccessibleText.AccessibleAttributeSequence + * @see AccessibleAttributeSequence * * @since 1.5 */ diff --git a/src/share/classes/javax/accessibility/AccessibleExtendedText.java b/src/share/classes/javax/accessibility/AccessibleExtendedText.java index 4868ab85e8f7bd0dae7225ffc63e6bf03a5bd84f..f7a0425213601d123686d314323fd32c730bf30d 100644 --- a/src/share/classes/javax/accessibility/AccessibleExtendedText.java +++ b/src/share/classes/javax/accessibility/AccessibleExtendedText.java @@ -45,7 +45,6 @@ import javax.swing.text.*; * @see Accessible#getAccessibleContext * @see AccessibleContext * @see AccessibleContext#getAccessibleText - * @see AccessibleText.AccessibleTextChunk * * @author Peter Korn * @author Lynn Monsanto diff --git a/src/share/classes/javax/accessibility/AccessibleKeyBinding.java b/src/share/classes/javax/accessibility/AccessibleKeyBinding.java index cdf4c493a62de27d451e9cc93982e8d9159eef23..e50e9f54259d3d5fb6be90940d33bf4eb1d9ecf2 100644 --- a/src/share/classes/javax/accessibility/AccessibleKeyBinding.java +++ b/src/share/classes/javax/accessibility/AccessibleKeyBinding.java @@ -32,16 +32,11 @@ package javax.accessibility; * the standard mechanism for an assistive technology to determine the * key bindings which exist for this object. * Any object that has such key bindings should support this - * interface. Applications can determine if an object supports the - * AccessibleKeyBinding interface by first obtaining its AccessibleContext - * (see @link Accessible} and then calling the - * {@link AccessibleContext#getAccessibleKeyBinding} method. If the return - * value is not null, the object supports this interface. + * interface. * * @see Accessible * @see Accessible#getAccessibleContext * @see AccessibleContext - * @see AccessibleContext#getAccessibleKeyBinding * * @author Lynn Monsanto * @since 1.4 @@ -58,21 +53,7 @@ public interface AccessibleKeyBinding { /** * Returns a key binding for this object. The value returned is an * java.lang.Object which must be cast to appropriate type depending - * on the underlying implementation of the key. For example, if the - * Object returned is a javax.swing.KeyStroke, the user of this - * method should do the following: - * - * Component c = - * AccessibleContext ac = c.getAccessibleContext(); - * AccessibleKeyBinding akb = ac.getAccessibleKeyBinding(); - * for (int i = 0; i < akb.getAccessibleKeyBindingCount(); i++) { - * Object o = akb.getAccessibleKeyBinding(i); - * if (o instanceof javax.swing.KeyStroke) { - * javax.swing.KeyStroke keyStroke = (javax.swing.KeyStroke)o; - * - * } - * } - * + * on the underlying implementation of the key. * * @param i zero-based index of the key bindings * @return a javax.lang.Object which specifies the key binding diff --git a/src/share/classes/org/ietf/jgss/GSSName.java b/src/share/classes/org/ietf/jgss/GSSName.java index f29efc74368cd500dd43181dbe0a4f70f0508f90..acc0ee55afbd7e45086792769b070cbf4443c8b7 100644 --- a/src/share/classes/org/ietf/jgss/GSSName.java +++ b/src/share/classes/org/ietf/jgss/GSSName.java @@ -1,5 +1,5 @@ /* - * Copyright 2000 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2000-2010 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -103,11 +103,12 @@ public interface GSSName { * follows: service@hostname.

    * * It represents the following Oid value:
    - * { 1(iso), 3(org), 6(dod), 1(internet), 5(security), - * 6(nametypes), 2(gss-host-based-services) } + * { iso(1) member-body(2) United + * States(840) mit(113554) infosys(1) gssapi(2) generic(1) service_name(4) + * } */ public static final Oid NT_HOSTBASED_SERVICE - = Oid.getInstance("1.3.6.1.5.6.2"); + = Oid.getInstance("1.2.840.113554.1.2.1.4"); /** * Name type to indicate a named user on a local system.

    diff --git a/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLSignature.java b/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLSignature.java index a758486e0cbdaaf81d3e80e71bc80fa0d68eed96..092681bd92d95fe66a1f3c091b88e38a986d9946 100644 --- a/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLSignature.java +++ b/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLSignature.java @@ -326,7 +326,7 @@ public final class DOMXMLSignature extends DOMStructure } // generate references and signature value - List allReferences = new ArrayList(si.getReferences()); + List allReferences = new ArrayList(); // traverse the Signature and register all objects with IDs that // may contain References @@ -356,6 +356,9 @@ public final class DOMXMLSignature extends DOMStructure } } } + // always add SignedInfo references after Manifest references so + // that Manifest reference are digested first + allReferences.addAll(si.getReferences()); // generate/digest each reference for (int i = 0, size = allReferences.size(); i < size; i++) { diff --git a/src/share/classes/sun/dyn/AdapterMethodHandle.java b/src/share/classes/sun/dyn/AdapterMethodHandle.java index 334e0a563a71d8bea30ae9d02fd350fb7ff48cca..3a2013551a35bc1d39e9ec9b8c087ff1a482f11a 100644 --- a/src/share/classes/sun/dyn/AdapterMethodHandle.java +++ b/src/share/classes/sun/dyn/AdapterMethodHandle.java @@ -30,7 +30,7 @@ import sun.dyn.util.Wrapper; import java.dyn.*; import java.util.Arrays; import static sun.dyn.MethodHandleNatives.Constants.*; -import static sun.dyn.MethodHandleImpl.newIllegalArgumentException; +import static sun.dyn.MemberName.newIllegalArgumentException; /** * This method handle performs simple conversion or checking of a single argument. @@ -302,7 +302,22 @@ public class AdapterMethodHandle extends BoundMethodHandle { */ private static int type2size(int type) { assert(type >= T_BOOLEAN && type <= T_OBJECT); - return (type == T_FLOAT || type == T_DOUBLE) ? 2 : 1; + return (type == T_LONG || type == T_DOUBLE) ? 2 : 1; + } + private static int type2size(Class type) { + return type2size(basicType(type)); + } + + /** The given stackMove is the number of slots pushed. + * It might be negative. Scale it (multiply) by the + * VM's notion of how an address changes with a push, + * to get the raw SP change for stackMove. + * Then shift and mask it into the correct field. + */ + private static long insertStackMove(int stackMove) { + // following variable must be long to avoid sign extension after '<<' + long spChange = stackMove * MethodHandleNatives.JVM_STACK_MOVE_UNIT; + return (spChange & CONV_STACK_MOVE_MASK) << CONV_STACK_MOVE_SHIFT; } /** Construct an adapter conversion descriptor for a single-argument conversion. */ @@ -310,16 +325,16 @@ public class AdapterMethodHandle extends BoundMethodHandle { assert(src == (src & 0xF)); assert(dest == (dest & 0xF)); assert(convOp >= OP_CHECK_CAST && convOp <= OP_PRIM_TO_REF); - long stackMove = type2size(dest) - type2size(src); + int stackMove = type2size(dest) - type2size(src); return ((long) argnum << 32 | (long) convOp << CONV_OP_SHIFT | (int) src << CONV_SRC_TYPE_SHIFT | (int) dest << CONV_DEST_TYPE_SHIFT | - stackMove << CONV_STACK_MOVE_SHIFT + insertStackMove(stackMove) ); } private static long makeConv(int convOp, int argnum, int stackMove) { - assert(convOp >= OP_SWAP_ARGS && convOp <= OP_SPREAD_ARGS); + assert(convOp >= OP_DUP_ARGS && convOp <= OP_SPREAD_ARGS); byte src = 0, dest = 0; if (convOp >= OP_COLLECT_ARGS && convOp <= OP_SPREAD_ARGS) src = dest = T_OBJECT; @@ -327,12 +342,21 @@ public class AdapterMethodHandle extends BoundMethodHandle { (long) convOp << CONV_OP_SHIFT | (int) src << CONV_SRC_TYPE_SHIFT | (int) dest << CONV_DEST_TYPE_SHIFT | - stackMove << CONV_STACK_MOVE_SHIFT + insertStackMove(stackMove) + ); + } + private static long makeSwapConv(int convOp, int srcArg, byte type, int destSlot) { + assert(convOp >= OP_SWAP_ARGS && convOp <= OP_ROT_ARGS); + return ((long) srcArg << 32 | + (long) convOp << CONV_OP_SHIFT | + (int) type << CONV_SRC_TYPE_SHIFT | + (int) type << CONV_DEST_TYPE_SHIFT | + (int) destSlot << CONV_VMINFO_SHIFT ); } private static long makeConv(int convOp) { - assert(convOp == OP_RETYPE_ONLY); - return (long) convOp << CONV_OP_SHIFT; // stackMove, src, dst, argnum all zero + assert(convOp == OP_RETYPE_ONLY || convOp == OP_RETYPE_RAW); + return ((long)-1 << 32) | (convOp << CONV_OP_SHIFT); // stackMove, src, dst all zero } private static int convCode(long conv) { return (int)conv; @@ -348,16 +372,6 @@ public class AdapterMethodHandle extends BoundMethodHandle { /** One of OP_RETYPE_ONLY, etc. */ int conversionOp() { return (conversion & CONV_OP_MASK) >> CONV_OP_SHIFT; } - @Override - public String toString() { - return addTypeString(this, "Adapted[" + basicToString(nonAdapter((MethodHandle)vmtarget)) + "]"); - } - - private static MethodHandle nonAdapter(MethodHandle mh) { - return (MethodHandle) - MethodHandleNatives.getTarget(mh, ETF_DIRECT_HANDLE); - } - /* Return one plus the position of the first non-trivial difference * between the given types. This is not a symmetric operation; * we are considering adapting the targetType to adapterType. @@ -399,14 +413,14 @@ public class AdapterMethodHandle extends BoundMethodHandle { //if (false) return 1; // never adaptable! return -1; // some significant difference } - private static int diffParamTypes(MethodType adapterType, int tstart, - MethodType targetType, int astart, + private static int diffParamTypes(MethodType adapterType, int astart, + MethodType targetType, int tstart, int nargs, boolean raw) { assert(nargs >= 0); int res = 0; for (int i = 0; i < nargs; i++) { - Class src = adapterType.parameterType(tstart+i); - Class dest = targetType.parameterType(astart+i); + Class src = adapterType.parameterType(astart+i); + Class dest = targetType.parameterType(tstart+i); if ((!raw ? VerifyType.canPassUnchecked(src, dest) : VerifyType.canPassRaw(src, dest) @@ -422,7 +436,7 @@ public class AdapterMethodHandle extends BoundMethodHandle { /** Can a retyping adapter (alone) validly convert the target to newType? */ public static boolean canRetypeOnly(MethodType newType, MethodType targetType) { - return canRetypeOnly(newType, targetType, false); + return canRetype(newType, targetType, false); } /** Can a retyping adapter (alone) convert the target to newType? * It is allowed to widen subword types and void to int, to make bitwise @@ -430,14 +444,14 @@ public class AdapterMethodHandle extends BoundMethodHandle { * reference conversions on return. This last feature requires that the * caller be trusted, and perform explicit cast conversions on return values. */ - static boolean canRawRetypeOnly(MethodType newType, MethodType targetType) { - return canRetypeOnly(newType, targetType, true); + public static boolean canRetypeRaw(MethodType newType, MethodType targetType) { + return canRetype(newType, targetType, true); } - static boolean canRetypeOnly(MethodType newType, MethodType targetType, boolean raw) { - if (!convOpSupported(OP_RETYPE_ONLY)) return false; + static boolean canRetype(MethodType newType, MethodType targetType, boolean raw) { + if (!convOpSupported(raw ? OP_RETYPE_RAW : OP_RETYPE_ONLY)) return false; int diff = diffTypes(newType, targetType, raw); // %%% This assert is too strong. Factor diff into VerifyType and reconcile. - assert((diff == 0) == VerifyType.isNullConversion(newType, targetType)); + assert(raw || (diff == 0) == VerifyType.isNullConversion(newType, targetType)); return diff == 0; } @@ -447,19 +461,21 @@ public class AdapterMethodHandle extends BoundMethodHandle { */ public static MethodHandle makeRetypeOnly(Access token, MethodType newType, MethodHandle target) { - return makeRetypeOnly(token, newType, target, false); + return makeRetype(token, newType, target, false); } - public static MethodHandle makeRawRetypeOnly(Access token, + public static MethodHandle makeRetypeRaw(Access token, MethodType newType, MethodHandle target) { - return makeRetypeOnly(token, newType, target, true); + return makeRetype(token, newType, target, true); } - static MethodHandle makeRetypeOnly(Access token, + static MethodHandle makeRetype(Access token, MethodType newType, MethodHandle target, boolean raw) { Access.check(token); - if (!canRetypeOnly(newType, target.type(), raw)) + MethodType oldType = target.type(); + if (oldType == newType) return target; + if (!canRetype(newType, oldType, raw)) return null; // TO DO: clone the target guy, whatever he is, with new type. - return new AdapterMethodHandle(target, newType, makeConv(OP_RETYPE_ONLY)); + return new AdapterMethodHandle(target, newType, makeConv(raw ? OP_RETYPE_RAW : OP_RETYPE_ONLY)); } /** Can a checkcast adapter validly convert the target to newType? @@ -492,7 +508,7 @@ public class AdapterMethodHandle extends BoundMethodHandle { Access.check(token); if (!canCheckCast(newType, target.type(), arg, castType)) return null; - long conv = makeConv(OP_CHECK_CAST, arg, 0); + long conv = makeConv(OP_CHECK_CAST, arg, T_OBJECT, T_OBJECT); return new AdapterMethodHandle(target, newType, conv, castType); } @@ -537,10 +553,9 @@ public class AdapterMethodHandle extends BoundMethodHandle { int arg, Class convType) { Access.check(token); MethodType oldType = target.type(); - Class src = newType.parameterType(arg); - Class dst = oldType.parameterType(arg); if (!canPrimCast(newType, oldType, arg, convType)) return null; + Class src = newType.parameterType(arg); long conv = makeConv(OP_PRIM_TO_PRIM, arg, basicType(src), basicType(convType)); return new AdapterMethodHandle(target, newType, conv); } @@ -607,8 +622,6 @@ public class AdapterMethodHandle extends BoundMethodHandle { return null; } - // TO DO: makeSwapArguments, makeRotateArguments, makeDuplicateArguments - /** Can an adapter simply drop arguments to convert the target to newType? */ public static boolean canDropArguments(MethodType newType, MethodType targetType, int dropArgPos, int dropArgCount) { @@ -643,26 +656,195 @@ public class AdapterMethodHandle extends BoundMethodHandle { Access.check(token); if (dropArgCount == 0) return makeRetypeOnly(IMPL_TOKEN, newType, target); - MethodType mt = target.type(); - int argCount = mt.parameterCount(); - if (!canDropArguments(newType, mt, dropArgPos, dropArgCount)) + if (!canDropArguments(newType, target.type(), dropArgPos, dropArgCount)) + return null; + // in arglist: [0: ...keep1 | dpos: drop... | dpos+dcount: keep2... ] + // out arglist: [0: ...keep1 | dpos: keep2... ] + int keep2InPos = dropArgPos + dropArgCount; + int dropSlot = newType.parameterSlotDepth(keep2InPos); + int keep1InSlot = newType.parameterSlotDepth(dropArgPos); + int slotCount = keep1InSlot - dropSlot; + assert(slotCount >= dropArgCount); + assert(target.type().parameterSlotCount() + slotCount == newType.parameterSlotCount()); + long conv = makeConv(OP_DROP_ARGS, dropArgPos + dropArgCount - 1, -slotCount); + return new AdapterMethodHandle(target, newType, conv); + } + + /** Can an adapter duplicate an argument to convert the target to newType? */ + public static boolean canDupArguments(MethodType newType, MethodType targetType, + int dupArgPos, int dupArgCount) { + if (!convOpSupported(OP_DUP_ARGS)) return false; + if (diffReturnTypes(newType, targetType, false) != 0) + return false; + int nptypes = newType.parameterCount(); + if (dupArgCount < 0 || dupArgPos + dupArgCount > nptypes) + return false; + if (targetType.parameterCount() != nptypes + dupArgCount) + return false; + // parameter types must be the same up to the duplicated arguments + if (diffParamTypes(newType, 0, targetType, 0, nptypes, false) != 0) + return false; + // duplicated types must be, well, duplicates + if (diffParamTypes(newType, dupArgPos, targetType, nptypes, dupArgCount, false) != 0) + return false; + return true; + } + + /** Factory method: Duplicate the selected argument. + * Return null if this is not possible. + */ + public static MethodHandle makeDupArguments(Access token, + MethodType newType, MethodHandle target, + int dupArgPos, int dupArgCount) { + Access.check(token); + if (!canDupArguments(newType, target.type(), dupArgPos, dupArgCount)) return null; - int dropSlotCount, dropSlotPos; - if (dropArgCount >= argCount) { - assert(dropArgPos == argCount-1); - dropSlotPos = 0; - dropSlotCount = mt.parameterSlotCount(); + if (dupArgCount == 0) + return target; + // in arglist: [0: ...keep1 | dpos: dup... | dpos+dcount: keep2... ] + // out arglist: [0: ...keep1 | dpos: dup... | dpos+dcount: keep2... | dup... ] + int keep2InPos = dupArgPos + dupArgCount; + int dupSlot = newType.parameterSlotDepth(keep2InPos); + int keep1InSlot = newType.parameterSlotDepth(dupArgPos); + int slotCount = keep1InSlot - dupSlot; + assert(target.type().parameterSlotCount() - slotCount == newType.parameterSlotCount()); + long conv = makeConv(OP_DUP_ARGS, dupArgPos + dupArgCount - 1, slotCount); + return new AdapterMethodHandle(target, newType, conv); + } + + /** Can an adapter swap two arguments to convert the target to newType? */ + public static boolean canSwapArguments(MethodType newType, MethodType targetType, + int swapArg1, int swapArg2) { + if (!convOpSupported(OP_SWAP_ARGS)) return false; + if (diffReturnTypes(newType, targetType, false) != 0) + return false; + if (swapArg1 >= swapArg2) return false; // caller resp + int nptypes = newType.parameterCount(); + if (targetType.parameterCount() != nptypes) + return false; + if (swapArg1 < 0 || swapArg2 >= nptypes) + return false; + if (diffParamTypes(newType, 0, targetType, 0, swapArg1, false) != 0) + return false; + if (diffParamTypes(newType, swapArg1, targetType, swapArg2, 1, false) != 0) + return false; + if (diffParamTypes(newType, swapArg1+1, targetType, swapArg1+1, swapArg2-swapArg1-1, false) != 0) + return false; + if (diffParamTypes(newType, swapArg2, targetType, swapArg1, 1, false) != 0) + return false; + if (diffParamTypes(newType, swapArg2+1, targetType, swapArg2+1, nptypes-swapArg2-1, false) != 0) + return false; + return true; + } + + /** Factory method: Swap the selected arguments. + * Return null if this is not possible. + */ + public static MethodHandle makeSwapArguments(Access token, + MethodType newType, MethodHandle target, + int swapArg1, int swapArg2) { + Access.check(token); + if (swapArg1 == swapArg2) + return target; + if (swapArg1 > swapArg2) { int t = swapArg1; swapArg1 = swapArg2; swapArg2 = t; } + if (!canSwapArguments(newType, target.type(), swapArg1, swapArg2)) + return null; + Class swapType = newType.parameterType(swapArg1); + // in arglist: [0: ...keep1 | pos1: a1 | pos1+1: keep2... | pos2: a2 | pos2+1: keep3... ] + // out arglist: [0: ...keep1 | pos1: a2 | pos1+1: keep2... | pos2: a1 | pos2+1: keep3... ] + int swapSlot2 = newType.parameterSlotDepth(swapArg2 + 1); + long conv = makeSwapConv(OP_SWAP_ARGS, swapArg1, basicType(swapType), swapSlot2); + return new AdapterMethodHandle(target, newType, conv); + } + + static int positiveRotation(int argCount, int rotateBy) { + assert(argCount > 0); + if (rotateBy >= 0) { + if (rotateBy < argCount) + return rotateBy; + return rotateBy % argCount; + } else if (rotateBy >= -argCount) { + return rotateBy + argCount; } else { - // arglist: [0: keep... | dpos: drop... | dpos+dcount: keep... ] - int lastDroppedArg = dropArgPos + dropArgCount - 1; - int lastKeptArg = dropArgPos - 1; // might be -1, which is OK - dropSlotPos = mt.parameterSlotDepth(1+lastDroppedArg); - int lastKeptSlot = mt.parameterSlotDepth(1+lastKeptArg); - dropSlotCount = lastKeptSlot - dropSlotPos; - assert(dropSlotCount >= dropArgCount); + return (-1-((-1-rotateBy) % argCount)) + argCount; } - long conv = makeConv(OP_DROP_ARGS, dropArgPos, +dropSlotCount); - return new AdapterMethodHandle(target, newType, dropSlotCount, conv); + } + + final static int MAX_ARG_ROTATION = 1; + + /** Can an adapter rotate arguments to convert the target to newType? */ + public static boolean canRotateArguments(MethodType newType, MethodType targetType, + int firstArg, int argCount, int rotateBy) { + if (!convOpSupported(OP_ROT_ARGS)) return false; + if (argCount <= 2) return false; // must be a swap, not a rotate + rotateBy = positiveRotation(argCount, rotateBy); + if (rotateBy == 0) return false; // no rotation + if (rotateBy > MAX_ARG_ROTATION && rotateBy < argCount - MAX_ARG_ROTATION) + return false; // too many argument positions + // Rotate incoming args right N to the out args, N in 1..(argCouunt-1). + if (diffReturnTypes(newType, targetType, false) != 0) + return false; + int nptypes = newType.parameterCount(); + if (targetType.parameterCount() != nptypes) + return false; + if (firstArg < 0 || firstArg >= nptypes) return false; + int argLimit = firstArg + argCount; + if (argLimit > nptypes) return false; + if (diffParamTypes(newType, 0, targetType, 0, firstArg, false) != 0) + return false; + int newChunk1 = argCount - rotateBy, newChunk2 = rotateBy; + // swap new chunk1 with target chunk2 + if (diffParamTypes(newType, firstArg, targetType, argLimit-newChunk1, newChunk1, false) != 0) + return false; + // swap new chunk2 with target chunk1 + if (diffParamTypes(newType, firstArg+newChunk1, targetType, firstArg, newChunk2, false) != 0) + return false; + return true; + } + + /** Factory method: Rotate the selected argument range. + * Return null if this is not possible. + */ + public static MethodHandle makeRotateArguments(Access token, + MethodType newType, MethodHandle target, + int firstArg, int argCount, int rotateBy) { + Access.check(token); + rotateBy = positiveRotation(argCount, rotateBy); + if (!canRotateArguments(newType, target.type(), firstArg, argCount, rotateBy)) + return null; + // Decide whether it should be done as a right or left rotation, + // on the JVM stack. Return the number of stack slots to rotate by, + // positive if right, negative if left. + int limit = firstArg + argCount; + int depth0 = newType.parameterSlotDepth(firstArg); + int depth1 = newType.parameterSlotDepth(limit-rotateBy); + int depth2 = newType.parameterSlotDepth(limit); + int chunk1Slots = depth0 - depth1; assert(chunk1Slots > 0); + int chunk2Slots = depth1 - depth2; assert(chunk2Slots > 0); + // From here on out, it assumes a single-argument shift. + assert(MAX_ARG_ROTATION == 1); + int srcArg, dstArg; + byte basicType; + if (chunk2Slots <= chunk1Slots) { + // Rotate right/down N (rotateBy = +N, N small, c2 small): + // in arglist: [0: ...keep1 | arg1: c1... | limit-N: c2 | limit: keep2... ] + // out arglist: [0: ...keep1 | arg1: c2 | arg1+N: c1... | limit: keep2... ] + srcArg = limit-1; + dstArg = firstArg; + basicType = basicType(newType.parameterType(srcArg)); + assert(chunk2Slots == type2size(basicType)); + } else { + // Rotate left/up N (rotateBy = -N, N small, c1 small): + // in arglist: [0: ...keep1 | arg1: c1 | arg1+N: c2... | limit: keep2... ] + // out arglist: [0: ...keep1 | arg1: c2 ... | limit-N: c1 | limit: keep2... ] + srcArg = firstArg; + dstArg = limit-1; + basicType = basicType(newType.parameterType(srcArg)); + assert(chunk1Slots == type2size(basicType)); + } + int dstSlot = newType.parameterSlotDepth(dstArg + 1); + long conv = makeSwapConv(OP_ROT_ARGS, srcArg, basicType, dstSlot); + return new AdapterMethodHandle(target, newType, conv); } /** Can an adapter spread an argument to convert the target to newType? */ @@ -676,10 +858,10 @@ public class AdapterMethodHandle extends BoundMethodHandle { if (spreadArgPos != 0 && diffParamTypes(newType, 0, targetType, 0, spreadArgPos, false) != 0) return false; int afterPos = spreadArgPos + spreadArgCount; - int afterCount = nptypes - afterPos; + int afterCount = nptypes - (spreadArgPos + 1); if (spreadArgPos < 0 || spreadArgPos >= nptypes || spreadArgCount < 0 || - targetType.parameterCount() != nptypes - 1 + spreadArgCount) + targetType.parameterCount() != afterPos + afterCount) return false; // parameter types after the spread point must also be the same if (afterCount != 0 && diffParamTypes(newType, spreadArgPos+1, targetType, afterPos, afterCount, false) != 0) @@ -697,32 +879,40 @@ public class AdapterMethodHandle extends BoundMethodHandle { return true; } + /** Factory method: Spread selected argument. */ public static MethodHandle makeSpreadArguments(Access token, MethodType newType, MethodHandle target, Class spreadArgType, int spreadArgPos, int spreadArgCount) { Access.check(token); - MethodType mt = target.type(); - int argCount = mt.parameterCount(); - if (!canSpreadArguments(newType, mt, spreadArgType, spreadArgPos, spreadArgCount)) + MethodType targetType = target.type(); + if (!canSpreadArguments(newType, targetType, spreadArgType, spreadArgPos, spreadArgCount)) return null; - int spreadSlotCount, spreadSlotPos; - if (spreadArgCount >= argCount) { - assert(spreadArgPos == argCount-1); - spreadSlotPos = 0; - spreadSlotCount = mt.parameterSlotCount(); - } else { - // arglist: [0: keep... | dpos: spread... | dpos+dcount: keep... ] - int lastSpreadArg = spreadArgPos + spreadArgCount - 1; - int lastKeptArg = spreadArgPos - 1; // might be -1, which is OK - spreadSlotPos = mt.parameterSlotDepth(1+lastSpreadArg); - int lastKeptSlot = mt.parameterSlotDepth(1+lastKeptArg); - spreadSlotCount = lastKeptSlot - spreadSlotPos; - assert(spreadSlotCount >= spreadArgCount); - } - long conv = makeConv(OP_SPREAD_ARGS, spreadArgPos, spreadSlotCount); - return new AdapterMethodHandle(target, newType, conv, spreadArgType); + // in arglist: [0: ...keep1 | spos: spreadArg | spos+1: keep2... ] + // out arglist: [0: ...keep1 | spos: spread... | spos+scount: keep2... ] + int keep2OutPos = spreadArgPos + spreadArgCount; + int spreadSlot = targetType.parameterSlotDepth(keep2OutPos); + int keep1OutSlot = targetType.parameterSlotDepth(spreadArgPos); + int slotCount = keep1OutSlot - spreadSlot; + assert(spreadSlot == newType.parameterSlotDepth(spreadArgPos+1)); + assert(slotCount >= spreadArgCount); + long conv = makeConv(OP_SPREAD_ARGS, spreadArgPos, slotCount-1); + MethodHandle res = new AdapterMethodHandle(target, newType, conv, spreadArgType); + assert(res.type().parameterType(spreadArgPos) == spreadArgType); + return res; } // TO DO: makeCollectArguments, makeFlyby, makeRicochet + + @Override + public String toString() { + return nonAdapter((MethodHandle)vmtarget).toString(); + } + + private static MethodHandle nonAdapter(MethodHandle mh) { + while (mh instanceof AdapterMethodHandle) { + mh = (MethodHandle) mh.vmtarget; + } + return mh; + } } diff --git a/src/share/classes/sun/dyn/BoundMethodHandle.java b/src/share/classes/sun/dyn/BoundMethodHandle.java index b0c511c2171693085cb4fe092416590e29421960..66bf2c9732383b3296d42bc52a110e0bc79cfe1e 100644 --- a/src/share/classes/sun/dyn/BoundMethodHandle.java +++ b/src/share/classes/sun/dyn/BoundMethodHandle.java @@ -28,6 +28,10 @@ package sun.dyn; import sun.dyn.util.VerifyType; import sun.dyn.util.Wrapper; import java.dyn.*; +import java.util.List; +import sun.dyn.MethodHandleNatives.Constants; +import static sun.dyn.MethodHandleImpl.IMPL_LOOKUP; +import static sun.dyn.MemberName.newIllegalArgumentException; /** * The flavor of method handle which emulates an invoke instruction @@ -35,18 +39,23 @@ import java.dyn.*; * when the handle is created, not when it is invoked. * @author jrose */ -public class BoundMethodHandle extends MethodHandle { +public class BoundMethodHandle extends MethodHandle { //MethodHandle vmtarget; // next BMH or final DMH or methodOop private final Object argument; // argument to insert private final int vmargslot; // position at which it is inserted + private static final Access IMPL_TOKEN = Access.getToken(); + private static final MemberName.Factory IMPL_NAMES = MemberName.getFactory(IMPL_TOKEN); + // Constructors in this class *must* be package scoped or private. + // Exception: JavaMethodHandle constructors are protected. + // (The link between JMH and BMH is temporary.) /** Bind a direct MH to its receiver (or first ref. argument). * The JVM will pre-dispatch the MH if it is not already static. */ BoundMethodHandle(DirectMethodHandle mh, Object argument) { - super(Access.TOKEN, mh.type().dropParameterType(0)); + super(Access.TOKEN, mh.type().dropParameterTypes(0, 1)); // check the type now, once for all: this.argument = checkReferenceArgument(argument, mh, 0); this.vmargslot = this.type().parameterSlotCount(); @@ -56,32 +65,34 @@ public class BoundMethodHandle extends MethodHandle { } else { this.vmtarget = mh; } - } - - private static final int REF_ARG = 0, PRIM_ARG = 1, SELF_ARG = 2; + } /** Insert an argument into an arbitrary method handle. * If argnum is zero, inserts the first argument, etc. * The argument type must be a reference. */ BoundMethodHandle(MethodHandle mh, Object argument, int argnum) { - this(mh, argument, argnum, mh.type().parameterType(argnum).isPrimitive() ? PRIM_ARG : REF_ARG); + this(mh.type().dropParameterTypes(argnum, argnum+1), + mh, argument, argnum); } /** Insert an argument into an arbitrary method handle. * If argnum is zero, inserts the first argument, etc. */ - BoundMethodHandle(MethodHandle mh, Object argument, int argnum, int whichArg) { - super(Access.TOKEN, mh.type().dropParameterType(argnum)); - if (whichArg == PRIM_ARG) + BoundMethodHandle(MethodType type, MethodHandle mh, Object argument, int argnum) { + super(Access.TOKEN, type); + if (mh.type().parameterType(argnum).isPrimitive()) this.argument = bindPrimitiveArgument(argument, mh, argnum); else { - if (whichArg == SELF_ARG) argument = this; this.argument = checkReferenceArgument(argument, mh, argnum); } - this.vmargslot = this.type().parameterSlotDepth(argnum); + this.vmargslot = type.parameterSlotDepth(argnum); + initTarget(mh, argnum); + } + + private void initTarget(MethodHandle mh, int argnum) { if (MethodHandleNatives.JVM_SUPPORT) { - this.vmtarget = null; // maybe updated by JVM + this.vmtarget = null; // maybe updated by JVM MethodHandleNatives.init(this, mh, argnum); } else { this.vmtarget = mh; @@ -97,29 +108,65 @@ public class BoundMethodHandle extends MethodHandle { assert(this.getClass() == AdapterMethodHandle.class); } - /** Initialize the current object as a method handle, binding it - * as the {@code argnum}th argument of the method handle {@code entryPoint}. + /** Initialize the current object as a Java method handle, binding it + * as the first argument of the method handle {@code entryPoint}. * The invocation type of the resulting method handle will be the - * same as {@code entryPoint}, except that the {@code argnum}th argument + * same as {@code entryPoint}, except that the first argument * type will be dropped. */ - public BoundMethodHandle(MethodHandle entryPoint, int argnum) { - this(entryPoint, null, argnum, SELF_ARG); - - // Note: If the conversion fails, perhaps because of a bad entryPoint, - // the MethodHandle.type field will not be filled in, and therefore - // no MH.invoke call will ever succeed. The caller may retain a pointer - // to the broken method handle, but no harm can be done with it. + protected BoundMethodHandle(MethodHandle entryPoint) { + super(Access.TOKEN, entryPoint.type().dropParameterTypes(0, 1)); + this.argument = this; // kludge; get rid of + this.vmargslot = this.type().parameterSlotDepth(0); + initTarget(entryPoint, 0); + assert(this instanceof JavaMethodHandle); } - /** Initialize the current object as a method handle, binding it - * as the first argument of the method handle {@code entryPoint}. - * The invocation type of the resulting method handle will be the - * same as {@code entryPoint}, except that the first argument - * type will be dropped. + /** Initialize the current object as a Java method handle. */ - public BoundMethodHandle(MethodHandle entryPoint) { - this(entryPoint, null, 0, SELF_ARG); + protected BoundMethodHandle(String entryPointName, MethodType type, boolean matchArity) { + super(Access.TOKEN, null); + MethodHandle entryPoint + = findJavaMethodHandleEntryPoint(this.getClass(), + entryPointName, type, matchArity); + MethodHandleImpl.initType(this, entryPoint.type().dropParameterTypes(0, 1)); + this.argument = this; // kludge; get rid of + this.vmargslot = this.type().parameterSlotDepth(0); + initTarget(entryPoint, 0); + assert(this instanceof JavaMethodHandle); + } + + private static + MethodHandle findJavaMethodHandleEntryPoint(Class caller, + String name, + MethodType type, + boolean matchArity) { + if (matchArity) type.getClass(); // elicit NPE + List methods = IMPL_NAMES.getMethods(caller, true, name, null, caller); + MethodType foundType = null; + MemberName foundMethod = null; + for (MemberName method : methods) { + MethodType mtype = method.getMethodType(); + if (type != null && type.parameterCount() != mtype.parameterCount()) + continue; + else if (foundType == null) + foundType = mtype; + else if (foundType != mtype) + throw newIllegalArgumentException("more than one method named "+name+" in "+caller.getName()); + // discard overrides + if (foundMethod == null) + foundMethod = method; + else if (foundMethod.getDeclaringClass().isAssignableFrom(method.getDeclaringClass())) + foundMethod = method; + } + if (foundMethod == null) + throw newIllegalArgumentException("no method named "+name+" in "+caller.getName()); + MethodHandle entryPoint = MethodHandleImpl.findMethod(IMPL_TOKEN, foundMethod, true, caller); + if (type != null) { + MethodType epType = type.insertParameterTypes(0, entryPoint.type().parameterType(0)); + entryPoint = MethodHandles.convertArguments(entryPoint, epType); + } + return entryPoint; } /** Make sure the given {@code argument} can be used as {@code argnum}-th @@ -175,6 +222,24 @@ public class BoundMethodHandle extends MethodHandle { @Override public String toString() { - return "Bound[" + super.toString() + "]"; + MethodHandle mh = this; + while (mh instanceof BoundMethodHandle) { + Object info = MethodHandleNatives.getTargetInfo(mh); + if (info instanceof MethodHandle) { + mh = (MethodHandle) info; + } else { + String name = null; + if (info instanceof MemberName) + name = ((MemberName)info).getName(); + if (name != null) + return name; + else + return super.toString(); // , probably + } + assert(mh != this); + if (mh instanceof JavaMethodHandle) + break; // access JMH.toString(), not BMH.toString() + } + return mh.toString(); } } diff --git a/src/share/classes/sun/dyn/CallSiteImpl.java b/src/share/classes/sun/dyn/CallSiteImpl.java index c5ac600eacd416f7e6d923755beb0a4e49c30415..247aaf1e83fb00e8329135c30aca32bc7f6c51d7 100644 --- a/src/share/classes/sun/dyn/CallSiteImpl.java +++ b/src/share/classes/sun/dyn/CallSiteImpl.java @@ -26,34 +26,51 @@ package sun.dyn; import java.dyn.*; +import java.util.logging.Level; +import java.util.logging.Logger; /** - * The CallSite privately created by the JVM at every invokedynamic instruction. + * Parts of CallSite known to the JVM. + * FIXME: Merge all this into CallSite proper. * @author jrose */ -class CallSiteImpl extends CallSite { - // Fields used only by the JVM. Do not use or change. +public class CallSiteImpl { + // Field used only by the JVM. Do not use or change. private Object vmmethod; // Values supplied by the JVM: - int callerMID, callerBCI; + protected int callerMID, callerBCI; - private CallSiteImpl(Class caller, String name, MethodType type) { - super(caller, name, type); + private MethodHandle target; + protected final Object caller; // usually a class + protected final String name; + protected final MethodType type; + + /** called only directly from CallSite() */ + protected CallSiteImpl(Access token, Object caller, String name, MethodType type) { + Access.check(token); + this.caller = caller; + this.name = name; + this.type = type; + } + + /** native version of setTarget */ + protected void setTarget(MethodHandle mh) { + //System.out.println("setTarget "+this+" := "+mh); + // XXX I don't know how to fix this properly. +// if (false && MethodHandleNatives.JVM_SUPPORT) // FIXME: enable this +// MethodHandleNatives.linkCallSite(this, mh); +// else + this.target = mh; } - @Override - public void setTarget(MethodHandle mh) { - checkTarget(mh); - if (MethodHandleNatives.JVM_SUPPORT) - MethodHandleNatives.linkCallSite(this, (MethodHandle) mh); - else - super.setTarget(mh); + protected MethodHandle getTarget() { + return target; } private static final MethodHandle PRIVATE_INITIALIZE_CALL_SITE = MethodHandleImpl.IMPL_LOOKUP.findStatic(CallSite.class, "privateInitializeCallSite", - MethodType.make(void.class, CallSite.class, int.class, int.class)); + MethodType.methodType(void.class, CallSite.class, int.class, int.class)); // this is the up-call from the JVM: static CallSite makeSite(Class caller, String name, MethodType type, @@ -61,10 +78,25 @@ class CallSiteImpl extends CallSite { MethodHandle bsm = Linkage.getBootstrapMethod(caller); if (bsm == null) throw new InvokeDynamicBootstrapError("class has no bootstrap method: "+caller); - CallSite site = bsm.invoke(caller, name, type); + CallSite site; + try { + site = bsm.invoke(caller, name, type); + } catch (Throwable ex) { + throw new InvokeDynamicBootstrapError("exception thrown while linking", ex); + } if (site == null) throw new InvokeDynamicBootstrapError("class bootstrap method failed to create a call site: "+caller); - PRIVATE_INITIALIZE_CALL_SITE.invoke(site, callerMID, callerBCI); + if (site.type() != type) + throw new InvokeDynamicBootstrapError("call site type not initialized correctly: "+site); + if (site.callerClass() != caller) + throw new InvokeDynamicBootstrapError("call site caller not initialized correctly: "+site); + if ((Object)site.name() != name) + throw new InvokeDynamicBootstrapError("call site name not initialized correctly: "+site); + try { + PRIVATE_INITIALIZE_CALL_SITE.invoke(site, callerMID, callerBCI); + } catch (Throwable ex) { + throw new InvokeDynamicBootstrapError("call site initialization exception", ex); + } return site; } } diff --git a/src/share/classes/sun/dyn/FilterGeneric.java b/src/share/classes/sun/dyn/FilterGeneric.java index a746ad21b95e8f5cfcb9e7e81cf88bd38b8c0d5c..37c4f40d231ea5b19f7a77d06b2f739a7ef283c0 100644 --- a/src/share/classes/sun/dyn/FilterGeneric.java +++ b/src/share/classes/sun/dyn/FilterGeneric.java @@ -31,174 +31,159 @@ import java.dyn.MethodType; import java.dyn.NoAccessException; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; +import static sun.dyn.MemberName.newIllegalArgumentException; /** - * "Flyby adapters" which apply arbitrary conversions to arguments + * These adapters apply arbitrary conversions to arguments * on the way to a ultimate target. * For simplicity, these are all generically typed. * @author jrose */ class FilterGeneric { - // type for the outgoing call (will be generic) - private final MethodType targetType; - // position of (first) argument to participate in filtering - private final short argumentPosition; - // number of arguments to participate in filtering - private final short argumentCount; - // how the result interacts with the filtered arguments: Prepend, Append, Replace, Discard - private final char replaceMode; - // prototype adapter (clone and customize for each new target & conversion!) - private final Adapter adapter; - // entry point for adapter (Adapter mh, a...) => ... - private final MethodHandle entryPoint; - // more of them (loosely cached) - private FilterGeneric variations; + // type for the incoming call (will be generic) + private final MethodType entryType; + // prototype adapters (clone and customize for each new target & conversion!) + private final Adapter[] adapters; - /** Compute and cache information common to all unboxing adapters - * that can call out to targets of the erasure-family of the given erased type. + /** Compute and cache information common to all filtering adapters + * with the given generic type */ - // TO DO: Make this private. - FilterGeneric(MethodType targetType, short argumentPosition, short argumentCount, char replaceMode) { - if (argumentCount == 0) { - if (replaceMode == 'P' || replaceMode == 'A') replaceMode = 'R'; - if (replaceMode == 'I') argumentPosition = 0; - } - this.targetType = targetType; - this.argumentPosition = argumentPosition; - this.argumentCount = argumentCount; - this.replaceMode = replaceMode; - validate(targetType, argumentPosition, argumentCount, replaceMode); - Adapter ad = findAdapter(targetType, argumentPosition, argumentCount, replaceMode, filterType()); + FilterGeneric(MethodType entryType) { + this.entryType = entryType; + int tableSize = Kind.LIMIT.invokerIndex(1 + entryType.parameterCount()); + this.adapters = new Adapter[tableSize]; + } + + Adapter getAdapter(Kind kind, int pos) { + int index = kind.invokerIndex(pos); + Adapter ad = adapters[index]; + if (ad != null) return ad; + ad = findAdapter(entryType, kind, pos); if (ad == null) - ad = buildAdapterFromBytecodes(targetType, argumentPosition, argumentCount, replaceMode, filterType()); - this.adapter = ad; - this.entryPoint = ad.prototypeEntryPoint(); + ad = buildAdapterFromBytecodes(entryType, kind, pos); + adapters[index] = ad; + return ad; } - Adapter makeInstance(MethodHandle filter, MethodHandle target) { - return adapter.makeInstance(entryPoint, filter, target); + Adapter makeInstance(Kind kind, int pos, MethodHandle filter, MethodHandle target) { + Adapter ad = getAdapter(kind, pos); + return ad.makeInstance(ad.prototypeEntryPoint(), filter, target); } - /** Build an adapter of the given generic type, which invokes typedTarget - * on the incoming arguments, after unboxing as necessary. - * The return value is boxed if necessary. - * @param genericType the required type of the result - * @param typedTarget the target + /** Build an adapter of the given generic type, which invokes filter + * on the selected incoming argument before passing it to the target. + * @param pos the argument to filter + * @param filter the function to call on the argument + * @param target the target to call with the modified argument list * @return an adapter method handle */ - public static MethodHandle make(MethodHandle target, int pos, MethodHandle filter) { - return FilterGeneric.of(target.type(), (short)pos, (short)1, 'R').makeInstance(filter, target); - } - - /** Return the adapter information for this type's erasure. */ - static FilterGeneric of(MethodType type, short ap, short ac, char mode) { - if (type.generic() != type) - throw new IllegalArgumentException("must be generic: "+type); - validate(type, ap, ac, mode); - MethodTypeImpl form = MethodTypeImpl.of(type); - FilterGeneric filterGen = form.filterGeneric; - if (filterGen == null) - form.filterGeneric = filterGen = new FilterGeneric(type, (short)0, (short)1, 'R'); - return find(filterGen, ap, ac, mode); + public static MethodHandle makeArgumentFilter(int pos, MethodHandle filter, MethodHandle target) { + return make(Kind.value, pos, filter, target); } - static FilterGeneric find(FilterGeneric gen, short ap, short ac, char mode) { - for (;;) { - if (gen.argumentPosition == ap && - gen.argumentCount == ac && - gen.replaceMode == mode) { - return gen; - } - FilterGeneric gen2 = gen.variations; - if (gen2 == null) break; - gen = gen2; - } - FilterGeneric gen2 = new FilterGeneric(gen.targetType, ap, ac, mode); - gen.variations = gen2; // OK if this smashes another cached chain - return gen2; + /** Build an adapter of the given generic type, which invokes a combiner + * on a selected group of leading arguments. + * The result of the combiner is prepended before all those arguments. + * @param combiner the function to call on the selected leading arguments + * @param target the target to call with the modified argument list + * @return an adapter method handle + */ + public static MethodHandle makeArgumentFolder(MethodHandle combiner, MethodHandle target) { + int num = combiner.type().parameterCount(); + return make(Kind.fold, num, combiner, target); } - private static void validate(MethodType type, short ap, short ac, char mode) { - int endpos = ap + ac; - switch (mode) { - case 'P': case 'A': case 'R': case 'D': - if (ap >= 0 && ac >= 0 && - endpos >= 0 && endpos <= type.parameterCount()) - return; - default: - throw new InternalError("configuration "+patternName(ap, ac, mode)); - } + /** Build an adapter of the given generic type, which invokes a filter + * on the incoming arguments, reified as a group. + * The argument may be modified (by side effects in the filter). + * The arguments, possibly modified, are passed on to the target. + * @param filter the function to call on the arguments + * @param target the target to call with the possibly-modified argument list + * @return an adapter method handle + */ + public static MethodHandle makeFlyby(MethodHandle filter, MethodHandle target) { + return make(Kind.flyby, 0, filter, target); } - public String toString() { - return "FilterGeneric/"+patternName()+targetType; + /** Build an adapter of the given generic type, which invokes a collector + * on the selected incoming argument and all following arguments. + * The result of the collector replaces all those arguments. + * @param collector the function to call on the selected trailing arguments + * @param target the target to call with the modified argument list + * @return an adapter method handle + */ + public static MethodHandle makeArgumentCollector(MethodHandle collector, MethodHandle target) { + int pos = target.type().parameterCount() - 1; + return make(Kind.collect, pos, collector, target); } - String patternName() { - return patternName(argumentPosition, argumentCount, replaceMode); + static MethodHandle make(Kind kind, int pos, MethodHandle filter, MethodHandle target) { + FilterGeneric fgen = of(kind, pos, filter.type(), target.type()); + return fgen.makeInstance(kind, pos, filter, target); } - static String patternName(short ap, short ac, char mode) { - return ""+mode+ap+(ac>1?"_"+ac:""); + /** Return the adapter information for this target and filter type. */ + static FilterGeneric of(Kind kind, int pos, MethodType filterType, MethodType targetType) { + MethodType entryType = entryType(kind, pos, filterType, targetType); + if (entryType.generic() != entryType) + throw newIllegalArgumentException("must be generic: "+entryType); + MethodTypeImpl form = MethodTypeImpl.of(entryType); + FilterGeneric filterGen = form.filterGeneric; + if (filterGen == null) + form.filterGeneric = filterGen = new FilterGeneric(entryType); + return filterGen; } - Class filterType() { - return Object.class; // result of filter operation; an uninteresting type + public String toString() { + return "FilterGeneric/"+entryType; } - static MethodType targetType(MethodType entryType, short ap, short ac, char mode, - Class arg) { + static MethodType targetType(MethodType entryType, Kind kind, int pos, MethodType filterType) { MethodType type = entryType; - int pos = ap; - switch (mode) { - case 'A': - pos += ac; - case 'P': - type = type.insertParameterType(pos, arg); - break; - case 'I': - for (int i = 1; i < ac; i++) - type = type.dropParameterType(pos); - assert(type.parameterType(pos) == arg); + switch (kind) { + case value: + case flyby: + break; // no change + case fold: + type = type.insertParameterTypes(0, filterType.returnType()); break; - case 'D': + case collect: + type = type.dropParameterTypes(pos, type.parameterCount()); + type = type.insertParameterTypes(pos, filterType.returnType()); break; + default: + throw new InternalError(); } return type; } - static MethodType entryType(MethodType targetType, short ap, short ac, char mode, - Class arg) { + static MethodType entryType(Kind kind, int pos, MethodType filterType, MethodType targetType) { MethodType type = targetType; - int pos = ap; - switch (mode) { - case 'A': - pos += ac; - case 'P': - type = type.dropParameterType(pos); + switch (kind) { + case value: + case flyby: + break; // no change + case fold: + type = type.dropParameterTypes(0, 1); break; - case 'I': - for (int i = 1; i < ac; i++) - type = type.insertParameterType(pos, arg); - assert(type.parameterType(pos) == arg); - break; - case 'D': + case collect: + type = type.dropParameterTypes(pos, pos+1); + type = type.insertParameterTypes(pos, filterType.parameterList()); break; + default: + throw new InternalError(); } return type; } /* Create an adapter that handles spreading calls for the given type. */ - static Adapter findAdapter(MethodType targetType, short ap, short ac, char mode, Class arg) { - MethodType entryType = entryType(targetType, ap, ac, mode, arg); - int argc = targetType.parameterCount(); - String pname = patternName(ap, ac, mode); + static Adapter findAdapter(MethodType entryType, Kind kind, int pos) { + int argc = entryType.parameterCount(); String cname0 = "F"+argc; - String cname1 = "F"+argc+mode; - String cname2 = "F"+argc+pname; - String[] cnames = { cname0, cname1, cname1+"X", cname2 }; - String iname = "invoke_"+pname; - // e.g., F5R; invoke_R3 + String cname1 = "F"+argc+kind.key; + String[] cnames = { cname0, cname1 }; + String iname = kind.invokerName(pos); + // e.g., F5; invoke_C3 for (String cname : cnames) { Class acls = Adapter.findSubClass(cname); if (acls == null) continue; @@ -220,7 +205,10 @@ class FilterGeneric { // Produce an instance configured as a prototype. return ctor.newInstance(entryPoint); } catch (IllegalArgumentException ex) { - } catch (InvocationTargetException ex) { + } catch (InvocationTargetException wex) { + Throwable ex = wex.getTargetException(); + if (ex instanceof Error) throw (Error)ex; + if (ex instanceof RuntimeException) throw (RuntimeException)ex; } catch (InstantiationException ex) { } catch (IllegalAccessException ex) { } @@ -228,7 +216,7 @@ class FilterGeneric { return null; } - static Adapter buildAdapterFromBytecodes(MethodType targetType, short ap, short ac, char mode, Class arg) { + static Adapter buildAdapterFromBytecodes(MethodType entryType, Kind kind, int pos) { throw new UnsupportedOperationException("NYI"); } @@ -242,8 +230,13 @@ class FilterGeneric { * generated once per type erasure family, and reused across adapters. */ static abstract class Adapter extends JavaMethodHandle { - protected final MethodHandle filter; - protected final MethodHandle target; + protected final MethodHandle filter; // transforms one or more arguments + protected final MethodHandle target; // ultimate target + + @Override + public String toString() { + return target.toString(); + } protected boolean isPrototype() { return target == null; } protected Adapter(MethodHandle entryPoint) { @@ -287,52 +280,4221 @@ class FilterGeneric { } } - //* generated classes follow this pattern: - static class F1RX extends Adapter { - protected F1RX(MethodHandle entryPoint) { super(entryPoint); } // to build prototype - protected F1RX(MethodHandle e, MethodHandle f, MethodHandle t) - { super(e, f, t); } - protected F1RX makeInstance(MethodHandle e, MethodHandle f, MethodHandle t) - { return new F1RX(e, f, t); } - protected Object filter(Object a0) { return filter.invoke(a0); } - protected Object target(Object a0) { return target.invoke(a0); } - protected Object invoke_R0(Object a0) { return target(filter(a0)); } - } - static class F2RX extends Adapter { - protected F2RX(MethodHandle entryPoint) { super(entryPoint); } // to build prototype - protected F2RX(MethodHandle e, MethodHandle f, MethodHandle t) - { super(e, f, t); } - protected F2RX makeInstance(MethodHandle e, MethodHandle f, MethodHandle t) - { return new F2RX(e, f, t); } - protected Object filter(Object a0) { return filter.invoke(a0); } - protected Object target(Object a0, Object a1) { return target.invoke(a0, a1); } - protected Object invoke_R0(Object a0, Object a1) { return target(filter(a0), a1); } - protected Object invoke_R1(Object a0, Object a1) { return target(a0, filter(a1)); } - } - static class F3RX extends Adapter { - protected F3RX(MethodHandle entryPoint) { super(entryPoint); } // to build prototype - protected F3RX(MethodHandle e, MethodHandle f, MethodHandle t) + static enum Kind { + value('V'), // filter and replace Nth argument value + fold('F'), // fold first N arguments, prepend result + collect('C'), // collect last N arguments, replace with result + flyby('Y'), // reify entire argument list, filter, pass to target + LIMIT('?'); + static final int COUNT = LIMIT.ordinal(); + + final char key; + Kind(char key) { this.key = key; } + String invokerName(int pos) { return "invoke_"+key+""+pos; } + int invokerIndex(int pos) { return pos * COUNT + ordinal(); } + } + + /* generated classes follow this pattern: + static class F1X extends Adapter { + protected F1X(MethodHandle entryPoint) { super(entryPoint); } // to build prototype + protected F1X(MethodHandle e, MethodHandle f, MethodHandle t) { super(e, f, t); } - protected F3RX makeInstance(MethodHandle e, MethodHandle f, MethodHandle t) - { return new F3RX(e, f, t); } - protected Object filter(Object a0) { return filter.invoke(a0); } - protected Object target(Object a0, Object a1, Object a2) { return target.invoke(a0, a1, a2); } - protected Object invoke_R0(Object a0, Object a1, Object a2) { return target(filter(a0), a1, a2); } - protected Object invoke_R1(Object a0, Object a1, Object a2) { return target(a0, filter(a1), a2); } - protected Object invoke_R2(Object a0, Object a1, Object a2) { return target(a0, a1, filter(a2)); } - } - static class F4RX extends Adapter { - protected F4RX(MethodHandle entryPoint) { super(entryPoint); } // to build prototype - protected F4RX(MethodHandle e, MethodHandle f, MethodHandle t) + protected F1X makeInstance(MethodHandle e, MethodHandle f, MethodHandle t) + { return new F1X(e, f, t); } + protected Object invoke_V0(Object a0) { return target.invoke(filter.invoke(a0)); } + protected Object invoke_F0(Object a0) { return target.invoke(filter.invoke(), a0); } + protected Object invoke_F1(Object a0) { return target.invoke(filter.invoke(a0), a0); } + protected Object invoke_C0(Object a0) { return target.invoke(filter.invoke(a0)); } + protected Object invoke_C1(Object a0) { return target.invoke(a0, filter.invoke()); } + protected Object invoke_Y0(Object a0) { Object[] av = { a0 }; + filter.invoke(av); return target.invoke(av[0]); } + } + static class F2X extends Adapter { + protected F2X(MethodHandle entryPoint) { super(entryPoint); } // to build prototype + protected F2X(MethodHandle e, MethodHandle f, MethodHandle t) { super(e, f, t); } - protected F4RX makeInstance(MethodHandle e, MethodHandle f, MethodHandle t) - { return new F4RX(e, f, t); } - protected Object filter(Object a0) { return filter.invoke(a0); } - protected Object target(Object a0, Object a1, Object a2, Object a3) { return target.invoke(a0, a1, a2, a3); } - protected Object invoke_R0(Object a0, Object a1, Object a2, Object a3) { return target(filter(a0), a1, a2, a3); } - protected Object invoke_R1(Object a0, Object a1, Object a2, Object a3) { return target(a0, filter(a1), a2, a3); } - protected Object invoke_R2(Object a0, Object a1, Object a2, Object a3) { return target(a0, a1, filter(a2), a3); } - protected Object invoke_R3(Object a0, Object a1, Object a2, Object a3) { return target(a0, a1, a2, filter(a3)); } + protected F2X makeInstance(MethodHandle e, MethodHandle f, MethodHandle t) + { return new F2X(e, f, t); } + protected Object invoke_V0(Object a0, Object a1) { return target.invoke(filter.invoke(a0), a1); } + protected Object invoke_V1(Object a0, Object a1) { return target.invoke(a0, filter.invoke(a1)); } + protected Object invoke_F0(Object a0, Object a1) { return target.invoke(filter.invoke(), a0, a1); } + protected Object invoke_F1(Object a0, Object a1) { return target.invoke(filter.invoke(a0), a0, a1); } + protected Object invoke_F2(Object a0, Object a1) { return target.invoke(filter.invoke(a0, a1), a0, a1); } + protected Object invoke_C0(Object a0, Object a1) { return target.invoke(filter.invoke(a0, a1)); } + protected Object invoke_C1(Object a0, Object a1) { return target.invoke(a0, filter.invoke(a1)); } + protected Object invoke_C2(Object a0, Object a1) { return target.invoke(a0, a1, filter.invoke()); } + protected Object invoke_Y0(Object a0, Object a1) { Object[] av = { a0, a1 }; + filter.invoke(av); return target.invoke(av[0], av[1]); } } // */ + + // This one is written by hand: + static class F0 extends Adapter { + protected F0(MethodHandle entryPoint) { super(entryPoint); } // to build prototype + protected F0(MethodHandle e, MethodHandle f, MethodHandle t) { + super(e, f, t); } + protected F0 makeInstance(MethodHandle e, MethodHandle f, MethodHandle t) { + return new F0(e, f, t); } + protected Object invoke_F0() throws Throwable { + return target.invoke(filter.invoke()); } + protected Object invoke_C0() throws Throwable { + return target.invoke(filter.invoke()); } + static final Object[] NO_ARGS = { }; + protected Object invoke_Y0() throws Throwable { + filter.invoke(NO_ARGS); // make the flyby + return target.invoke(); } + } + +/* + : SHELL; n=FilterGeneric; cp -p $n.java $n.java-; sed < $n.java- > $n.java+ -e '/{{*{{/,/}}*}}/w /tmp/genclasses.java' -e '/}}*}}/q'; (cd /tmp; javac -d . genclasses.java; java -ea -cp . genclasses | sed 's| *[/]/ *$||') >> $n.java+; echo '}' >> $n.java+; mv $n.java+ $n.java; mv $n.java- $n.java~ +//{{{ +import java.util.*; +class genclasses { + static String[][] TEMPLATES = { { + "@for@ N=1..20", + " //@each-cat@", + " static class @cat@ extends Adapter {", + " protected @cat@(MethodHandle entryPoint) { super(entryPoint); } // to build prototype", + " protected @cat@(MethodHandle e, MethodHandle f, MethodHandle t) {", + " super(e, f, t); }", + " protected @cat@ makeInstance(MethodHandle e, MethodHandle f, MethodHandle t) {", + " return new @cat@(e, f, t); }", + " //@each-P@", + " protected Object invoke_V@P@(@Tvav@) throws Throwable {", + " return target.invoke(@a0_@@Psp@filter.invoke(a@P@)@_aN@); }", + " //@end-P@", + " //@each-P@", + " protected Object invoke_F@P@(@Tvav@) throws Throwable {", + " return target.invoke(filter.invoke(@a0@),", + " @av@); }", + " //@end-P@", + " protected Object invoke_F@N@(@Tvav@) throws Throwable {", + " return target.invoke(filter.invoke(@av@),", + " @av@); }", + " //@each-P@", + " protected Object invoke_C@P@(@Tvav@) throws Throwable {", + " return target.invoke(@a0_@filter.invoke(a@P@@_aN@)); }", + " //@end-P@", + " protected Object invoke_C@N@(@Tvav@) throws Throwable {", + " return target.invoke(@av@, filter.invoke()); }", + " protected Object invoke_Y0(@Tvav@) throws Throwable {", + " Object[] av = { @av@ };", + " filter.invoke(av); // make the flyby", + " return target.invoke(@av[i]@); }", + " }", + } }; + static final String NEWLINE_INDENT = " //\n "; + enum VAR { + cat, N, P, Tvav, av, a0, a0_, _aN, Psp, av_i_; + public final String pattern = "@"+toString().replace('_','.')+"@"; + public String binding = toString(); + static void makeBindings(boolean topLevel, int inargs, int pos) { + assert(-1 <= pos && pos < inargs); + VAR.cat.binding = "F"+inargs; + VAR.N.binding = String.valueOf(inargs); // incoming arg count + VAR.P.binding = String.valueOf(pos); // selected arg position + String[] av = new String[inargs]; + String[] Tvav = new String[inargs]; + String[] av_i_ = new String[inargs]; + for (int i = 0; i < inargs; i++) { + av[i] = arg(i); + av_i_[i] = "av["+i+"]"; + String spc = ""; + if (i > 0 && i % 4 == 0) spc = NEWLINE_INDENT+(pos>9?" ":"")+" "; + Tvav[i] = spc+param("Object", av[i]); + } + VAR.av.binding = comma(av); + VAR.av_i_.binding = comma(av_i_); + VAR.Tvav.binding = comma(Tvav); + if (pos >= 0) { + VAR.Psp.binding = (pos > 0 && pos % 10 == 0) ? NEWLINE_INDENT : ""; + String[] a0 = new String[pos]; + String[] aN = new String[inargs - (pos+1)]; + for (int i = 0; i < pos; i++) { + String spc = ""; + if (i > 0 && i % 10 == 0) spc = NEWLINE_INDENT; + a0[i] = spc+av[i]; + } + VAR.a0.binding = comma(a0); + VAR.a0_.binding = comma(a0, ", "); + for (int i = pos+1; i < inargs; i++) { + String spc = ""; + if (i > 0 && i % 10 == 0) spc = NEWLINE_INDENT; + aN[i - (pos+1)] = spc+av[i]; + } + VAR._aN.binding = comma(", ", aN); + } + } + static String arg(int i) { return "a"+i; } + static String param(String t, String a) { return t+" "+a; } + static String comma(String[] v) { return comma(v, ""); } + static String comma(String[] v, String sep) { return comma("", v, sep); } + static String comma(String sep, String[] v) { return comma(sep, v, ""); } + static String comma(String sep1, String[] v, String sep2) { + if (v.length == 0) return ""; + String res = v[0]; + for (int i = 1; i < v.length; i++) res += ", "+v[i]; + return sep1 + res + sep2; + } + static String transform(String string) { + for (VAR var : values()) + string = string.replaceAll(var.pattern, var.binding); + return string; + } + } + static String[] stringsIn(String[] strings, int beg, int end) { + return Arrays.copyOfRange(strings, beg, Math.min(end, strings.length)); + } + static String[] stringsBefore(String[] strings, int pos) { + return stringsIn(strings, 0, pos); + } + static String[] stringsAfter(String[] strings, int pos) { + return stringsIn(strings, pos, strings.length); + } + static int indexAfter(String[] strings, int pos, String tag) { + return Math.min(indexBefore(strings, pos, tag) + 1, strings.length); + } + static int indexBefore(String[] strings, int pos, String tag) { + for (int i = pos, end = strings.length; ; i++) { + if (i == end || strings[i].endsWith(tag)) return i; + } + } + static int MIN_ARITY, MAX_ARITY; + public static void main(String... av) { + for (String[] template : TEMPLATES) { + int forLinesLimit = indexBefore(template, 0, "@each-cat@"); + String[] forLines = stringsBefore(template, forLinesLimit); + template = stringsAfter(template, forLinesLimit); + for (String forLine : forLines) + expandTemplate(forLine, template); + } + } + static void expandTemplate(String forLine, String[] template) { + String[] params = forLine.split("[^0-9]+"); + if (params[0].length() == 0) params = stringsAfter(params, 1); + System.out.println("//params="+Arrays.asList(params)); + int pcur = 0; + MIN_ARITY = Integer.valueOf(params[pcur++]); + MAX_ARITY = Integer.valueOf(params[pcur++]); + if (pcur != params.length) throw new RuntimeException("bad extra param: "+forLine); + for (int inargs = MIN_ARITY; inargs <= MAX_ARITY; inargs++) { + expandTemplate(template, true, inargs, -1); + } + } + static void expandTemplate(String[] template, boolean topLevel, int inargs, int pos) { + VAR.makeBindings(topLevel, inargs, pos); + for (int i = 0; i < template.length; i++) { + String line = template[i]; + if (line.endsWith("@each-cat@")) { + // ignore + } else if (line.endsWith("@each-P@")) { + int blockEnd = indexAfter(template, i, "@end-P@"); + String[] block = stringsIn(template, i+1, blockEnd-1); + for (int pos1 = Math.max(0,pos); pos1 < inargs; pos1++) + expandTemplate(block, false, inargs, pos1); + VAR.makeBindings(topLevel, inargs, pos); + i = blockEnd-1; continue; + } else { + System.out.println(VAR.transform(line)); + } + } + } +} +//}}} */ +//params=[1, 20] + static class F1 extends Adapter { + protected F1(MethodHandle entryPoint) { super(entryPoint); } // to build prototype + protected F1(MethodHandle e, MethodHandle f, MethodHandle t) { + super(e, f, t); } + protected F1 makeInstance(MethodHandle e, MethodHandle f, MethodHandle t) { + return new F1(e, f, t); } + protected Object invoke_V0(Object a0) throws Throwable { + return target.invoke(filter.invoke(a0)); } + protected Object invoke_F0(Object a0) throws Throwable { + return target.invoke(filter.invoke(), + a0); } + protected Object invoke_F1(Object a0) throws Throwable { + return target.invoke(filter.invoke(a0), + a0); } + protected Object invoke_C0(Object a0) throws Throwable { + return target.invoke(filter.invoke(a0)); } + protected Object invoke_C1(Object a0) throws Throwable { + return target.invoke(a0, filter.invoke()); } + protected Object invoke_Y0(Object a0) throws Throwable { + Object[] av = { a0 }; + filter.invoke(av); // make the flyby + return target.invoke(av[0]); } + } + static class F2 extends Adapter { + protected F2(MethodHandle entryPoint) { super(entryPoint); } // to build prototype + protected F2(MethodHandle e, MethodHandle f, MethodHandle t) { + super(e, f, t); } + protected F2 makeInstance(MethodHandle e, MethodHandle f, MethodHandle t) { + return new F2(e, f, t); } + protected Object invoke_V0(Object a0, Object a1) throws Throwable { + return target.invoke(filter.invoke(a0), a1); } + protected Object invoke_V1(Object a0, Object a1) throws Throwable { + return target.invoke(a0, filter.invoke(a1)); } + protected Object invoke_F0(Object a0, Object a1) throws Throwable { + return target.invoke(filter.invoke(), + a0, a1); } + protected Object invoke_F1(Object a0, Object a1) throws Throwable { + return target.invoke(filter.invoke(a0), + a0, a1); } + protected Object invoke_F2(Object a0, Object a1) throws Throwable { + return target.invoke(filter.invoke(a0, a1), + a0, a1); } + protected Object invoke_C0(Object a0, Object a1) throws Throwable { + return target.invoke(filter.invoke(a0, a1)); } + protected Object invoke_C1(Object a0, Object a1) throws Throwable { + return target.invoke(a0, filter.invoke(a1)); } + protected Object invoke_C2(Object a0, Object a1) throws Throwable { + return target.invoke(a0, a1, filter.invoke()); } + protected Object invoke_Y0(Object a0, Object a1) throws Throwable { + Object[] av = { a0, a1 }; + filter.invoke(av); // make the flyby + return target.invoke(av[0], av[1]); } + } + static class F3 extends Adapter { + protected F3(MethodHandle entryPoint) { super(entryPoint); } // to build prototype + protected F3(MethodHandle e, MethodHandle f, MethodHandle t) { + super(e, f, t); } + protected F3 makeInstance(MethodHandle e, MethodHandle f, MethodHandle t) { + return new F3(e, f, t); } + protected Object invoke_V0(Object a0, Object a1, Object a2) throws Throwable { + return target.invoke(filter.invoke(a0), a1, a2); } + protected Object invoke_V1(Object a0, Object a1, Object a2) throws Throwable { + return target.invoke(a0, filter.invoke(a1), a2); } + protected Object invoke_V2(Object a0, Object a1, Object a2) throws Throwable { + return target.invoke(a0, a1, filter.invoke(a2)); } + protected Object invoke_F0(Object a0, Object a1, Object a2) throws Throwable { + return target.invoke(filter.invoke(), + a0, a1, a2); } + protected Object invoke_F1(Object a0, Object a1, Object a2) throws Throwable { + return target.invoke(filter.invoke(a0), + a0, a1, a2); } + protected Object invoke_F2(Object a0, Object a1, Object a2) throws Throwable { + return target.invoke(filter.invoke(a0, a1), + a0, a1, a2); } + protected Object invoke_F3(Object a0, Object a1, Object a2) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2), + a0, a1, a2); } + protected Object invoke_C0(Object a0, Object a1, Object a2) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2)); } + protected Object invoke_C1(Object a0, Object a1, Object a2) throws Throwable { + return target.invoke(a0, filter.invoke(a1, a2)); } + protected Object invoke_C2(Object a0, Object a1, Object a2) throws Throwable { + return target.invoke(a0, a1, filter.invoke(a2)); } + protected Object invoke_C3(Object a0, Object a1, Object a2) throws Throwable { + return target.invoke(a0, a1, a2, filter.invoke()); } + protected Object invoke_Y0(Object a0, Object a1, Object a2) throws Throwable { + Object[] av = { a0, a1, a2 }; + filter.invoke(av); // make the flyby + return target.invoke(av[0], av[1], av[2]); } + } + static class F4 extends Adapter { + protected F4(MethodHandle entryPoint) { super(entryPoint); } // to build prototype + protected F4(MethodHandle e, MethodHandle f, MethodHandle t) { + super(e, f, t); } + protected F4 makeInstance(MethodHandle e, MethodHandle f, MethodHandle t) { + return new F4(e, f, t); } + protected Object invoke_V0(Object a0, Object a1, Object a2, Object a3) throws Throwable { + return target.invoke(filter.invoke(a0), a1, a2, a3); } + protected Object invoke_V1(Object a0, Object a1, Object a2, Object a3) throws Throwable { + return target.invoke(a0, filter.invoke(a1), a2, a3); } + protected Object invoke_V2(Object a0, Object a1, Object a2, Object a3) throws Throwable { + return target.invoke(a0, a1, filter.invoke(a2), a3); } + protected Object invoke_V3(Object a0, Object a1, Object a2, Object a3) throws Throwable { + return target.invoke(a0, a1, a2, filter.invoke(a3)); } + protected Object invoke_F0(Object a0, Object a1, Object a2, Object a3) throws Throwable { + return target.invoke(filter.invoke(), + a0, a1, a2, a3); } + protected Object invoke_F1(Object a0, Object a1, Object a2, Object a3) throws Throwable { + return target.invoke(filter.invoke(a0), + a0, a1, a2, a3); } + protected Object invoke_F2(Object a0, Object a1, Object a2, Object a3) throws Throwable { + return target.invoke(filter.invoke(a0, a1), + a0, a1, a2, a3); } + protected Object invoke_F3(Object a0, Object a1, Object a2, Object a3) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2), + a0, a1, a2, a3); } + protected Object invoke_F4(Object a0, Object a1, Object a2, Object a3) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3), + a0, a1, a2, a3); } + protected Object invoke_C0(Object a0, Object a1, Object a2, Object a3) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3)); } + protected Object invoke_C1(Object a0, Object a1, Object a2, Object a3) throws Throwable { + return target.invoke(a0, filter.invoke(a1, a2, a3)); } + protected Object invoke_C2(Object a0, Object a1, Object a2, Object a3) throws Throwable { + return target.invoke(a0, a1, filter.invoke(a2, a3)); } + protected Object invoke_C3(Object a0, Object a1, Object a2, Object a3) throws Throwable { + return target.invoke(a0, a1, a2, filter.invoke(a3)); } + protected Object invoke_C4(Object a0, Object a1, Object a2, Object a3) throws Throwable { + return target.invoke(a0, a1, a2, a3, filter.invoke()); } + protected Object invoke_Y0(Object a0, Object a1, Object a2, Object a3) throws Throwable { + Object[] av = { a0, a1, a2, a3 }; + filter.invoke(av); // make the flyby + return target.invoke(av[0], av[1], av[2], av[3]); } + } + static class F5 extends Adapter { + protected F5(MethodHandle entryPoint) { super(entryPoint); } // to build prototype + protected F5(MethodHandle e, MethodHandle f, MethodHandle t) { + super(e, f, t); } + protected F5 makeInstance(MethodHandle e, MethodHandle f, MethodHandle t) { + return new F5(e, f, t); } + protected Object invoke_V0(Object a0, Object a1, Object a2, Object a3, + Object a4) throws Throwable { + return target.invoke(filter.invoke(a0), a1, a2, a3, a4); } + protected Object invoke_V1(Object a0, Object a1, Object a2, Object a3, + Object a4) throws Throwable { + return target.invoke(a0, filter.invoke(a1), a2, a3, a4); } + protected Object invoke_V2(Object a0, Object a1, Object a2, Object a3, + Object a4) throws Throwable { + return target.invoke(a0, a1, filter.invoke(a2), a3, a4); } + protected Object invoke_V3(Object a0, Object a1, Object a2, Object a3, + Object a4) throws Throwable { + return target.invoke(a0, a1, a2, filter.invoke(a3), a4); } + protected Object invoke_V4(Object a0, Object a1, Object a2, Object a3, + Object a4) throws Throwable { + return target.invoke(a0, a1, a2, a3, filter.invoke(a4)); } + protected Object invoke_F0(Object a0, Object a1, Object a2, Object a3, + Object a4) throws Throwable { + return target.invoke(filter.invoke(), + a0, a1, a2, a3, a4); } + protected Object invoke_F1(Object a0, Object a1, Object a2, Object a3, + Object a4) throws Throwable { + return target.invoke(filter.invoke(a0), + a0, a1, a2, a3, a4); } + protected Object invoke_F2(Object a0, Object a1, Object a2, Object a3, + Object a4) throws Throwable { + return target.invoke(filter.invoke(a0, a1), + a0, a1, a2, a3, a4); } + protected Object invoke_F3(Object a0, Object a1, Object a2, Object a3, + Object a4) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2), + a0, a1, a2, a3, a4); } + protected Object invoke_F4(Object a0, Object a1, Object a2, Object a3, + Object a4) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3), + a0, a1, a2, a3, a4); } + protected Object invoke_F5(Object a0, Object a1, Object a2, Object a3, + Object a4) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4), + a0, a1, a2, a3, a4); } + protected Object invoke_C0(Object a0, Object a1, Object a2, Object a3, + Object a4) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4)); } + protected Object invoke_C1(Object a0, Object a1, Object a2, Object a3, + Object a4) throws Throwable { + return target.invoke(a0, filter.invoke(a1, a2, a3, a4)); } + protected Object invoke_C2(Object a0, Object a1, Object a2, Object a3, + Object a4) throws Throwable { + return target.invoke(a0, a1, filter.invoke(a2, a3, a4)); } + protected Object invoke_C3(Object a0, Object a1, Object a2, Object a3, + Object a4) throws Throwable { + return target.invoke(a0, a1, a2, filter.invoke(a3, a4)); } + protected Object invoke_C4(Object a0, Object a1, Object a2, Object a3, + Object a4) throws Throwable { + return target.invoke(a0, a1, a2, a3, filter.invoke(a4)); } + protected Object invoke_C5(Object a0, Object a1, Object a2, Object a3, + Object a4) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, filter.invoke()); } + protected Object invoke_Y0(Object a0, Object a1, Object a2, Object a3, + Object a4) throws Throwable { + Object[] av = { a0, a1, a2, a3, a4 }; + filter.invoke(av); // make the flyby + return target.invoke(av[0], av[1], av[2], av[3], av[4]); } + } + static class F6 extends Adapter { + protected F6(MethodHandle entryPoint) { super(entryPoint); } // to build prototype + protected F6(MethodHandle e, MethodHandle f, MethodHandle t) { + super(e, f, t); } + protected F6 makeInstance(MethodHandle e, MethodHandle f, MethodHandle t) { + return new F6(e, f, t); } + protected Object invoke_V0(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5) throws Throwable { + return target.invoke(filter.invoke(a0), a1, a2, a3, a4, a5); } + protected Object invoke_V1(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5) throws Throwable { + return target.invoke(a0, filter.invoke(a1), a2, a3, a4, a5); } + protected Object invoke_V2(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5) throws Throwable { + return target.invoke(a0, a1, filter.invoke(a2), a3, a4, a5); } + protected Object invoke_V3(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5) throws Throwable { + return target.invoke(a0, a1, a2, filter.invoke(a3), a4, a5); } + protected Object invoke_V4(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5) throws Throwable { + return target.invoke(a0, a1, a2, a3, filter.invoke(a4), a5); } + protected Object invoke_V5(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, filter.invoke(a5)); } + protected Object invoke_F0(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5) throws Throwable { + return target.invoke(filter.invoke(), + a0, a1, a2, a3, a4, a5); } + protected Object invoke_F1(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5) throws Throwable { + return target.invoke(filter.invoke(a0), + a0, a1, a2, a3, a4, a5); } + protected Object invoke_F2(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5) throws Throwable { + return target.invoke(filter.invoke(a0, a1), + a0, a1, a2, a3, a4, a5); } + protected Object invoke_F3(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2), + a0, a1, a2, a3, a4, a5); } + protected Object invoke_F4(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3), + a0, a1, a2, a3, a4, a5); } + protected Object invoke_F5(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4), + a0, a1, a2, a3, a4, a5); } + protected Object invoke_F6(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5), + a0, a1, a2, a3, a4, a5); } + protected Object invoke_C0(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5)); } + protected Object invoke_C1(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5) throws Throwable { + return target.invoke(a0, filter.invoke(a1, a2, a3, a4, a5)); } + protected Object invoke_C2(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5) throws Throwable { + return target.invoke(a0, a1, filter.invoke(a2, a3, a4, a5)); } + protected Object invoke_C3(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5) throws Throwable { + return target.invoke(a0, a1, a2, filter.invoke(a3, a4, a5)); } + protected Object invoke_C4(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5) throws Throwable { + return target.invoke(a0, a1, a2, a3, filter.invoke(a4, a5)); } + protected Object invoke_C5(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, filter.invoke(a5)); } + protected Object invoke_C6(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, filter.invoke()); } + protected Object invoke_Y0(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5) throws Throwable { + Object[] av = { a0, a1, a2, a3, a4, a5 }; + filter.invoke(av); // make the flyby + return target.invoke(av[0], av[1], av[2], av[3], av[4], av[5]); } + } + static class F7 extends Adapter { + protected F7(MethodHandle entryPoint) { super(entryPoint); } // to build prototype + protected F7(MethodHandle e, MethodHandle f, MethodHandle t) { + super(e, f, t); } + protected F7 makeInstance(MethodHandle e, MethodHandle f, MethodHandle t) { + return new F7(e, f, t); } + protected Object invoke_V0(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6) throws Throwable { + return target.invoke(filter.invoke(a0), a1, a2, a3, a4, a5, a6); } + protected Object invoke_V1(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6) throws Throwable { + return target.invoke(a0, filter.invoke(a1), a2, a3, a4, a5, a6); } + protected Object invoke_V2(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6) throws Throwable { + return target.invoke(a0, a1, filter.invoke(a2), a3, a4, a5, a6); } + protected Object invoke_V3(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6) throws Throwable { + return target.invoke(a0, a1, a2, filter.invoke(a3), a4, a5, a6); } + protected Object invoke_V4(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6) throws Throwable { + return target.invoke(a0, a1, a2, a3, filter.invoke(a4), a5, a6); } + protected Object invoke_V5(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, filter.invoke(a5), a6); } + protected Object invoke_V6(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, filter.invoke(a6)); } + protected Object invoke_F0(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6) throws Throwable { + return target.invoke(filter.invoke(), + a0, a1, a2, a3, a4, a5, a6); } + protected Object invoke_F1(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6) throws Throwable { + return target.invoke(filter.invoke(a0), + a0, a1, a2, a3, a4, a5, a6); } + protected Object invoke_F2(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6) throws Throwable { + return target.invoke(filter.invoke(a0, a1), + a0, a1, a2, a3, a4, a5, a6); } + protected Object invoke_F3(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2), + a0, a1, a2, a3, a4, a5, a6); } + protected Object invoke_F4(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3), + a0, a1, a2, a3, a4, a5, a6); } + protected Object invoke_F5(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4), + a0, a1, a2, a3, a4, a5, a6); } + protected Object invoke_F6(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5), + a0, a1, a2, a3, a4, a5, a6); } + protected Object invoke_F7(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6), + a0, a1, a2, a3, a4, a5, a6); } + protected Object invoke_C0(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6)); } + protected Object invoke_C1(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6) throws Throwable { + return target.invoke(a0, filter.invoke(a1, a2, a3, a4, a5, a6)); } + protected Object invoke_C2(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6) throws Throwable { + return target.invoke(a0, a1, filter.invoke(a2, a3, a4, a5, a6)); } + protected Object invoke_C3(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6) throws Throwable { + return target.invoke(a0, a1, a2, filter.invoke(a3, a4, a5, a6)); } + protected Object invoke_C4(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6) throws Throwable { + return target.invoke(a0, a1, a2, a3, filter.invoke(a4, a5, a6)); } + protected Object invoke_C5(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, filter.invoke(a5, a6)); } + protected Object invoke_C6(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, filter.invoke(a6)); } + protected Object invoke_C7(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, filter.invoke()); } + protected Object invoke_Y0(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6) throws Throwable { + Object[] av = { a0, a1, a2, a3, a4, a5, a6 }; + filter.invoke(av); // make the flyby + return target.invoke(av[0], av[1], av[2], av[3], av[4], av[5], av[6]); } + } + static class F8 extends Adapter { + protected F8(MethodHandle entryPoint) { super(entryPoint); } // to build prototype + protected F8(MethodHandle e, MethodHandle f, MethodHandle t) { + super(e, f, t); } + protected F8 makeInstance(MethodHandle e, MethodHandle f, MethodHandle t) { + return new F8(e, f, t); } + protected Object invoke_V0(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7) throws Throwable { + return target.invoke(filter.invoke(a0), a1, a2, a3, a4, a5, a6, a7); } + protected Object invoke_V1(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7) throws Throwable { + return target.invoke(a0, filter.invoke(a1), a2, a3, a4, a5, a6, a7); } + protected Object invoke_V2(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7) throws Throwable { + return target.invoke(a0, a1, filter.invoke(a2), a3, a4, a5, a6, a7); } + protected Object invoke_V3(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7) throws Throwable { + return target.invoke(a0, a1, a2, filter.invoke(a3), a4, a5, a6, a7); } + protected Object invoke_V4(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7) throws Throwable { + return target.invoke(a0, a1, a2, a3, filter.invoke(a4), a5, a6, a7); } + protected Object invoke_V5(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, filter.invoke(a5), a6, a7); } + protected Object invoke_V6(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, filter.invoke(a6), a7); } + protected Object invoke_V7(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, filter.invoke(a7)); } + protected Object invoke_F0(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7) throws Throwable { + return target.invoke(filter.invoke(), + a0, a1, a2, a3, a4, a5, a6, a7); } + protected Object invoke_F1(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7) throws Throwable { + return target.invoke(filter.invoke(a0), + a0, a1, a2, a3, a4, a5, a6, a7); } + protected Object invoke_F2(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7) throws Throwable { + return target.invoke(filter.invoke(a0, a1), + a0, a1, a2, a3, a4, a5, a6, a7); } + protected Object invoke_F3(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2), + a0, a1, a2, a3, a4, a5, a6, a7); } + protected Object invoke_F4(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3), + a0, a1, a2, a3, a4, a5, a6, a7); } + protected Object invoke_F5(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4), + a0, a1, a2, a3, a4, a5, a6, a7); } + protected Object invoke_F6(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5), + a0, a1, a2, a3, a4, a5, a6, a7); } + protected Object invoke_F7(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6), + a0, a1, a2, a3, a4, a5, a6, a7); } + protected Object invoke_F8(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7), + a0, a1, a2, a3, a4, a5, a6, a7); } + protected Object invoke_C0(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7)); } + protected Object invoke_C1(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7) throws Throwable { + return target.invoke(a0, filter.invoke(a1, a2, a3, a4, a5, a6, a7)); } + protected Object invoke_C2(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7) throws Throwable { + return target.invoke(a0, a1, filter.invoke(a2, a3, a4, a5, a6, a7)); } + protected Object invoke_C3(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7) throws Throwable { + return target.invoke(a0, a1, a2, filter.invoke(a3, a4, a5, a6, a7)); } + protected Object invoke_C4(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7) throws Throwable { + return target.invoke(a0, a1, a2, a3, filter.invoke(a4, a5, a6, a7)); } + protected Object invoke_C5(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, filter.invoke(a5, a6, a7)); } + protected Object invoke_C6(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, filter.invoke(a6, a7)); } + protected Object invoke_C7(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, filter.invoke(a7)); } + protected Object invoke_C8(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, filter.invoke()); } + protected Object invoke_Y0(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7) throws Throwable { + Object[] av = { a0, a1, a2, a3, a4, a5, a6, a7 }; + filter.invoke(av); // make the flyby + return target.invoke(av[0], av[1], av[2], av[3], av[4], av[5], av[6], av[7]); } + } + static class F9 extends Adapter { + protected F9(MethodHandle entryPoint) { super(entryPoint); } // to build prototype + protected F9(MethodHandle e, MethodHandle f, MethodHandle t) { + super(e, f, t); } + protected F9 makeInstance(MethodHandle e, MethodHandle f, MethodHandle t) { + return new F9(e, f, t); } + protected Object invoke_V0(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8) throws Throwable { + return target.invoke(filter.invoke(a0), a1, a2, a3, a4, a5, a6, a7, a8); } + protected Object invoke_V1(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8) throws Throwable { + return target.invoke(a0, filter.invoke(a1), a2, a3, a4, a5, a6, a7, a8); } + protected Object invoke_V2(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8) throws Throwable { + return target.invoke(a0, a1, filter.invoke(a2), a3, a4, a5, a6, a7, a8); } + protected Object invoke_V3(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8) throws Throwable { + return target.invoke(a0, a1, a2, filter.invoke(a3), a4, a5, a6, a7, a8); } + protected Object invoke_V4(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8) throws Throwable { + return target.invoke(a0, a1, a2, a3, filter.invoke(a4), a5, a6, a7, a8); } + protected Object invoke_V5(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, filter.invoke(a5), a6, a7, a8); } + protected Object invoke_V6(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, filter.invoke(a6), a7, a8); } + protected Object invoke_V7(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, filter.invoke(a7), a8); } + protected Object invoke_V8(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, filter.invoke(a8)); } + protected Object invoke_F0(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8) throws Throwable { + return target.invoke(filter.invoke(), + a0, a1, a2, a3, a4, a5, a6, a7, a8); } + protected Object invoke_F1(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8) throws Throwable { + return target.invoke(filter.invoke(a0), + a0, a1, a2, a3, a4, a5, a6, a7, a8); } + protected Object invoke_F2(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8) throws Throwable { + return target.invoke(filter.invoke(a0, a1), + a0, a1, a2, a3, a4, a5, a6, a7, a8); } + protected Object invoke_F3(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2), + a0, a1, a2, a3, a4, a5, a6, a7, a8); } + protected Object invoke_F4(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3), + a0, a1, a2, a3, a4, a5, a6, a7, a8); } + protected Object invoke_F5(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4), + a0, a1, a2, a3, a4, a5, a6, a7, a8); } + protected Object invoke_F6(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5), + a0, a1, a2, a3, a4, a5, a6, a7, a8); } + protected Object invoke_F7(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6), + a0, a1, a2, a3, a4, a5, a6, a7, a8); } + protected Object invoke_F8(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7), + a0, a1, a2, a3, a4, a5, a6, a7, a8); } + protected Object invoke_F9(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8), + a0, a1, a2, a3, a4, a5, a6, a7, a8); } + protected Object invoke_C0(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8)); } + protected Object invoke_C1(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8) throws Throwable { + return target.invoke(a0, filter.invoke(a1, a2, a3, a4, a5, a6, a7, a8)); } + protected Object invoke_C2(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8) throws Throwable { + return target.invoke(a0, a1, filter.invoke(a2, a3, a4, a5, a6, a7, a8)); } + protected Object invoke_C3(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8) throws Throwable { + return target.invoke(a0, a1, a2, filter.invoke(a3, a4, a5, a6, a7, a8)); } + protected Object invoke_C4(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8) throws Throwable { + return target.invoke(a0, a1, a2, a3, filter.invoke(a4, a5, a6, a7, a8)); } + protected Object invoke_C5(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, filter.invoke(a5, a6, a7, a8)); } + protected Object invoke_C6(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, filter.invoke(a6, a7, a8)); } + protected Object invoke_C7(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, filter.invoke(a7, a8)); } + protected Object invoke_C8(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, filter.invoke(a8)); } + protected Object invoke_C9(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, filter.invoke()); } + protected Object invoke_Y0(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8) throws Throwable { + Object[] av = { a0, a1, a2, a3, a4, a5, a6, a7, a8 }; + filter.invoke(av); // make the flyby + return target.invoke(av[0], av[1], av[2], av[3], av[4], av[5], av[6], av[7], av[8]); } + } + static class F10 extends Adapter { + protected F10(MethodHandle entryPoint) { super(entryPoint); } // to build prototype + protected F10(MethodHandle e, MethodHandle f, MethodHandle t) { + super(e, f, t); } + protected F10 makeInstance(MethodHandle e, MethodHandle f, MethodHandle t) { + return new F10(e, f, t); } + protected Object invoke_V0(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9) throws Throwable { + return target.invoke(filter.invoke(a0), a1, a2, a3, a4, a5, a6, a7, a8, a9); } + protected Object invoke_V1(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9) throws Throwable { + return target.invoke(a0, filter.invoke(a1), a2, a3, a4, a5, a6, a7, a8, a9); } + protected Object invoke_V2(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9) throws Throwable { + return target.invoke(a0, a1, filter.invoke(a2), a3, a4, a5, a6, a7, a8, a9); } + protected Object invoke_V3(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9) throws Throwable { + return target.invoke(a0, a1, a2, filter.invoke(a3), a4, a5, a6, a7, a8, a9); } + protected Object invoke_V4(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9) throws Throwable { + return target.invoke(a0, a1, a2, a3, filter.invoke(a4), a5, a6, a7, a8, a9); } + protected Object invoke_V5(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, filter.invoke(a5), a6, a7, a8, a9); } + protected Object invoke_V6(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, filter.invoke(a6), a7, a8, a9); } + protected Object invoke_V7(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, filter.invoke(a7), a8, a9); } + protected Object invoke_V8(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, filter.invoke(a8), a9); } + protected Object invoke_V9(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, filter.invoke(a9)); } + protected Object invoke_F0(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9) throws Throwable { + return target.invoke(filter.invoke(), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); } + protected Object invoke_F1(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9) throws Throwable { + return target.invoke(filter.invoke(a0), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); } + protected Object invoke_F2(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9) throws Throwable { + return target.invoke(filter.invoke(a0, a1), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); } + protected Object invoke_F3(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); } + protected Object invoke_F4(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); } + protected Object invoke_F5(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); } + protected Object invoke_F6(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); } + protected Object invoke_F7(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); } + protected Object invoke_F8(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); } + protected Object invoke_F9(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); } + protected Object invoke_F10(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); } + protected Object invoke_C0(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); } + protected Object invoke_C1(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9) throws Throwable { + return target.invoke(a0, filter.invoke(a1, a2, a3, a4, a5, a6, a7, a8, a9)); } + protected Object invoke_C2(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9) throws Throwable { + return target.invoke(a0, a1, filter.invoke(a2, a3, a4, a5, a6, a7, a8, a9)); } + protected Object invoke_C3(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9) throws Throwable { + return target.invoke(a0, a1, a2, filter.invoke(a3, a4, a5, a6, a7, a8, a9)); } + protected Object invoke_C4(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9) throws Throwable { + return target.invoke(a0, a1, a2, a3, filter.invoke(a4, a5, a6, a7, a8, a9)); } + protected Object invoke_C5(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, filter.invoke(a5, a6, a7, a8, a9)); } + protected Object invoke_C6(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, filter.invoke(a6, a7, a8, a9)); } + protected Object invoke_C7(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, filter.invoke(a7, a8, a9)); } + protected Object invoke_C8(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, filter.invoke(a8, a9)); } + protected Object invoke_C9(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, filter.invoke(a9)); } + protected Object invoke_C10(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, filter.invoke()); } + protected Object invoke_Y0(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9) throws Throwable { + Object[] av = { a0, a1, a2, a3, a4, a5, a6, a7, a8, a9 }; + filter.invoke(av); // make the flyby + return target.invoke(av[0], av[1], av[2], av[3], av[4], av[5], av[6], av[7], av[8], av[9]); } + } + static class F11 extends Adapter { + protected F11(MethodHandle entryPoint) { super(entryPoint); } // to build prototype + protected F11(MethodHandle e, MethodHandle f, MethodHandle t) { + super(e, f, t); } + protected F11 makeInstance(MethodHandle e, MethodHandle f, MethodHandle t) { + return new F11(e, f, t); } + protected Object invoke_V0(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10) throws Throwable { + return target.invoke(filter.invoke(a0), a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10); } + protected Object invoke_V1(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10) throws Throwable { + return target.invoke(a0, filter.invoke(a1), a2, a3, a4, a5, a6, a7, a8, a9, + a10); } + protected Object invoke_V2(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10) throws Throwable { + return target.invoke(a0, a1, filter.invoke(a2), a3, a4, a5, a6, a7, a8, a9, + a10); } + protected Object invoke_V3(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10) throws Throwable { + return target.invoke(a0, a1, a2, filter.invoke(a3), a4, a5, a6, a7, a8, a9, + a10); } + protected Object invoke_V4(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10) throws Throwable { + return target.invoke(a0, a1, a2, a3, filter.invoke(a4), a5, a6, a7, a8, a9, + a10); } + protected Object invoke_V5(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, filter.invoke(a5), a6, a7, a8, a9, + a10); } + protected Object invoke_V6(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, filter.invoke(a6), a7, a8, a9, + a10); } + protected Object invoke_V7(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, filter.invoke(a7), a8, a9, + a10); } + protected Object invoke_V8(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, filter.invoke(a8), a9, + a10); } + protected Object invoke_V9(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, filter.invoke(a9), + a10); } + protected Object invoke_V10(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + filter.invoke(a10)); } + protected Object invoke_F0(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10) throws Throwable { + return target.invoke(filter.invoke(), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); } + protected Object invoke_F1(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10) throws Throwable { + return target.invoke(filter.invoke(a0), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); } + protected Object invoke_F2(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10) throws Throwable { + return target.invoke(filter.invoke(a0, a1), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); } + protected Object invoke_F3(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); } + protected Object invoke_F4(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); } + protected Object invoke_F5(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); } + protected Object invoke_F6(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); } + protected Object invoke_F7(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); } + protected Object invoke_F8(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); } + protected Object invoke_F9(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); } + protected Object invoke_F10(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); } + protected Object invoke_F11(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); } + protected Object invoke_C0(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10)); } + protected Object invoke_C1(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10) throws Throwable { + return target.invoke(a0, filter.invoke(a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10)); } + protected Object invoke_C2(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10) throws Throwable { + return target.invoke(a0, a1, filter.invoke(a2, a3, a4, a5, a6, a7, a8, a9, + a10)); } + protected Object invoke_C3(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10) throws Throwable { + return target.invoke(a0, a1, a2, filter.invoke(a3, a4, a5, a6, a7, a8, a9, + a10)); } + protected Object invoke_C4(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10) throws Throwable { + return target.invoke(a0, a1, a2, a3, filter.invoke(a4, a5, a6, a7, a8, a9, + a10)); } + protected Object invoke_C5(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, filter.invoke(a5, a6, a7, a8, a9, + a10)); } + protected Object invoke_C6(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, filter.invoke(a6, a7, a8, a9, + a10)); } + protected Object invoke_C7(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, filter.invoke(a7, a8, a9, + a10)); } + protected Object invoke_C8(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, filter.invoke(a8, a9, + a10)); } + protected Object invoke_C9(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, filter.invoke(a9, + a10)); } + protected Object invoke_C10(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, filter.invoke(a10)); } + protected Object invoke_C11(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, filter.invoke()); } + protected Object invoke_Y0(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10) throws Throwable { + Object[] av = { a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10 }; + filter.invoke(av); // make the flyby + return target.invoke(av[0], av[1], av[2], av[3], av[4], av[5], av[6], av[7], av[8], av[9], av[10]); } + } + static class F12 extends Adapter { + protected F12(MethodHandle entryPoint) { super(entryPoint); } // to build prototype + protected F12(MethodHandle e, MethodHandle f, MethodHandle t) { + super(e, f, t); } + protected F12 makeInstance(MethodHandle e, MethodHandle f, MethodHandle t) { + return new F12(e, f, t); } + protected Object invoke_V0(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11) throws Throwable { + return target.invoke(filter.invoke(a0), a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11); } + protected Object invoke_V1(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11) throws Throwable { + return target.invoke(a0, filter.invoke(a1), a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11); } + protected Object invoke_V2(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11) throws Throwable { + return target.invoke(a0, a1, filter.invoke(a2), a3, a4, a5, a6, a7, a8, a9, + a10, a11); } + protected Object invoke_V3(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11) throws Throwable { + return target.invoke(a0, a1, a2, filter.invoke(a3), a4, a5, a6, a7, a8, a9, + a10, a11); } + protected Object invoke_V4(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11) throws Throwable { + return target.invoke(a0, a1, a2, a3, filter.invoke(a4), a5, a6, a7, a8, a9, + a10, a11); } + protected Object invoke_V5(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, filter.invoke(a5), a6, a7, a8, a9, + a10, a11); } + protected Object invoke_V6(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, filter.invoke(a6), a7, a8, a9, + a10, a11); } + protected Object invoke_V7(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, filter.invoke(a7), a8, a9, + a10, a11); } + protected Object invoke_V8(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, filter.invoke(a8), a9, + a10, a11); } + protected Object invoke_V9(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, filter.invoke(a9), + a10, a11); } + protected Object invoke_V10(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + filter.invoke(a10), a11); } + protected Object invoke_V11(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, filter.invoke(a11)); } + protected Object invoke_F0(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11) throws Throwable { + return target.invoke(filter.invoke(), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); } + protected Object invoke_F1(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11) throws Throwable { + return target.invoke(filter.invoke(a0), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); } + protected Object invoke_F2(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11) throws Throwable { + return target.invoke(filter.invoke(a0, a1), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); } + protected Object invoke_F3(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); } + protected Object invoke_F4(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); } + protected Object invoke_F5(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); } + protected Object invoke_F6(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); } + protected Object invoke_F7(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); } + protected Object invoke_F8(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); } + protected Object invoke_F9(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); } + protected Object invoke_F10(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); } + protected Object invoke_F11(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); } + protected Object invoke_F12(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); } + protected Object invoke_C0(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11)); } + protected Object invoke_C1(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11) throws Throwable { + return target.invoke(a0, filter.invoke(a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11)); } + protected Object invoke_C2(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11) throws Throwable { + return target.invoke(a0, a1, filter.invoke(a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11)); } + protected Object invoke_C3(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11) throws Throwable { + return target.invoke(a0, a1, a2, filter.invoke(a3, a4, a5, a6, a7, a8, a9, + a10, a11)); } + protected Object invoke_C4(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11) throws Throwable { + return target.invoke(a0, a1, a2, a3, filter.invoke(a4, a5, a6, a7, a8, a9, + a10, a11)); } + protected Object invoke_C5(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, filter.invoke(a5, a6, a7, a8, a9, + a10, a11)); } + protected Object invoke_C6(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, filter.invoke(a6, a7, a8, a9, + a10, a11)); } + protected Object invoke_C7(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, filter.invoke(a7, a8, a9, + a10, a11)); } + protected Object invoke_C8(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, filter.invoke(a8, a9, + a10, a11)); } + protected Object invoke_C9(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, filter.invoke(a9, + a10, a11)); } + protected Object invoke_C10(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, filter.invoke(a10, a11)); } + protected Object invoke_C11(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, filter.invoke(a11)); } + protected Object invoke_C12(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, filter.invoke()); } + protected Object invoke_Y0(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11) throws Throwable { + Object[] av = { a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11 }; + filter.invoke(av); // make the flyby + return target.invoke(av[0], av[1], av[2], av[3], av[4], av[5], av[6], av[7], av[8], av[9], av[10], av[11]); } + } + static class F13 extends Adapter { + protected F13(MethodHandle entryPoint) { super(entryPoint); } // to build prototype + protected F13(MethodHandle e, MethodHandle f, MethodHandle t) { + super(e, f, t); } + protected F13 makeInstance(MethodHandle e, MethodHandle f, MethodHandle t) { + return new F13(e, f, t); } + protected Object invoke_V0(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12) throws Throwable { + return target.invoke(filter.invoke(a0), a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12); } + protected Object invoke_V1(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12) throws Throwable { + return target.invoke(a0, filter.invoke(a1), a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12); } + protected Object invoke_V2(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12) throws Throwable { + return target.invoke(a0, a1, filter.invoke(a2), a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12); } + protected Object invoke_V3(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12) throws Throwable { + return target.invoke(a0, a1, a2, filter.invoke(a3), a4, a5, a6, a7, a8, a9, + a10, a11, a12); } + protected Object invoke_V4(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12) throws Throwable { + return target.invoke(a0, a1, a2, a3, filter.invoke(a4), a5, a6, a7, a8, a9, + a10, a11, a12); } + protected Object invoke_V5(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, filter.invoke(a5), a6, a7, a8, a9, + a10, a11, a12); } + protected Object invoke_V6(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, filter.invoke(a6), a7, a8, a9, + a10, a11, a12); } + protected Object invoke_V7(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, filter.invoke(a7), a8, a9, + a10, a11, a12); } + protected Object invoke_V8(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, filter.invoke(a8), a9, + a10, a11, a12); } + protected Object invoke_V9(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, filter.invoke(a9), + a10, a11, a12); } + protected Object invoke_V10(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + filter.invoke(a10), a11, a12); } + protected Object invoke_V11(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, filter.invoke(a11), a12); } + protected Object invoke_V12(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, filter.invoke(a12)); } + protected Object invoke_F0(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12) throws Throwable { + return target.invoke(filter.invoke(), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); } + protected Object invoke_F1(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12) throws Throwable { + return target.invoke(filter.invoke(a0), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); } + protected Object invoke_F2(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12) throws Throwable { + return target.invoke(filter.invoke(a0, a1), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); } + protected Object invoke_F3(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); } + protected Object invoke_F4(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); } + protected Object invoke_F5(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); } + protected Object invoke_F6(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); } + protected Object invoke_F7(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); } + protected Object invoke_F8(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); } + protected Object invoke_F9(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); } + protected Object invoke_F10(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); } + protected Object invoke_F11(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); } + protected Object invoke_F12(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); } + protected Object invoke_F13(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); } + protected Object invoke_C0(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12)); } + protected Object invoke_C1(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12) throws Throwable { + return target.invoke(a0, filter.invoke(a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12)); } + protected Object invoke_C2(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12) throws Throwable { + return target.invoke(a0, a1, filter.invoke(a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12)); } + protected Object invoke_C3(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12) throws Throwable { + return target.invoke(a0, a1, a2, filter.invoke(a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12)); } + protected Object invoke_C4(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12) throws Throwable { + return target.invoke(a0, a1, a2, a3, filter.invoke(a4, a5, a6, a7, a8, a9, + a10, a11, a12)); } + protected Object invoke_C5(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, filter.invoke(a5, a6, a7, a8, a9, + a10, a11, a12)); } + protected Object invoke_C6(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, filter.invoke(a6, a7, a8, a9, + a10, a11, a12)); } + protected Object invoke_C7(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, filter.invoke(a7, a8, a9, + a10, a11, a12)); } + protected Object invoke_C8(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, filter.invoke(a8, a9, + a10, a11, a12)); } + protected Object invoke_C9(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, filter.invoke(a9, + a10, a11, a12)); } + protected Object invoke_C10(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, filter.invoke(a10, a11, a12)); } + protected Object invoke_C11(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, filter.invoke(a11, a12)); } + protected Object invoke_C12(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, filter.invoke(a12)); } + protected Object invoke_C13(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, filter.invoke()); } + protected Object invoke_Y0(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12) throws Throwable { + Object[] av = { a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12 }; + filter.invoke(av); // make the flyby + return target.invoke(av[0], av[1], av[2], av[3], av[4], av[5], av[6], av[7], av[8], av[9], av[10], av[11], av[12]); } + } + static class F14 extends Adapter { + protected F14(MethodHandle entryPoint) { super(entryPoint); } // to build prototype + protected F14(MethodHandle e, MethodHandle f, MethodHandle t) { + super(e, f, t); } + protected F14 makeInstance(MethodHandle e, MethodHandle f, MethodHandle t) { + return new F14(e, f, t); } + protected Object invoke_V0(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13) throws Throwable { + return target.invoke(filter.invoke(a0), a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13); } + protected Object invoke_V1(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13) throws Throwable { + return target.invoke(a0, filter.invoke(a1), a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13); } + protected Object invoke_V2(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13) throws Throwable { + return target.invoke(a0, a1, filter.invoke(a2), a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13); } + protected Object invoke_V3(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13) throws Throwable { + return target.invoke(a0, a1, a2, filter.invoke(a3), a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13); } + protected Object invoke_V4(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13) throws Throwable { + return target.invoke(a0, a1, a2, a3, filter.invoke(a4), a5, a6, a7, a8, a9, + a10, a11, a12, a13); } + protected Object invoke_V5(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, filter.invoke(a5), a6, a7, a8, a9, + a10, a11, a12, a13); } + protected Object invoke_V6(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, filter.invoke(a6), a7, a8, a9, + a10, a11, a12, a13); } + protected Object invoke_V7(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, filter.invoke(a7), a8, a9, + a10, a11, a12, a13); } + protected Object invoke_V8(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, filter.invoke(a8), a9, + a10, a11, a12, a13); } + protected Object invoke_V9(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, filter.invoke(a9), + a10, a11, a12, a13); } + protected Object invoke_V10(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + filter.invoke(a10), a11, a12, a13); } + protected Object invoke_V11(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, filter.invoke(a11), a12, a13); } + protected Object invoke_V12(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, filter.invoke(a12), a13); } + protected Object invoke_V13(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, filter.invoke(a13)); } + protected Object invoke_F0(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13) throws Throwable { + return target.invoke(filter.invoke(), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); } + protected Object invoke_F1(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13) throws Throwable { + return target.invoke(filter.invoke(a0), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); } + protected Object invoke_F2(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13) throws Throwable { + return target.invoke(filter.invoke(a0, a1), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); } + protected Object invoke_F3(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); } + protected Object invoke_F4(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); } + protected Object invoke_F5(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); } + protected Object invoke_F6(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); } + protected Object invoke_F7(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); } + protected Object invoke_F8(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); } + protected Object invoke_F9(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); } + protected Object invoke_F10(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); } + protected Object invoke_F11(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); } + protected Object invoke_F12(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); } + protected Object invoke_F13(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); } + protected Object invoke_F14(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); } + protected Object invoke_C0(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13)); } + protected Object invoke_C1(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13) throws Throwable { + return target.invoke(a0, filter.invoke(a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13)); } + protected Object invoke_C2(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13) throws Throwable { + return target.invoke(a0, a1, filter.invoke(a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13)); } + protected Object invoke_C3(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13) throws Throwable { + return target.invoke(a0, a1, a2, filter.invoke(a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13)); } + protected Object invoke_C4(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13) throws Throwable { + return target.invoke(a0, a1, a2, a3, filter.invoke(a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13)); } + protected Object invoke_C5(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, filter.invoke(a5, a6, a7, a8, a9, + a10, a11, a12, a13)); } + protected Object invoke_C6(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, filter.invoke(a6, a7, a8, a9, + a10, a11, a12, a13)); } + protected Object invoke_C7(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, filter.invoke(a7, a8, a9, + a10, a11, a12, a13)); } + protected Object invoke_C8(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, filter.invoke(a8, a9, + a10, a11, a12, a13)); } + protected Object invoke_C9(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, filter.invoke(a9, + a10, a11, a12, a13)); } + protected Object invoke_C10(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, filter.invoke(a10, a11, a12, a13)); } + protected Object invoke_C11(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, filter.invoke(a11, a12, a13)); } + protected Object invoke_C12(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, filter.invoke(a12, a13)); } + protected Object invoke_C13(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, filter.invoke(a13)); } + protected Object invoke_C14(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, filter.invoke()); } + protected Object invoke_Y0(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13) throws Throwable { + Object[] av = { a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13 }; + filter.invoke(av); // make the flyby + return target.invoke(av[0], av[1], av[2], av[3], av[4], av[5], av[6], av[7], av[8], av[9], av[10], av[11], av[12], av[13]); } + } + static class F15 extends Adapter { + protected F15(MethodHandle entryPoint) { super(entryPoint); } // to build prototype + protected F15(MethodHandle e, MethodHandle f, MethodHandle t) { + super(e, f, t); } + protected F15 makeInstance(MethodHandle e, MethodHandle f, MethodHandle t) { + return new F15(e, f, t); } + protected Object invoke_V0(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14) throws Throwable { + return target.invoke(filter.invoke(a0), a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14); } + protected Object invoke_V1(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14) throws Throwable { + return target.invoke(a0, filter.invoke(a1), a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14); } + protected Object invoke_V2(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14) throws Throwable { + return target.invoke(a0, a1, filter.invoke(a2), a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14); } + protected Object invoke_V3(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14) throws Throwable { + return target.invoke(a0, a1, a2, filter.invoke(a3), a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14); } + protected Object invoke_V4(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14) throws Throwable { + return target.invoke(a0, a1, a2, a3, filter.invoke(a4), a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14); } + protected Object invoke_V5(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, filter.invoke(a5), a6, a7, a8, a9, + a10, a11, a12, a13, a14); } + protected Object invoke_V6(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, filter.invoke(a6), a7, a8, a9, + a10, a11, a12, a13, a14); } + protected Object invoke_V7(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, filter.invoke(a7), a8, a9, + a10, a11, a12, a13, a14); } + protected Object invoke_V8(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, filter.invoke(a8), a9, + a10, a11, a12, a13, a14); } + protected Object invoke_V9(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, filter.invoke(a9), + a10, a11, a12, a13, a14); } + protected Object invoke_V10(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + filter.invoke(a10), a11, a12, a13, a14); } + protected Object invoke_V11(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, filter.invoke(a11), a12, a13, a14); } + protected Object invoke_V12(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, filter.invoke(a12), a13, a14); } + protected Object invoke_V13(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, filter.invoke(a13), a14); } + protected Object invoke_V14(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, filter.invoke(a14)); } + protected Object invoke_F0(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14) throws Throwable { + return target.invoke(filter.invoke(), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14); } + protected Object invoke_F1(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14) throws Throwable { + return target.invoke(filter.invoke(a0), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14); } + protected Object invoke_F2(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14) throws Throwable { + return target.invoke(filter.invoke(a0, a1), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14); } + protected Object invoke_F3(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14); } + protected Object invoke_F4(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14); } + protected Object invoke_F5(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14); } + protected Object invoke_F6(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14); } + protected Object invoke_F7(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14); } + protected Object invoke_F8(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14); } + protected Object invoke_F9(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14); } + protected Object invoke_F10(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14); } + protected Object invoke_F11(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14); } + protected Object invoke_F12(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14); } + protected Object invoke_F13(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14); } + protected Object invoke_F14(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14); } + protected Object invoke_F15(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14); } + protected Object invoke_C0(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14)); } + protected Object invoke_C1(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14) throws Throwable { + return target.invoke(a0, filter.invoke(a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14)); } + protected Object invoke_C2(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14) throws Throwable { + return target.invoke(a0, a1, filter.invoke(a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14)); } + protected Object invoke_C3(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14) throws Throwable { + return target.invoke(a0, a1, a2, filter.invoke(a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14)); } + protected Object invoke_C4(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14) throws Throwable { + return target.invoke(a0, a1, a2, a3, filter.invoke(a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14)); } + protected Object invoke_C5(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, filter.invoke(a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14)); } + protected Object invoke_C6(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, filter.invoke(a6, a7, a8, a9, + a10, a11, a12, a13, a14)); } + protected Object invoke_C7(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, filter.invoke(a7, a8, a9, + a10, a11, a12, a13, a14)); } + protected Object invoke_C8(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, filter.invoke(a8, a9, + a10, a11, a12, a13, a14)); } + protected Object invoke_C9(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, filter.invoke(a9, + a10, a11, a12, a13, a14)); } + protected Object invoke_C10(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, filter.invoke(a10, a11, a12, a13, a14)); } + protected Object invoke_C11(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, filter.invoke(a11, a12, a13, a14)); } + protected Object invoke_C12(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, filter.invoke(a12, a13, a14)); } + protected Object invoke_C13(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, filter.invoke(a13, a14)); } + protected Object invoke_C14(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, filter.invoke(a14)); } + protected Object invoke_C15(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, filter.invoke()); } + protected Object invoke_Y0(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14) throws Throwable { + Object[] av = { a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14 }; + filter.invoke(av); // make the flyby + return target.invoke(av[0], av[1], av[2], av[3], av[4], av[5], av[6], av[7], av[8], av[9], av[10], av[11], av[12], av[13], av[14]); } + } + static class F16 extends Adapter { + protected F16(MethodHandle entryPoint) { super(entryPoint); } // to build prototype + protected F16(MethodHandle e, MethodHandle f, MethodHandle t) { + super(e, f, t); } + protected F16 makeInstance(MethodHandle e, MethodHandle f, MethodHandle t) { + return new F16(e, f, t); } + protected Object invoke_V0(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15) throws Throwable { + return target.invoke(filter.invoke(a0), a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15); } + protected Object invoke_V1(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15) throws Throwable { + return target.invoke(a0, filter.invoke(a1), a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15); } + protected Object invoke_V2(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15) throws Throwable { + return target.invoke(a0, a1, filter.invoke(a2), a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15); } + protected Object invoke_V3(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15) throws Throwable { + return target.invoke(a0, a1, a2, filter.invoke(a3), a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15); } + protected Object invoke_V4(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15) throws Throwable { + return target.invoke(a0, a1, a2, a3, filter.invoke(a4), a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15); } + protected Object invoke_V5(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, filter.invoke(a5), a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15); } + protected Object invoke_V6(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, filter.invoke(a6), a7, a8, a9, + a10, a11, a12, a13, a14, a15); } + protected Object invoke_V7(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, filter.invoke(a7), a8, a9, + a10, a11, a12, a13, a14, a15); } + protected Object invoke_V8(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, filter.invoke(a8), a9, + a10, a11, a12, a13, a14, a15); } + protected Object invoke_V9(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, filter.invoke(a9), + a10, a11, a12, a13, a14, a15); } + protected Object invoke_V10(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + filter.invoke(a10), a11, a12, a13, a14, a15); } + protected Object invoke_V11(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, filter.invoke(a11), a12, a13, a14, a15); } + protected Object invoke_V12(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, filter.invoke(a12), a13, a14, a15); } + protected Object invoke_V13(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, filter.invoke(a13), a14, a15); } + protected Object invoke_V14(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, filter.invoke(a14), a15); } + protected Object invoke_V15(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, filter.invoke(a15)); } + protected Object invoke_F0(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15) throws Throwable { + return target.invoke(filter.invoke(), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); } + protected Object invoke_F1(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15) throws Throwable { + return target.invoke(filter.invoke(a0), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); } + protected Object invoke_F2(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15) throws Throwable { + return target.invoke(filter.invoke(a0, a1), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); } + protected Object invoke_F3(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); } + protected Object invoke_F4(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); } + protected Object invoke_F5(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); } + protected Object invoke_F6(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); } + protected Object invoke_F7(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); } + protected Object invoke_F8(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); } + protected Object invoke_F9(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); } + protected Object invoke_F10(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); } + protected Object invoke_F11(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); } + protected Object invoke_F12(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); } + protected Object invoke_F13(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); } + protected Object invoke_F14(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); } + protected Object invoke_F15(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); } + protected Object invoke_F16(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); } + protected Object invoke_C0(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15)); } + protected Object invoke_C1(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15) throws Throwable { + return target.invoke(a0, filter.invoke(a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15)); } + protected Object invoke_C2(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15) throws Throwable { + return target.invoke(a0, a1, filter.invoke(a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15)); } + protected Object invoke_C3(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15) throws Throwable { + return target.invoke(a0, a1, a2, filter.invoke(a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15)); } + protected Object invoke_C4(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15) throws Throwable { + return target.invoke(a0, a1, a2, a3, filter.invoke(a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15)); } + protected Object invoke_C5(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, filter.invoke(a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15)); } + protected Object invoke_C6(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, filter.invoke(a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15)); } + protected Object invoke_C7(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, filter.invoke(a7, a8, a9, + a10, a11, a12, a13, a14, a15)); } + protected Object invoke_C8(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, filter.invoke(a8, a9, + a10, a11, a12, a13, a14, a15)); } + protected Object invoke_C9(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, filter.invoke(a9, + a10, a11, a12, a13, a14, a15)); } + protected Object invoke_C10(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, filter.invoke(a10, a11, a12, a13, a14, a15)); } + protected Object invoke_C11(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, filter.invoke(a11, a12, a13, a14, a15)); } + protected Object invoke_C12(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, filter.invoke(a12, a13, a14, a15)); } + protected Object invoke_C13(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, filter.invoke(a13, a14, a15)); } + protected Object invoke_C14(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, filter.invoke(a14, a15)); } + protected Object invoke_C15(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, filter.invoke(a15)); } + protected Object invoke_C16(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, filter.invoke()); } + protected Object invoke_Y0(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15) throws Throwable { + Object[] av = { a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15 }; + filter.invoke(av); // make the flyby + return target.invoke(av[0], av[1], av[2], av[3], av[4], av[5], av[6], av[7], av[8], av[9], av[10], av[11], av[12], av[13], av[14], av[15]); } + } + static class F17 extends Adapter { + protected F17(MethodHandle entryPoint) { super(entryPoint); } // to build prototype + protected F17(MethodHandle e, MethodHandle f, MethodHandle t) { + super(e, f, t); } + protected F17 makeInstance(MethodHandle e, MethodHandle f, MethodHandle t) { + return new F17(e, f, t); } + protected Object invoke_V0(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16) throws Throwable { + return target.invoke(filter.invoke(a0), a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15, a16); } + protected Object invoke_V1(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16) throws Throwable { + return target.invoke(a0, filter.invoke(a1), a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15, a16); } + protected Object invoke_V2(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16) throws Throwable { + return target.invoke(a0, a1, filter.invoke(a2), a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15, a16); } + protected Object invoke_V3(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16) throws Throwable { + return target.invoke(a0, a1, a2, filter.invoke(a3), a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15, a16); } + protected Object invoke_V4(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16) throws Throwable { + return target.invoke(a0, a1, a2, a3, filter.invoke(a4), a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15, a16); } + protected Object invoke_V5(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, filter.invoke(a5), a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15, a16); } + protected Object invoke_V6(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, filter.invoke(a6), a7, a8, a9, + a10, a11, a12, a13, a14, a15, a16); } + protected Object invoke_V7(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, filter.invoke(a7), a8, a9, + a10, a11, a12, a13, a14, a15, a16); } + protected Object invoke_V8(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, filter.invoke(a8), a9, + a10, a11, a12, a13, a14, a15, a16); } + protected Object invoke_V9(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, filter.invoke(a9), + a10, a11, a12, a13, a14, a15, a16); } + protected Object invoke_V10(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + filter.invoke(a10), a11, a12, a13, a14, a15, a16); } + protected Object invoke_V11(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, filter.invoke(a11), a12, a13, a14, a15, a16); } + protected Object invoke_V12(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, filter.invoke(a12), a13, a14, a15, a16); } + protected Object invoke_V13(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, filter.invoke(a13), a14, a15, a16); } + protected Object invoke_V14(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, filter.invoke(a14), a15, a16); } + protected Object invoke_V15(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, filter.invoke(a15), a16); } + protected Object invoke_V16(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15, filter.invoke(a16)); } + protected Object invoke_F0(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16) throws Throwable { + return target.invoke(filter.invoke(), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); } + protected Object invoke_F1(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16) throws Throwable { + return target.invoke(filter.invoke(a0), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); } + protected Object invoke_F2(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16) throws Throwable { + return target.invoke(filter.invoke(a0, a1), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); } + protected Object invoke_F3(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); } + protected Object invoke_F4(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); } + protected Object invoke_F5(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); } + protected Object invoke_F6(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); } + protected Object invoke_F7(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); } + protected Object invoke_F8(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); } + protected Object invoke_F9(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); } + protected Object invoke_F10(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); } + protected Object invoke_F11(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); } + protected Object invoke_F12(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); } + protected Object invoke_F13(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); } + protected Object invoke_F14(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); } + protected Object invoke_F15(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); } + protected Object invoke_F16(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); } + protected Object invoke_F17(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); } + protected Object invoke_C0(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15, a16)); } + protected Object invoke_C1(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16) throws Throwable { + return target.invoke(a0, filter.invoke(a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15, a16)); } + protected Object invoke_C2(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16) throws Throwable { + return target.invoke(a0, a1, filter.invoke(a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15, a16)); } + protected Object invoke_C3(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16) throws Throwable { + return target.invoke(a0, a1, a2, filter.invoke(a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15, a16)); } + protected Object invoke_C4(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16) throws Throwable { + return target.invoke(a0, a1, a2, a3, filter.invoke(a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15, a16)); } + protected Object invoke_C5(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, filter.invoke(a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15, a16)); } + protected Object invoke_C6(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, filter.invoke(a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15, a16)); } + protected Object invoke_C7(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, filter.invoke(a7, a8, a9, + a10, a11, a12, a13, a14, a15, a16)); } + protected Object invoke_C8(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, filter.invoke(a8, a9, + a10, a11, a12, a13, a14, a15, a16)); } + protected Object invoke_C9(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, filter.invoke(a9, + a10, a11, a12, a13, a14, a15, a16)); } + protected Object invoke_C10(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, filter.invoke(a10, a11, a12, a13, a14, a15, a16)); } + protected Object invoke_C11(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, filter.invoke(a11, a12, a13, a14, a15, a16)); } + protected Object invoke_C12(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, filter.invoke(a12, a13, a14, a15, a16)); } + protected Object invoke_C13(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, filter.invoke(a13, a14, a15, a16)); } + protected Object invoke_C14(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, filter.invoke(a14, a15, a16)); } + protected Object invoke_C15(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, filter.invoke(a15, a16)); } + protected Object invoke_C16(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15, filter.invoke(a16)); } + protected Object invoke_C17(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, filter.invoke()); } + protected Object invoke_Y0(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16) throws Throwable { + Object[] av = { a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16 }; + filter.invoke(av); // make the flyby + return target.invoke(av[0], av[1], av[2], av[3], av[4], av[5], av[6], av[7], av[8], av[9], av[10], av[11], av[12], av[13], av[14], av[15], av[16]); } + } + static class F18 extends Adapter { + protected F18(MethodHandle entryPoint) { super(entryPoint); } // to build prototype + protected F18(MethodHandle e, MethodHandle f, MethodHandle t) { + super(e, f, t); } + protected F18 makeInstance(MethodHandle e, MethodHandle f, MethodHandle t) { + return new F18(e, f, t); } + protected Object invoke_V0(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17) throws Throwable { + return target.invoke(filter.invoke(a0), a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15, a16, a17); } + protected Object invoke_V1(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17) throws Throwable { + return target.invoke(a0, filter.invoke(a1), a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15, a16, a17); } + protected Object invoke_V2(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17) throws Throwable { + return target.invoke(a0, a1, filter.invoke(a2), a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15, a16, a17); } + protected Object invoke_V3(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17) throws Throwable { + return target.invoke(a0, a1, a2, filter.invoke(a3), a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15, a16, a17); } + protected Object invoke_V4(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17) throws Throwable { + return target.invoke(a0, a1, a2, a3, filter.invoke(a4), a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15, a16, a17); } + protected Object invoke_V5(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, filter.invoke(a5), a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15, a16, a17); } + protected Object invoke_V6(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, filter.invoke(a6), a7, a8, a9, + a10, a11, a12, a13, a14, a15, a16, a17); } + protected Object invoke_V7(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, filter.invoke(a7), a8, a9, + a10, a11, a12, a13, a14, a15, a16, a17); } + protected Object invoke_V8(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, filter.invoke(a8), a9, + a10, a11, a12, a13, a14, a15, a16, a17); } + protected Object invoke_V9(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, filter.invoke(a9), + a10, a11, a12, a13, a14, a15, a16, a17); } + protected Object invoke_V10(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + filter.invoke(a10), a11, a12, a13, a14, a15, a16, a17); } + protected Object invoke_V11(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, filter.invoke(a11), a12, a13, a14, a15, a16, a17); } + protected Object invoke_V12(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, filter.invoke(a12), a13, a14, a15, a16, a17); } + protected Object invoke_V13(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, filter.invoke(a13), a14, a15, a16, a17); } + protected Object invoke_V14(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, filter.invoke(a14), a15, a16, a17); } + protected Object invoke_V15(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, filter.invoke(a15), a16, a17); } + protected Object invoke_V16(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15, filter.invoke(a16), a17); } + protected Object invoke_V17(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15, a16, filter.invoke(a17)); } + protected Object invoke_F0(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17) throws Throwable { + return target.invoke(filter.invoke(), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17); } + protected Object invoke_F1(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17) throws Throwable { + return target.invoke(filter.invoke(a0), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17); } + protected Object invoke_F2(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17) throws Throwable { + return target.invoke(filter.invoke(a0, a1), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17); } + protected Object invoke_F3(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17); } + protected Object invoke_F4(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17); } + protected Object invoke_F5(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17); } + protected Object invoke_F6(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17); } + protected Object invoke_F7(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17); } + protected Object invoke_F8(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17); } + protected Object invoke_F9(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17); } + protected Object invoke_F10(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17); } + protected Object invoke_F11(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17); } + protected Object invoke_F12(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17); } + protected Object invoke_F13(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17); } + protected Object invoke_F14(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17); } + protected Object invoke_F15(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17); } + protected Object invoke_F16(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17); } + protected Object invoke_F17(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15, a16), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17); } + protected Object invoke_F18(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17); } + protected Object invoke_C0(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15, a16, a17)); } + protected Object invoke_C1(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17) throws Throwable { + return target.invoke(a0, filter.invoke(a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15, a16, a17)); } + protected Object invoke_C2(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17) throws Throwable { + return target.invoke(a0, a1, filter.invoke(a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15, a16, a17)); } + protected Object invoke_C3(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17) throws Throwable { + return target.invoke(a0, a1, a2, filter.invoke(a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15, a16, a17)); } + protected Object invoke_C4(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17) throws Throwable { + return target.invoke(a0, a1, a2, a3, filter.invoke(a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15, a16, a17)); } + protected Object invoke_C5(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, filter.invoke(a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15, a16, a17)); } + protected Object invoke_C6(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, filter.invoke(a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15, a16, a17)); } + protected Object invoke_C7(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, filter.invoke(a7, a8, a9, + a10, a11, a12, a13, a14, a15, a16, a17)); } + protected Object invoke_C8(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, filter.invoke(a8, a9, + a10, a11, a12, a13, a14, a15, a16, a17)); } + protected Object invoke_C9(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, filter.invoke(a9, + a10, a11, a12, a13, a14, a15, a16, a17)); } + protected Object invoke_C10(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, filter.invoke(a10, a11, a12, a13, a14, a15, a16, a17)); } + protected Object invoke_C11(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, filter.invoke(a11, a12, a13, a14, a15, a16, a17)); } + protected Object invoke_C12(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, filter.invoke(a12, a13, a14, a15, a16, a17)); } + protected Object invoke_C13(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, filter.invoke(a13, a14, a15, a16, a17)); } + protected Object invoke_C14(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, filter.invoke(a14, a15, a16, a17)); } + protected Object invoke_C15(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, filter.invoke(a15, a16, a17)); } + protected Object invoke_C16(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15, filter.invoke(a16, a17)); } + protected Object invoke_C17(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15, a16, filter.invoke(a17)); } + protected Object invoke_C18(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, filter.invoke()); } + protected Object invoke_Y0(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17) throws Throwable { + Object[] av = { a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17 }; + filter.invoke(av); // make the flyby + return target.invoke(av[0], av[1], av[2], av[3], av[4], av[5], av[6], av[7], av[8], av[9], av[10], av[11], av[12], av[13], av[14], av[15], av[16], av[17]); } + } + static class F19 extends Adapter { + protected F19(MethodHandle entryPoint) { super(entryPoint); } // to build prototype + protected F19(MethodHandle e, MethodHandle f, MethodHandle t) { + super(e, f, t); } + protected F19 makeInstance(MethodHandle e, MethodHandle f, MethodHandle t) { + return new F19(e, f, t); } + protected Object invoke_V0(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18) throws Throwable { + return target.invoke(filter.invoke(a0), a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15, a16, a17, a18); } + protected Object invoke_V1(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18) throws Throwable { + return target.invoke(a0, filter.invoke(a1), a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15, a16, a17, a18); } + protected Object invoke_V2(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18) throws Throwable { + return target.invoke(a0, a1, filter.invoke(a2), a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15, a16, a17, a18); } + protected Object invoke_V3(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18) throws Throwable { + return target.invoke(a0, a1, a2, filter.invoke(a3), a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15, a16, a17, a18); } + protected Object invoke_V4(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18) throws Throwable { + return target.invoke(a0, a1, a2, a3, filter.invoke(a4), a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15, a16, a17, a18); } + protected Object invoke_V5(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, filter.invoke(a5), a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15, a16, a17, a18); } + protected Object invoke_V6(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, filter.invoke(a6), a7, a8, a9, + a10, a11, a12, a13, a14, a15, a16, a17, a18); } + protected Object invoke_V7(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, filter.invoke(a7), a8, a9, + a10, a11, a12, a13, a14, a15, a16, a17, a18); } + protected Object invoke_V8(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, filter.invoke(a8), a9, + a10, a11, a12, a13, a14, a15, a16, a17, a18); } + protected Object invoke_V9(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, filter.invoke(a9), + a10, a11, a12, a13, a14, a15, a16, a17, a18); } + protected Object invoke_V10(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + filter.invoke(a10), a11, a12, a13, a14, a15, a16, a17, a18); } + protected Object invoke_V11(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, filter.invoke(a11), a12, a13, a14, a15, a16, a17, a18); } + protected Object invoke_V12(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, filter.invoke(a12), a13, a14, a15, a16, a17, a18); } + protected Object invoke_V13(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, filter.invoke(a13), a14, a15, a16, a17, a18); } + protected Object invoke_V14(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, filter.invoke(a14), a15, a16, a17, a18); } + protected Object invoke_V15(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, filter.invoke(a15), a16, a17, a18); } + protected Object invoke_V16(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15, filter.invoke(a16), a17, a18); } + protected Object invoke_V17(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15, a16, filter.invoke(a17), a18); } + protected Object invoke_V18(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15, a16, a17, filter.invoke(a18)); } + protected Object invoke_F0(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18) throws Throwable { + return target.invoke(filter.invoke(), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18); } + protected Object invoke_F1(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18) throws Throwable { + return target.invoke(filter.invoke(a0), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18); } + protected Object invoke_F2(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18) throws Throwable { + return target.invoke(filter.invoke(a0, a1), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18); } + protected Object invoke_F3(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18); } + protected Object invoke_F4(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18); } + protected Object invoke_F5(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18); } + protected Object invoke_F6(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18); } + protected Object invoke_F7(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18); } + protected Object invoke_F8(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18); } + protected Object invoke_F9(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18); } + protected Object invoke_F10(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18); } + protected Object invoke_F11(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18); } + protected Object invoke_F12(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18); } + protected Object invoke_F13(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18); } + protected Object invoke_F14(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18); } + protected Object invoke_F15(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18); } + protected Object invoke_F16(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18); } + protected Object invoke_F17(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15, a16), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18); } + protected Object invoke_F18(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15, a16, a17), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18); } + protected Object invoke_F19(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18); } + protected Object invoke_C0(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15, a16, a17, a18)); } + protected Object invoke_C1(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18) throws Throwable { + return target.invoke(a0, filter.invoke(a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15, a16, a17, a18)); } + protected Object invoke_C2(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18) throws Throwable { + return target.invoke(a0, a1, filter.invoke(a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15, a16, a17, a18)); } + protected Object invoke_C3(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18) throws Throwable { + return target.invoke(a0, a1, a2, filter.invoke(a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15, a16, a17, a18)); } + protected Object invoke_C4(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18) throws Throwable { + return target.invoke(a0, a1, a2, a3, filter.invoke(a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15, a16, a17, a18)); } + protected Object invoke_C5(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, filter.invoke(a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15, a16, a17, a18)); } + protected Object invoke_C6(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, filter.invoke(a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15, a16, a17, a18)); } + protected Object invoke_C7(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, filter.invoke(a7, a8, a9, + a10, a11, a12, a13, a14, a15, a16, a17, a18)); } + protected Object invoke_C8(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, filter.invoke(a8, a9, + a10, a11, a12, a13, a14, a15, a16, a17, a18)); } + protected Object invoke_C9(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, filter.invoke(a9, + a10, a11, a12, a13, a14, a15, a16, a17, a18)); } + protected Object invoke_C10(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, filter.invoke(a10, a11, a12, a13, a14, a15, a16, a17, a18)); } + protected Object invoke_C11(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, filter.invoke(a11, a12, a13, a14, a15, a16, a17, a18)); } + protected Object invoke_C12(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, filter.invoke(a12, a13, a14, a15, a16, a17, a18)); } + protected Object invoke_C13(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, filter.invoke(a13, a14, a15, a16, a17, a18)); } + protected Object invoke_C14(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, filter.invoke(a14, a15, a16, a17, a18)); } + protected Object invoke_C15(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, filter.invoke(a15, a16, a17, a18)); } + protected Object invoke_C16(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15, filter.invoke(a16, a17, a18)); } + protected Object invoke_C17(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15, a16, filter.invoke(a17, a18)); } + protected Object invoke_C18(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15, a16, a17, filter.invoke(a18)); } + protected Object invoke_C19(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, filter.invoke()); } + protected Object invoke_Y0(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18) throws Throwable { + Object[] av = { a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18 }; + filter.invoke(av); // make the flyby + return target.invoke(av[0], av[1], av[2], av[3], av[4], av[5], av[6], av[7], av[8], av[9], av[10], av[11], av[12], av[13], av[14], av[15], av[16], av[17], av[18]); } + } + static class F20 extends Adapter { + protected F20(MethodHandle entryPoint) { super(entryPoint); } // to build prototype + protected F20(MethodHandle e, MethodHandle f, MethodHandle t) { + super(e, f, t); } + protected F20 makeInstance(MethodHandle e, MethodHandle f, MethodHandle t) { + return new F20(e, f, t); } + protected Object invoke_V0(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18, Object a19) throws Throwable { + return target.invoke(filter.invoke(a0), a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); } + protected Object invoke_V1(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18, Object a19) throws Throwable { + return target.invoke(a0, filter.invoke(a1), a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); } + protected Object invoke_V2(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18, Object a19) throws Throwable { + return target.invoke(a0, a1, filter.invoke(a2), a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); } + protected Object invoke_V3(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18, Object a19) throws Throwable { + return target.invoke(a0, a1, a2, filter.invoke(a3), a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); } + protected Object invoke_V4(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18, Object a19) throws Throwable { + return target.invoke(a0, a1, a2, a3, filter.invoke(a4), a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); } + protected Object invoke_V5(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18, Object a19) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, filter.invoke(a5), a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); } + protected Object invoke_V6(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18, Object a19) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, filter.invoke(a6), a7, a8, a9, + a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); } + protected Object invoke_V7(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18, Object a19) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, filter.invoke(a7), a8, a9, + a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); } + protected Object invoke_V8(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18, Object a19) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, filter.invoke(a8), a9, + a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); } + protected Object invoke_V9(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18, Object a19) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, filter.invoke(a9), + a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); } + protected Object invoke_V10(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18, Object a19) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + filter.invoke(a10), a11, a12, a13, a14, a15, a16, a17, a18, a19); } + protected Object invoke_V11(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18, Object a19) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, filter.invoke(a11), a12, a13, a14, a15, a16, a17, a18, a19); } + protected Object invoke_V12(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18, Object a19) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, filter.invoke(a12), a13, a14, a15, a16, a17, a18, a19); } + protected Object invoke_V13(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18, Object a19) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, filter.invoke(a13), a14, a15, a16, a17, a18, a19); } + protected Object invoke_V14(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18, Object a19) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, filter.invoke(a14), a15, a16, a17, a18, a19); } + protected Object invoke_V15(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18, Object a19) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, filter.invoke(a15), a16, a17, a18, a19); } + protected Object invoke_V16(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18, Object a19) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15, filter.invoke(a16), a17, a18, a19); } + protected Object invoke_V17(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18, Object a19) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15, a16, filter.invoke(a17), a18, a19); } + protected Object invoke_V18(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18, Object a19) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15, a16, a17, filter.invoke(a18), a19); } + protected Object invoke_V19(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18, Object a19) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15, a16, a17, a18, filter.invoke(a19)); } + protected Object invoke_F0(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18, Object a19) throws Throwable { + return target.invoke(filter.invoke(), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); } + protected Object invoke_F1(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18, Object a19) throws Throwable { + return target.invoke(filter.invoke(a0), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); } + protected Object invoke_F2(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18, Object a19) throws Throwable { + return target.invoke(filter.invoke(a0, a1), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); } + protected Object invoke_F3(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18, Object a19) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); } + protected Object invoke_F4(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18, Object a19) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); } + protected Object invoke_F5(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18, Object a19) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); } + protected Object invoke_F6(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18, Object a19) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); } + protected Object invoke_F7(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18, Object a19) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); } + protected Object invoke_F8(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18, Object a19) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); } + protected Object invoke_F9(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18, Object a19) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); } + protected Object invoke_F10(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18, Object a19) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); } + protected Object invoke_F11(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18, Object a19) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); } + protected Object invoke_F12(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18, Object a19) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); } + protected Object invoke_F13(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18, Object a19) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); } + protected Object invoke_F14(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18, Object a19) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); } + protected Object invoke_F15(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18, Object a19) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); } + protected Object invoke_F16(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18, Object a19) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); } + protected Object invoke_F17(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18, Object a19) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15, a16), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); } + protected Object invoke_F18(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18, Object a19) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15, a16, a17), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); } + protected Object invoke_F19(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18, Object a19) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15, a16, a17, a18), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); } + protected Object invoke_F20(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18, Object a19) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19), + a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); } + protected Object invoke_C0(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18, Object a19) throws Throwable { + return target.invoke(filter.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15, a16, a17, a18, a19)); } + protected Object invoke_C1(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18, Object a19) throws Throwable { + return target.invoke(a0, filter.invoke(a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15, a16, a17, a18, a19)); } + protected Object invoke_C2(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18, Object a19) throws Throwable { + return target.invoke(a0, a1, filter.invoke(a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15, a16, a17, a18, a19)); } + protected Object invoke_C3(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18, Object a19) throws Throwable { + return target.invoke(a0, a1, a2, filter.invoke(a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15, a16, a17, a18, a19)); } + protected Object invoke_C4(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18, Object a19) throws Throwable { + return target.invoke(a0, a1, a2, a3, filter.invoke(a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15, a16, a17, a18, a19)); } + protected Object invoke_C5(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18, Object a19) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, filter.invoke(a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15, a16, a17, a18, a19)); } + protected Object invoke_C6(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18, Object a19) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, filter.invoke(a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15, a16, a17, a18, a19)); } + protected Object invoke_C7(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18, Object a19) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, filter.invoke(a7, a8, a9, + a10, a11, a12, a13, a14, a15, a16, a17, a18, a19)); } + protected Object invoke_C8(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18, Object a19) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, filter.invoke(a8, a9, + a10, a11, a12, a13, a14, a15, a16, a17, a18, a19)); } + protected Object invoke_C9(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18, Object a19) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, filter.invoke(a9, + a10, a11, a12, a13, a14, a15, a16, a17, a18, a19)); } + protected Object invoke_C10(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18, Object a19) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, filter.invoke(a10, a11, a12, a13, a14, a15, a16, a17, a18, a19)); } + protected Object invoke_C11(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18, Object a19) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, filter.invoke(a11, a12, a13, a14, a15, a16, a17, a18, a19)); } + protected Object invoke_C12(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18, Object a19) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, filter.invoke(a12, a13, a14, a15, a16, a17, a18, a19)); } + protected Object invoke_C13(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18, Object a19) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, filter.invoke(a13, a14, a15, a16, a17, a18, a19)); } + protected Object invoke_C14(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18, Object a19) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, filter.invoke(a14, a15, a16, a17, a18, a19)); } + protected Object invoke_C15(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18, Object a19) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, filter.invoke(a15, a16, a17, a18, a19)); } + protected Object invoke_C16(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18, Object a19) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15, filter.invoke(a16, a17, a18, a19)); } + protected Object invoke_C17(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18, Object a19) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15, a16, filter.invoke(a17, a18, a19)); } + protected Object invoke_C18(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18, Object a19) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15, a16, a17, filter.invoke(a18, a19)); } + protected Object invoke_C19(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18, Object a19) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15, a16, a17, a18, filter.invoke(a19)); } + protected Object invoke_C20(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18, Object a19) throws Throwable { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, filter.invoke()); } + protected Object invoke_Y0(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9, Object a10, Object a11, + Object a12, Object a13, Object a14, Object a15, + Object a16, Object a17, Object a18, Object a19) throws Throwable { + Object[] av = { a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19 }; + filter.invoke(av); // make the flyby + return target.invoke(av[0], av[1], av[2], av[3], av[4], av[5], av[6], av[7], av[8], av[9], av[10], av[11], av[12], av[13], av[14], av[15], av[16], av[17], av[18], av[19]); } + } } diff --git a/src/share/classes/sun/dyn/FilterOneArgument.java b/src/share/classes/sun/dyn/FilterOneArgument.java index c2fd98e0c09dfe890e3d86ea09d61286cb1bf484..ac9849c69d9734297ee91defda28ab9080406b21 100644 --- a/src/share/classes/sun/dyn/FilterOneArgument.java +++ b/src/share/classes/sun/dyn/FilterOneArgument.java @@ -27,7 +27,6 @@ package sun.dyn; import java.dyn.JavaMethodHandle; import java.dyn.MethodHandle; -import java.dyn.MethodHandles; import java.dyn.MethodType; /** @@ -42,16 +41,21 @@ public class FilterOneArgument extends JavaMethodHandle { protected final MethodHandle filter; // Object -> Object protected final MethodHandle target; // Object -> Object - protected Object entryPoint(Object argument) { - Object filteredArgument = filter.invoke(argument); - return target.invoke(filteredArgument); + @Override + public String toString() { + return target.toString(); + } + + protected Object invoke(Object argument) throws Throwable { + Object filteredArgument = filter.invoke(argument); + return target.invoke(filteredArgument); } - private static final MethodHandle entryPoint = - MethodHandleImpl.IMPL_LOOKUP.findVirtual(FilterOneArgument.class, "entryPoint", MethodType.makeGeneric(1)); + private static final MethodHandle INVOKE = + MethodHandleImpl.IMPL_LOOKUP.findVirtual(FilterOneArgument.class, "invoke", MethodType.genericMethodType(1)); protected FilterOneArgument(MethodHandle filter, MethodHandle target) { - super(entryPoint); + super(INVOKE); this.filter = filter; this.target = target; } @@ -62,10 +66,6 @@ public class FilterOneArgument extends JavaMethodHandle { return new FilterOneArgument(filter, target); } - public String toString() { - return filter + "|>" + target; - } - // MethodHandle make(MethodHandle filter1, MethodHandle filter2, MethodHandle target) { // MethodHandle filter = make(filter1, filter2); // return make(filter, target); diff --git a/src/share/classes/sun/dyn/FromGeneric.java b/src/share/classes/sun/dyn/FromGeneric.java index 85f35d6557755ff2dec53fe3c2ac18e691b926b3..a42be3fcd51f45925793f473e83c9c29f9ccbb6b 100644 --- a/src/share/classes/sun/dyn/FromGeneric.java +++ b/src/share/classes/sun/dyn/FromGeneric.java @@ -36,8 +36,8 @@ import sun.dyn.util.ValueConversions; import sun.dyn.util.Wrapper; /** - * Adapters which mediate between incoming calls which are not generic - * and outgoing calls which are. Any call can be represented generically + * Adapters which mediate between incoming calls which are generic + * and outgoing calls which are not. Any call can be represented generically * boxing up its arguments, and (on return) unboxing the return value. *

    * A call is "generic" (in MethodHandle terms) if its MethodType features @@ -50,9 +50,6 @@ import sun.dyn.util.Wrapper; * either binds internally or else takes as a leading argument). * (To stretch the term, adapter-like method handles may have multiple * targets or be polymorphic across multiple call types.) - *

    - * This adapter can sometimes be more directly implemented - * by the JVM's built-in OP_SPREAD_ARGS adapter. * @author jrose */ class FromGeneric { @@ -99,7 +96,7 @@ class FromGeneric { } this.internalType = internalType0; this.adapter = ad; - MethodType tepType = targetType.insertParameterType(0, adapter.getClass()); + MethodType tepType = targetType.insertParameterTypes(0, adapter.getClass()); this.entryPoint = ad.prototypeEntryPoint(); this.returnConversion = computeReturnConversion(targetType, internalType0); this.unboxingInvoker = computeUnboxingInvoker(targetType, internalType0); @@ -146,7 +143,7 @@ class FromGeneric { if (fixArgs == null) throw new InternalError("bad fixArgs"); // reinterpret the calling sequence as raw: - MethodHandle retyper = AdapterMethodHandle.makeRawRetypeOnly(Access.TOKEN, + MethodHandle retyper = AdapterMethodHandle.makeRetypeRaw(Access.TOKEN, Invokers.invokerType(internalType), fixArgs); if (retyper == null) throw new InternalError("bad retyper"); @@ -226,7 +223,10 @@ class FromGeneric { // Produce an instance configured as a prototype. return ctor.newInstance(entryPoint); } catch (IllegalArgumentException ex) { - } catch (InvocationTargetException ex) { + } catch (InvocationTargetException wex) { + Throwable ex = wex.getTargetException(); + if (ex instanceof Error) throw (Error)ex; + if (ex instanceof RuntimeException) throw (RuntimeException)ex; } catch (InstantiationException ex) { } catch (IllegalAccessException ex) { } @@ -260,6 +260,11 @@ class FromGeneric { protected final MethodHandle convert; // raw(R) => Object protected final MethodHandle target; // (any**N) => R + @Override + public String toString() { + return target.toString(); + } + protected boolean isPrototype() { return target == null; } protected Adapter(MethodHandle entryPoint) { this(entryPoint, null, entryPoint, null); @@ -284,11 +289,11 @@ class FromGeneric { // { return new ThisType(entryPoint, convert, target); } /// Conversions on the value returned from the target. - protected Object convert_L(Object result) { return convert.invoke(result); } - protected Object convert_I(int result) { return convert.invoke(result); } - protected Object convert_J(long result) { return convert.invoke(result); } - protected Object convert_F(float result) { return convert.invoke(result); } - protected Object convert_D(double result) { return convert.invoke(result); } + protected Object convert_L(Object result) throws Throwable { return convert.invoke(result); } + protected Object convert_I(int result) throws Throwable { return convert.invoke(result); } + protected Object convert_J(long result) throws Throwable { return convert.invoke(result); } + protected Object convert_F(float result) throws Throwable { return convert.invoke(result); } + protected Object convert_D(double result) throws Throwable { return convert.invoke(result); } static private final String CLASS_PREFIX; // "sun.dyn.FromGeneric$" static { @@ -317,11 +322,11 @@ class FromGeneric { { super(e, i, c, t); } protected xA2 makeInstance(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t) { return new xA2(e, i, c, t); } - protected Object invoke_L2(Object a0, Object a1) { return convert_L(invoker.invoke(target, a0, a1)); } - protected Object invoke_I2(Object a0, Object a1) { return convert_I(invoker.invoke(target, a0, a1)); } - protected Object invoke_J2(Object a0, Object a1) { return convert_J(invoker.invoke(target, a0, a1)); } - protected Object invoke_F2(Object a0, Object a1) { return convert_F(invoker.invoke(target, a0, a1)); } - protected Object invoke_D2(Object a0, Object a1) { return convert_D(invoker.invoke(target, a0, a1)); } + protected Object invoke_L2(Object a0, Object a1) throws Throwable { return convert_L(invoker.invoke(target, a0, a1)); } + protected Object invoke_I2(Object a0, Object a1) throws Throwable { return convert_I(invoker.invoke(target, a0, a1)); } + protected Object invoke_J2(Object a0, Object a1) throws Throwable { return convert_J(invoker.invoke(target, a0, a1)); } + protected Object invoke_F2(Object a0, Object a1) throws Throwable { return convert_F(invoker.invoke(target, a0, a1)); } + protected Object invoke_D2(Object a0, Object a1) throws Throwable { return convert_D(invoker.invoke(target, a0, a1)); } } // */ @@ -342,7 +347,7 @@ class genclasses { " protected @cat@ makeInstance(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t)", " { return new @cat@(e, i, c, t); }", " //@each-R@", - " protected Object invoke_@catN@(@Tvav@) { return convert_@Rc@(invoker.<@R@>invoke(target@av@)); }", + " protected Object invoke_@catN@(@Tvav@) throws Throwable { return convert_@Rc@(invoker.<@R@>invoke(target@av@)); }", " //@end-R@", " }", } }; @@ -498,11 +503,11 @@ class genclasses { { super(e, i, c, t); } protected A0 makeInstance(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t) { return new A0(e, i, c, t); } - protected Object invoke_L0() { return convert_L(invoker.invoke(target)); } - protected Object invoke_I0() { return convert_I(invoker.invoke(target)); } - protected Object invoke_J0() { return convert_J(invoker.invoke(target)); } - protected Object invoke_F0() { return convert_F(invoker.invoke(target)); } - protected Object invoke_D0() { return convert_D(invoker.invoke(target)); } + protected Object invoke_L0() throws Throwable { return convert_L(invoker.invoke(target)); } + protected Object invoke_I0() throws Throwable { return convert_I(invoker.invoke(target)); } + protected Object invoke_J0() throws Throwable { return convert_J(invoker.invoke(target)); } + protected Object invoke_F0() throws Throwable { return convert_F(invoker.invoke(target)); } + protected Object invoke_D0() throws Throwable { return convert_D(invoker.invoke(target)); } } static class A1 extends Adapter { protected A1(MethodHandle entryPoint) { super(entryPoint); } // to build prototype @@ -510,11 +515,11 @@ class genclasses { { super(e, i, c, t); } protected A1 makeInstance(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t) { return new A1(e, i, c, t); } - protected Object invoke_L1(Object a0) { return convert_L(invoker.invoke(target, a0)); } - protected Object invoke_I1(Object a0) { return convert_I(invoker.invoke(target, a0)); } - protected Object invoke_J1(Object a0) { return convert_J(invoker.invoke(target, a0)); } - protected Object invoke_F1(Object a0) { return convert_F(invoker.invoke(target, a0)); } - protected Object invoke_D1(Object a0) { return convert_D(invoker.invoke(target, a0)); } + protected Object invoke_L1(Object a0) throws Throwable { return convert_L(invoker.invoke(target, a0)); } + protected Object invoke_I1(Object a0) throws Throwable { return convert_I(invoker.invoke(target, a0)); } + protected Object invoke_J1(Object a0) throws Throwable { return convert_J(invoker.invoke(target, a0)); } + protected Object invoke_F1(Object a0) throws Throwable { return convert_F(invoker.invoke(target, a0)); } + protected Object invoke_D1(Object a0) throws Throwable { return convert_D(invoker.invoke(target, a0)); } } static class A2 extends Adapter { protected A2(MethodHandle entryPoint) { super(entryPoint); } // to build prototype @@ -522,11 +527,11 @@ class genclasses { { super(e, i, c, t); } protected A2 makeInstance(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t) { return new A2(e, i, c, t); } - protected Object invoke_L2(Object a0, Object a1) { return convert_L(invoker.invoke(target, a0, a1)); } - protected Object invoke_I2(Object a0, Object a1) { return convert_I(invoker.invoke(target, a0, a1)); } - protected Object invoke_J2(Object a0, Object a1) { return convert_J(invoker.invoke(target, a0, a1)); } - protected Object invoke_F2(Object a0, Object a1) { return convert_F(invoker.invoke(target, a0, a1)); } - protected Object invoke_D2(Object a0, Object a1) { return convert_D(invoker.invoke(target, a0, a1)); } + protected Object invoke_L2(Object a0, Object a1) throws Throwable { return convert_L(invoker.invoke(target, a0, a1)); } + protected Object invoke_I2(Object a0, Object a1) throws Throwable { return convert_I(invoker.invoke(target, a0, a1)); } + protected Object invoke_J2(Object a0, Object a1) throws Throwable { return convert_J(invoker.invoke(target, a0, a1)); } + protected Object invoke_F2(Object a0, Object a1) throws Throwable { return convert_F(invoker.invoke(target, a0, a1)); } + protected Object invoke_D2(Object a0, Object a1) throws Throwable { return convert_D(invoker.invoke(target, a0, a1)); } } static class A3 extends Adapter { protected A3(MethodHandle entryPoint) { super(entryPoint); } // to build prototype @@ -534,11 +539,11 @@ class genclasses { { super(e, i, c, t); } protected A3 makeInstance(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t) { return new A3(e, i, c, t); } - protected Object invoke_L3(Object a0, Object a1, Object a2) { return convert_L(invoker.invoke(target, a0, a1, a2)); } - protected Object invoke_I3(Object a0, Object a1, Object a2) { return convert_I(invoker.invoke(target, a0, a1, a2)); } - protected Object invoke_J3(Object a0, Object a1, Object a2) { return convert_J(invoker.invoke(target, a0, a1, a2)); } - protected Object invoke_F3(Object a0, Object a1, Object a2) { return convert_F(invoker.invoke(target, a0, a1, a2)); } - protected Object invoke_D3(Object a0, Object a1, Object a2) { return convert_D(invoker.invoke(target, a0, a1, a2)); } + protected Object invoke_L3(Object a0, Object a1, Object a2) throws Throwable { return convert_L(invoker.invoke(target, a0, a1, a2)); } + protected Object invoke_I3(Object a0, Object a1, Object a2) throws Throwable { return convert_I(invoker.invoke(target, a0, a1, a2)); } + protected Object invoke_J3(Object a0, Object a1, Object a2) throws Throwable { return convert_J(invoker.invoke(target, a0, a1, a2)); } + protected Object invoke_F3(Object a0, Object a1, Object a2) throws Throwable { return convert_F(invoker.invoke(target, a0, a1, a2)); } + protected Object invoke_D3(Object a0, Object a1, Object a2) throws Throwable { return convert_D(invoker.invoke(target, a0, a1, a2)); } } static class A4 extends Adapter { protected A4(MethodHandle entryPoint) { super(entryPoint); } // to build prototype @@ -546,11 +551,11 @@ class genclasses { { super(e, i, c, t); } protected A4 makeInstance(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t) { return new A4(e, i, c, t); } - protected Object invoke_L4(Object a0, Object a1, Object a2, Object a3) { return convert_L(invoker.invoke(target, a0, a1, a2, a3)); } - protected Object invoke_I4(Object a0, Object a1, Object a2, Object a3) { return convert_I(invoker.invoke(target, a0, a1, a2, a3)); } - protected Object invoke_J4(Object a0, Object a1, Object a2, Object a3) { return convert_J(invoker.invoke(target, a0, a1, a2, a3)); } - protected Object invoke_F4(Object a0, Object a1, Object a2, Object a3) { return convert_F(invoker.invoke(target, a0, a1, a2, a3)); } - protected Object invoke_D4(Object a0, Object a1, Object a2, Object a3) { return convert_D(invoker.invoke(target, a0, a1, a2, a3)); } + protected Object invoke_L4(Object a0, Object a1, Object a2, Object a3) throws Throwable { return convert_L(invoker.invoke(target, a0, a1, a2, a3)); } + protected Object invoke_I4(Object a0, Object a1, Object a2, Object a3) throws Throwable { return convert_I(invoker.invoke(target, a0, a1, a2, a3)); } + protected Object invoke_J4(Object a0, Object a1, Object a2, Object a3) throws Throwable { return convert_J(invoker.invoke(target, a0, a1, a2, a3)); } + protected Object invoke_F4(Object a0, Object a1, Object a2, Object a3) throws Throwable { return convert_F(invoker.invoke(target, a0, a1, a2, a3)); } + protected Object invoke_D4(Object a0, Object a1, Object a2, Object a3) throws Throwable { return convert_D(invoker.invoke(target, a0, a1, a2, a3)); } } static class A5 extends Adapter { protected A5(MethodHandle entryPoint) { super(entryPoint); } // to build prototype @@ -558,11 +563,11 @@ class genclasses { { super(e, i, c, t); } protected A5 makeInstance(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t) { return new A5(e, i, c, t); } - protected Object invoke_L5(Object a0, Object a1, Object a2, Object a3, Object a4) { return convert_L(invoker.invoke(target, a0, a1, a2, a3, a4)); } - protected Object invoke_I5(Object a0, Object a1, Object a2, Object a3, Object a4) { return convert_I(invoker.invoke(target, a0, a1, a2, a3, a4)); } - protected Object invoke_J5(Object a0, Object a1, Object a2, Object a3, Object a4) { return convert_J(invoker.invoke(target, a0, a1, a2, a3, a4)); } - protected Object invoke_F5(Object a0, Object a1, Object a2, Object a3, Object a4) { return convert_F(invoker.invoke(target, a0, a1, a2, a3, a4)); } - protected Object invoke_D5(Object a0, Object a1, Object a2, Object a3, Object a4) { return convert_D(invoker.invoke(target, a0, a1, a2, a3, a4)); } + protected Object invoke_L5(Object a0, Object a1, Object a2, Object a3, Object a4) throws Throwable { return convert_L(invoker.invoke(target, a0, a1, a2, a3, a4)); } + protected Object invoke_I5(Object a0, Object a1, Object a2, Object a3, Object a4) throws Throwable { return convert_I(invoker.invoke(target, a0, a1, a2, a3, a4)); } + protected Object invoke_J5(Object a0, Object a1, Object a2, Object a3, Object a4) throws Throwable { return convert_J(invoker.invoke(target, a0, a1, a2, a3, a4)); } + protected Object invoke_F5(Object a0, Object a1, Object a2, Object a3, Object a4) throws Throwable { return convert_F(invoker.invoke(target, a0, a1, a2, a3, a4)); } + protected Object invoke_D5(Object a0, Object a1, Object a2, Object a3, Object a4) throws Throwable { return convert_D(invoker.invoke(target, a0, a1, a2, a3, a4)); } } static class A6 extends Adapter { protected A6(MethodHandle entryPoint) { super(entryPoint); } // to build prototype @@ -570,11 +575,11 @@ class genclasses { { super(e, i, c, t); } protected A6 makeInstance(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t) { return new A6(e, i, c, t); } - protected Object invoke_L6(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5) { return convert_L(invoker.invoke(target, a0, a1, a2, a3, a4, a5)); } - protected Object invoke_I6(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5) { return convert_I(invoker.invoke(target, a0, a1, a2, a3, a4, a5)); } - protected Object invoke_J6(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5) { return convert_J(invoker.invoke(target, a0, a1, a2, a3, a4, a5)); } - protected Object invoke_F6(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5) { return convert_F(invoker.invoke(target, a0, a1, a2, a3, a4, a5)); } - protected Object invoke_D6(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5) { return convert_D(invoker.invoke(target, a0, a1, a2, a3, a4, a5)); } + protected Object invoke_L6(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5) throws Throwable { return convert_L(invoker.invoke(target, a0, a1, a2, a3, a4, a5)); } + protected Object invoke_I6(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5) throws Throwable { return convert_I(invoker.invoke(target, a0, a1, a2, a3, a4, a5)); } + protected Object invoke_J6(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5) throws Throwable { return convert_J(invoker.invoke(target, a0, a1, a2, a3, a4, a5)); } + protected Object invoke_F6(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5) throws Throwable { return convert_F(invoker.invoke(target, a0, a1, a2, a3, a4, a5)); } + protected Object invoke_D6(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5) throws Throwable { return convert_D(invoker.invoke(target, a0, a1, a2, a3, a4, a5)); } } static class A7 extends Adapter { protected A7(MethodHandle entryPoint) { super(entryPoint); } // to build prototype @@ -582,11 +587,11 @@ class genclasses { { super(e, i, c, t); } protected A7 makeInstance(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t) { return new A7(e, i, c, t); } - protected Object invoke_L7(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6) { return convert_L(invoker.invoke(target, a0, a1, a2, a3, a4, a5, a6)); } - protected Object invoke_I7(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6) { return convert_I(invoker.invoke(target, a0, a1, a2, a3, a4, a5, a6)); } - protected Object invoke_J7(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6) { return convert_J(invoker.invoke(target, a0, a1, a2, a3, a4, a5, a6)); } - protected Object invoke_F7(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6) { return convert_F(invoker.invoke(target, a0, a1, a2, a3, a4, a5, a6)); } - protected Object invoke_D7(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6) { return convert_D(invoker.invoke(target, a0, a1, a2, a3, a4, a5, a6)); } + protected Object invoke_L7(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6) throws Throwable { return convert_L(invoker.invoke(target, a0, a1, a2, a3, a4, a5, a6)); } + protected Object invoke_I7(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6) throws Throwable { return convert_I(invoker.invoke(target, a0, a1, a2, a3, a4, a5, a6)); } + protected Object invoke_J7(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6) throws Throwable { return convert_J(invoker.invoke(target, a0, a1, a2, a3, a4, a5, a6)); } + protected Object invoke_F7(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6) throws Throwable { return convert_F(invoker.invoke(target, a0, a1, a2, a3, a4, a5, a6)); } + protected Object invoke_D7(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6) throws Throwable { return convert_D(invoker.invoke(target, a0, a1, a2, a3, a4, a5, a6)); } } static class A8 extends Adapter { protected A8(MethodHandle entryPoint) { super(entryPoint); } // to build prototype @@ -594,11 +599,11 @@ class genclasses { { super(e, i, c, t); } protected A8 makeInstance(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t) { return new A8(e, i, c, t); } - protected Object invoke_L8(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7) { return convert_L(invoker.invoke(target, a0, a1, a2, a3, a4, a5, a6, a7)); } - protected Object invoke_I8(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7) { return convert_I(invoker.invoke(target, a0, a1, a2, a3, a4, a5, a6, a7)); } - protected Object invoke_J8(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7) { return convert_J(invoker.invoke(target, a0, a1, a2, a3, a4, a5, a6, a7)); } - protected Object invoke_F8(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7) { return convert_F(invoker.invoke(target, a0, a1, a2, a3, a4, a5, a6, a7)); } - protected Object invoke_D8(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7) { return convert_D(invoker.invoke(target, a0, a1, a2, a3, a4, a5, a6, a7)); } + protected Object invoke_L8(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7) throws Throwable { return convert_L(invoker.invoke(target, a0, a1, a2, a3, a4, a5, a6, a7)); } + protected Object invoke_I8(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7) throws Throwable { return convert_I(invoker.invoke(target, a0, a1, a2, a3, a4, a5, a6, a7)); } + protected Object invoke_J8(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7) throws Throwable { return convert_J(invoker.invoke(target, a0, a1, a2, a3, a4, a5, a6, a7)); } + protected Object invoke_F8(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7) throws Throwable { return convert_F(invoker.invoke(target, a0, a1, a2, a3, a4, a5, a6, a7)); } + protected Object invoke_D8(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7) throws Throwable { return convert_D(invoker.invoke(target, a0, a1, a2, a3, a4, a5, a6, a7)); } } static class A9 extends Adapter { protected A9(MethodHandle entryPoint) { super(entryPoint); } // to build prototype @@ -606,11 +611,11 @@ class genclasses { { super(e, i, c, t); } protected A9 makeInstance(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t) { return new A9(e, i, c, t); } - protected Object invoke_L9(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8) { return convert_L(invoker.invoke(target, a0, a1, a2, a3, a4, a5, a6, a7, a8)); } - protected Object invoke_I9(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8) { return convert_I(invoker.invoke(target, a0, a1, a2, a3, a4, a5, a6, a7, a8)); } - protected Object invoke_J9(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8) { return convert_J(invoker.invoke(target, a0, a1, a2, a3, a4, a5, a6, a7, a8)); } - protected Object invoke_F9(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8) { return convert_F(invoker.invoke(target, a0, a1, a2, a3, a4, a5, a6, a7, a8)); } - protected Object invoke_D9(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8) { return convert_D(invoker.invoke(target, a0, a1, a2, a3, a4, a5, a6, a7, a8)); } + protected Object invoke_L9(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8) throws Throwable { return convert_L(invoker.invoke(target, a0, a1, a2, a3, a4, a5, a6, a7, a8)); } + protected Object invoke_I9(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8) throws Throwable { return convert_I(invoker.invoke(target, a0, a1, a2, a3, a4, a5, a6, a7, a8)); } + protected Object invoke_J9(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8) throws Throwable { return convert_J(invoker.invoke(target, a0, a1, a2, a3, a4, a5, a6, a7, a8)); } + protected Object invoke_F9(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8) throws Throwable { return convert_F(invoker.invoke(target, a0, a1, a2, a3, a4, a5, a6, a7, a8)); } + protected Object invoke_D9(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8) throws Throwable { return convert_D(invoker.invoke(target, a0, a1, a2, a3, a4, a5, a6, a7, a8)); } } static class A10 extends Adapter { protected A10(MethodHandle entryPoint) { super(entryPoint); } // to build prototype @@ -618,10 +623,10 @@ class genclasses { { super(e, i, c, t); } protected A10 makeInstance(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t) { return new A10(e, i, c, t); } - protected Object invoke_L10(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8, Object a9) { return convert_L(invoker.invoke(target, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); } - protected Object invoke_I10(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8, Object a9) { return convert_I(invoker.invoke(target, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); } - protected Object invoke_J10(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8, Object a9) { return convert_J(invoker.invoke(target, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); } - protected Object invoke_F10(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8, Object a9) { return convert_F(invoker.invoke(target, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); } - protected Object invoke_D10(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8, Object a9) { return convert_D(invoker.invoke(target, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); } + protected Object invoke_L10(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8, Object a9) throws Throwable { return convert_L(invoker.invoke(target, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); } + protected Object invoke_I10(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8, Object a9) throws Throwable { return convert_I(invoker.invoke(target, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); } + protected Object invoke_J10(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8, Object a9) throws Throwable { return convert_J(invoker.invoke(target, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); } + protected Object invoke_F10(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8, Object a9) throws Throwable { return convert_F(invoker.invoke(target, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); } + protected Object invoke_D10(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8, Object a9) throws Throwable { return convert_D(invoker.invoke(target, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); } } } diff --git a/src/share/classes/sun/dyn/Invokers.java b/src/share/classes/sun/dyn/Invokers.java index eddd437a5d54a30179ac31267db271949346f827..c1565852e4cf521d59d235bcc3246732921a0da2 100644 --- a/src/share/classes/sun/dyn/Invokers.java +++ b/src/share/classes/sun/dyn/Invokers.java @@ -44,16 +44,20 @@ public class Invokers { // generic (untyped) invoker for the outgoing call private /*lazy*/ MethodHandle genericInvoker; + // generic (untyped) invoker for the outgoing call; accepts a single Object[] + private final /*lazy*/ MethodHandle[] varargsInvokers; + /** Compute and cache information common to all collecting adapters * that implement members of the erasure-family of the given erased type. */ public Invokers(Access token, MethodType targetType) { Access.check(token); this.targetType = targetType; + this.varargsInvokers = new MethodHandle[targetType.parameterCount()+1]; } public static MethodType invokerType(MethodType targetType) { - return targetType.insertParameterType(0, MethodHandle.class); + return targetType.insertParameterTypes(0, MethodHandle.class); } public MethodHandle exactInvoker() { @@ -76,8 +80,14 @@ public class Invokers { return invoker; } - public MethodHandle varargsInvoker() { - throw new UnsupportedOperationException("NYI"); + public MethodHandle varargsInvoker(int objectArgCount) { + MethodHandle vaInvoker = varargsInvokers[objectArgCount]; + if (vaInvoker != null) return vaInvoker; + MethodHandle gInvoker = genericInvoker(); + MethodType vaType = MethodType.genericMethodType(objectArgCount, true); + vaInvoker = MethodHandles.spreadArguments(gInvoker, invokerType(vaType)); + varargsInvokers[objectArgCount] = vaInvoker; + return vaInvoker; } public String toString() { diff --git a/src/share/classes/sun/dyn/MemberName.java b/src/share/classes/sun/dyn/MemberName.java index 26919efa8c5bdccda63a548e031bbb31f2875ea0..01af94b516661acd54101fe505f8602001cdaf00 100644 --- a/src/share/classes/sun/dyn/MemberName.java +++ b/src/share/classes/sun/dyn/MemberName.java @@ -25,7 +25,7 @@ package sun.dyn; -import sun.dyn.util.BytecodeSignature; +import sun.dyn.util.BytecodeDescriptor; import java.dyn.*; import java.lang.reflect.Constructor; import java.lang.reflect.Field; @@ -33,6 +33,7 @@ import java.lang.reflect.Method; import java.lang.reflect.Member; import java.lang.reflect.Modifier; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collections; import java.util.Iterator; import java.util.List; @@ -93,7 +94,7 @@ public final class MemberName implements Member, Cloneable { } if (type instanceof String) { String sig = (String) type; - MethodType res = MethodType.fromBytecodeString(sig, getClassLoader()); + MethodType res = MethodType.fromMethodDescriptorString(sig, getClassLoader()); this.type = res; return res; } @@ -101,7 +102,7 @@ public final class MemberName implements Member, Cloneable { Object[] typeInfo = (Object[]) type; Class[] ptypes = (Class[]) typeInfo[1]; Class rtype = (Class) typeInfo[0]; - MethodType res = MethodType.make(rtype, ptypes); + MethodType res = MethodType.methodType(rtype, ptypes); this.type = res; return res; } @@ -111,7 +112,7 @@ public final class MemberName implements Member, Cloneable { public MethodType getInvocationType() { MethodType itype = getMethodType(); if (!isStatic()) - itype = itype.insertParameterType(0, clazz); + itype = itype.insertParameterTypes(0, clazz); return itype; } @@ -135,7 +136,7 @@ public final class MemberName implements Member, Cloneable { } if (type instanceof String) { String sig = (String) type; - MethodType mtype = MethodType.fromBytecodeString("()"+sig, getClassLoader()); + MethodType mtype = MethodType.fromMethodDescriptorString("()"+sig, getClassLoader()); Class res = mtype.returnType(); this.type = res; return res; @@ -155,9 +156,9 @@ public final class MemberName implements Member, Cloneable { if (type instanceof String) return (String) type; if (isInvocable()) - return BytecodeSignature.unparse(getMethodType()); + return BytecodeDescriptor.unparse(getMethodType()); else - return BytecodeSignature.unparse(getFieldType()); + return BytecodeDescriptor.unparse(getFieldType()); } public int getModifiers() { @@ -353,6 +354,8 @@ public final class MemberName implements Member, Cloneable { return type.toString(); // class java.lang.String // else it is a field, method, or constructor StringBuilder buf = new StringBuilder(); + if (!isResolved()) + buf.append("*."); if (getDeclaringClass() != null) { buf.append(getName(clazz)); buf.append('.'); @@ -381,7 +384,7 @@ public final class MemberName implements Member, Cloneable { private static String getName(Object obj) { if (obj instanceof Class) return ((Class)obj).getName(); - return obj.toString(); + return String.valueOf(obj); } // Queries to the JVM: @@ -408,6 +411,9 @@ public final class MemberName implements Member, Cloneable { public static NoAccessException newNoAccessException(MemberName name, Class lookupClass) { return newNoAccessException("cannot access", name, lookupClass); } + public static NoAccessException newNoAccessException(MemberName name, MethodHandles.Lookup lookup) { + return newNoAccessException(name, lookup.lookupClass()); + } public static NoAccessException newNoAccessException(String message, MemberName name, Class lookupClass) { message += ": " + name; @@ -436,7 +442,7 @@ public final class MemberName implements Member, Cloneable { matchFlags &= ALLOWED_FLAGS; String matchSig = null; if (matchType != null) { - matchSig = BytecodeSignature.unparse(matchType); + matchSig = BytecodeDescriptor.unparse(matchType); if (matchSig.startsWith("(")) matchFlags &= ~(ALL_KINDS & ~IS_INVOCABLE); else @@ -447,17 +453,18 @@ public final class MemberName implements Member, Cloneable { MemberName[] buf = newMemberBuffer(len1); int totalCount = 0; ArrayList bufs = null; + int bufCount = 0; for (;;) { - int bufCount = MethodHandleNatives.getMembers(defc, + bufCount = MethodHandleNatives.getMembers(defc, matchName, matchSig, matchFlags, lookupClass, totalCount, buf); if (bufCount <= buf.length) { - if (bufCount >= 0) - totalCount += bufCount; + if (bufCount < 0) bufCount = 0; + totalCount += bufCount; break; } - // JVM returned tp us with an intentional overflow! + // JVM returned to us with an intentional overflow! totalCount += buf.length; int excess = bufCount - buf.length; if (bufs == null) bufs = new ArrayList(1); @@ -473,7 +480,7 @@ public final class MemberName implements Member, Cloneable { Collections.addAll(result, buf0); } } - Collections.addAll(result, buf); + result.addAll(Arrays.asList(buf).subList(0, bufCount)); // Signature matching is not the same as type matching, since // one signature might correspond to several types. // So if matchType is a Class or MethodType, refilter the results. diff --git a/src/share/classes/sun/dyn/MethodHandleImpl.java b/src/share/classes/sun/dyn/MethodHandleImpl.java index 2dd59deeff092722709130ac843e7b64a40dace8..f8a8bca38d7f7ebf3f0c26b269c7a5a15dd77f6d 100644 --- a/src/share/classes/sun/dyn/MethodHandleImpl.java +++ b/src/share/classes/sun/dyn/MethodHandleImpl.java @@ -25,12 +25,25 @@ package sun.dyn; +import java.dyn.JavaMethodHandle; import java.dyn.MethodHandle; import java.dyn.MethodHandles; import java.dyn.MethodHandles.Lookup; import java.dyn.MethodType; +import java.util.logging.Level; +import java.util.logging.Logger; import sun.dyn.util.VerifyType; import java.dyn.NoAccessException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import sun.dyn.empty.Empty; +import sun.dyn.util.ValueConversions; +import sun.dyn.util.Wrapper; +import sun.misc.Unsafe; import static sun.dyn.MemberName.newIllegalArgumentException; import static sun.dyn.MemberName.newNoAccessException; @@ -57,6 +70,25 @@ public abstract class MethodHandleImpl { static final int INT_FIELD = 0; static final long LONG_FIELD = 0; + /** Access methods for the internals of MethodHandle, supplied to + * MethodHandleImpl as a trusted agent. + */ + static public interface MethodHandleFriend { + void initType(MethodHandle mh, MethodType type); + } + public static void setMethodHandleFriend(Access token, MethodHandleFriend am) { + Access.check(token); + if (METHOD_HANDLE_FRIEND != null) + throw new InternalError(); // just once + METHOD_HANDLE_FRIEND = am; + } + static private MethodHandleFriend METHOD_HANDLE_FRIEND; + + // NOT public + static void initType(MethodHandle mh, MethodType type) { + METHOD_HANDLE_FRIEND.initType(mh, type); + } + // type is defined in java.dyn.MethodHandle, which is platform-independent // vmentry (a void* field) is used *only* by by the JVM. @@ -106,8 +138,8 @@ public abstract class MethodHandleImpl { } static { - // Force initialization: - Lookup.PUBLIC_LOOKUP.lookupClass(); + // Force initialization of Lookup, so it calls us back as initLookup: + MethodHandles.publicLookup(); if (IMPL_LOOKUP_INIT == null) throw new InternalError(); } @@ -151,7 +183,7 @@ public abstract class MethodHandleImpl { // adjust the advertised receiver type to be exactly the one requested // (in the case of invokespecial, this will be the calling class) Class recvType = method.getDeclaringClass(); - mtype = mtype.insertParameterType(0, recvType); + mtype = mtype.insertParameterTypes(0, recvType); if (method.isConstructor()) doDispatch = true; // FIXME: JVM has trouble building MH.invoke sites for @@ -170,21 +202,223 @@ public abstract class MethodHandleImpl { public static MethodHandle accessField(Access token, - MemberName member, boolean isSetter, - Class lookupClass) { + MemberName member, boolean isSetter, + Class lookupClass) { Access.check(token); - // FIXME: Use sun.misc.Unsafe to dig up the dirt on the field. - throw new UnsupportedOperationException("Not yet implemented"); + // Use sun. misc.Unsafe to dig up the dirt on the field. + MethodHandle mh = new FieldAccessor(token, member, isSetter); + return mh; } public static MethodHandle accessArrayElement(Access token, - Class arrayClass, boolean isSetter) { + Class arrayClass, boolean isSetter) { Access.check(token); if (!arrayClass.isArray()) throw newIllegalArgumentException("not an array: "+arrayClass); - // FIXME: Use sun.misc.Unsafe to dig up the dirt on the array. - throw new UnsupportedOperationException("Not yet implemented"); + Class elemClass = arrayClass.getComponentType(); + MethodHandle[] mhs = FieldAccessor.ARRAY_CACHE.get(elemClass); + if (mhs == null) { + if (!FieldAccessor.doCache(elemClass)) + return FieldAccessor.ahandle(arrayClass, isSetter); + mhs = new MethodHandle[] { + FieldAccessor.ahandle(arrayClass, false), + FieldAccessor.ahandle(arrayClass, true) + }; + if (mhs[0].type().parameterType(0) == Class.class) { + mhs[0] = MethodHandles.insertArguments(mhs[0], 0, elemClass); + mhs[1] = MethodHandles.insertArguments(mhs[1], 0, elemClass); + } + synchronized (FieldAccessor.ARRAY_CACHE) {} // memory barrier + FieldAccessor.ARRAY_CACHE.put(elemClass, mhs); + } + return mhs[isSetter ? 1 : 0]; + } + + static final class FieldAccessor extends JavaMethodHandle { + private static final Unsafe unsafe = Unsafe.getUnsafe(); + final Object base; // for static refs only + final long offset; + final String name; + + public FieldAccessor(Access token, MemberName field, boolean isSetter) { + super(fhandle(field.getDeclaringClass(), field.getFieldType(), isSetter, field.isStatic())); + this.offset = (long) field.getVMIndex(token); + this.name = field.getName(); + this.base = staticBase(field); + } + public String toString() { return name; } + + int getFieldI(C obj) { return unsafe.getInt(obj, offset); } + void setFieldI(C obj, int x) { unsafe.putInt(obj, offset, x); } + long getFieldJ(C obj) { return unsafe.getLong(obj, offset); } + void setFieldJ(C obj, long x) { unsafe.putLong(obj, offset, x); } + float getFieldF(C obj) { return unsafe.getFloat(obj, offset); } + void setFieldF(C obj, float x) { unsafe.putFloat(obj, offset, x); } + double getFieldD(C obj) { return unsafe.getDouble(obj, offset); } + void setFieldD(C obj, double x) { unsafe.putDouble(obj, offset, x); } + boolean getFieldZ(C obj) { return unsafe.getBoolean(obj, offset); } + void setFieldZ(C obj, boolean x) { unsafe.putBoolean(obj, offset, x); } + byte getFieldB(C obj) { return unsafe.getByte(obj, offset); } + void setFieldB(C obj, byte x) { unsafe.putByte(obj, offset, x); } + short getFieldS(C obj) { return unsafe.getShort(obj, offset); } + void setFieldS(C obj, short x) { unsafe.putShort(obj, offset, x); } + char getFieldC(C obj) { return unsafe.getChar(obj, offset); } + void setFieldC(C obj, char x) { unsafe.putChar(obj, offset, x); } + @SuppressWarnings("unchecked") + V getFieldL(C obj) { return (V) unsafe.getObject(obj, offset); } + @SuppressWarnings("unchecked") + void setFieldL(C obj, V x) { unsafe.putObject(obj, offset, x); } + // cast (V) is OK here, since we wrap convertArguments around the MH. + + static Object staticBase(MemberName field) { + if (!field.isStatic()) return null; + Class c = field.getDeclaringClass(); + java.lang.reflect.Field f; + try { + // FIXME: Should not have to create 'f' to get this value. + f = c.getDeclaredField(field.getName()); + return unsafe.staticFieldBase(f); + } catch (Exception ee) { + Error e = new InternalError(); + e.initCause(ee); + throw e; + } + } + + int getStaticI() { return unsafe.getInt(base, offset); } + void setStaticI(int x) { unsafe.putInt(base, offset, x); } + long getStaticJ() { return unsafe.getLong(base, offset); } + void setStaticJ(long x) { unsafe.putLong(base, offset, x); } + float getStaticF() { return unsafe.getFloat(base, offset); } + void setStaticF(float x) { unsafe.putFloat(base, offset, x); } + double getStaticD() { return unsafe.getDouble(base, offset); } + void setStaticD(double x) { unsafe.putDouble(base, offset, x); } + boolean getStaticZ() { return unsafe.getBoolean(base, offset); } + void setStaticZ(boolean x) { unsafe.putBoolean(base, offset, x); } + byte getStaticB() { return unsafe.getByte(base, offset); } + void setStaticB(byte x) { unsafe.putByte(base, offset, x); } + short getStaticS() { return unsafe.getShort(base, offset); } + void setStaticS(short x) { unsafe.putShort(base, offset, x); } + char getStaticC() { return unsafe.getChar(base, offset); } + void setStaticC(char x) { unsafe.putChar(base, offset, x); } + V getStaticL() { return (V) unsafe.getObject(base, offset); } + void setStaticL(V x) { unsafe.putObject(base, offset, x); } + + static String fname(Class vclass, boolean isSetter, boolean isStatic) { + String stem; + if (!isStatic) + stem = (!isSetter ? "getField" : "setField"); + else + stem = (!isSetter ? "getStatic" : "setStatic"); + return stem + Wrapper.basicTypeChar(vclass); + } + static MethodType ftype(Class cclass, Class vclass, boolean isSetter, boolean isStatic) { + MethodType type; + if (!isStatic) { + if (!isSetter) + return MethodType.methodType(vclass, cclass); + else + return MethodType.methodType(void.class, cclass, vclass); + } else { + if (!isSetter) + return MethodType.methodType(vclass); + else + return MethodType.methodType(void.class, vclass); + } + } + static MethodHandle fhandle(Class cclass, Class vclass, boolean isSetter, boolean isStatic) { + String name = FieldAccessor.fname(vclass, isSetter, isStatic); + if (cclass.isPrimitive()) throw newIllegalArgumentException("primitive "+cclass); + Class ecclass = Object.class; //erase this type + Class evclass = vclass; + if (!evclass.isPrimitive()) evclass = Object.class; + MethodType type = FieldAccessor.ftype(ecclass, evclass, isSetter, isStatic); + MethodHandle mh; + try { + mh = IMPL_LOOKUP.findVirtual(FieldAccessor.class, name, type); + } catch (NoAccessException ee) { + Error e = new InternalError("name,type="+name+type); + e.initCause(ee); + throw e; + } + if (evclass != vclass || (!isStatic && ecclass != cclass)) { + MethodType strongType = FieldAccessor.ftype(cclass, vclass, isSetter, isStatic); + strongType = strongType.insertParameterTypes(0, FieldAccessor.class); + mh = MethodHandles.convertArguments(mh, strongType); + } + return mh; + } + + /// Support for array element access + static final HashMap, MethodHandle[]> ARRAY_CACHE = + new HashMap, MethodHandle[]>(); + // FIXME: Cache on the classes themselves, not here. + static boolean doCache(Class elemClass) { + if (elemClass.isPrimitive()) return true; + ClassLoader cl = elemClass.getClassLoader(); + return cl == null || cl == ClassLoader.getSystemClassLoader(); + } + static int getElementI(int[] a, int i) { return a[i]; } + static void setElementI(int[] a, int i, int x) { a[i] = x; } + static long getElementJ(long[] a, int i) { return a[i]; } + static void setElementJ(long[] a, int i, long x) { a[i] = x; } + static float getElementF(float[] a, int i) { return a[i]; } + static void setElementF(float[] a, int i, float x) { a[i] = x; } + static double getElementD(double[] a, int i) { return a[i]; } + static void setElementD(double[] a, int i, double x) { a[i] = x; } + static boolean getElementZ(boolean[] a, int i) { return a[i]; } + static void setElementZ(boolean[] a, int i, boolean x) { a[i] = x; } + static byte getElementB(byte[] a, int i) { return a[i]; } + static void setElementB(byte[] a, int i, byte x) { a[i] = x; } + static short getElementS(short[] a, int i) { return a[i]; } + static void setElementS(short[] a, int i, short x) { a[i] = x; } + static char getElementC(char[] a, int i) { return a[i]; } + static void setElementC(char[] a, int i, char x) { a[i] = x; } + static Object getElementL(Object[] a, int i) { return a[i]; } + static void setElementL(Object[] a, int i, Object x) { a[i] = x; } + static V getElementL(Class aclass, V[] a, int i) { return aclass.cast(a)[i]; } + static void setElementL(Class aclass, V[] a, int i, V x) { aclass.cast(a)[i] = x; } + + static String aname(Class aclass, boolean isSetter) { + Class vclass = aclass.getComponentType(); + if (vclass == null) throw new IllegalArgumentException(); + return (!isSetter ? "getElement" : "setElement") + Wrapper.basicTypeChar(vclass); + } + static MethodType atype(Class aclass, boolean isSetter) { + Class vclass = aclass.getComponentType(); + if (!isSetter) + return MethodType.methodType(vclass, aclass, int.class); + else + return MethodType.methodType(void.class, aclass, int.class, vclass); + } + static MethodHandle ahandle(Class aclass, boolean isSetter) { + Class vclass = aclass.getComponentType(); + String name = FieldAccessor.aname(aclass, isSetter); + Class caclass = null; + if (!vclass.isPrimitive() && vclass != Object.class) { + caclass = aclass; + aclass = Object[].class; + vclass = Object.class; + } + MethodType type = FieldAccessor.atype(aclass, isSetter); + if (caclass != null) + type = type.insertParameterTypes(0, Class.class); + MethodHandle mh; + try { + mh = IMPL_LOOKUP.findStatic(FieldAccessor.class, name, type); + } catch (NoAccessException ee) { + Error e = new InternalError("name,type="+name+type); + e.initCause(ee); + throw e; + } + if (caclass != null) { + MethodType strongType = FieldAccessor.atype(caclass, isSetter); + mh = MethodHandles.insertArguments(mh, 0, caclass); + mh = MethodHandles.convertArguments(mh, strongType); + } + return mh; + } } /** Bind a predetermined first argument to the given direct method handle. @@ -203,8 +437,11 @@ public abstract class MethodHandleImpl { if (info instanceof DirectMethodHandle) { DirectMethodHandle dmh = (DirectMethodHandle) info; if (receiver == null || - dmh.type().parameterType(0).isAssignableFrom(receiver.getClass())) - target = dmh; + dmh.type().parameterType(0).isAssignableFrom(receiver.getClass())) { + MethodHandle bmh = new BoundMethodHandle(dmh, receiver, 0); + MethodType newType = target.type().dropParameterTypes(0, 1); + return convertArguments(token, bmh, newType, bmh.type(), null); + } } } if (target instanceof DirectMethodHandle) @@ -223,7 +460,7 @@ public abstract class MethodHandleImpl { MethodHandle bindArgument(Access token, MethodHandle target, int argnum, Object receiver) { Access.check(token); - throw new UnsupportedOperationException("NYI"); + return new BoundMethodHandle(target, receiver, argnum); } public static MethodHandle convertArguments(Access token, @@ -232,6 +469,189 @@ public abstract class MethodHandleImpl { MethodType oldType, int[] permutationOrNull) { Access.check(token); + if (permutationOrNull != null) { + int outargs = oldType.parameterCount(), inargs = newType.parameterCount(); + if (permutationOrNull.length != outargs) + throw newIllegalArgumentException("wrong number of arguments in permutation"); + // Make the individual outgoing argument types match up first. + Class[] callTypeArgs = new Class[outargs]; + for (int i = 0; i < outargs; i++) + callTypeArgs[i] = newType.parameterType(permutationOrNull[i]); + MethodType callType = MethodType.methodType(oldType.returnType(), callTypeArgs); + target = convertArguments(token, target, callType, oldType, null); + assert(target != null); + oldType = target.type(); + List goal = new ArrayList(); // i*TOKEN + List state = new ArrayList(); // i*TOKEN + List drops = new ArrayList(); // not tokens + List dups = new ArrayList(); // not tokens + final int TOKEN = 10; // to mark items which are symbolic only + // state represents the argument values coming into target + for (int i = 0; i < outargs; i++) { + state.add(permutationOrNull[i] * TOKEN); + } + // goal represents the desired state + for (int i = 0; i < inargs; i++) { + if (state.contains(i * TOKEN)) { + goal.add(i * TOKEN); + } else { + // adapter must initially drop all unused arguments + drops.add(i); + } + } + // detect duplications + while (state.size() > goal.size()) { + for (int i2 = 0; i2 < state.size(); i2++) { + int arg1 = state.get(i2); + int i1 = state.indexOf(arg1); + if (i1 != i2) { + // found duplicate occurrence at i2 + int arg2 = (inargs++) * TOKEN; + state.set(i2, arg2); + dups.add(goal.indexOf(arg1)); + goal.add(arg2); + } + } + } + assert(state.size() == goal.size()); + int size = goal.size(); + while (!state.equals(goal)) { + // Look for a maximal sequence of adjacent misplaced arguments, + // and try to rotate them into place. + int bestRotArg = -10 * TOKEN, bestRotLen = 0; + int thisRotArg = -10 * TOKEN, thisRotLen = 0; + for (int i = 0; i < size; i++) { + int arg = state.get(i); + // Does this argument match the current run? + if (arg == thisRotArg + TOKEN) { + thisRotArg = arg; + thisRotLen += 1; + if (bestRotLen < thisRotLen) { + bestRotLen = thisRotLen; + bestRotArg = thisRotArg; + } + } else { + // The old sequence (if any) stops here. + thisRotLen = 0; + thisRotArg = -10 * TOKEN; + // But maybe a new one starts here also. + int wantArg = goal.get(i); + final int MAX_ARG_ROTATION = AdapterMethodHandle.MAX_ARG_ROTATION; + if (arg != wantArg && + arg >= wantArg - TOKEN * MAX_ARG_ROTATION && + arg <= wantArg + TOKEN * MAX_ARG_ROTATION) { + thisRotArg = arg; + thisRotLen = 1; + } + } + } + if (bestRotLen >= 2) { + // Do a rotation if it can improve argument positioning + // by at least 2 arguments. This is not always optimal, + // but it seems to catch common cases. + int dstEnd = state.indexOf(bestRotArg); + int srcEnd = goal.indexOf(bestRotArg); + int rotBy = dstEnd - srcEnd; + int dstBeg = dstEnd - (bestRotLen - 1); + int srcBeg = srcEnd - (bestRotLen - 1); + assert((dstEnd | dstBeg | srcEnd | srcBeg) >= 0); // no negs + // Make a span which covers both source and destination. + int rotBeg = Math.min(dstBeg, srcBeg); + int rotEnd = Math.max(dstEnd, srcEnd); + int score = 0; + for (int i = rotBeg; i <= rotEnd; i++) { + if ((int)state.get(i) != (int)goal.get(i)) + score += 1; + } + List rotSpan = state.subList(rotBeg, rotEnd+1); + Collections.rotate(rotSpan, -rotBy); // reverse direction + for (int i = rotBeg; i <= rotEnd; i++) { + if ((int)state.get(i) != (int)goal.get(i)) + score -= 1; + } + if (score >= 2) { + // Improved at least two argument positions. Do it. + List> ptypes = Arrays.asList(oldType.parameterArray()); + Collections.rotate(ptypes.subList(rotBeg, rotEnd+1), -rotBy); + MethodType rotType = MethodType.methodType(oldType.returnType(), ptypes); + MethodHandle nextTarget + = AdapterMethodHandle.makeRotateArguments(token, rotType, target, + rotBeg, rotSpan.size(), rotBy); + if (nextTarget != null) { + //System.out.println("Rot: "+rotSpan+" by "+rotBy); + target = nextTarget; + oldType = rotType; + continue; + } + } + // Else de-rotate, and drop through to the swap-fest. + Collections.rotate(rotSpan, rotBy); + } + + // Now swap like the wind! + List> ptypes = Arrays.asList(oldType.parameterArray()); + for (int i = 0; i < size; i++) { + // What argument do I want here? + int arg = goal.get(i); + if (arg != state.get(i)) { + // Where is it now? + int j = state.indexOf(arg); + Collections.swap(ptypes, i, j); + MethodType swapType = MethodType.methodType(oldType.returnType(), ptypes); + target = AdapterMethodHandle.makeSwapArguments(token, swapType, target, i, j); + if (target == null) throw newIllegalArgumentException("cannot swap"); + assert(target.type() == swapType); + oldType = swapType; + Collections.swap(state, i, j); + } + } + // One pass of swapping must finish the job. + assert(state.equals(goal)); + } + while (!dups.isEmpty()) { + // Grab a contiguous trailing sequence of dups. + int grab = dups.size() - 1; + int dupArgPos = dups.get(grab), dupArgCount = 1; + while (grab - 1 >= 0) { + int dup0 = dups.get(grab - 1); + if (dup0 != dupArgPos - 1) break; + dupArgPos -= 1; + dupArgCount += 1; + grab -= 1; + } + //if (dupArgCount > 1) System.out.println("Dup: "+dups.subList(grab, dups.size())); + dups.subList(grab, dups.size()).clear(); + // In the new target type drop that many args from the tail: + List> ptypes = oldType.parameterList(); + ptypes = ptypes.subList(0, ptypes.size() - dupArgCount); + MethodType dupType = MethodType.methodType(oldType.returnType(), ptypes); + target = AdapterMethodHandle.makeDupArguments(token, dupType, target, dupArgPos, dupArgCount); + if (target == null) + throw newIllegalArgumentException("cannot dup"); + oldType = target.type(); + } + while (!drops.isEmpty()) { + // Grab a contiguous initial sequence of drops. + int dropArgPos = drops.get(0), dropArgCount = 1; + while (dropArgCount < drops.size()) { + int drop1 = drops.get(dropArgCount); + if (drop1 != dropArgPos + dropArgCount) break; + dropArgCount += 1; + } + //if (dropArgCount > 1) System.out.println("Drop: "+drops.subList(0, dropArgCount)); + drops.subList(0, dropArgCount).clear(); + List> dropTypes = newType.parameterList() + .subList(dropArgPos, dropArgPos + dropArgCount); + MethodType dropType = oldType.insertParameterTypes(dropArgPos, dropTypes); + target = AdapterMethodHandle.makeDropArguments(token, dropType, target, dropArgPos, dropArgCount); + if (target == null) throw newIllegalArgumentException("cannot drop"); + oldType = target.type(); + } + } + if (newType == oldType) + return target; + if (oldType.parameterCount() != newType.parameterCount()) + throw newIllegalArgumentException("mismatched parameter count"); MethodHandle res = AdapterMethodHandle.makePairwiseConvert(token, newType, target); if (res != null) return res; @@ -241,7 +661,7 @@ public abstract class MethodHandleImpl { // Use a heavier method: Convert all the arguments to Object, // then back to the desired types. We might have to use Java-based // method handles to do this. - MethodType objType = MethodType.makeGeneric(argc); + MethodType objType = MethodType.genericMethodType(argc); MethodHandle objTarget = AdapterMethodHandle.makePairwiseConvert(token, objType, target); if (objTarget == null) objTarget = FromGeneric.make(target); @@ -272,83 +692,386 @@ public abstract class MethodHandleImpl { Class[] ptypes = oldType.parameterArray(); for (int i = 0; i < spreadCount; i++) ptypes[spreadArg + i] = VerifyType.spreadArgElementType(spreadType, i); - MethodType midType = MethodType.make(newType.returnType(), ptypes); + MethodType midType = MethodType.methodType(newType.returnType(), ptypes); // after spreading, some arguments may need further conversion - target = convertArguments(token, target, midType, oldType, null); - if (target == null) + MethodHandle target2 = convertArguments(token, target, midType, oldType, null); + if (target2 == null) throw new UnsupportedOperationException("NYI: convert "+midType+" =calls=> "+oldType); - res = AdapterMethodHandle.makeSpreadArguments(token, newType, target, spreadArgType, spreadArg, spreadCount); + res = AdapterMethodHandle.makeSpreadArguments(token, newType, target2, spreadArgType, spreadArg, spreadCount); + if (res != null) + return res; + res = SpreadGeneric.make(target2, spreadCount); + if (res != null) + res = convertArguments(token, res, newType, res.type(), null); return res; } public static MethodHandle collectArguments(Access token, MethodHandle target, MethodType newType, - int collectArg) { - if (collectArg > 0) - throw new UnsupportedOperationException("NYI"); - throw new UnsupportedOperationException("NYI"); + int collectArg, + MethodHandle collector) { + MethodType oldType = target.type(); // (a...,c)=>r + if (collector == null) { + int numCollect = newType.parameterCount() - oldType.parameterCount() + 1; + collector = ValueConversions.varargsArray(numCollect); + } + // newType // (a..., b...)=>r + MethodType colType = collector.type(); // (b...)=>c + // oldType // (a..., b...)=>r + assert(newType.parameterCount() == collectArg + colType.parameterCount()); + assert(oldType.parameterCount() == collectArg + 1); + MethodHandle gtarget = convertArguments(token, target, oldType.generic(), oldType, null); + MethodHandle gcollector = convertArguments(token, collector, colType.generic(), colType, null); + if (gtarget == null || gcollector == null) return null; + MethodHandle gresult = FilterGeneric.makeArgumentCollector(gcollector, gtarget); + MethodHandle result = convertArguments(token, gresult, newType, gresult.type(), null); + return result; } + + public static MethodHandle filterArgument(Access token, + MethodHandle target, + int pos, + MethodHandle filter) { + Access.check(token); + MethodType ttype = target.type(), gttype = ttype.generic(); + if (ttype != gttype) { + target = convertArguments(token, target, gttype, ttype, null); + ttype = gttype; + } + MethodType ftype = filter.type(), gftype = ftype.generic(); + if (ftype.parameterCount() != 1) + throw new InternalError(); + if (ftype != gftype) { + filter = convertArguments(token, filter, gftype, ftype, null); + ftype = gftype; + } + if (ftype == ttype) { + // simple unary case + return FilterOneArgument.make(filter, target); + } + return FilterGeneric.makeArgumentFilter(pos, filter, target); + } + + public static MethodHandle foldArguments(Access token, + MethodHandle target, + MethodType newType, + MethodHandle combiner) { + Access.check(token); + MethodType oldType = target.type(); + MethodType ctype = combiner.type(); + MethodHandle gtarget = convertArguments(token, target, oldType.generic(), oldType, null); + MethodHandle gcombiner = convertArguments(token, combiner, ctype.generic(), ctype, null); + if (gtarget == null || gcombiner == null) return null; + MethodHandle gresult = FilterGeneric.makeArgumentFolder(gcombiner, gtarget); + MethodHandle result = convertArguments(token, gresult, newType, gresult.type(), null); + return result; + } + public static MethodHandle dropArguments(Access token, MethodHandle target, MethodType newType, int argnum) { Access.check(token); + int drops = newType.parameterCount() - target.type().parameterCount(); + MethodHandle res = AdapterMethodHandle.makeDropArguments(token, newType, target, argnum, drops); + if (res != null) + return res; throw new UnsupportedOperationException("NYI"); } + private static class GuardWithTest extends JavaMethodHandle { + private final MethodHandle test, target, fallback; + public GuardWithTest(MethodHandle test, MethodHandle target, MethodHandle fallback) { + this(INVOKES[target.type().parameterCount()], test, target, fallback); + } + public GuardWithTest(MethodHandle invoker, + MethodHandle test, MethodHandle target, MethodHandle fallback) { + super(invoker); + this.test = test; + this.target = target; + this.fallback = fallback; + } + @Override + public String toString() { + return target.toString(); + } + private Object invoke_V(Object... av) throws Throwable { + if (test.invoke(av)) + return target.invoke(av); + return fallback.invoke(av); + } + private Object invoke_L0() throws Throwable { + if (test.invoke()) + return target.invoke(); + return fallback.invoke(); + } + private Object invoke_L1(Object a0) throws Throwable { + if (test.invoke(a0)) + return target.invoke(a0); + return fallback.invoke(a0); + } + private Object invoke_L2(Object a0, Object a1) throws Throwable { + if (test.invoke(a0, a1)) + return target.invoke(a0, a1); + return fallback.invoke(a0, a1); + } + private Object invoke_L3(Object a0, Object a1, Object a2) throws Throwable { + if (test.invoke(a0, a1, a2)) + return target.invoke(a0, a1, a2); + return fallback.invoke(a0, a1, a2); + } + private Object invoke_L4(Object a0, Object a1, Object a2, Object a3) throws Throwable { + if (test.invoke(a0, a1, a2, a3)) + return target.invoke(a0, a1, a2, a3); + return fallback.invoke(a0, a1, a2, a3); + } + private Object invoke_L5(Object a0, Object a1, Object a2, Object a3, Object a4) throws Throwable { + if (test.invoke(a0, a1, a2, a3, a4)) + return target.invoke(a0, a1, a2, a3, a4); + return fallback.invoke(a0, a1, a2, a3, a4); + } + private Object invoke_L6(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5) throws Throwable { + if (test.invoke(a0, a1, a2, a3, a4, a5)) + return target.invoke(a0, a1, a2, a3, a4, a5); + return fallback.invoke(a0, a1, a2, a3, a4, a5); + } + private Object invoke_L7(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6) throws Throwable { + if (test.invoke(a0, a1, a2, a3, a4, a5, a6)) + return target.invoke(a0, a1, a2, a3, a4, a5, a6); + return fallback.invoke(a0, a1, a2, a3, a4, a5, a6); + } + private Object invoke_L8(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7) throws Throwable { + if (test.invoke(a0, a1, a2, a3, a4, a5, a6, a7)) + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7); + return fallback.invoke(a0, a1, a2, a3, a4, a5, a6, a7); + } + static MethodHandle[] makeInvokes() { + ArrayList invokes = new ArrayList(); + MethodHandles.Lookup lookup = IMPL_LOOKUP; + for (;;) { + int nargs = invokes.size(); + String name = "invoke_L"+nargs; + MethodHandle invoke = null; + try { + invoke = lookup.findVirtual(GuardWithTest.class, name, MethodType.genericMethodType(nargs)); + } catch (NoAccessException ex) { + } + if (invoke == null) break; + invokes.add(invoke); + } + assert(invokes.size() == 9); // current number of methods + return invokes.toArray(new MethodHandle[0]); + }; + static final MethodHandle[] INVOKES = makeInvokes(); + // For testing use this: + //static final MethodHandle[] INVOKES = Arrays.copyOf(makeInvokes(), 2); + static final MethodHandle VARARGS_INVOKE; + static { + try { + VARARGS_INVOKE = IMPL_LOOKUP.findVirtual(GuardWithTest.class, "invoke_V", MethodType.genericMethodType(0, true)); + } catch (NoAccessException ex) { + throw new InternalError(""); + } + } + } + public static MethodHandle makeGuardWithTest(Access token, - final MethodHandle test, - final MethodHandle target, - final MethodHandle fallback) { + MethodHandle test, + MethodHandle target, + MethodHandle fallback) { Access.check(token); - // %%% This is just a sketch. It needs to be de-boxed. - // Adjust the handles to accept varargs lists. MethodType type = target.type(); - Class rtype = type.returnType(); - if (type.parameterCount() != 1 || type.parameterType(0).isPrimitive()) { - MethodType vatestType = MethodType.make(boolean.class, Object[].class); - MethodType vatargetType = MethodType.make(rtype, Object[].class); - MethodHandle vaguard = makeGuardWithTest(token, - MethodHandles.spreadArguments(test, vatestType), - MethodHandles.spreadArguments(target, vatargetType), - MethodHandles.spreadArguments(fallback, vatargetType)); - return MethodHandles.collectArguments(vaguard, type); - } - if (rtype.isPrimitive()) { - MethodType boxtype = type.changeReturnType(Object.class); - MethodHandle boxguard = makeGuardWithTest(token, - test, - MethodHandles.convertArguments(target, boxtype), - MethodHandles.convertArguments(fallback, boxtype)); - return MethodHandles.convertArguments(boxguard, type); - } - // Got here? Reduced calling sequence to Object(Object). - class Guarder { - Object invoke(Object x) { - // If javac supports MethodHandle.invoke directly: - //z = vatest.invoke(arguments); - // If javac does not support direct MH.invoke calls: - boolean z = (Boolean) MethodHandles.invoke_1(test, x); - MethodHandle mh = (z ? target : fallback); - return MethodHandles.invoke_1(mh, x); + int nargs = type.parameterCount(); + if (nargs < GuardWithTest.INVOKES.length) { + MethodType gtype = type.generic(); + MethodHandle gtest = convertArguments(token, test, gtype.changeReturnType(boolean.class), test.type(), null); + MethodHandle gtarget = convertArguments(token, target, gtype, type, null); + MethodHandle gfallback = convertArguments(token, fallback, gtype, type, null); + if (gtest == null || gtarget == null || gfallback == null) return null; + MethodHandle gguard = new GuardWithTest(gtest, gtarget, gfallback); + return convertArguments(token, gguard, type, gtype, null); + } else { + MethodType gtype = MethodType.genericMethodType(0, true); + MethodHandle gtest = spreadArguments(token, test, gtype.changeReturnType(boolean.class), 0); + MethodHandle gtarget = spreadArguments(token, target, gtype, 0); + MethodHandle gfallback = spreadArguments(token, fallback, gtype, 0); + MethodHandle gguard = new GuardWithTest(GuardWithTest.VARARGS_INVOKE, gtest, gtarget, gfallback); + if (gtest == null || gtarget == null || gfallback == null) return null; + return collectArguments(token, gguard, type, 0, null); + } + } + + private static class GuardWithCatch extends JavaMethodHandle { + private final MethodHandle target; + private final Class exType; + private final MethodHandle catcher; + public GuardWithCatch(MethodHandle target, Class exType, MethodHandle catcher) { + this(INVOKES[target.type().parameterCount()], target, exType, catcher); + } + public GuardWithCatch(MethodHandle invoker, + MethodHandle target, Class exType, MethodHandle catcher) { + super(invoker); + this.target = target; + this.exType = exType; + this.catcher = catcher; + } + @Override + public String toString() { + return target.toString(); + } + private Object invoke_V(Object... av) throws Throwable { + try { + return target.invoke(av); + } catch (Throwable t) { + if (!exType.isInstance(t)) throw t; + return catcher.invoke(t, av); } - MethodHandle handle() { - MethodType invokeType = MethodType.makeGeneric(0, true); - MethodHandle vh = IMPL_LOOKUP.bind(this, "invoke", invokeType); - return MethodHandles.collectArguments(vh, target.type()); + } + private Object invoke_L0() throws Throwable { + try { + return target.invoke(); + } catch (Throwable t) { + if (!exType.isInstance(t)) throw t; + return catcher.invoke(t); + } + } + private Object invoke_L1(Object a0) throws Throwable { + try { + return target.invoke(a0); + } catch (Throwable t) { + if (!exType.isInstance(t)) throw t; + return catcher.invoke(t, a0); } } - return new Guarder().handle(); + private Object invoke_L2(Object a0, Object a1) throws Throwable { + try { + return target.invoke(a0, a1); + } catch (Throwable t) { + if (!exType.isInstance(t)) throw t; + return catcher.invoke(t, a0, a1); + } + } + private Object invoke_L3(Object a0, Object a1, Object a2) throws Throwable { + try { + return target.invoke(a0, a1, a2); + } catch (Throwable t) { + if (!exType.isInstance(t)) throw t; + return catcher.invoke(t, a0, a1, a2); + } + } + private Object invoke_L4(Object a0, Object a1, Object a2, Object a3) throws Throwable { + try { + return target.invoke(a0, a1, a2, a3); + } catch (Throwable t) { + if (!exType.isInstance(t)) throw t; + return catcher.invoke(t, a0, a1, a2, a3); + } + } + private Object invoke_L5(Object a0, Object a1, Object a2, Object a3, Object a4) throws Throwable { + try { + return target.invoke(a0, a1, a2, a3, a4); + } catch (Throwable t) { + if (!exType.isInstance(t)) throw t; + return catcher.invoke(t, a0, a1, a2, a3, a4); + } + } + private Object invoke_L6(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5) throws Throwable { + try { + return target.invoke(a0, a1, a2, a3, a4, a5); + } catch (Throwable t) { + if (!exType.isInstance(t)) throw t; + return catcher.invoke(t, a0, a1, a2, a3, a4, a5); + } + } + private Object invoke_L7(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6) throws Throwable { + try { + return target.invoke(a0, a1, a2, a3, a4, a5, a6); + } catch (Throwable t) { + if (!exType.isInstance(t)) throw t; + return catcher.invoke(t, a0, a1, a2, a3, a4, a5, a6); + } + } + private Object invoke_L8(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7) throws Throwable { + try { + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7); + } catch (Throwable t) { + if (!exType.isInstance(t)) throw t; + return catcher.invoke(t, a0, a1, a2, a3, a4, a5, a6, a7); + } + } + static MethodHandle[] makeInvokes() { + ArrayList invokes = new ArrayList(); + MethodHandles.Lookup lookup = IMPL_LOOKUP; + for (;;) { + int nargs = invokes.size(); + String name = "invoke_L"+nargs; + MethodHandle invoke = null; + try { + invoke = lookup.findVirtual(GuardWithCatch.class, name, MethodType.genericMethodType(nargs)); + } catch (NoAccessException ex) { + } + if (invoke == null) break; + invokes.add(invoke); + } + assert(invokes.size() == 9); // current number of methods + return invokes.toArray(new MethodHandle[0]); + }; + static final MethodHandle[] INVOKES = makeInvokes(); + // For testing use this: + //static final MethodHandle[] INVOKES = Arrays.copyOf(makeInvokes(), 2); + static final MethodHandle VARARGS_INVOKE; + static { + try { + VARARGS_INVOKE = IMPL_LOOKUP.findVirtual(GuardWithCatch.class, "invoke_V", MethodType.genericMethodType(0, true)); + } catch (NoAccessException ex) { + throw new InternalError(""); + } + } + } + + + public static + MethodHandle makeGuardWithCatch(Access token, + MethodHandle target, + Class exType, + MethodHandle catcher) { + Access.check(token); + MethodType type = target.type(); + MethodType ctype = catcher.type(); + int nargs = type.parameterCount(); + if (nargs < GuardWithCatch.INVOKES.length) { + MethodType gtype = type.generic(); + MethodType gcatchType = gtype.insertParameterTypes(0, Throwable.class); + MethodHandle gtarget = convertArguments(token, target, gtype, type, null); + MethodHandle gcatcher = convertArguments(token, catcher, gcatchType, ctype, null); + MethodHandle gguard = new GuardWithCatch(gtarget, exType, gcatcher); + if (gtarget == null || gcatcher == null || gguard == null) return null; + return convertArguments(token, gguard, type, gtype, null); + } else { + MethodType gtype = MethodType.genericMethodType(0, true); + MethodType gcatchType = gtype.insertParameterTypes(0, Throwable.class); + MethodHandle gtarget = spreadArguments(token, target, gtype, 0); + MethodHandle gcatcher = spreadArguments(token, catcher, gcatchType, 1); + MethodHandle gguard = new GuardWithCatch(GuardWithCatch.VARARGS_INVOKE, gtarget, exType, gcatcher); + if (gtarget == null || gcatcher == null || gguard == null) return null; + return collectArguments(token, gguard, type, 0, null); + } } public static - MethodHandle combineArguments(Access token, MethodHandle target, MethodHandle checker, int pos) { + MethodHandle throwException(Access token, MethodType type) { Access.check(token); - throw new UnsupportedOperationException("Not yet implemented"); + return AdapterMethodHandle.makeRetypeRaw(token, type, THROW_EXCEPTION); } - protected static String basicToString(MethodHandle target) { + static final MethodHandle THROW_EXCEPTION + = IMPL_LOOKUP.findStatic(MethodHandleImpl.class, "throwException", + MethodType.methodType(Empty.class, Throwable.class)); + static Empty throwException(T t) throws T { throw t; } + + public static String getNameString(Access token, MethodHandle target) { + Access.check(token); MemberName name = null; if (target != null) name = MethodHandleNatives.getMethodName(target); @@ -357,17 +1080,30 @@ public abstract class MethodHandleImpl { return name.getName(); } - protected static String addTypeString(MethodHandle target, String name) { - if (target == null) return name; - return name+target.type(); + public static String addTypeString(MethodHandle target) { + if (target == null) return "null"; + return target.toString() + target.type(); } - static RuntimeException newIllegalArgumentException(String string) { - return new IllegalArgumentException(string); + + public static void checkSpreadArgument(Object av, int n) { + if (av == null ? n != 0 : ((Object[])av).length != n) + throw newIllegalArgumentException("Array is not of length "+n); } - @Override - public String toString() { - MethodHandle self = (MethodHandle) this; - return addTypeString(self, basicToString(self)); + public static void raiseException(int code, Object actual, Object required) { + String message; + // disregard the identity of the actual object, if it is not a class: + if (!(actual instanceof Class) && !(actual instanceof MethodType)) + actual = actual.getClass(); + if (actual != null) + message = "required "+required+" but encountered "+actual; + else + message = "required "+required; + switch (code) { + case 192: // checkcast + throw new ClassCastException(message); + default: + throw new InternalError("unexpected code "+code+": "+message); + } } } diff --git a/src/share/classes/sun/dyn/MethodHandleNatives.java b/src/share/classes/sun/dyn/MethodHandleNatives.java index fc2d82aa8ffd2e7e6104e135a899a41336a6383a..0ede3c2f7067f9854df7ee769c82d15d6db2985e 100644 --- a/src/share/classes/sun/dyn/MethodHandleNatives.java +++ b/src/share/classes/sun/dyn/MethodHandleNatives.java @@ -25,6 +25,7 @@ package sun.dyn; +import java.dyn.CallSite; import java.dyn.MethodHandle; import java.dyn.MethodType; import java.lang.reflect.AccessibleObject; @@ -60,7 +61,7 @@ class MethodHandleNatives { static native void init(MethodType self); /** Tell the JVM that we need to change the target of an invokedynamic. */ - static native void linkCallSite(CallSiteImpl site, MethodHandle target); + static native void linkCallSite(CallSite site, MethodHandle target); /** Fetch the vmtarget field. * It will be sanitized as necessary to avoid exposing non-Java references. @@ -84,8 +85,7 @@ class MethodHandleNatives { } /** Fetch the target of this method handle. - * If it directly targets a method, return a tuple of method info. - * The info is of the form new Object[]{defclass, name, sig, refclass}. + * If it directly targets a method, return a MemberName for the method. * If it is chained to another method handle, return that handle. */ static Object getTargetInfo(MethodHandle self) { @@ -123,7 +123,7 @@ class MethodHandleNatives { registerNatives(); JVM_SUPPORT_ = true; JVM_PUSH_LIMIT_ = getConstant(Constants.GC_JVM_PUSH_LIMIT); - JVM_STACK_MOVE_UNIT_ = getConstant(Constants.GC_JVM_STACK_MOVE_LIMIT); + JVM_STACK_MOVE_UNIT_ = getConstant(Constants.GC_JVM_STACK_MOVE_UNIT); //sun.reflect.Reflection.registerMethodsToFilter(MethodHandleImpl.class, "init"); } catch (UnsatisfiedLinkError ee) { // ignore; if we use init() methods later we'll see linkage errors @@ -149,7 +149,7 @@ class MethodHandleNatives { // MethodHandleImpl static final int // for getConstant GC_JVM_PUSH_LIMIT = 0, - GC_JVM_STACK_MOVE_LIMIT = 1; + GC_JVM_STACK_MOVE_UNIT = 1; static final int ETF_HANDLE_OR_METHOD_NAME = 0, // all available data (immediate MH or method) ETF_DIRECT_HANDLE = 1, // ultimate method handle (will be a DMH, may be self) @@ -178,19 +178,20 @@ class MethodHandleNatives { */ static final int OP_RETYPE_ONLY = 0x0, // no argument changes; straight retype - OP_CHECK_CAST = 0x1, // ref-to-ref conversion; requires a Class argument - OP_PRIM_TO_PRIM = 0x2, // converts from one primitive to another - OP_REF_TO_PRIM = 0x3, // unboxes a wrapper to produce a primitive - OP_PRIM_TO_REF = 0x4, // boxes a primitive into a wrapper (NYI) - OP_SWAP_ARGS = 0x5, // swap arguments (vminfo is 2nd arg) - OP_ROT_ARGS = 0x6, // rotate arguments (vminfo is displaced arg) - OP_DUP_ARGS = 0x7, // duplicates one or more arguments (at TOS) - OP_DROP_ARGS = 0x8, // remove one or more argument slots - OP_COLLECT_ARGS = 0x9, // combine one or more arguments into a varargs (NYI) - OP_SPREAD_ARGS = 0xA, // expand in place a varargs array (of known size) - OP_FLYBY = 0xB, // operate first on reified argument list (NYI) - OP_RICOCHET = 0xC, // run an adapter chain on the return value (NYI) - CONV_OP_LIMIT = 0xD; // limit of CONV_OP enumeration + OP_RETYPE_RAW = 0x1, // no argument changes; straight retype + OP_CHECK_CAST = 0x2, // ref-to-ref conversion; requires a Class argument + OP_PRIM_TO_PRIM = 0x3, // converts from one primitive to another + OP_REF_TO_PRIM = 0x4, // unboxes a wrapper to produce a primitive + OP_PRIM_TO_REF = 0x5, // boxes a primitive into a wrapper (NYI) + OP_SWAP_ARGS = 0x6, // swap arguments (vminfo is 2nd arg) + OP_ROT_ARGS = 0x7, // rotate arguments (vminfo is displaced arg) + OP_DUP_ARGS = 0x8, // duplicates one or more arguments (at TOS) + OP_DROP_ARGS = 0x9, // remove one or more argument slots + OP_COLLECT_ARGS = 0xA, // combine one or more arguments into a varargs (NYI) + OP_SPREAD_ARGS = 0xB, // expand in place a varargs array (of known size) + OP_FLYBY = 0xC, // operate first on reified argument list (NYI) + OP_RICOCHET = 0xD, // run an adapter chain on the return value (NYI) + CONV_OP_LIMIT = 0xE; // limit of CONV_OP enumeration /** Shift and mask values for decoding the AMH.conversion field. * These numbers are shared with the JVM for creating AMHs. */ @@ -209,6 +210,7 @@ class MethodHandleNatives { // TODO: The following expression should be replaced by // a JVM query. ((1<[] ptypes(MethodType mt); @@ -150,7 +151,7 @@ public class MethodTypeImpl { this.argToSlotTable = argToSlotTab; this.slotToArgTable = slotToArgTab; - if (pslotCount >= 256) throw new IllegalArgumentException("too many arguments"); + if (pslotCount >= 256) throw newIllegalArgumentException("too many arguments"); // send a few bits down to the JVM: this.vmslots = parameterSlotCount(); @@ -378,10 +379,10 @@ public class MethodTypeImpl { static MethodTypeImpl findForm(MethodType mt) { MethodType erased = canonicalize(mt, ERASE, ERASE); if (erased == null) { - // It is already erased. Make a new MethodTypeForm. + // It is already erased. Make a new MethodTypeImpl. return METHOD_TYPE_FRIEND.newMethodTypeForm(mt); } else { - // Share the MethodTypeForm with the erased version. + // Share the MethodTypeImpl with the erased version. return METHOD_TYPE_FRIEND.form(erased); } } diff --git a/src/share/classes/sun/dyn/SpreadGeneric.java b/src/share/classes/sun/dyn/SpreadGeneric.java new file mode 100644 index 0000000000000000000000000000000000000000..264479e233662826ab27e8fbfbddb3ab3139e92e --- /dev/null +++ b/src/share/classes/sun/dyn/SpreadGeneric.java @@ -0,0 +1,682 @@ +/* + * Copyright 2008-2009 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Sun designates this + * particular file as subject to the "Classpath" exception as provided + * by Sun in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ + +package sun.dyn; + +import java.dyn.JavaMethodHandle; +import java.dyn.MethodHandle; +import java.dyn.MethodHandles; +import java.dyn.MethodType; +import java.dyn.NoAccessException; +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; +import java.util.ArrayList; +import sun.dyn.util.ValueConversions; +import static sun.dyn.MemberName.newIllegalArgumentException; + +/** + * Generic spread adapter. + * Expands a final argument into multiple (zero or more) arguments, keeping the others the same. + * @author jrose + */ +class SpreadGeneric { + // type for the outgoing call + private final MethodType targetType; + // number of arguments to spread + private final int spreadCount; + // prototype adapter (clone and customize for each new target!) + private final Adapter adapter; + // entry point for adapter (Adapter mh, a...) => ... + private final MethodHandle entryPoint; + + /** Compute and cache information common to all spreading adapters + * that accept calls of the given (generic) type. + */ + private SpreadGeneric(MethodType targetType, int spreadCount) { + assert(targetType == targetType.generic()); + this.targetType = targetType; + this.spreadCount = spreadCount; + // the target invoker will generally need casts on reference arguments + MethodHandle[] ep = { null }; + Adapter ad = findAdapter(this, ep); + if (ad != null) { + this.adapter = ad; + this.entryPoint = ep[0]; + return; + } + this.adapter = buildAdapterFromBytecodes(targetType, spreadCount, ep); + this.entryPoint = ep[0]; + } + + /** From targetType remove the last spreadCount arguments, and instead + * append a simple Object argument. + */ + static MethodType preSpreadType(MethodType targetType, int spreadCount) { + @SuppressWarnings("unchecked") + ArrayList> params = new ArrayList(targetType.parameterList()); + int outargs = params.size(); + params.subList(outargs - spreadCount, outargs).clear(); + params.add(Object.class); + return MethodType.methodType(targetType.returnType(), params); + } + + MethodHandle makeInstance(MethodHandle target) { + MethodType type = target.type(); + if (type != targetType) { + throw new UnsupportedOperationException("NYI type="+type); + } + return adapter.makeInstance(this, target); + } + + /** Build an adapter of the given generic type, which invokes typedTarget + * on the incoming arguments, after unboxing as necessary. + * The return value is boxed if necessary. + * @param genericType the required type of the result + * @param typedTarget the target + * @return an adapter method handle + */ + public static MethodHandle make(MethodHandle target, int spreadCount) { + MethodType type = target.type(); + MethodType gtype = type.generic(); + if (type == gtype) { + return SpreadGeneric.of(type, spreadCount).makeInstance(target); + } else { + MethodHandle gtarget = FromGeneric.make(target); + assert(gtarget.type() == gtype); + MethodHandle gspread = SpreadGeneric.of(gtype, spreadCount).makeInstance(gtarget); + return ToGeneric.make(preSpreadType(type, spreadCount), gspread); + } + } + + /** Return the adapter information for this type's erasure. */ + static SpreadGeneric of(MethodType targetType, int spreadCount) { + if (targetType != targetType.generic()) + throw new UnsupportedOperationException("NYI type="+targetType); + MethodTypeImpl form = MethodTypeImpl.of(targetType); + int outcount = form.parameterCount(); + assert(spreadCount <= outcount); + SpreadGeneric[] spreadGens = form.spreadGeneric; + if (spreadGens == null) + form.spreadGeneric = spreadGens = new SpreadGeneric[outcount+1]; + SpreadGeneric spreadGen = spreadGens[spreadCount]; + if (spreadGen == null) + spreadGens[spreadCount] = spreadGen = new SpreadGeneric(form.erasedType(), spreadCount); + return spreadGen; + } + + public String toString() { + return getClass().getSimpleName()+targetType+"["+spreadCount+"]"; + } + + // This mini-api is called from an Adapter to manage the spread. + /** A check/coercion that happens once before any selections. */ + protected Object check(Object av, int n) { + MethodHandleImpl.checkSpreadArgument(av, n); + return av; + } + + /** The selection operator for spreading; note that it takes Object not Object[]. */ + protected Object select(Object av, int n) { + return ((Object[])av)[n]; + } + /* + protected int select_I(Object av, int n) { + // maybe return ((int[])select)[n] + throw new UnsupportedOperationException("subclass resp."); + } + protected int select_J(Object av, int n) { + // maybe return ((long[])select)[n] + throw new UnsupportedOperationException("subclass resp."); + } + // */ + + /* Create an adapter that handles spreading calls for the given type. */ + static Adapter findAdapter(SpreadGeneric outer, MethodHandle[] ep) { + MethodType targetType = outer.targetType; + int spreadCount = outer.spreadCount; + int outargs = targetType.parameterCount(); + int inargs = outargs - spreadCount; + if (inargs < 0) return null; + MethodType entryType = MethodType.genericMethodType(inargs + 1); // 1 for av + String cname1 = "S" + outargs; + String[] cnames = { cname1 }; + String iname = "invoke_S"+spreadCount; + // e.g., D5I2, D5, L5I2, L5; invoke_D5 + for (String cname : cnames) { + Class acls = Adapter.findSubClass(cname); + if (acls == null) continue; + // see if it has the required invoke method + MethodHandle entryPoint = null; + try { + entryPoint = MethodHandleImpl.IMPL_LOOKUP.findSpecial(acls, iname, entryType, acls); + } catch (NoAccessException ex) { + } + if (entryPoint == null) continue; + Constructor ctor = null; + try { + ctor = acls.getDeclaredConstructor(SpreadGeneric.class); + } catch (NoSuchMethodException ex) { + } catch (SecurityException ex) { + } + if (ctor == null) continue; + try { + // Produce an instance configured as a prototype. + Adapter ad = ctor.newInstance(outer); + ep[0] = entryPoint; + return ad; + } catch (IllegalArgumentException ex) { + } catch (InvocationTargetException wex) { + Throwable ex = wex.getTargetException(); + if (ex instanceof Error) throw (Error)ex; + if (ex instanceof RuntimeException) throw (RuntimeException)ex; + } catch (InstantiationException ex) { + } catch (IllegalAccessException ex) { + } + } + return null; + } + + static Adapter buildAdapterFromBytecodes(MethodType targetType, + int spreadCount, MethodHandle[] ep) { + throw new UnsupportedOperationException("NYI"); + } + + /** + * This adapter takes some untyped arguments, and returns an untyped result. + * Internally, it applies the invoker to the target, which causes the + * objects to be unboxed; the result is a raw type in L/I/J/F/D. + * This result is passed to convert, which is responsible for + * converting the raw result into a boxed object. + * The invoker is kept separate from the target because it can be + * generated once per type erasure family, and reused across adapters. + */ + static abstract class Adapter extends JavaMethodHandle { + /* + * class X<> extends Adapter { + * (Object**N)=>R target; + * static int S = N-M; + * Object invoke(Object**M a, Object v) = target(a..., v[0]...v[S-1]); + * } + */ + protected final SpreadGeneric outer; + protected final MethodHandle target; // (any**N) => R + + @Override + public String toString() { + return target.toString(); + } + + static final MethodHandle NO_ENTRY = ValueConversions.identity(); + + protected boolean isPrototype() { return target == null; } + protected Adapter(SpreadGeneric outer) { + super(NO_ENTRY); + this.outer = outer; + this.target = null; + assert(isPrototype()); + } + + protected Adapter(SpreadGeneric outer, MethodHandle target) { + super(outer.entryPoint); + this.outer = outer; + this.target = target; + } + + /** Make a copy of self, with new fields. */ + protected abstract Adapter makeInstance(SpreadGeneric outer, MethodHandle target); + // { return new ThisType(outer, target); } + + protected Object check(Object av, int n) { + return outer.check(av, n); + } + protected Object select(Object av, int n) { + return outer.select(av, n); + } + + static private final String CLASS_PREFIX; // "sun.dyn.SpreadGeneric$" + static { + String aname = Adapter.class.getName(); + String sname = Adapter.class.getSimpleName(); + if (!aname.endsWith(sname)) throw new InternalError(); + CLASS_PREFIX = aname.substring(0, aname.length() - sname.length()); + } + /** Find a sibing class of Adapter. */ + static Class findSubClass(String name) { + String cname = Adapter.CLASS_PREFIX + name; + try { + return Class.forName(cname).asSubclass(Adapter.class); + } catch (ClassNotFoundException ex) { + return null; + } catch (ClassCastException ex) { + return null; + } + } + } + + /* generated classes follow this pattern: + static class xS2 extends Adapter { + protected xS2(SpreadGeneric outer) { super(outer); } // to build prototype + protected xS2(SpreadGeneric outer, MethodHandle t) { super(outer, t); } + protected xS2 makeInstance(SpreadGeneric outer, MethodHandle t) { return new xS2(outer, t); } + protected Object invoke_S0(Object a0, Object a1, Object av) throws Throwable { av = super.check(av,0); + return target.invoke(a0, a1)); } + protected Object invoke_S1(Object a0, Object av) throws Throwable { av = super.check(av,1); + return target.invoke(a0, + super.select(av,0)); } + protected Object invoke_S2(Object a0, Object av) throws Throwable { av = super.check(av,1); + return target.invoke( + super.select(av,0), super.select(av,1)); } + } + // */ + +/* +: SHELL; n=SpreadGeneric; cp -p $n.java $n.java-; sed < $n.java- > $n.java+ -e '/{{*{{/,/}}*}}/w /tmp/genclasses.java' -e '/}}*}}/q'; (cd /tmp; javac -d . genclasses.java; java -cp . genclasses) >> $n.java+; echo '}' >> $n.java+; mv $n.java+ $n.java; mv $n.java- $n.java~ +//{{{ +import java.util.*; +class genclasses { + static String[][] TEMPLATES = { { + "@for@ N=0..10", + " //@each-cat@", + " static class @cat@ extends Adapter {", + " protected @cat@(SpreadGeneric outer) { super(outer); } // to build prototype", + " protected @cat@(SpreadGeneric outer, MethodHandle t) { super(outer, t); }", + " protected @cat@ makeInstance(SpreadGeneric outer, MethodHandle t) { return new @cat@(outer, t); }", + " protected Object invoke_S0(@Tvav,@Object av) throws Throwable { av = super.check(av, 0);", + " return target.invoke(@av@); }", + " //@each-S@", + " protected Object invoke_S@S@(@Tvav,@Object av) throws Throwable { av = super.check(av, @S@);", + " return target.invoke(@av,@@sv@); }", + " //@end-S@", + " }", + } }; + static final String NEWLINE_INDENT = "\n "; + enum VAR { + cat, N, S, av, av_, Tvav_, sv; + public final String pattern = "@"+toString().replace('_','.')+"@"; + public String binding = toString(); + static void makeBindings(boolean topLevel, int outargs, int spread) { + int inargs = outargs - spread; + VAR.cat.binding = "S"+outargs; + VAR.N.binding = String.valueOf(outargs); // outgoing arg count + VAR.S.binding = String.valueOf(spread); // spread count + String[] av = new String[inargs]; + String[] Tvav = new String[inargs]; + for (int i = 0; i < inargs; i++) { + av[i] = arg(i); + Tvav[i] = param("Object", av[i]); + } + VAR.av.binding = comma(av); + VAR.av_.binding = comma(av, ", "); + VAR.Tvav_.binding = comma(Tvav, ", "); + String[] sv = new String[spread]; + for (int i = 0; i < spread; i++) { + String spc = ""; + if (i % 4 == 0) spc = NEWLINE_INDENT; + sv[i] = spc+"super.select(av,"+i+")"; + } + VAR.sv.binding = comma(sv); + } + static String arg(int i) { return "a"+i; } + static String param(String t, String a) { return t+" "+a; } + static String comma(String[] v) { return comma(v, ""); } + static String comma(String[] v, String sep) { + if (v.length == 0) return ""; + String res = v[0]; + for (int i = 1; i < v.length; i++) res += ", "+v[i]; + return res + sep; + } + static String transform(String string) { + for (VAR var : values()) + string = string.replaceAll(var.pattern, var.binding); + return string; + } + } + static String[] stringsIn(String[] strings, int beg, int end) { + return Arrays.copyOfRange(strings, beg, Math.min(end, strings.length)); + } + static String[] stringsBefore(String[] strings, int pos) { + return stringsIn(strings, 0, pos); + } + static String[] stringsAfter(String[] strings, int pos) { + return stringsIn(strings, pos, strings.length); + } + static int indexAfter(String[] strings, int pos, String tag) { + return Math.min(indexBefore(strings, pos, tag) + 1, strings.length); + } + static int indexBefore(String[] strings, int pos, String tag) { + for (int i = pos, end = strings.length; ; i++) { + if (i == end || strings[i].endsWith(tag)) return i; + } + } + static int MIN_ARITY, MAX_ARITY; + public static void main(String... av) { + for (String[] template : TEMPLATES) { + int forLinesLimit = indexBefore(template, 0, "@each-cat@"); + String[] forLines = stringsBefore(template, forLinesLimit); + template = stringsAfter(template, forLinesLimit); + for (String forLine : forLines) + expandTemplate(forLine, template); + } + } + static void expandTemplate(String forLine, String[] template) { + String[] params = forLine.split("[^0-9]+"); + if (params[0].length() == 0) params = stringsAfter(params, 1); + System.out.println("//params="+Arrays.asList(params)); + int pcur = 0; + MIN_ARITY = Integer.valueOf(params[pcur++]); + MAX_ARITY = Integer.valueOf(params[pcur++]); + if (pcur != params.length) throw new RuntimeException("bad extra param: "+forLine); + for (int outargs = MIN_ARITY; outargs <= MAX_ARITY; outargs++) { + expandTemplate(template, true, outargs, 0); + } + } + static void expandTemplate(String[] template, boolean topLevel, int outargs, int spread) { + VAR.makeBindings(topLevel, outargs, spread); + for (int i = 0; i < template.length; i++) { + String line = template[i]; + if (line.endsWith("@each-cat@")) { + // ignore + } else if (line.endsWith("@each-S@")) { + int blockEnd = indexAfter(template, i, "@end-S@"); + String[] block = stringsIn(template, i+1, blockEnd-1); + for (int spread1 = spread+1; spread1 <= outargs; spread1++) + expandTemplate(block, false, outargs, spread1); + VAR.makeBindings(topLevel, outargs, spread); + i = blockEnd-1; continue; + } else { + System.out.println(VAR.transform(line)); + } + } + } +} +//}}} */ +//params=[0, 10] + static class S0 extends Adapter { + protected S0(SpreadGeneric outer) { super(outer); } // to build prototype + protected S0(SpreadGeneric outer, MethodHandle t) { super(outer, t); } + protected S0 makeInstance(SpreadGeneric outer, MethodHandle t) { return new S0(outer, t); } + protected Object invoke_S0(Object av) throws Throwable { av = super.check(av, 0); + return target.invoke(); } + } + static class S1 extends Adapter { + protected S1(SpreadGeneric outer) { super(outer); } // to build prototype + protected S1(SpreadGeneric outer, MethodHandle t) { super(outer, t); } + protected S1 makeInstance(SpreadGeneric outer, MethodHandle t) { return new S1(outer, t); } + protected Object invoke_S0(Object a0, Object av) throws Throwable { av = super.check(av, 0); + return target.invoke(a0); } + protected Object invoke_S1(Object av) throws Throwable { av = super.check(av, 1); + return target.invoke( + super.select(av,0)); } + } + static class S2 extends Adapter { + protected S2(SpreadGeneric outer) { super(outer); } // to build prototype + protected S2(SpreadGeneric outer, MethodHandle t) { super(outer, t); } + protected S2 makeInstance(SpreadGeneric outer, MethodHandle t) { return new S2(outer, t); } + protected Object invoke_S0(Object a0, Object a1, Object av) throws Throwable { av = super.check(av, 0); + return target.invoke(a0, a1); } + protected Object invoke_S1(Object a0, Object av) throws Throwable { av = super.check(av, 1); + return target.invoke(a0, + super.select(av,0)); } + protected Object invoke_S2(Object av) throws Throwable { av = super.check(av, 2); + return target.invoke( + super.select(av,0), super.select(av,1)); } + } + static class S3 extends Adapter { + protected S3(SpreadGeneric outer) { super(outer); } // to build prototype + protected S3(SpreadGeneric outer, MethodHandle t) { super(outer, t); } + protected S3 makeInstance(SpreadGeneric outer, MethodHandle t) { return new S3(outer, t); } + protected Object invoke_S0(Object a0, Object a1, Object a2, Object av) throws Throwable { av = super.check(av, 0); + return target.invoke(a0, a1, a2); } + protected Object invoke_S1(Object a0, Object a1, Object av) throws Throwable { av = super.check(av, 1); + return target.invoke(a0, a1, + super.select(av,0)); } + protected Object invoke_S2(Object a0, Object av) throws Throwable { av = super.check(av, 2); + return target.invoke(a0, + super.select(av,0), super.select(av,1)); } + protected Object invoke_S3(Object av) throws Throwable { av = super.check(av, 3); + return target.invoke( + super.select(av,0), super.select(av,1), super.select(av,2)); } + } + static class S4 extends Adapter { + protected S4(SpreadGeneric outer) { super(outer); } // to build prototype + protected S4(SpreadGeneric outer, MethodHandle t) { super(outer, t); } + protected S4 makeInstance(SpreadGeneric outer, MethodHandle t) { return new S4(outer, t); } + protected Object invoke_S0(Object a0, Object a1, Object a2, Object a3, Object av) throws Throwable { av = super.check(av, 0); + return target.invoke(a0, a1, a2, a3); } + protected Object invoke_S1(Object a0, Object a1, Object a2, Object av) throws Throwable { av = super.check(av, 1); + return target.invoke(a0, a1, a2, + super.select(av,0)); } + protected Object invoke_S2(Object a0, Object a1, Object av) throws Throwable { av = super.check(av, 2); + return target.invoke(a0, a1, + super.select(av,0), super.select(av,1)); } + protected Object invoke_S3(Object a0, Object av) throws Throwable { av = super.check(av, 3); + return target.invoke(a0, + super.select(av,0), super.select(av,1), super.select(av,2)); } + protected Object invoke_S4(Object av) throws Throwable { av = super.check(av, 4); + return target.invoke( + super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3)); } + } + static class S5 extends Adapter { + protected S5(SpreadGeneric outer) { super(outer); } // to build prototype + protected S5(SpreadGeneric outer, MethodHandle t) { super(outer, t); } + protected S5 makeInstance(SpreadGeneric outer, MethodHandle t) { return new S5(outer, t); } + protected Object invoke_S0(Object a0, Object a1, Object a2, Object a3, Object a4, Object av) throws Throwable { av = super.check(av, 0); + return target.invoke(a0, a1, a2, a3, a4); } + protected Object invoke_S1(Object a0, Object a1, Object a2, Object a3, Object av) throws Throwable { av = super.check(av, 1); + return target.invoke(a0, a1, a2, a3, + super.select(av,0)); } + protected Object invoke_S2(Object a0, Object a1, Object a2, Object av) throws Throwable { av = super.check(av, 2); + return target.invoke(a0, a1, a2, + super.select(av,0), super.select(av,1)); } + protected Object invoke_S3(Object a0, Object a1, Object av) throws Throwable { av = super.check(av, 3); + return target.invoke(a0, a1, + super.select(av,0), super.select(av,1), super.select(av,2)); } + protected Object invoke_S4(Object a0, Object av) throws Throwable { av = super.check(av, 4); + return target.invoke(a0, + super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3)); } + protected Object invoke_S5(Object av) throws Throwable { av = super.check(av, 5); + return target.invoke( + super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3), + super.select(av,4)); } + } + static class S6 extends Adapter { + protected S6(SpreadGeneric outer) { super(outer); } // to build prototype + protected S6(SpreadGeneric outer, MethodHandle t) { super(outer, t); } + protected S6 makeInstance(SpreadGeneric outer, MethodHandle t) { return new S6(outer, t); } + protected Object invoke_S0(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object av) throws Throwable { av = super.check(av, 0); + return target.invoke(a0, a1, a2, a3, a4, a5); } + protected Object invoke_S1(Object a0, Object a1, Object a2, Object a3, Object a4, Object av) throws Throwable { av = super.check(av, 1); + return target.invoke(a0, a1, a2, a3, a4, + super.select(av,0)); } + protected Object invoke_S2(Object a0, Object a1, Object a2, Object a3, Object av) throws Throwable { av = super.check(av, 2); + return target.invoke(a0, a1, a2, a3, + super.select(av,0), super.select(av,1)); } + protected Object invoke_S3(Object a0, Object a1, Object a2, Object av) throws Throwable { av = super.check(av, 3); + return target.invoke(a0, a1, a2, + super.select(av,0), super.select(av,1), super.select(av,2)); } + protected Object invoke_S4(Object a0, Object a1, Object av) throws Throwable { av = super.check(av, 4); + return target.invoke(a0, a1, + super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3)); } + protected Object invoke_S5(Object a0, Object av) throws Throwable { av = super.check(av, 5); + return target.invoke(a0, + super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3), + super.select(av,4)); } + protected Object invoke_S6(Object av) throws Throwable { av = super.check(av, 6); + return target.invoke( + super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3), + super.select(av,4), super.select(av,5)); } + } + static class S7 extends Adapter { + protected S7(SpreadGeneric outer) { super(outer); } // to build prototype + protected S7(SpreadGeneric outer, MethodHandle t) { super(outer, t); } + protected S7 makeInstance(SpreadGeneric outer, MethodHandle t) { return new S7(outer, t); } + protected Object invoke_S0(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object av) throws Throwable { av = super.check(av, 0); + return target.invoke(a0, a1, a2, a3, a4, a5, a6); } + protected Object invoke_S1(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object av) throws Throwable { av = super.check(av, 1); + return target.invoke(a0, a1, a2, a3, a4, a5, + super.select(av,0)); } + protected Object invoke_S2(Object a0, Object a1, Object a2, Object a3, Object a4, Object av) throws Throwable { av = super.check(av, 2); + return target.invoke(a0, a1, a2, a3, a4, + super.select(av,0), super.select(av,1)); } + protected Object invoke_S3(Object a0, Object a1, Object a2, Object a3, Object av) throws Throwable { av = super.check(av, 3); + return target.invoke(a0, a1, a2, a3, + super.select(av,0), super.select(av,1), super.select(av,2)); } + protected Object invoke_S4(Object a0, Object a1, Object a2, Object av) throws Throwable { av = super.check(av, 4); + return target.invoke(a0, a1, a2, + super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3)); } + protected Object invoke_S5(Object a0, Object a1, Object av) throws Throwable { av = super.check(av, 5); + return target.invoke(a0, a1, + super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3), + super.select(av,4)); } + protected Object invoke_S6(Object a0, Object av) throws Throwable { av = super.check(av, 6); + return target.invoke(a0, + super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3), + super.select(av,4), super.select(av,5)); } + protected Object invoke_S7(Object av) throws Throwable { av = super.check(av, 7); + return target.invoke( + super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3), + super.select(av,4), super.select(av,5), super.select(av,6)); } + } + static class S8 extends Adapter { + protected S8(SpreadGeneric outer) { super(outer); } // to build prototype + protected S8(SpreadGeneric outer, MethodHandle t) { super(outer, t); } + protected S8 makeInstance(SpreadGeneric outer, MethodHandle t) { return new S8(outer, t); } + protected Object invoke_S0(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object av) throws Throwable { av = super.check(av, 0); + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7); } + protected Object invoke_S1(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object av) throws Throwable { av = super.check(av, 1); + return target.invoke(a0, a1, a2, a3, a4, a5, a6, + super.select(av,0)); } + protected Object invoke_S2(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object av) throws Throwable { av = super.check(av, 2); + return target.invoke(a0, a1, a2, a3, a4, a5, + super.select(av,0), super.select(av,1)); } + protected Object invoke_S3(Object a0, Object a1, Object a2, Object a3, Object a4, Object av) throws Throwable { av = super.check(av, 3); + return target.invoke(a0, a1, a2, a3, a4, + super.select(av,0), super.select(av,1), super.select(av,2)); } + protected Object invoke_S4(Object a0, Object a1, Object a2, Object a3, Object av) throws Throwable { av = super.check(av, 4); + return target.invoke(a0, a1, a2, a3, + super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3)); } + protected Object invoke_S5(Object a0, Object a1, Object a2, Object av) throws Throwable { av = super.check(av, 5); + return target.invoke(a0, a1, a2, + super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3), + super.select(av,4)); } + protected Object invoke_S6(Object a0, Object a1, Object av) throws Throwable { av = super.check(av, 6); + return target.invoke(a0, a1, + super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3), + super.select(av,4), super.select(av,5)); } + protected Object invoke_S7(Object a0, Object av) throws Throwable { av = super.check(av, 7); + return target.invoke(a0, + super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3), + super.select(av,4), super.select(av,5), super.select(av,6)); } + protected Object invoke_S8(Object av) throws Throwable { av = super.check(av, 8); + return target.invoke( + super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3), + super.select(av,4), super.select(av,5), super.select(av,6), super.select(av,7)); } + } + static class S9 extends Adapter { + protected S9(SpreadGeneric outer) { super(outer); } // to build prototype + protected S9(SpreadGeneric outer, MethodHandle t) { super(outer, t); } + protected S9 makeInstance(SpreadGeneric outer, MethodHandle t) { return new S9(outer, t); } + protected Object invoke_S0(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8, Object av) throws Throwable { av = super.check(av, 0); + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8); } + protected Object invoke_S1(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object av) throws Throwable { av = super.check(av, 1); + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, + super.select(av,0)); } + protected Object invoke_S2(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object av) throws Throwable { av = super.check(av, 2); + return target.invoke(a0, a1, a2, a3, a4, a5, a6, + super.select(av,0), super.select(av,1)); } + protected Object invoke_S3(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object av) throws Throwable { av = super.check(av, 3); + return target.invoke(a0, a1, a2, a3, a4, a5, + super.select(av,0), super.select(av,1), super.select(av,2)); } + protected Object invoke_S4(Object a0, Object a1, Object a2, Object a3, Object a4, Object av) throws Throwable { av = super.check(av, 4); + return target.invoke(a0, a1, a2, a3, a4, + super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3)); } + protected Object invoke_S5(Object a0, Object a1, Object a2, Object a3, Object av) throws Throwable { av = super.check(av, 5); + return target.invoke(a0, a1, a2, a3, + super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3), + super.select(av,4)); } + protected Object invoke_S6(Object a0, Object a1, Object a2, Object av) throws Throwable { av = super.check(av, 6); + return target.invoke(a0, a1, a2, + super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3), + super.select(av,4), super.select(av,5)); } + protected Object invoke_S7(Object a0, Object a1, Object av) throws Throwable { av = super.check(av, 7); + return target.invoke(a0, a1, + super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3), + super.select(av,4), super.select(av,5), super.select(av,6)); } + protected Object invoke_S8(Object a0, Object av) throws Throwable { av = super.check(av, 8); + return target.invoke(a0, + super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3), + super.select(av,4), super.select(av,5), super.select(av,6), super.select(av,7)); } + protected Object invoke_S9(Object av) throws Throwable { av = super.check(av, 9); + return target.invoke( + super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3), + super.select(av,4), super.select(av,5), super.select(av,6), super.select(av,7), + super.select(av,8)); } + } + static class S10 extends Adapter { + protected S10(SpreadGeneric outer) { super(outer); } // to build prototype + protected S10(SpreadGeneric outer, MethodHandle t) { super(outer, t); } + protected S10 makeInstance(SpreadGeneric outer, MethodHandle t) { return new S10(outer, t); } + protected Object invoke_S0(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8, Object a9, Object av) throws Throwable { av = super.check(av, 0); + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); } + protected Object invoke_S1(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8, Object av) throws Throwable { av = super.check(av, 1); + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, a8, + super.select(av,0)); } + protected Object invoke_S2(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object av) throws Throwable { av = super.check(av, 2); + return target.invoke(a0, a1, a2, a3, a4, a5, a6, a7, + super.select(av,0), super.select(av,1)); } + protected Object invoke_S3(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object av) throws Throwable { av = super.check(av, 3); + return target.invoke(a0, a1, a2, a3, a4, a5, a6, + super.select(av,0), super.select(av,1), super.select(av,2)); } + protected Object invoke_S4(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object av) throws Throwable { av = super.check(av, 4); + return target.invoke(a0, a1, a2, a3, a4, a5, + super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3)); } + protected Object invoke_S5(Object a0, Object a1, Object a2, Object a3, Object a4, Object av) throws Throwable { av = super.check(av, 5); + return target.invoke(a0, a1, a2, a3, a4, + super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3), + super.select(av,4)); } + protected Object invoke_S6(Object a0, Object a1, Object a2, Object a3, Object av) throws Throwable { av = super.check(av, 6); + return target.invoke(a0, a1, a2, a3, + super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3), + super.select(av,4), super.select(av,5)); } + protected Object invoke_S7(Object a0, Object a1, Object a2, Object av) throws Throwable { av = super.check(av, 7); + return target.invoke(a0, a1, a2, + super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3), + super.select(av,4), super.select(av,5), super.select(av,6)); } + protected Object invoke_S8(Object a0, Object a1, Object av) throws Throwable { av = super.check(av, 8); + return target.invoke(a0, a1, + super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3), + super.select(av,4), super.select(av,5), super.select(av,6), super.select(av,7)); } + protected Object invoke_S9(Object a0, Object av) throws Throwable { av = super.check(av, 9); + return target.invoke(a0, + super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3), + super.select(av,4), super.select(av,5), super.select(av,6), super.select(av,7), + super.select(av,8)); } + protected Object invoke_S10(Object av) throws Throwable { av = super.check(av, 10); + return target.invoke( + super.select(av,0), super.select(av,1), super.select(av,2), super.select(av,3), + super.select(av,4), super.select(av,5), super.select(av,6), super.select(av,7), + super.select(av,8), super.select(av,9)); } + } +} diff --git a/src/share/classes/sun/dyn/ToGeneric.java b/src/share/classes/sun/dyn/ToGeneric.java index fd04d753e7447a6b733cb3ba373ae50f6e9a637d..03c374b1c5c8a14fa46bb99349ad7c8ab0663e41 100644 --- a/src/share/classes/sun/dyn/ToGeneric.java +++ b/src/share/classes/sun/dyn/ToGeneric.java @@ -34,6 +34,7 @@ import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import sun.dyn.util.ValueConversions; import sun.dyn.util.Wrapper; +import static sun.dyn.MemberName.newIllegalArgumentException; /** * Adapters which mediate between incoming calls which are not generic @@ -68,7 +69,7 @@ class ToGeneric { // conversion which unboxes a primitive return value private final MethodHandle returnConversion; - /** Compute and cache information common to all collecting adapters + /** Compute and cache information common to all generifying (boxing) adapters * that implement members of the erasure-family of the given erased type. */ private ToGeneric(MethodType entryType) { @@ -111,30 +112,48 @@ class ToGeneric { // primitive arguments according to their "raw" types int/long MethodType intsAtEnd = MethodTypeImpl.of(primsAtEnd).primsAsInts(); ad = findAdapter(rawEntryTypeInit = intsAtEnd); - if (ad == null) { + MethodHandle rawEntryPoint; + if (ad != null) { + rawEntryPoint = ad.prototypeEntryPoint(); + } else { // Perhaps the adapter is available only for longs. // If so, we can use it, but there will have to be a little // more stack motion on each call. MethodType longsAtEnd = MethodTypeImpl.of(primsAtEnd).primsAsLongs(); ad = findAdapter(rawEntryTypeInit = longsAtEnd); - if (ad == null) { + if (ad != null) { + MethodType eptWithLongs = longsAtEnd.insertParameterTypes(0, ad.getClass()); + MethodType eptWithInts = intsAtEnd.insertParameterTypes(0, ad.getClass()); + rawEntryPoint = ad.prototypeEntryPoint(); + MethodType midType = eptWithLongs; // will change longs to ints + for (int i = 0, nargs = midType.parameterCount(); i < nargs; i++) { + if (midType.parameterType(i) != eptWithInts.parameterType(i)) { + assert(midType.parameterType(i) == long.class); + assert(eptWithInts.parameterType(i) == int.class); + MethodType nextType = midType.changeParameterType(i, int.class); + rawEntryPoint = MethodHandle.convertArguments(Access.TOKEN, + rawEntryPoint, nextType, midType, null); + midType = nextType; + } + } + assert(midType == eptWithInts); + } else { // If there is no statically compiled adapter, // build one by means of dynamic bytecode generation. ad = buildAdapterFromBytecodes(rawEntryTypeInit = intsAtEnd); + rawEntryPoint = ad.prototypeEntryPoint(); } } - MethodHandle rawEntryPoint = ad.prototypeEntryPoint(); - MethodType tepType = entryType.insertParameterType(0, ad.getClass()); + MethodType tepType = entryType.insertParameterTypes(0, ad.getClass()); this.entryPoint = - AdapterMethodHandle.makeRawRetypeOnly(Access.TOKEN, tepType, rawEntryPoint); + AdapterMethodHandle.makeRetypeRaw(Access.TOKEN, tepType, rawEntryPoint); if (this.entryPoint == null) throw new UnsupportedOperationException("cannot retype to "+entryType - +" from "+rawEntryPoint.type().dropParameterType(0)); + +" from "+rawEntryPoint.type().dropParameterTypes(0, 1)); this.returnConversion = computeReturnConversion(entryType, rawEntryTypeInit, false); this.rawEntryType = rawEntryTypeInit; this.adapter = ad; - this.invoker = makeRawArgumentFilter(invoker0, - rawEntryPoint.type().dropParameterType(0), entryType); + this.invoker = makeRawArgumentFilter(invoker0, rawEntryTypeInit, entryType); } /** A generic argument list will be created by a call of type 'raw'. @@ -157,8 +176,8 @@ class ToGeneric { if (filteredInvoker == null) throw new UnsupportedOperationException("NYI"); } MethodHandle reboxer = ValueConversions.rebox(dst, false); - FilterGeneric gen = new FilterGeneric(filteredInvoker.type(), (short)(1+i), (short)1, 'R'); - filteredInvoker = gen.makeInstance(reboxer, filteredInvoker); + filteredInvoker = FilterGeneric.makeArgumentFilter(1+i, reboxer, filteredInvoker); + if (filteredInvoker == null) throw new InternalError(); } if (filteredInvoker == null) return invoker; return AdapterMethodHandle.makeRetypeOnly(Access.TOKEN, invoker.type(), filteredInvoker); @@ -209,9 +228,9 @@ class ToGeneric { if (convert == null) convert = computeReturnConversion(type, rawEntryType, true); // retype erased reference arguments (the cast makes it safe to do this) - MethodType tepType = type.insertParameterType(0, adapter.getClass()); + MethodType tepType = type.insertParameterTypes(0, adapter.getClass()); MethodHandle typedEntryPoint = - AdapterMethodHandle.makeRawRetypeOnly(Access.TOKEN, tepType, entryPoint); + AdapterMethodHandle.makeRetypeRaw(Access.TOKEN, tepType, entryPoint); return adapter.makeInstance(typedEntryPoint, invoker, convert, genericTarget); } @@ -225,7 +244,7 @@ class ToGeneric { public static MethodHandle make(MethodType type, MethodHandle genericTarget) { MethodType gtype = genericTarget.type(); if (type.generic() != gtype) - throw new IllegalArgumentException(); + throw newIllegalArgumentException("type must be generic"); if (type == gtype) return genericTarget; return ToGeneric.of(type).makeInstance(type, genericTarget); } @@ -283,7 +302,10 @@ class ToGeneric { try { return ctor.newInstance(entryPoint); } catch (IllegalArgumentException ex) { - } catch (InvocationTargetException ex) { + } catch (InvocationTargetException wex) { + Throwable ex = wex.getTargetException(); + if (ex instanceof Error) throw (Error)ex; + if (ex instanceof RuntimeException) throw (RuntimeException)ex; } catch (InstantiationException ex) { } catch (IllegalAccessException ex) { } @@ -317,6 +339,11 @@ class ToGeneric { protected final MethodHandle target; // Object... -> Object protected final MethodHandle convert; // Object -> R + @Override + public String toString() { + return target.toString(); + } + protected boolean isPrototype() { return target == null; } /* Prototype constructor. */ protected Adapter(MethodHandle entryPoint) { @@ -344,33 +371,33 @@ class ToGeneric { // { return new ThisType(entryPoint, convert, target); } // Code to run when the arguments (<= 4) have all been boxed. - protected Object target() { return invoker.invoke(target); } - protected Object target(Object a0) { return invoker.invoke(target, a0); } + protected Object target() throws Throwable { return invoker.invoke(target); } + protected Object target(Object a0) throws Throwable { return invoker.invoke(target, a0); } protected Object target(Object a0, Object a1) - { return invoker.invoke(target, a0, a1); } + throws Throwable { return invoker.invoke(target, a0, a1); } protected Object target(Object a0, Object a1, Object a2) - { return invoker.invoke(target, a0, a1, a2); } + throws Throwable { return invoker.invoke(target, a0, a1, a2); } protected Object target(Object a0, Object a1, Object a2, Object a3) - { return invoker.invoke(target, a0, a1, a2, a3); } + throws Throwable { return invoker.invoke(target, a0, a1, a2, a3); } /* - protected Object target_0(Object... av) { return invoker.invoke(target, av); } + protected Object target_0(Object... av) throws Throwable { return invoker.invoke(target, av); } protected Object target_1(Object a0, Object... av) - { return invoker.invoke(target, a0, (Object)av); } + throws Throwable { return invoker.invoke(target, a0, (Object)av); } protected Object target_2(Object a0, Object a1, Object... av) - { return invoker.invoke(target, a0, a1, (Object)av); } + throws Throwable { return invoker.invoke(target, a0, a1, (Object)av); } protected Object target_3(Object a0, Object a1, Object a2, Object... av) - { return invoker.invoke(target, a0, a1, a2, (Object)av); } + throws Throwable { return invoker.invoke(target, a0, a1, a2, (Object)av); } protected Object target_4(Object a0, Object a1, Object a2, Object a3, Object... av) - { return invoker.invoke(target, a0, a1, a2, a3, (Object)av); } + throws Throwable { return invoker.invoke(target, a0, a1, a2, a3, (Object)av); } // */ // (For more than 4 arguments, generate the code in the adapter itself.) // Code to run when the generic target has finished and produced a value. - protected Object return_L(Object res) { return convert.invoke(res); } - protected int return_I(Object res) { return convert.invoke(res); } - protected long return_J(Object res) { return convert.invoke(res); } - protected float return_F(Object res) { return convert.invoke(res); } - protected double return_D(Object res) { return convert.invoke(res); } + protected Object return_L(Object res) throws Throwable { return convert.invoke(res); } + protected int return_I(Object res) throws Throwable { return convert.invoke(res); } + protected long return_J(Object res) throws Throwable { return convert.invoke(res); } + protected float return_F(Object res) throws Throwable { return convert.invoke(res); } + protected double return_D(Object res) throws Throwable { return convert.invoke(res); } static private final String CLASS_PREFIX; // "sun.dyn.ToGeneric$" static { @@ -397,25 +424,25 @@ class ToGeneric { protected A1(MethodHandle entryPoint) { super(entryPoint); } // to build prototype protected A1(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t) { super(e, i, c, t); } protected A1 makeInstance(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t) { return new A1(e, i, c, t); } - protected Object target(Object a0) { return invoker.invoke(target, a0); } - protected Object targetA1(Object a0) { return target(a0); } - protected Object targetA1(int a0) { return target(a0); } - protected Object targetA1(long a0) { return target(a0); } - protected Object invoke_L(Object a0) { return return_L(targetA1(a0)); } - protected int invoke_I(Object a0) { return return_I(targetA1(a0)); } - protected long invoke_J(Object a0) { return return_J(targetA1(a0)); } - protected float invoke_F(Object a0) { return return_F(targetA1(a0)); } - protected double invoke_D(Object a0) { return return_D(targetA1(a0)); } - protected Object invoke_L(int a0) { return return_L(targetA1(a0)); } - protected int invoke_I(int a0) { return return_I(targetA1(a0)); } - protected long invoke_J(int a0) { return return_J(targetA1(a0)); } - protected float invoke_F(int a0) { return return_F(targetA1(a0)); } - protected double invoke_D(int a0) { return return_D(targetA1(a0)); } - protected Object invoke_L(long a0) { return return_L(targetA1(a0)); } - protected int invoke_I(long a0) { return return_I(targetA1(a0)); } - protected long invoke_J(long a0) { return return_J(targetA1(a0)); } - protected float invoke_F(long a0) { return return_F(targetA1(a0)); } - protected double invoke_D(long a0) { return return_D(targetA1(a0)); } + protected Object target(Object a0) throws Throwable { return invoker.invoke(target, a0); } + protected Object targetA1(Object a0) throws Throwable { return target(a0); } + protected Object targetA1(int a0) throws Throwable { return target(a0); } + protected Object targetA1(long a0) throws Throwable { return target(a0); } + protected Object invoke_L(Object a0) throws Throwable { return return_L(targetA1(a0)); } + protected int invoke_I(Object a0) throws Throwable { return return_I(targetA1(a0)); } + protected long invoke_J(Object a0) throws Throwable { return return_J(targetA1(a0)); } + protected float invoke_F(Object a0) throws Throwable { return return_F(targetA1(a0)); } + protected double invoke_D(Object a0) throws Throwable { return return_D(targetA1(a0)); } + protected Object invoke_L(int a0) throws Throwable { return return_L(targetA1(a0)); } + protected int invoke_I(int a0) throws Throwable { return return_I(targetA1(a0)); } + protected long invoke_J(int a0) throws Throwable { return return_J(targetA1(a0)); } + protected float invoke_F(int a0) throws Throwable { return return_F(targetA1(a0)); } + protected double invoke_D(int a0) throws Throwable { return return_D(targetA1(a0)); } + protected Object invoke_L(long a0) throws Throwable { return return_L(targetA1(a0)); } + protected int invoke_I(long a0) throws Throwable { return return_I(targetA1(a0)); } + protected long invoke_J(long a0) throws Throwable { return return_J(targetA1(a0)); } + protected float invoke_F(long a0) throws Throwable { return return_F(targetA1(a0)); } + protected double invoke_D(long a0) throws Throwable { return return_D(targetA1(a0)); } } // */ @@ -435,13 +462,13 @@ class genclasses { " protected @cat@(MethodHandle entryPoint) { super(entryPoint); } // to build prototype", " protected @cat@(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t) { super(e, i, c, t); }", " protected @cat@ makeInstance(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t) { return new @cat@(e, i, c, t); }", - " protected Object target(@Ovav@) { return invoker.invoke(target, @av@); }", + " protected Object target(@Ovav@) throws Throwable { return invoker.invoke(target, @av@); }", " //@each-Tv@", - " protected Object target@cat@(@Tvav@) { return target(@av@); }", + " protected Object target@cat@(@Tvav@) throws Throwable { return target(@av@); }", " //@end-Tv@", " //@each-Tv@", " //@each-R@", - " protected @R@ invoke_@Rc@(@Tvav@) { return return_@Rc@(target@cat@(@av@)); }", + " protected @R@ invoke_@Rc@(@Tvav@) throws Throwable { return return_@Rc@(target@cat@(@av@)); }", " //@end-R@", " //@end-Tv@", " }", @@ -595,424 +622,424 @@ class genclasses { protected A0(MethodHandle entryPoint) { super(entryPoint); } // to build prototype protected A0(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t) { super(e, i, c, t); } protected A0 makeInstance(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t) { return new A0(e, i, c, t); } - protected Object target() { return invoker.invoke(target); } - protected Object targetA0() { return target(); } - protected Object invoke_L() { return return_L(targetA0()); } - protected int invoke_I() { return return_I(targetA0()); } - protected long invoke_J() { return return_J(targetA0()); } - protected float invoke_F() { return return_F(targetA0()); } - protected double invoke_D() { return return_D(targetA0()); } + protected Object target() throws Throwable { return invoker.invoke(target); } + protected Object targetA0() throws Throwable { return target(); } + protected Object invoke_L() throws Throwable { return return_L(targetA0()); } + protected int invoke_I() throws Throwable { return return_I(targetA0()); } + protected long invoke_J() throws Throwable { return return_J(targetA0()); } + protected float invoke_F() throws Throwable { return return_F(targetA0()); } + protected double invoke_D() throws Throwable { return return_D(targetA0()); } } static class A1 extends Adapter { protected A1(MethodHandle entryPoint) { super(entryPoint); } // to build prototype protected A1(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t) { super(e, i, c, t); } protected A1 makeInstance(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t) { return new A1(e, i, c, t); } - protected Object target(Object a0) { return invoker.invoke(target, a0); } - protected Object targetA1(Object a0) { return target(a0); } - protected Object targetA1(int a0) { return target(a0); } - protected Object targetA1(long a0) { return target(a0); } - protected Object invoke_L(Object a0) { return return_L(targetA1(a0)); } - protected int invoke_I(Object a0) { return return_I(targetA1(a0)); } - protected long invoke_J(Object a0) { return return_J(targetA1(a0)); } - protected float invoke_F(Object a0) { return return_F(targetA1(a0)); } - protected double invoke_D(Object a0) { return return_D(targetA1(a0)); } - protected Object invoke_L(int a0) { return return_L(targetA1(a0)); } - protected int invoke_I(int a0) { return return_I(targetA1(a0)); } - protected long invoke_J(int a0) { return return_J(targetA1(a0)); } - protected float invoke_F(int a0) { return return_F(targetA1(a0)); } - protected double invoke_D(int a0) { return return_D(targetA1(a0)); } - protected Object invoke_L(long a0) { return return_L(targetA1(a0)); } - protected int invoke_I(long a0) { return return_I(targetA1(a0)); } - protected long invoke_J(long a0) { return return_J(targetA1(a0)); } - protected float invoke_F(long a0) { return return_F(targetA1(a0)); } - protected double invoke_D(long a0) { return return_D(targetA1(a0)); } + protected Object target(Object a0) throws Throwable { return invoker.invoke(target, a0); } + protected Object targetA1(Object a0) throws Throwable { return target(a0); } + protected Object targetA1(int a0) throws Throwable { return target(a0); } + protected Object targetA1(long a0) throws Throwable { return target(a0); } + protected Object invoke_L(Object a0) throws Throwable { return return_L(targetA1(a0)); } + protected int invoke_I(Object a0) throws Throwable { return return_I(targetA1(a0)); } + protected long invoke_J(Object a0) throws Throwable { return return_J(targetA1(a0)); } + protected float invoke_F(Object a0) throws Throwable { return return_F(targetA1(a0)); } + protected double invoke_D(Object a0) throws Throwable { return return_D(targetA1(a0)); } + protected Object invoke_L(int a0) throws Throwable { return return_L(targetA1(a0)); } + protected int invoke_I(int a0) throws Throwable { return return_I(targetA1(a0)); } + protected long invoke_J(int a0) throws Throwable { return return_J(targetA1(a0)); } + protected float invoke_F(int a0) throws Throwable { return return_F(targetA1(a0)); } + protected double invoke_D(int a0) throws Throwable { return return_D(targetA1(a0)); } + protected Object invoke_L(long a0) throws Throwable { return return_L(targetA1(a0)); } + protected int invoke_I(long a0) throws Throwable { return return_I(targetA1(a0)); } + protected long invoke_J(long a0) throws Throwable { return return_J(targetA1(a0)); } + protected float invoke_F(long a0) throws Throwable { return return_F(targetA1(a0)); } + protected double invoke_D(long a0) throws Throwable { return return_D(targetA1(a0)); } } static class A2 extends Adapter { protected A2(MethodHandle entryPoint) { super(entryPoint); } // to build prototype protected A2(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t) { super(e, i, c, t); } protected A2 makeInstance(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t) { return new A2(e, i, c, t); } - protected Object target(Object a0, Object a1) { return invoker.invoke(target, a0, a1); } - protected Object targetA2(Object a0, Object a1) { return target(a0, a1); } - protected Object targetA2(Object a0, int a1) { return target(a0, a1); } - protected Object targetA2(int a0, int a1) { return target(a0, a1); } - protected Object targetA2(Object a0, long a1) { return target(a0, a1); } - protected Object targetA2(long a0, long a1) { return target(a0, a1); } - protected Object invoke_L(Object a0, Object a1) { return return_L(targetA2(a0, a1)); } - protected int invoke_I(Object a0, Object a1) { return return_I(targetA2(a0, a1)); } - protected long invoke_J(Object a0, Object a1) { return return_J(targetA2(a0, a1)); } - protected float invoke_F(Object a0, Object a1) { return return_F(targetA2(a0, a1)); } - protected double invoke_D(Object a0, Object a1) { return return_D(targetA2(a0, a1)); } - protected Object invoke_L(Object a0, int a1) { return return_L(targetA2(a0, a1)); } - protected int invoke_I(Object a0, int a1) { return return_I(targetA2(a0, a1)); } - protected long invoke_J(Object a0, int a1) { return return_J(targetA2(a0, a1)); } - protected float invoke_F(Object a0, int a1) { return return_F(targetA2(a0, a1)); } - protected double invoke_D(Object a0, int a1) { return return_D(targetA2(a0, a1)); } - protected Object invoke_L(int a0, int a1) { return return_L(targetA2(a0, a1)); } - protected int invoke_I(int a0, int a1) { return return_I(targetA2(a0, a1)); } - protected long invoke_J(int a0, int a1) { return return_J(targetA2(a0, a1)); } - protected float invoke_F(int a0, int a1) { return return_F(targetA2(a0, a1)); } - protected double invoke_D(int a0, int a1) { return return_D(targetA2(a0, a1)); } - protected Object invoke_L(Object a0, long a1) { return return_L(targetA2(a0, a1)); } - protected int invoke_I(Object a0, long a1) { return return_I(targetA2(a0, a1)); } - protected long invoke_J(Object a0, long a1) { return return_J(targetA2(a0, a1)); } - protected float invoke_F(Object a0, long a1) { return return_F(targetA2(a0, a1)); } - protected double invoke_D(Object a0, long a1) { return return_D(targetA2(a0, a1)); } - protected Object invoke_L(long a0, long a1) { return return_L(targetA2(a0, a1)); } - protected int invoke_I(long a0, long a1) { return return_I(targetA2(a0, a1)); } - protected long invoke_J(long a0, long a1) { return return_J(targetA2(a0, a1)); } - protected float invoke_F(long a0, long a1) { return return_F(targetA2(a0, a1)); } - protected double invoke_D(long a0, long a1) { return return_D(targetA2(a0, a1)); } + protected Object target(Object a0, Object a1) throws Throwable { return invoker.invoke(target, a0, a1); } + protected Object targetA2(Object a0, Object a1) throws Throwable { return target(a0, a1); } + protected Object targetA2(Object a0, int a1) throws Throwable { return target(a0, a1); } + protected Object targetA2(int a0, int a1) throws Throwable { return target(a0, a1); } + protected Object targetA2(Object a0, long a1) throws Throwable { return target(a0, a1); } + protected Object targetA2(long a0, long a1) throws Throwable { return target(a0, a1); } + protected Object invoke_L(Object a0, Object a1) throws Throwable { return return_L(targetA2(a0, a1)); } + protected int invoke_I(Object a0, Object a1) throws Throwable { return return_I(targetA2(a0, a1)); } + protected long invoke_J(Object a0, Object a1) throws Throwable { return return_J(targetA2(a0, a1)); } + protected float invoke_F(Object a0, Object a1) throws Throwable { return return_F(targetA2(a0, a1)); } + protected double invoke_D(Object a0, Object a1) throws Throwable { return return_D(targetA2(a0, a1)); } + protected Object invoke_L(Object a0, int a1) throws Throwable { return return_L(targetA2(a0, a1)); } + protected int invoke_I(Object a0, int a1) throws Throwable { return return_I(targetA2(a0, a1)); } + protected long invoke_J(Object a0, int a1) throws Throwable { return return_J(targetA2(a0, a1)); } + protected float invoke_F(Object a0, int a1) throws Throwable { return return_F(targetA2(a0, a1)); } + protected double invoke_D(Object a0, int a1) throws Throwable { return return_D(targetA2(a0, a1)); } + protected Object invoke_L(int a0, int a1) throws Throwable { return return_L(targetA2(a0, a1)); } + protected int invoke_I(int a0, int a1) throws Throwable { return return_I(targetA2(a0, a1)); } + protected long invoke_J(int a0, int a1) throws Throwable { return return_J(targetA2(a0, a1)); } + protected float invoke_F(int a0, int a1) throws Throwable { return return_F(targetA2(a0, a1)); } + protected double invoke_D(int a0, int a1) throws Throwable { return return_D(targetA2(a0, a1)); } + protected Object invoke_L(Object a0, long a1) throws Throwable { return return_L(targetA2(a0, a1)); } + protected int invoke_I(Object a0, long a1) throws Throwable { return return_I(targetA2(a0, a1)); } + protected long invoke_J(Object a0, long a1) throws Throwable { return return_J(targetA2(a0, a1)); } + protected float invoke_F(Object a0, long a1) throws Throwable { return return_F(targetA2(a0, a1)); } + protected double invoke_D(Object a0, long a1) throws Throwable { return return_D(targetA2(a0, a1)); } + protected Object invoke_L(long a0, long a1) throws Throwable { return return_L(targetA2(a0, a1)); } + protected int invoke_I(long a0, long a1) throws Throwable { return return_I(targetA2(a0, a1)); } + protected long invoke_J(long a0, long a1) throws Throwable { return return_J(targetA2(a0, a1)); } + protected float invoke_F(long a0, long a1) throws Throwable { return return_F(targetA2(a0, a1)); } + protected double invoke_D(long a0, long a1) throws Throwable { return return_D(targetA2(a0, a1)); } } static class A3 extends Adapter { protected A3(MethodHandle entryPoint) { super(entryPoint); } // to build prototype protected A3(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t) { super(e, i, c, t); } protected A3 makeInstance(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t) { return new A3(e, i, c, t); } - protected Object target(Object a0, Object a1, Object a2) { return invoker.invoke(target, a0, a1, a2); } - protected Object targetA3(Object a0, Object a1, Object a2) { return target(a0, a1, a2); } - protected Object targetA3(Object a0, Object a1, int a2) { return target(a0, a1, a2); } - protected Object targetA3(Object a0, int a1, int a2) { return target(a0, a1, a2); } - protected Object targetA3(int a0, int a1, int a2) { return target(a0, a1, a2); } - protected Object targetA3(Object a0, Object a1, long a2) { return target(a0, a1, a2); } - protected Object targetA3(Object a0, long a1, long a2) { return target(a0, a1, a2); } - protected Object targetA3(long a0, long a1, long a2) { return target(a0, a1, a2); } - protected Object invoke_L(Object a0, Object a1, Object a2) { return return_L(targetA3(a0, a1, a2)); } - protected int invoke_I(Object a0, Object a1, Object a2) { return return_I(targetA3(a0, a1, a2)); } - protected long invoke_J(Object a0, Object a1, Object a2) { return return_J(targetA3(a0, a1, a2)); } - protected float invoke_F(Object a0, Object a1, Object a2) { return return_F(targetA3(a0, a1, a2)); } - protected double invoke_D(Object a0, Object a1, Object a2) { return return_D(targetA3(a0, a1, a2)); } - protected Object invoke_L(Object a0, Object a1, int a2) { return return_L(targetA3(a0, a1, a2)); } - protected int invoke_I(Object a0, Object a1, int a2) { return return_I(targetA3(a0, a1, a2)); } - protected long invoke_J(Object a0, Object a1, int a2) { return return_J(targetA3(a0, a1, a2)); } - protected float invoke_F(Object a0, Object a1, int a2) { return return_F(targetA3(a0, a1, a2)); } - protected double invoke_D(Object a0, Object a1, int a2) { return return_D(targetA3(a0, a1, a2)); } - protected Object invoke_L(Object a0, int a1, int a2) { return return_L(targetA3(a0, a1, a2)); } - protected int invoke_I(Object a0, int a1, int a2) { return return_I(targetA3(a0, a1, a2)); } - protected long invoke_J(Object a0, int a1, int a2) { return return_J(targetA3(a0, a1, a2)); } - protected float invoke_F(Object a0, int a1, int a2) { return return_F(targetA3(a0, a1, a2)); } - protected double invoke_D(Object a0, int a1, int a2) { return return_D(targetA3(a0, a1, a2)); } - protected Object invoke_L(int a0, int a1, int a2) { return return_L(targetA3(a0, a1, a2)); } - protected int invoke_I(int a0, int a1, int a2) { return return_I(targetA3(a0, a1, a2)); } - protected long invoke_J(int a0, int a1, int a2) { return return_J(targetA3(a0, a1, a2)); } - protected float invoke_F(int a0, int a1, int a2) { return return_F(targetA3(a0, a1, a2)); } - protected double invoke_D(int a0, int a1, int a2) { return return_D(targetA3(a0, a1, a2)); } - protected Object invoke_L(Object a0, Object a1, long a2) { return return_L(targetA3(a0, a1, a2)); } - protected int invoke_I(Object a0, Object a1, long a2) { return return_I(targetA3(a0, a1, a2)); } - protected long invoke_J(Object a0, Object a1, long a2) { return return_J(targetA3(a0, a1, a2)); } - protected float invoke_F(Object a0, Object a1, long a2) { return return_F(targetA3(a0, a1, a2)); } - protected double invoke_D(Object a0, Object a1, long a2) { return return_D(targetA3(a0, a1, a2)); } - protected Object invoke_L(Object a0, long a1, long a2) { return return_L(targetA3(a0, a1, a2)); } - protected int invoke_I(Object a0, long a1, long a2) { return return_I(targetA3(a0, a1, a2)); } - protected long invoke_J(Object a0, long a1, long a2) { return return_J(targetA3(a0, a1, a2)); } - protected float invoke_F(Object a0, long a1, long a2) { return return_F(targetA3(a0, a1, a2)); } - protected double invoke_D(Object a0, long a1, long a2) { return return_D(targetA3(a0, a1, a2)); } - protected Object invoke_L(long a0, long a1, long a2) { return return_L(targetA3(a0, a1, a2)); } - protected int invoke_I(long a0, long a1, long a2) { return return_I(targetA3(a0, a1, a2)); } - protected long invoke_J(long a0, long a1, long a2) { return return_J(targetA3(a0, a1, a2)); } - protected float invoke_F(long a0, long a1, long a2) { return return_F(targetA3(a0, a1, a2)); } - protected double invoke_D(long a0, long a1, long a2) { return return_D(targetA3(a0, a1, a2)); } + protected Object target(Object a0, Object a1, Object a2) throws Throwable { return invoker.invoke(target, a0, a1, a2); } + protected Object targetA3(Object a0, Object a1, Object a2) throws Throwable { return target(a0, a1, a2); } + protected Object targetA3(Object a0, Object a1, int a2) throws Throwable { return target(a0, a1, a2); } + protected Object targetA3(Object a0, int a1, int a2) throws Throwable { return target(a0, a1, a2); } + protected Object targetA3(int a0, int a1, int a2) throws Throwable { return target(a0, a1, a2); } + protected Object targetA3(Object a0, Object a1, long a2) throws Throwable { return target(a0, a1, a2); } + protected Object targetA3(Object a0, long a1, long a2) throws Throwable { return target(a0, a1, a2); } + protected Object targetA3(long a0, long a1, long a2) throws Throwable { return target(a0, a1, a2); } + protected Object invoke_L(Object a0, Object a1, Object a2) throws Throwable { return return_L(targetA3(a0, a1, a2)); } + protected int invoke_I(Object a0, Object a1, Object a2) throws Throwable { return return_I(targetA3(a0, a1, a2)); } + protected long invoke_J(Object a0, Object a1, Object a2) throws Throwable { return return_J(targetA3(a0, a1, a2)); } + protected float invoke_F(Object a0, Object a1, Object a2) throws Throwable { return return_F(targetA3(a0, a1, a2)); } + protected double invoke_D(Object a0, Object a1, Object a2) throws Throwable { return return_D(targetA3(a0, a1, a2)); } + protected Object invoke_L(Object a0, Object a1, int a2) throws Throwable { return return_L(targetA3(a0, a1, a2)); } + protected int invoke_I(Object a0, Object a1, int a2) throws Throwable { return return_I(targetA3(a0, a1, a2)); } + protected long invoke_J(Object a0, Object a1, int a2) throws Throwable { return return_J(targetA3(a0, a1, a2)); } + protected float invoke_F(Object a0, Object a1, int a2) throws Throwable { return return_F(targetA3(a0, a1, a2)); } + protected double invoke_D(Object a0, Object a1, int a2) throws Throwable { return return_D(targetA3(a0, a1, a2)); } + protected Object invoke_L(Object a0, int a1, int a2) throws Throwable { return return_L(targetA3(a0, a1, a2)); } + protected int invoke_I(Object a0, int a1, int a2) throws Throwable { return return_I(targetA3(a0, a1, a2)); } + protected long invoke_J(Object a0, int a1, int a2) throws Throwable { return return_J(targetA3(a0, a1, a2)); } + protected float invoke_F(Object a0, int a1, int a2) throws Throwable { return return_F(targetA3(a0, a1, a2)); } + protected double invoke_D(Object a0, int a1, int a2) throws Throwable { return return_D(targetA3(a0, a1, a2)); } + protected Object invoke_L(int a0, int a1, int a2) throws Throwable { return return_L(targetA3(a0, a1, a2)); } + protected int invoke_I(int a0, int a1, int a2) throws Throwable { return return_I(targetA3(a0, a1, a2)); } + protected long invoke_J(int a0, int a1, int a2) throws Throwable { return return_J(targetA3(a0, a1, a2)); } + protected float invoke_F(int a0, int a1, int a2) throws Throwable { return return_F(targetA3(a0, a1, a2)); } + protected double invoke_D(int a0, int a1, int a2) throws Throwable { return return_D(targetA3(a0, a1, a2)); } + protected Object invoke_L(Object a0, Object a1, long a2) throws Throwable { return return_L(targetA3(a0, a1, a2)); } + protected int invoke_I(Object a0, Object a1, long a2) throws Throwable { return return_I(targetA3(a0, a1, a2)); } + protected long invoke_J(Object a0, Object a1, long a2) throws Throwable { return return_J(targetA3(a0, a1, a2)); } + protected float invoke_F(Object a0, Object a1, long a2) throws Throwable { return return_F(targetA3(a0, a1, a2)); } + protected double invoke_D(Object a0, Object a1, long a2) throws Throwable { return return_D(targetA3(a0, a1, a2)); } + protected Object invoke_L(Object a0, long a1, long a2) throws Throwable { return return_L(targetA3(a0, a1, a2)); } + protected int invoke_I(Object a0, long a1, long a2) throws Throwable { return return_I(targetA3(a0, a1, a2)); } + protected long invoke_J(Object a0, long a1, long a2) throws Throwable { return return_J(targetA3(a0, a1, a2)); } + protected float invoke_F(Object a0, long a1, long a2) throws Throwable { return return_F(targetA3(a0, a1, a2)); } + protected double invoke_D(Object a0, long a1, long a2) throws Throwable { return return_D(targetA3(a0, a1, a2)); } + protected Object invoke_L(long a0, long a1, long a2) throws Throwable { return return_L(targetA3(a0, a1, a2)); } + protected int invoke_I(long a0, long a1, long a2) throws Throwable { return return_I(targetA3(a0, a1, a2)); } + protected long invoke_J(long a0, long a1, long a2) throws Throwable { return return_J(targetA3(a0, a1, a2)); } + protected float invoke_F(long a0, long a1, long a2) throws Throwable { return return_F(targetA3(a0, a1, a2)); } + protected double invoke_D(long a0, long a1, long a2) throws Throwable { return return_D(targetA3(a0, a1, a2)); } } //params=[4, 5, 2, 99, 99, 99] static class A4 extends Adapter { protected A4(MethodHandle entryPoint) { super(entryPoint); } // to build prototype protected A4(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t) { super(e, i, c, t); } protected A4 makeInstance(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t) { return new A4(e, i, c, t); } - protected Object target(Object a0, Object a1, Object a2, Object a3) { return invoker.invoke(target, a0, a1, a2, a3); } - protected Object targetA4(Object a0, Object a1, Object a2, Object a3) { return target(a0, a1, a2, a3); } - protected Object targetA4(Object a0, Object a1, Object a2, int a3) { return target(a0, a1, a2, a3); } - protected Object targetA4(Object a0, Object a1, int a2, int a3) { return target(a0, a1, a2, a3); } - protected Object targetA4(Object a0, int a1, int a2, int a3) { return target(a0, a1, a2, a3); } - protected Object targetA4(int a0, int a1, int a2, int a3) { return target(a0, a1, a2, a3); } - protected Object targetA4(Object a0, Object a1, Object a2, long a3) { return target(a0, a1, a2, a3); } - protected Object targetA4(Object a0, Object a1, long a2, long a3) { return target(a0, a1, a2, a3); } - protected Object targetA4(Object a0, long a1, long a2, long a3) { return target(a0, a1, a2, a3); } - protected Object targetA4(long a0, long a1, long a2, long a3) { return target(a0, a1, a2, a3); } - protected Object invoke_L(Object a0, Object a1, Object a2, Object a3) { return return_L(targetA4(a0, a1, a2, a3)); } - protected int invoke_I(Object a0, Object a1, Object a2, Object a3) { return return_I(targetA4(a0, a1, a2, a3)); } - protected long invoke_J(Object a0, Object a1, Object a2, Object a3) { return return_J(targetA4(a0, a1, a2, a3)); } - protected Object invoke_L(Object a0, Object a1, Object a2, int a3) { return return_L(targetA4(a0, a1, a2, a3)); } - protected int invoke_I(Object a0, Object a1, Object a2, int a3) { return return_I(targetA4(a0, a1, a2, a3)); } - protected long invoke_J(Object a0, Object a1, Object a2, int a3) { return return_J(targetA4(a0, a1, a2, a3)); } - protected Object invoke_L(Object a0, Object a1, int a2, int a3) { return return_L(targetA4(a0, a1, a2, a3)); } - protected int invoke_I(Object a0, Object a1, int a2, int a3) { return return_I(targetA4(a0, a1, a2, a3)); } - protected long invoke_J(Object a0, Object a1, int a2, int a3) { return return_J(targetA4(a0, a1, a2, a3)); } - protected Object invoke_L(Object a0, int a1, int a2, int a3) { return return_L(targetA4(a0, a1, a2, a3)); } - protected int invoke_I(Object a0, int a1, int a2, int a3) { return return_I(targetA4(a0, a1, a2, a3)); } - protected long invoke_J(Object a0, int a1, int a2, int a3) { return return_J(targetA4(a0, a1, a2, a3)); } - protected Object invoke_L(int a0, int a1, int a2, int a3) { return return_L(targetA4(a0, a1, a2, a3)); } - protected int invoke_I(int a0, int a1, int a2, int a3) { return return_I(targetA4(a0, a1, a2, a3)); } - protected long invoke_J(int a0, int a1, int a2, int a3) { return return_J(targetA4(a0, a1, a2, a3)); } - protected Object invoke_L(Object a0, Object a1, Object a2, long a3) { return return_L(targetA4(a0, a1, a2, a3)); } - protected int invoke_I(Object a0, Object a1, Object a2, long a3) { return return_I(targetA4(a0, a1, a2, a3)); } - protected long invoke_J(Object a0, Object a1, Object a2, long a3) { return return_J(targetA4(a0, a1, a2, a3)); } - protected Object invoke_L(Object a0, Object a1, long a2, long a3) { return return_L(targetA4(a0, a1, a2, a3)); } - protected int invoke_I(Object a0, Object a1, long a2, long a3) { return return_I(targetA4(a0, a1, a2, a3)); } - protected long invoke_J(Object a0, Object a1, long a2, long a3) { return return_J(targetA4(a0, a1, a2, a3)); } - protected Object invoke_L(Object a0, long a1, long a2, long a3) { return return_L(targetA4(a0, a1, a2, a3)); } - protected int invoke_I(Object a0, long a1, long a2, long a3) { return return_I(targetA4(a0, a1, a2, a3)); } - protected long invoke_J(Object a0, long a1, long a2, long a3) { return return_J(targetA4(a0, a1, a2, a3)); } - protected Object invoke_L(long a0, long a1, long a2, long a3) { return return_L(targetA4(a0, a1, a2, a3)); } - protected int invoke_I(long a0, long a1, long a2, long a3) { return return_I(targetA4(a0, a1, a2, a3)); } - protected long invoke_J(long a0, long a1, long a2, long a3) { return return_J(targetA4(a0, a1, a2, a3)); } + protected Object target(Object a0, Object a1, Object a2, Object a3) throws Throwable { return invoker.invoke(target, a0, a1, a2, a3); } + protected Object targetA4(Object a0, Object a1, Object a2, Object a3) throws Throwable { return target(a0, a1, a2, a3); } + protected Object targetA4(Object a0, Object a1, Object a2, int a3) throws Throwable { return target(a0, a1, a2, a3); } + protected Object targetA4(Object a0, Object a1, int a2, int a3) throws Throwable { return target(a0, a1, a2, a3); } + protected Object targetA4(Object a0, int a1, int a2, int a3) throws Throwable { return target(a0, a1, a2, a3); } + protected Object targetA4(int a0, int a1, int a2, int a3) throws Throwable { return target(a0, a1, a2, a3); } + protected Object targetA4(Object a0, Object a1, Object a2, long a3) throws Throwable { return target(a0, a1, a2, a3); } + protected Object targetA4(Object a0, Object a1, long a2, long a3) throws Throwable { return target(a0, a1, a2, a3); } + protected Object targetA4(Object a0, long a1, long a2, long a3) throws Throwable { return target(a0, a1, a2, a3); } + protected Object targetA4(long a0, long a1, long a2, long a3) throws Throwable { return target(a0, a1, a2, a3); } + protected Object invoke_L(Object a0, Object a1, Object a2, Object a3) throws Throwable { return return_L(targetA4(a0, a1, a2, a3)); } + protected int invoke_I(Object a0, Object a1, Object a2, Object a3) throws Throwable { return return_I(targetA4(a0, a1, a2, a3)); } + protected long invoke_J(Object a0, Object a1, Object a2, Object a3) throws Throwable { return return_J(targetA4(a0, a1, a2, a3)); } + protected Object invoke_L(Object a0, Object a1, Object a2, int a3) throws Throwable { return return_L(targetA4(a0, a1, a2, a3)); } + protected int invoke_I(Object a0, Object a1, Object a2, int a3) throws Throwable { return return_I(targetA4(a0, a1, a2, a3)); } + protected long invoke_J(Object a0, Object a1, Object a2, int a3) throws Throwable { return return_J(targetA4(a0, a1, a2, a3)); } + protected Object invoke_L(Object a0, Object a1, int a2, int a3) throws Throwable { return return_L(targetA4(a0, a1, a2, a3)); } + protected int invoke_I(Object a0, Object a1, int a2, int a3) throws Throwable { return return_I(targetA4(a0, a1, a2, a3)); } + protected long invoke_J(Object a0, Object a1, int a2, int a3) throws Throwable { return return_J(targetA4(a0, a1, a2, a3)); } + protected Object invoke_L(Object a0, int a1, int a2, int a3) throws Throwable { return return_L(targetA4(a0, a1, a2, a3)); } + protected int invoke_I(Object a0, int a1, int a2, int a3) throws Throwable { return return_I(targetA4(a0, a1, a2, a3)); } + protected long invoke_J(Object a0, int a1, int a2, int a3) throws Throwable { return return_J(targetA4(a0, a1, a2, a3)); } + protected Object invoke_L(int a0, int a1, int a2, int a3) throws Throwable { return return_L(targetA4(a0, a1, a2, a3)); } + protected int invoke_I(int a0, int a1, int a2, int a3) throws Throwable { return return_I(targetA4(a0, a1, a2, a3)); } + protected long invoke_J(int a0, int a1, int a2, int a3) throws Throwable { return return_J(targetA4(a0, a1, a2, a3)); } + protected Object invoke_L(Object a0, Object a1, Object a2, long a3) throws Throwable { return return_L(targetA4(a0, a1, a2, a3)); } + protected int invoke_I(Object a0, Object a1, Object a2, long a3) throws Throwable { return return_I(targetA4(a0, a1, a2, a3)); } + protected long invoke_J(Object a0, Object a1, Object a2, long a3) throws Throwable { return return_J(targetA4(a0, a1, a2, a3)); } + protected Object invoke_L(Object a0, Object a1, long a2, long a3) throws Throwable { return return_L(targetA4(a0, a1, a2, a3)); } + protected int invoke_I(Object a0, Object a1, long a2, long a3) throws Throwable { return return_I(targetA4(a0, a1, a2, a3)); } + protected long invoke_J(Object a0, Object a1, long a2, long a3) throws Throwable { return return_J(targetA4(a0, a1, a2, a3)); } + protected Object invoke_L(Object a0, long a1, long a2, long a3) throws Throwable { return return_L(targetA4(a0, a1, a2, a3)); } + protected int invoke_I(Object a0, long a1, long a2, long a3) throws Throwable { return return_I(targetA4(a0, a1, a2, a3)); } + protected long invoke_J(Object a0, long a1, long a2, long a3) throws Throwable { return return_J(targetA4(a0, a1, a2, a3)); } + protected Object invoke_L(long a0, long a1, long a2, long a3) throws Throwable { return return_L(targetA4(a0, a1, a2, a3)); } + protected int invoke_I(long a0, long a1, long a2, long a3) throws Throwable { return return_I(targetA4(a0, a1, a2, a3)); } + protected long invoke_J(long a0, long a1, long a2, long a3) throws Throwable { return return_J(targetA4(a0, a1, a2, a3)); } } static class A5 extends Adapter { protected A5(MethodHandle entryPoint) { super(entryPoint); } // to build prototype protected A5(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t) { super(e, i, c, t); } protected A5 makeInstance(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t) { return new A5(e, i, c, t); } - protected Object target(Object a0, Object a1, Object a2, Object a3, Object a4) { return invoker.invoke(target, a0, a1, a2, a3, a4); } - protected Object targetA5(Object a0, Object a1, Object a2, Object a3, Object a4) { return target(a0, a1, a2, a3, a4); } - protected Object targetA5(Object a0, Object a1, Object a2, Object a3, int a4) { return target(a0, a1, a2, a3, a4); } - protected Object targetA5(Object a0, Object a1, Object a2, int a3, int a4) { return target(a0, a1, a2, a3, a4); } - protected Object targetA5(Object a0, Object a1, int a2, int a3, int a4) { return target(a0, a1, a2, a3, a4); } - protected Object targetA5(Object a0, int a1, int a2, int a3, int a4) { return target(a0, a1, a2, a3, a4); } - protected Object targetA5(int a0, int a1, int a2, int a3, int a4) { return target(a0, a1, a2, a3, a4); } - protected Object targetA5(Object a0, Object a1, Object a2, Object a3, long a4) { return target(a0, a1, a2, a3, a4); } - protected Object targetA5(Object a0, Object a1, Object a2, long a3, long a4) { return target(a0, a1, a2, a3, a4); } - protected Object targetA5(Object a0, Object a1, long a2, long a3, long a4) { return target(a0, a1, a2, a3, a4); } - protected Object targetA5(Object a0, long a1, long a2, long a3, long a4) { return target(a0, a1, a2, a3, a4); } - protected Object targetA5(long a0, long a1, long a2, long a3, long a4) { return target(a0, a1, a2, a3, a4); } - protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, Object a4) { return return_L(targetA5(a0, a1, a2, a3, a4)); } - protected int invoke_I(Object a0, Object a1, Object a2, Object a3, Object a4) { return return_I(targetA5(a0, a1, a2, a3, a4)); } - protected long invoke_J(Object a0, Object a1, Object a2, Object a3, Object a4) { return return_J(targetA5(a0, a1, a2, a3, a4)); } - protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, int a4) { return return_L(targetA5(a0, a1, a2, a3, a4)); } - protected int invoke_I(Object a0, Object a1, Object a2, Object a3, int a4) { return return_I(targetA5(a0, a1, a2, a3, a4)); } - protected long invoke_J(Object a0, Object a1, Object a2, Object a3, int a4) { return return_J(targetA5(a0, a1, a2, a3, a4)); } - protected Object invoke_L(Object a0, Object a1, Object a2, int a3, int a4) { return return_L(targetA5(a0, a1, a2, a3, a4)); } - protected int invoke_I(Object a0, Object a1, Object a2, int a3, int a4) { return return_I(targetA5(a0, a1, a2, a3, a4)); } - protected long invoke_J(Object a0, Object a1, Object a2, int a3, int a4) { return return_J(targetA5(a0, a1, a2, a3, a4)); } - protected Object invoke_L(Object a0, Object a1, int a2, int a3, int a4) { return return_L(targetA5(a0, a1, a2, a3, a4)); } - protected int invoke_I(Object a0, Object a1, int a2, int a3, int a4) { return return_I(targetA5(a0, a1, a2, a3, a4)); } - protected long invoke_J(Object a0, Object a1, int a2, int a3, int a4) { return return_J(targetA5(a0, a1, a2, a3, a4)); } - protected Object invoke_L(Object a0, int a1, int a2, int a3, int a4) { return return_L(targetA5(a0, a1, a2, a3, a4)); } - protected int invoke_I(Object a0, int a1, int a2, int a3, int a4) { return return_I(targetA5(a0, a1, a2, a3, a4)); } - protected long invoke_J(Object a0, int a1, int a2, int a3, int a4) { return return_J(targetA5(a0, a1, a2, a3, a4)); } - protected Object invoke_L(int a0, int a1, int a2, int a3, int a4) { return return_L(targetA5(a0, a1, a2, a3, a4)); } - protected int invoke_I(int a0, int a1, int a2, int a3, int a4) { return return_I(targetA5(a0, a1, a2, a3, a4)); } - protected long invoke_J(int a0, int a1, int a2, int a3, int a4) { return return_J(targetA5(a0, a1, a2, a3, a4)); } - protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, long a4) { return return_L(targetA5(a0, a1, a2, a3, a4)); } - protected int invoke_I(Object a0, Object a1, Object a2, Object a3, long a4) { return return_I(targetA5(a0, a1, a2, a3, a4)); } - protected long invoke_J(Object a0, Object a1, Object a2, Object a3, long a4) { return return_J(targetA5(a0, a1, a2, a3, a4)); } - protected Object invoke_L(Object a0, Object a1, Object a2, long a3, long a4) { return return_L(targetA5(a0, a1, a2, a3, a4)); } - protected int invoke_I(Object a0, Object a1, Object a2, long a3, long a4) { return return_I(targetA5(a0, a1, a2, a3, a4)); } - protected long invoke_J(Object a0, Object a1, Object a2, long a3, long a4) { return return_J(targetA5(a0, a1, a2, a3, a4)); } - protected Object invoke_L(Object a0, Object a1, long a2, long a3, long a4) { return return_L(targetA5(a0, a1, a2, a3, a4)); } - protected int invoke_I(Object a0, Object a1, long a2, long a3, long a4) { return return_I(targetA5(a0, a1, a2, a3, a4)); } - protected long invoke_J(Object a0, Object a1, long a2, long a3, long a4) { return return_J(targetA5(a0, a1, a2, a3, a4)); } - protected Object invoke_L(Object a0, long a1, long a2, long a3, long a4) { return return_L(targetA5(a0, a1, a2, a3, a4)); } - protected int invoke_I(Object a0, long a1, long a2, long a3, long a4) { return return_I(targetA5(a0, a1, a2, a3, a4)); } - protected long invoke_J(Object a0, long a1, long a2, long a3, long a4) { return return_J(targetA5(a0, a1, a2, a3, a4)); } - protected Object invoke_L(long a0, long a1, long a2, long a3, long a4) { return return_L(targetA5(a0, a1, a2, a3, a4)); } - protected int invoke_I(long a0, long a1, long a2, long a3, long a4) { return return_I(targetA5(a0, a1, a2, a3, a4)); } - protected long invoke_J(long a0, long a1, long a2, long a3, long a4) { return return_J(targetA5(a0, a1, a2, a3, a4)); } + protected Object target(Object a0, Object a1, Object a2, Object a3, Object a4) throws Throwable { return invoker.invoke(target, a0, a1, a2, a3, a4); } + protected Object targetA5(Object a0, Object a1, Object a2, Object a3, Object a4) throws Throwable { return target(a0, a1, a2, a3, a4); } + protected Object targetA5(Object a0, Object a1, Object a2, Object a3, int a4) throws Throwable { return target(a0, a1, a2, a3, a4); } + protected Object targetA5(Object a0, Object a1, Object a2, int a3, int a4) throws Throwable { return target(a0, a1, a2, a3, a4); } + protected Object targetA5(Object a0, Object a1, int a2, int a3, int a4) throws Throwable { return target(a0, a1, a2, a3, a4); } + protected Object targetA5(Object a0, int a1, int a2, int a3, int a4) throws Throwable { return target(a0, a1, a2, a3, a4); } + protected Object targetA5(int a0, int a1, int a2, int a3, int a4) throws Throwable { return target(a0, a1, a2, a3, a4); } + protected Object targetA5(Object a0, Object a1, Object a2, Object a3, long a4) throws Throwable { return target(a0, a1, a2, a3, a4); } + protected Object targetA5(Object a0, Object a1, Object a2, long a3, long a4) throws Throwable { return target(a0, a1, a2, a3, a4); } + protected Object targetA5(Object a0, Object a1, long a2, long a3, long a4) throws Throwable { return target(a0, a1, a2, a3, a4); } + protected Object targetA5(Object a0, long a1, long a2, long a3, long a4) throws Throwable { return target(a0, a1, a2, a3, a4); } + protected Object targetA5(long a0, long a1, long a2, long a3, long a4) throws Throwable { return target(a0, a1, a2, a3, a4); } + protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, Object a4) throws Throwable { return return_L(targetA5(a0, a1, a2, a3, a4)); } + protected int invoke_I(Object a0, Object a1, Object a2, Object a3, Object a4) throws Throwable { return return_I(targetA5(a0, a1, a2, a3, a4)); } + protected long invoke_J(Object a0, Object a1, Object a2, Object a3, Object a4) throws Throwable { return return_J(targetA5(a0, a1, a2, a3, a4)); } + protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, int a4) throws Throwable { return return_L(targetA5(a0, a1, a2, a3, a4)); } + protected int invoke_I(Object a0, Object a1, Object a2, Object a3, int a4) throws Throwable { return return_I(targetA5(a0, a1, a2, a3, a4)); } + protected long invoke_J(Object a0, Object a1, Object a2, Object a3, int a4) throws Throwable { return return_J(targetA5(a0, a1, a2, a3, a4)); } + protected Object invoke_L(Object a0, Object a1, Object a2, int a3, int a4) throws Throwable { return return_L(targetA5(a0, a1, a2, a3, a4)); } + protected int invoke_I(Object a0, Object a1, Object a2, int a3, int a4) throws Throwable { return return_I(targetA5(a0, a1, a2, a3, a4)); } + protected long invoke_J(Object a0, Object a1, Object a2, int a3, int a4) throws Throwable { return return_J(targetA5(a0, a1, a2, a3, a4)); } + protected Object invoke_L(Object a0, Object a1, int a2, int a3, int a4) throws Throwable { return return_L(targetA5(a0, a1, a2, a3, a4)); } + protected int invoke_I(Object a0, Object a1, int a2, int a3, int a4) throws Throwable { return return_I(targetA5(a0, a1, a2, a3, a4)); } + protected long invoke_J(Object a0, Object a1, int a2, int a3, int a4) throws Throwable { return return_J(targetA5(a0, a1, a2, a3, a4)); } + protected Object invoke_L(Object a0, int a1, int a2, int a3, int a4) throws Throwable { return return_L(targetA5(a0, a1, a2, a3, a4)); } + protected int invoke_I(Object a0, int a1, int a2, int a3, int a4) throws Throwable { return return_I(targetA5(a0, a1, a2, a3, a4)); } + protected long invoke_J(Object a0, int a1, int a2, int a3, int a4) throws Throwable { return return_J(targetA5(a0, a1, a2, a3, a4)); } + protected Object invoke_L(int a0, int a1, int a2, int a3, int a4) throws Throwable { return return_L(targetA5(a0, a1, a2, a3, a4)); } + protected int invoke_I(int a0, int a1, int a2, int a3, int a4) throws Throwable { return return_I(targetA5(a0, a1, a2, a3, a4)); } + protected long invoke_J(int a0, int a1, int a2, int a3, int a4) throws Throwable { return return_J(targetA5(a0, a1, a2, a3, a4)); } + protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, long a4) throws Throwable { return return_L(targetA5(a0, a1, a2, a3, a4)); } + protected int invoke_I(Object a0, Object a1, Object a2, Object a3, long a4) throws Throwable { return return_I(targetA5(a0, a1, a2, a3, a4)); } + protected long invoke_J(Object a0, Object a1, Object a2, Object a3, long a4) throws Throwable { return return_J(targetA5(a0, a1, a2, a3, a4)); } + protected Object invoke_L(Object a0, Object a1, Object a2, long a3, long a4) throws Throwable { return return_L(targetA5(a0, a1, a2, a3, a4)); } + protected int invoke_I(Object a0, Object a1, Object a2, long a3, long a4) throws Throwable { return return_I(targetA5(a0, a1, a2, a3, a4)); } + protected long invoke_J(Object a0, Object a1, Object a2, long a3, long a4) throws Throwable { return return_J(targetA5(a0, a1, a2, a3, a4)); } + protected Object invoke_L(Object a0, Object a1, long a2, long a3, long a4) throws Throwable { return return_L(targetA5(a0, a1, a2, a3, a4)); } + protected int invoke_I(Object a0, Object a1, long a2, long a3, long a4) throws Throwable { return return_I(targetA5(a0, a1, a2, a3, a4)); } + protected long invoke_J(Object a0, Object a1, long a2, long a3, long a4) throws Throwable { return return_J(targetA5(a0, a1, a2, a3, a4)); } + protected Object invoke_L(Object a0, long a1, long a2, long a3, long a4) throws Throwable { return return_L(targetA5(a0, a1, a2, a3, a4)); } + protected int invoke_I(Object a0, long a1, long a2, long a3, long a4) throws Throwable { return return_I(targetA5(a0, a1, a2, a3, a4)); } + protected long invoke_J(Object a0, long a1, long a2, long a3, long a4) throws Throwable { return return_J(targetA5(a0, a1, a2, a3, a4)); } + protected Object invoke_L(long a0, long a1, long a2, long a3, long a4) throws Throwable { return return_L(targetA5(a0, a1, a2, a3, a4)); } + protected int invoke_I(long a0, long a1, long a2, long a3, long a4) throws Throwable { return return_I(targetA5(a0, a1, a2, a3, a4)); } + protected long invoke_J(long a0, long a1, long a2, long a3, long a4) throws Throwable { return return_J(targetA5(a0, a1, a2, a3, a4)); } } //params=[6, 10, 2, 99, 0, 99] static class A6 extends Adapter { protected A6(MethodHandle entryPoint) { super(entryPoint); } // to build prototype protected A6(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t) { super(e, i, c, t); } protected A6 makeInstance(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t) { return new A6(e, i, c, t); } - protected Object target(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5) { return invoker.invoke(target, a0, a1, a2, a3, a4, a5); } - protected Object targetA6(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5) { return target(a0, a1, a2, a3, a4, a5); } - protected Object targetA6(Object a0, Object a1, Object a2, Object a3, Object a4, long a5) { return target(a0, a1, a2, a3, a4, a5); } - protected Object targetA6(Object a0, Object a1, Object a2, Object a3, long a4, long a5) { return target(a0, a1, a2, a3, a4, a5); } - protected Object targetA6(Object a0, Object a1, Object a2, long a3, long a4, long a5) { return target(a0, a1, a2, a3, a4, a5); } - protected Object targetA6(Object a0, Object a1, long a2, long a3, long a4, long a5) { return target(a0, a1, a2, a3, a4, a5); } - protected Object targetA6(Object a0, long a1, long a2, long a3, long a4, long a5) { return target(a0, a1, a2, a3, a4, a5); } - protected Object targetA6(long a0, long a1, long a2, long a3, long a4, long a5) { return target(a0, a1, a2, a3, a4, a5); } - protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5) { return return_L(targetA6(a0, a1, a2, a3, a4, a5)); } - protected int invoke_I(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5) { return return_I(targetA6(a0, a1, a2, a3, a4, a5)); } - protected long invoke_J(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5) { return return_J(targetA6(a0, a1, a2, a3, a4, a5)); } - protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, Object a4, long a5) { return return_L(targetA6(a0, a1, a2, a3, a4, a5)); } - protected int invoke_I(Object a0, Object a1, Object a2, Object a3, Object a4, long a5) { return return_I(targetA6(a0, a1, a2, a3, a4, a5)); } - protected long invoke_J(Object a0, Object a1, Object a2, Object a3, Object a4, long a5) { return return_J(targetA6(a0, a1, a2, a3, a4, a5)); } - protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, long a4, long a5) { return return_L(targetA6(a0, a1, a2, a3, a4, a5)); } - protected int invoke_I(Object a0, Object a1, Object a2, Object a3, long a4, long a5) { return return_I(targetA6(a0, a1, a2, a3, a4, a5)); } - protected long invoke_J(Object a0, Object a1, Object a2, Object a3, long a4, long a5) { return return_J(targetA6(a0, a1, a2, a3, a4, a5)); } - protected Object invoke_L(Object a0, Object a1, Object a2, long a3, long a4, long a5) { return return_L(targetA6(a0, a1, a2, a3, a4, a5)); } - protected int invoke_I(Object a0, Object a1, Object a2, long a3, long a4, long a5) { return return_I(targetA6(a0, a1, a2, a3, a4, a5)); } - protected long invoke_J(Object a0, Object a1, Object a2, long a3, long a4, long a5) { return return_J(targetA6(a0, a1, a2, a3, a4, a5)); } - protected Object invoke_L(Object a0, Object a1, long a2, long a3, long a4, long a5) { return return_L(targetA6(a0, a1, a2, a3, a4, a5)); } - protected int invoke_I(Object a0, Object a1, long a2, long a3, long a4, long a5) { return return_I(targetA6(a0, a1, a2, a3, a4, a5)); } - protected long invoke_J(Object a0, Object a1, long a2, long a3, long a4, long a5) { return return_J(targetA6(a0, a1, a2, a3, a4, a5)); } - protected Object invoke_L(Object a0, long a1, long a2, long a3, long a4, long a5) { return return_L(targetA6(a0, a1, a2, a3, a4, a5)); } - protected int invoke_I(Object a0, long a1, long a2, long a3, long a4, long a5) { return return_I(targetA6(a0, a1, a2, a3, a4, a5)); } - protected long invoke_J(Object a0, long a1, long a2, long a3, long a4, long a5) { return return_J(targetA6(a0, a1, a2, a3, a4, a5)); } - protected Object invoke_L(long a0, long a1, long a2, long a3, long a4, long a5) { return return_L(targetA6(a0, a1, a2, a3, a4, a5)); } - protected int invoke_I(long a0, long a1, long a2, long a3, long a4, long a5) { return return_I(targetA6(a0, a1, a2, a3, a4, a5)); } - protected long invoke_J(long a0, long a1, long a2, long a3, long a4, long a5) { return return_J(targetA6(a0, a1, a2, a3, a4, a5)); } + protected Object target(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5) throws Throwable { return invoker.invoke(target, a0, a1, a2, a3, a4, a5); } + protected Object targetA6(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5) throws Throwable { return target(a0, a1, a2, a3, a4, a5); } + protected Object targetA6(Object a0, Object a1, Object a2, Object a3, Object a4, long a5) throws Throwable { return target(a0, a1, a2, a3, a4, a5); } + protected Object targetA6(Object a0, Object a1, Object a2, Object a3, long a4, long a5) throws Throwable { return target(a0, a1, a2, a3, a4, a5); } + protected Object targetA6(Object a0, Object a1, Object a2, long a3, long a4, long a5) throws Throwable { return target(a0, a1, a2, a3, a4, a5); } + protected Object targetA6(Object a0, Object a1, long a2, long a3, long a4, long a5) throws Throwable { return target(a0, a1, a2, a3, a4, a5); } + protected Object targetA6(Object a0, long a1, long a2, long a3, long a4, long a5) throws Throwable { return target(a0, a1, a2, a3, a4, a5); } + protected Object targetA6(long a0, long a1, long a2, long a3, long a4, long a5) throws Throwable { return target(a0, a1, a2, a3, a4, a5); } + protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5) throws Throwable { return return_L(targetA6(a0, a1, a2, a3, a4, a5)); } + protected int invoke_I(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5) throws Throwable { return return_I(targetA6(a0, a1, a2, a3, a4, a5)); } + protected long invoke_J(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5) throws Throwable { return return_J(targetA6(a0, a1, a2, a3, a4, a5)); } + protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, Object a4, long a5) throws Throwable { return return_L(targetA6(a0, a1, a2, a3, a4, a5)); } + protected int invoke_I(Object a0, Object a1, Object a2, Object a3, Object a4, long a5) throws Throwable { return return_I(targetA6(a0, a1, a2, a3, a4, a5)); } + protected long invoke_J(Object a0, Object a1, Object a2, Object a3, Object a4, long a5) throws Throwable { return return_J(targetA6(a0, a1, a2, a3, a4, a5)); } + protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, long a4, long a5) throws Throwable { return return_L(targetA6(a0, a1, a2, a3, a4, a5)); } + protected int invoke_I(Object a0, Object a1, Object a2, Object a3, long a4, long a5) throws Throwable { return return_I(targetA6(a0, a1, a2, a3, a4, a5)); } + protected long invoke_J(Object a0, Object a1, Object a2, Object a3, long a4, long a5) throws Throwable { return return_J(targetA6(a0, a1, a2, a3, a4, a5)); } + protected Object invoke_L(Object a0, Object a1, Object a2, long a3, long a4, long a5) throws Throwable { return return_L(targetA6(a0, a1, a2, a3, a4, a5)); } + protected int invoke_I(Object a0, Object a1, Object a2, long a3, long a4, long a5) throws Throwable { return return_I(targetA6(a0, a1, a2, a3, a4, a5)); } + protected long invoke_J(Object a0, Object a1, Object a2, long a3, long a4, long a5) throws Throwable { return return_J(targetA6(a0, a1, a2, a3, a4, a5)); } + protected Object invoke_L(Object a0, Object a1, long a2, long a3, long a4, long a5) throws Throwable { return return_L(targetA6(a0, a1, a2, a3, a4, a5)); } + protected int invoke_I(Object a0, Object a1, long a2, long a3, long a4, long a5) throws Throwable { return return_I(targetA6(a0, a1, a2, a3, a4, a5)); } + protected long invoke_J(Object a0, Object a1, long a2, long a3, long a4, long a5) throws Throwable { return return_J(targetA6(a0, a1, a2, a3, a4, a5)); } + protected Object invoke_L(Object a0, long a1, long a2, long a3, long a4, long a5) throws Throwable { return return_L(targetA6(a0, a1, a2, a3, a4, a5)); } + protected int invoke_I(Object a0, long a1, long a2, long a3, long a4, long a5) throws Throwable { return return_I(targetA6(a0, a1, a2, a3, a4, a5)); } + protected long invoke_J(Object a0, long a1, long a2, long a3, long a4, long a5) throws Throwable { return return_J(targetA6(a0, a1, a2, a3, a4, a5)); } + protected Object invoke_L(long a0, long a1, long a2, long a3, long a4, long a5) throws Throwable { return return_L(targetA6(a0, a1, a2, a3, a4, a5)); } + protected int invoke_I(long a0, long a1, long a2, long a3, long a4, long a5) throws Throwable { return return_I(targetA6(a0, a1, a2, a3, a4, a5)); } + protected long invoke_J(long a0, long a1, long a2, long a3, long a4, long a5) throws Throwable { return return_J(targetA6(a0, a1, a2, a3, a4, a5)); } } static class A7 extends Adapter { protected A7(MethodHandle entryPoint) { super(entryPoint); } // to build prototype protected A7(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t) { super(e, i, c, t); } protected A7 makeInstance(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t) { return new A7(e, i, c, t); } - protected Object target(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6) { return invoker.invoke(target, a0, a1, a2, a3, a4, a5, a6); } - protected Object targetA7(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6) { return target(a0, a1, a2, a3, a4, a5, a6); } - protected Object targetA7(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, long a6) { return target(a0, a1, a2, a3, a4, a5, a6); } - protected Object targetA7(Object a0, Object a1, Object a2, Object a3, Object a4, long a5, long a6) { return target(a0, a1, a2, a3, a4, a5, a6); } - protected Object targetA7(Object a0, Object a1, Object a2, Object a3, long a4, long a5, long a6) { return target(a0, a1, a2, a3, a4, a5, a6); } - protected Object targetA7(Object a0, Object a1, Object a2, long a3, long a4, long a5, long a6) { return target(a0, a1, a2, a3, a4, a5, a6); } - protected Object targetA7(Object a0, Object a1, long a2, long a3, long a4, long a5, long a6) { return target(a0, a1, a2, a3, a4, a5, a6); } - protected Object targetA7(Object a0, long a1, long a2, long a3, long a4, long a5, long a6) { return target(a0, a1, a2, a3, a4, a5, a6); } - protected Object targetA7(long a0, long a1, long a2, long a3, long a4, long a5, long a6) { return target(a0, a1, a2, a3, a4, a5, a6); } - protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6) { return return_L(targetA7(a0, a1, a2, a3, a4, a5, a6)); } - protected int invoke_I(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6) { return return_I(targetA7(a0, a1, a2, a3, a4, a5, a6)); } - protected long invoke_J(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6) { return return_J(targetA7(a0, a1, a2, a3, a4, a5, a6)); } - protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, long a6) { return return_L(targetA7(a0, a1, a2, a3, a4, a5, a6)); } - protected int invoke_I(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, long a6) { return return_I(targetA7(a0, a1, a2, a3, a4, a5, a6)); } - protected long invoke_J(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, long a6) { return return_J(targetA7(a0, a1, a2, a3, a4, a5, a6)); } - protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, Object a4, long a5, long a6) { return return_L(targetA7(a0, a1, a2, a3, a4, a5, a6)); } - protected int invoke_I(Object a0, Object a1, Object a2, Object a3, Object a4, long a5, long a6) { return return_I(targetA7(a0, a1, a2, a3, a4, a5, a6)); } - protected long invoke_J(Object a0, Object a1, Object a2, Object a3, Object a4, long a5, long a6) { return return_J(targetA7(a0, a1, a2, a3, a4, a5, a6)); } - protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, long a4, long a5, long a6) { return return_L(targetA7(a0, a1, a2, a3, a4, a5, a6)); } - protected int invoke_I(Object a0, Object a1, Object a2, Object a3, long a4, long a5, long a6) { return return_I(targetA7(a0, a1, a2, a3, a4, a5, a6)); } - protected long invoke_J(Object a0, Object a1, Object a2, Object a3, long a4, long a5, long a6) { return return_J(targetA7(a0, a1, a2, a3, a4, a5, a6)); } - protected Object invoke_L(Object a0, Object a1, Object a2, long a3, long a4, long a5, long a6) { return return_L(targetA7(a0, a1, a2, a3, a4, a5, a6)); } - protected int invoke_I(Object a0, Object a1, Object a2, long a3, long a4, long a5, long a6) { return return_I(targetA7(a0, a1, a2, a3, a4, a5, a6)); } - protected long invoke_J(Object a0, Object a1, Object a2, long a3, long a4, long a5, long a6) { return return_J(targetA7(a0, a1, a2, a3, a4, a5, a6)); } - protected Object invoke_L(Object a0, Object a1, long a2, long a3, long a4, long a5, long a6) { return return_L(targetA7(a0, a1, a2, a3, a4, a5, a6)); } - protected int invoke_I(Object a0, Object a1, long a2, long a3, long a4, long a5, long a6) { return return_I(targetA7(a0, a1, a2, a3, a4, a5, a6)); } - protected long invoke_J(Object a0, Object a1, long a2, long a3, long a4, long a5, long a6) { return return_J(targetA7(a0, a1, a2, a3, a4, a5, a6)); } - protected Object invoke_L(Object a0, long a1, long a2, long a3, long a4, long a5, long a6) { return return_L(targetA7(a0, a1, a2, a3, a4, a5, a6)); } - protected int invoke_I(Object a0, long a1, long a2, long a3, long a4, long a5, long a6) { return return_I(targetA7(a0, a1, a2, a3, a4, a5, a6)); } - protected long invoke_J(Object a0, long a1, long a2, long a3, long a4, long a5, long a6) { return return_J(targetA7(a0, a1, a2, a3, a4, a5, a6)); } - protected Object invoke_L(long a0, long a1, long a2, long a3, long a4, long a5, long a6) { return return_L(targetA7(a0, a1, a2, a3, a4, a5, a6)); } - protected int invoke_I(long a0, long a1, long a2, long a3, long a4, long a5, long a6) { return return_I(targetA7(a0, a1, a2, a3, a4, a5, a6)); } - protected long invoke_J(long a0, long a1, long a2, long a3, long a4, long a5, long a6) { return return_J(targetA7(a0, a1, a2, a3, a4, a5, a6)); } + protected Object target(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6) throws Throwable { return invoker.invoke(target, a0, a1, a2, a3, a4, a5, a6); } + protected Object targetA7(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6); } + protected Object targetA7(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, long a6) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6); } + protected Object targetA7(Object a0, Object a1, Object a2, Object a3, Object a4, long a5, long a6) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6); } + protected Object targetA7(Object a0, Object a1, Object a2, Object a3, long a4, long a5, long a6) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6); } + protected Object targetA7(Object a0, Object a1, Object a2, long a3, long a4, long a5, long a6) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6); } + protected Object targetA7(Object a0, Object a1, long a2, long a3, long a4, long a5, long a6) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6); } + protected Object targetA7(Object a0, long a1, long a2, long a3, long a4, long a5, long a6) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6); } + protected Object targetA7(long a0, long a1, long a2, long a3, long a4, long a5, long a6) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6); } + protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6) throws Throwable { return return_L(targetA7(a0, a1, a2, a3, a4, a5, a6)); } + protected int invoke_I(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6) throws Throwable { return return_I(targetA7(a0, a1, a2, a3, a4, a5, a6)); } + protected long invoke_J(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6) throws Throwable { return return_J(targetA7(a0, a1, a2, a3, a4, a5, a6)); } + protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, long a6) throws Throwable { return return_L(targetA7(a0, a1, a2, a3, a4, a5, a6)); } + protected int invoke_I(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, long a6) throws Throwable { return return_I(targetA7(a0, a1, a2, a3, a4, a5, a6)); } + protected long invoke_J(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, long a6) throws Throwable { return return_J(targetA7(a0, a1, a2, a3, a4, a5, a6)); } + protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, Object a4, long a5, long a6) throws Throwable { return return_L(targetA7(a0, a1, a2, a3, a4, a5, a6)); } + protected int invoke_I(Object a0, Object a1, Object a2, Object a3, Object a4, long a5, long a6) throws Throwable { return return_I(targetA7(a0, a1, a2, a3, a4, a5, a6)); } + protected long invoke_J(Object a0, Object a1, Object a2, Object a3, Object a4, long a5, long a6) throws Throwable { return return_J(targetA7(a0, a1, a2, a3, a4, a5, a6)); } + protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, long a4, long a5, long a6) throws Throwable { return return_L(targetA7(a0, a1, a2, a3, a4, a5, a6)); } + protected int invoke_I(Object a0, Object a1, Object a2, Object a3, long a4, long a5, long a6) throws Throwable { return return_I(targetA7(a0, a1, a2, a3, a4, a5, a6)); } + protected long invoke_J(Object a0, Object a1, Object a2, Object a3, long a4, long a5, long a6) throws Throwable { return return_J(targetA7(a0, a1, a2, a3, a4, a5, a6)); } + protected Object invoke_L(Object a0, Object a1, Object a2, long a3, long a4, long a5, long a6) throws Throwable { return return_L(targetA7(a0, a1, a2, a3, a4, a5, a6)); } + protected int invoke_I(Object a0, Object a1, Object a2, long a3, long a4, long a5, long a6) throws Throwable { return return_I(targetA7(a0, a1, a2, a3, a4, a5, a6)); } + protected long invoke_J(Object a0, Object a1, Object a2, long a3, long a4, long a5, long a6) throws Throwable { return return_J(targetA7(a0, a1, a2, a3, a4, a5, a6)); } + protected Object invoke_L(Object a0, Object a1, long a2, long a3, long a4, long a5, long a6) throws Throwable { return return_L(targetA7(a0, a1, a2, a3, a4, a5, a6)); } + protected int invoke_I(Object a0, Object a1, long a2, long a3, long a4, long a5, long a6) throws Throwable { return return_I(targetA7(a0, a1, a2, a3, a4, a5, a6)); } + protected long invoke_J(Object a0, Object a1, long a2, long a3, long a4, long a5, long a6) throws Throwable { return return_J(targetA7(a0, a1, a2, a3, a4, a5, a6)); } + protected Object invoke_L(Object a0, long a1, long a2, long a3, long a4, long a5, long a6) throws Throwable { return return_L(targetA7(a0, a1, a2, a3, a4, a5, a6)); } + protected int invoke_I(Object a0, long a1, long a2, long a3, long a4, long a5, long a6) throws Throwable { return return_I(targetA7(a0, a1, a2, a3, a4, a5, a6)); } + protected long invoke_J(Object a0, long a1, long a2, long a3, long a4, long a5, long a6) throws Throwable { return return_J(targetA7(a0, a1, a2, a3, a4, a5, a6)); } + protected Object invoke_L(long a0, long a1, long a2, long a3, long a4, long a5, long a6) throws Throwable { return return_L(targetA7(a0, a1, a2, a3, a4, a5, a6)); } + protected int invoke_I(long a0, long a1, long a2, long a3, long a4, long a5, long a6) throws Throwable { return return_I(targetA7(a0, a1, a2, a3, a4, a5, a6)); } + protected long invoke_J(long a0, long a1, long a2, long a3, long a4, long a5, long a6) throws Throwable { return return_J(targetA7(a0, a1, a2, a3, a4, a5, a6)); } } static class A8 extends Adapter { protected A8(MethodHandle entryPoint) { super(entryPoint); } // to build prototype protected A8(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t) { super(e, i, c, t); } protected A8 makeInstance(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t) { return new A8(e, i, c, t); } - protected Object target(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7) { return invoker.invoke(target, a0, a1, a2, a3, a4, a5, a6, a7); } - protected Object targetA8(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7) { return target(a0, a1, a2, a3, a4, a5, a6, a7); } - protected Object targetA8(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, long a7) { return target(a0, a1, a2, a3, a4, a5, a6, a7); } - protected Object targetA8(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, long a6, long a7) { return target(a0, a1, a2, a3, a4, a5, a6, a7); } - protected Object targetA8(Object a0, Object a1, Object a2, Object a3, Object a4, long a5, long a6, long a7) { return target(a0, a1, a2, a3, a4, a5, a6, a7); } - protected Object targetA8(Object a0, Object a1, Object a2, Object a3, long a4, long a5, long a6, long a7) { return target(a0, a1, a2, a3, a4, a5, a6, a7); } - protected Object targetA8(Object a0, Object a1, Object a2, long a3, long a4, long a5, long a6, long a7) { return target(a0, a1, a2, a3, a4, a5, a6, a7); } - protected Object targetA8(Object a0, Object a1, long a2, long a3, long a4, long a5, long a6, long a7) { return target(a0, a1, a2, a3, a4, a5, a6, a7); } - protected Object targetA8(Object a0, long a1, long a2, long a3, long a4, long a5, long a6, long a7) { return target(a0, a1, a2, a3, a4, a5, a6, a7); } - protected Object targetA8(long a0, long a1, long a2, long a3, long a4, long a5, long a6, long a7) { return target(a0, a1, a2, a3, a4, a5, a6, a7); } - protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7) { return return_L(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); } - protected int invoke_I(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7) { return return_I(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); } - protected long invoke_J(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7) { return return_J(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); } - protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, long a7) { return return_L(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); } - protected int invoke_I(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, long a7) { return return_I(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); } - protected long invoke_J(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, long a7) { return return_J(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); } - protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, long a6, long a7) { return return_L(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); } - protected int invoke_I(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, long a6, long a7) { return return_I(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); } - protected long invoke_J(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, long a6, long a7) { return return_J(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); } - protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, Object a4, long a5, long a6, long a7) { return return_L(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); } - protected int invoke_I(Object a0, Object a1, Object a2, Object a3, Object a4, long a5, long a6, long a7) { return return_I(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); } - protected long invoke_J(Object a0, Object a1, Object a2, Object a3, Object a4, long a5, long a6, long a7) { return return_J(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); } - protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, long a4, long a5, long a6, long a7) { return return_L(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); } - protected int invoke_I(Object a0, Object a1, Object a2, Object a3, long a4, long a5, long a6, long a7) { return return_I(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); } - protected long invoke_J(Object a0, Object a1, Object a2, Object a3, long a4, long a5, long a6, long a7) { return return_J(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); } - protected Object invoke_L(Object a0, Object a1, Object a2, long a3, long a4, long a5, long a6, long a7) { return return_L(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); } - protected int invoke_I(Object a0, Object a1, Object a2, long a3, long a4, long a5, long a6, long a7) { return return_I(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); } - protected long invoke_J(Object a0, Object a1, Object a2, long a3, long a4, long a5, long a6, long a7) { return return_J(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); } - protected Object invoke_L(Object a0, Object a1, long a2, long a3, long a4, long a5, long a6, long a7) { return return_L(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); } - protected int invoke_I(Object a0, Object a1, long a2, long a3, long a4, long a5, long a6, long a7) { return return_I(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); } - protected long invoke_J(Object a0, Object a1, long a2, long a3, long a4, long a5, long a6, long a7) { return return_J(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); } - protected Object invoke_L(Object a0, long a1, long a2, long a3, long a4, long a5, long a6, long a7) { return return_L(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); } - protected int invoke_I(Object a0, long a1, long a2, long a3, long a4, long a5, long a6, long a7) { return return_I(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); } - protected long invoke_J(Object a0, long a1, long a2, long a3, long a4, long a5, long a6, long a7) { return return_J(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); } - protected Object invoke_L(long a0, long a1, long a2, long a3, long a4, long a5, long a6, long a7) { return return_L(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); } - protected int invoke_I(long a0, long a1, long a2, long a3, long a4, long a5, long a6, long a7) { return return_I(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); } - protected long invoke_J(long a0, long a1, long a2, long a3, long a4, long a5, long a6, long a7) { return return_J(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); } + protected Object target(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7) throws Throwable { return invoker.invoke(target, a0, a1, a2, a3, a4, a5, a6, a7); } + protected Object targetA8(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6, a7); } + protected Object targetA8(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, long a7) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6, a7); } + protected Object targetA8(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, long a6, long a7) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6, a7); } + protected Object targetA8(Object a0, Object a1, Object a2, Object a3, Object a4, long a5, long a6, long a7) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6, a7); } + protected Object targetA8(Object a0, Object a1, Object a2, Object a3, long a4, long a5, long a6, long a7) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6, a7); } + protected Object targetA8(Object a0, Object a1, Object a2, long a3, long a4, long a5, long a6, long a7) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6, a7); } + protected Object targetA8(Object a0, Object a1, long a2, long a3, long a4, long a5, long a6, long a7) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6, a7); } + protected Object targetA8(Object a0, long a1, long a2, long a3, long a4, long a5, long a6, long a7) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6, a7); } + protected Object targetA8(long a0, long a1, long a2, long a3, long a4, long a5, long a6, long a7) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6, a7); } + protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7) throws Throwable { return return_L(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); } + protected int invoke_I(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7) throws Throwable { return return_I(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); } + protected long invoke_J(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7) throws Throwable { return return_J(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); } + protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, long a7) throws Throwable { return return_L(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); } + protected int invoke_I(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, long a7) throws Throwable { return return_I(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); } + protected long invoke_J(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, long a7) throws Throwable { return return_J(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); } + protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, long a6, long a7) throws Throwable { return return_L(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); } + protected int invoke_I(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, long a6, long a7) throws Throwable { return return_I(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); } + protected long invoke_J(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, long a6, long a7) throws Throwable { return return_J(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); } + protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, Object a4, long a5, long a6, long a7) throws Throwable { return return_L(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); } + protected int invoke_I(Object a0, Object a1, Object a2, Object a3, Object a4, long a5, long a6, long a7) throws Throwable { return return_I(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); } + protected long invoke_J(Object a0, Object a1, Object a2, Object a3, Object a4, long a5, long a6, long a7) throws Throwable { return return_J(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); } + protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, long a4, long a5, long a6, long a7) throws Throwable { return return_L(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); } + protected int invoke_I(Object a0, Object a1, Object a2, Object a3, long a4, long a5, long a6, long a7) throws Throwable { return return_I(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); } + protected long invoke_J(Object a0, Object a1, Object a2, Object a3, long a4, long a5, long a6, long a7) throws Throwable { return return_J(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); } + protected Object invoke_L(Object a0, Object a1, Object a2, long a3, long a4, long a5, long a6, long a7) throws Throwable { return return_L(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); } + protected int invoke_I(Object a0, Object a1, Object a2, long a3, long a4, long a5, long a6, long a7) throws Throwable { return return_I(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); } + protected long invoke_J(Object a0, Object a1, Object a2, long a3, long a4, long a5, long a6, long a7) throws Throwable { return return_J(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); } + protected Object invoke_L(Object a0, Object a1, long a2, long a3, long a4, long a5, long a6, long a7) throws Throwable { return return_L(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); } + protected int invoke_I(Object a0, Object a1, long a2, long a3, long a4, long a5, long a6, long a7) throws Throwable { return return_I(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); } + protected long invoke_J(Object a0, Object a1, long a2, long a3, long a4, long a5, long a6, long a7) throws Throwable { return return_J(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); } + protected Object invoke_L(Object a0, long a1, long a2, long a3, long a4, long a5, long a6, long a7) throws Throwable { return return_L(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); } + protected int invoke_I(Object a0, long a1, long a2, long a3, long a4, long a5, long a6, long a7) throws Throwable { return return_I(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); } + protected long invoke_J(Object a0, long a1, long a2, long a3, long a4, long a5, long a6, long a7) throws Throwable { return return_J(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); } + protected Object invoke_L(long a0, long a1, long a2, long a3, long a4, long a5, long a6, long a7) throws Throwable { return return_L(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); } + protected int invoke_I(long a0, long a1, long a2, long a3, long a4, long a5, long a6, long a7) throws Throwable { return return_I(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); } + protected long invoke_J(long a0, long a1, long a2, long a3, long a4, long a5, long a6, long a7) throws Throwable { return return_J(targetA8(a0, a1, a2, a3, a4, a5, a6, a7)); } } static class A9 extends Adapter { protected A9(MethodHandle entryPoint) { super(entryPoint); } // to build prototype protected A9(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t) { super(e, i, c, t); } protected A9 makeInstance(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t) { return new A9(e, i, c, t); } - protected Object target(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8) { return invoker.invoke(target, a0, a1, a2, a3, a4, a5, a6, a7, a8); } - protected Object targetA9(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8) { return target(a0, a1, a2, a3, a4, a5, a6, a7, a8); } - protected Object targetA9(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, long a8) { return target(a0, a1, a2, a3, a4, a5, a6, a7, a8); } - protected Object targetA9(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, long a7, long a8) { return target(a0, a1, a2, a3, a4, a5, a6, a7, a8); } - protected Object targetA9(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, long a6, long a7, long a8) { return target(a0, a1, a2, a3, a4, a5, a6, a7, a8); } - protected Object targetA9(Object a0, Object a1, Object a2, Object a3, Object a4, long a5, long a6, long a7, long a8) { return target(a0, a1, a2, a3, a4, a5, a6, a7, a8); } - protected Object targetA9(Object a0, Object a1, Object a2, Object a3, long a4, long a5, long a6, long a7, long a8) { return target(a0, a1, a2, a3, a4, a5, a6, a7, a8); } - protected Object targetA9(Object a0, Object a1, Object a2, long a3, long a4, long a5, long a6, long a7, long a8) { return target(a0, a1, a2, a3, a4, a5, a6, a7, a8); } - protected Object targetA9(Object a0, Object a1, long a2, long a3, long a4, long a5, long a6, long a7, long a8) { return target(a0, a1, a2, a3, a4, a5, a6, a7, a8); } - protected Object targetA9(Object a0, long a1, long a2, long a3, long a4, long a5, long a6, long a7, long a8) { return target(a0, a1, a2, a3, a4, a5, a6, a7, a8); } - protected Object targetA9(long a0, long a1, long a2, long a3, long a4, long a5, long a6, long a7, long a8) { return target(a0, a1, a2, a3, a4, a5, a6, a7, a8); } - protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8) { return return_L(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); } - protected int invoke_I(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8) { return return_I(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); } - protected long invoke_J(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8) { return return_J(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); } - protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, long a8) { return return_L(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); } - protected int invoke_I(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, long a8) { return return_I(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); } - protected long invoke_J(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, long a8) { return return_J(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); } - protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, long a7, long a8) { return return_L(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); } - protected int invoke_I(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, long a7, long a8) { return return_I(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); } - protected long invoke_J(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, long a7, long a8) { return return_J(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); } - protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, long a6, long a7, long a8) { return return_L(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); } - protected int invoke_I(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, long a6, long a7, long a8) { return return_I(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); } - protected long invoke_J(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, long a6, long a7, long a8) { return return_J(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); } - protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, Object a4, long a5, long a6, long a7, long a8) { return return_L(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); } - protected int invoke_I(Object a0, Object a1, Object a2, Object a3, Object a4, long a5, long a6, long a7, long a8) { return return_I(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); } - protected long invoke_J(Object a0, Object a1, Object a2, Object a3, Object a4, long a5, long a6, long a7, long a8) { return return_J(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); } - protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, long a4, long a5, long a6, long a7, long a8) { return return_L(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); } - protected int invoke_I(Object a0, Object a1, Object a2, Object a3, long a4, long a5, long a6, long a7, long a8) { return return_I(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); } - protected long invoke_J(Object a0, Object a1, Object a2, Object a3, long a4, long a5, long a6, long a7, long a8) { return return_J(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); } - protected Object invoke_L(Object a0, Object a1, Object a2, long a3, long a4, long a5, long a6, long a7, long a8) { return return_L(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); } - protected int invoke_I(Object a0, Object a1, Object a2, long a3, long a4, long a5, long a6, long a7, long a8) { return return_I(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); } - protected long invoke_J(Object a0, Object a1, Object a2, long a3, long a4, long a5, long a6, long a7, long a8) { return return_J(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); } - protected Object invoke_L(Object a0, Object a1, long a2, long a3, long a4, long a5, long a6, long a7, long a8) { return return_L(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); } - protected int invoke_I(Object a0, Object a1, long a2, long a3, long a4, long a5, long a6, long a7, long a8) { return return_I(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); } - protected long invoke_J(Object a0, Object a1, long a2, long a3, long a4, long a5, long a6, long a7, long a8) { return return_J(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); } - protected Object invoke_L(Object a0, long a1, long a2, long a3, long a4, long a5, long a6, long a7, long a8) { return return_L(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); } - protected int invoke_I(Object a0, long a1, long a2, long a3, long a4, long a5, long a6, long a7, long a8) { return return_I(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); } - protected long invoke_J(Object a0, long a1, long a2, long a3, long a4, long a5, long a6, long a7, long a8) { return return_J(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); } - protected Object invoke_L(long a0, long a1, long a2, long a3, long a4, long a5, long a6, long a7, long a8) { return return_L(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); } - protected int invoke_I(long a0, long a1, long a2, long a3, long a4, long a5, long a6, long a7, long a8) { return return_I(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); } - protected long invoke_J(long a0, long a1, long a2, long a3, long a4, long a5, long a6, long a7, long a8) { return return_J(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); } + protected Object target(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8) throws Throwable { return invoker.invoke(target, a0, a1, a2, a3, a4, a5, a6, a7, a8); } + protected Object targetA9(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6, a7, a8); } + protected Object targetA9(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, long a8) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6, a7, a8); } + protected Object targetA9(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, long a7, long a8) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6, a7, a8); } + protected Object targetA9(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, long a6, long a7, long a8) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6, a7, a8); } + protected Object targetA9(Object a0, Object a1, Object a2, Object a3, Object a4, long a5, long a6, long a7, long a8) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6, a7, a8); } + protected Object targetA9(Object a0, Object a1, Object a2, Object a3, long a4, long a5, long a6, long a7, long a8) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6, a7, a8); } + protected Object targetA9(Object a0, Object a1, Object a2, long a3, long a4, long a5, long a6, long a7, long a8) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6, a7, a8); } + protected Object targetA9(Object a0, Object a1, long a2, long a3, long a4, long a5, long a6, long a7, long a8) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6, a7, a8); } + protected Object targetA9(Object a0, long a1, long a2, long a3, long a4, long a5, long a6, long a7, long a8) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6, a7, a8); } + protected Object targetA9(long a0, long a1, long a2, long a3, long a4, long a5, long a6, long a7, long a8) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6, a7, a8); } + protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8) throws Throwable { return return_L(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); } + protected int invoke_I(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8) throws Throwable { return return_I(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); } + protected long invoke_J(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8) throws Throwable { return return_J(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); } + protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, long a8) throws Throwable { return return_L(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); } + protected int invoke_I(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, long a8) throws Throwable { return return_I(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); } + protected long invoke_J(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, long a8) throws Throwable { return return_J(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); } + protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, long a7, long a8) throws Throwable { return return_L(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); } + protected int invoke_I(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, long a7, long a8) throws Throwable { return return_I(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); } + protected long invoke_J(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, long a7, long a8) throws Throwable { return return_J(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); } + protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, long a6, long a7, long a8) throws Throwable { return return_L(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); } + protected int invoke_I(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, long a6, long a7, long a8) throws Throwable { return return_I(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); } + protected long invoke_J(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, long a6, long a7, long a8) throws Throwable { return return_J(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); } + protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, Object a4, long a5, long a6, long a7, long a8) throws Throwable { return return_L(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); } + protected int invoke_I(Object a0, Object a1, Object a2, Object a3, Object a4, long a5, long a6, long a7, long a8) throws Throwable { return return_I(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); } + protected long invoke_J(Object a0, Object a1, Object a2, Object a3, Object a4, long a5, long a6, long a7, long a8) throws Throwable { return return_J(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); } + protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, long a4, long a5, long a6, long a7, long a8) throws Throwable { return return_L(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); } + protected int invoke_I(Object a0, Object a1, Object a2, Object a3, long a4, long a5, long a6, long a7, long a8) throws Throwable { return return_I(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); } + protected long invoke_J(Object a0, Object a1, Object a2, Object a3, long a4, long a5, long a6, long a7, long a8) throws Throwable { return return_J(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); } + protected Object invoke_L(Object a0, Object a1, Object a2, long a3, long a4, long a5, long a6, long a7, long a8) throws Throwable { return return_L(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); } + protected int invoke_I(Object a0, Object a1, Object a2, long a3, long a4, long a5, long a6, long a7, long a8) throws Throwable { return return_I(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); } + protected long invoke_J(Object a0, Object a1, Object a2, long a3, long a4, long a5, long a6, long a7, long a8) throws Throwable { return return_J(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); } + protected Object invoke_L(Object a0, Object a1, long a2, long a3, long a4, long a5, long a6, long a7, long a8) throws Throwable { return return_L(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); } + protected int invoke_I(Object a0, Object a1, long a2, long a3, long a4, long a5, long a6, long a7, long a8) throws Throwable { return return_I(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); } + protected long invoke_J(Object a0, Object a1, long a2, long a3, long a4, long a5, long a6, long a7, long a8) throws Throwable { return return_J(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); } + protected Object invoke_L(Object a0, long a1, long a2, long a3, long a4, long a5, long a6, long a7, long a8) throws Throwable { return return_L(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); } + protected int invoke_I(Object a0, long a1, long a2, long a3, long a4, long a5, long a6, long a7, long a8) throws Throwable { return return_I(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); } + protected long invoke_J(Object a0, long a1, long a2, long a3, long a4, long a5, long a6, long a7, long a8) throws Throwable { return return_J(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); } + protected Object invoke_L(long a0, long a1, long a2, long a3, long a4, long a5, long a6, long a7, long a8) throws Throwable { return return_L(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); } + protected int invoke_I(long a0, long a1, long a2, long a3, long a4, long a5, long a6, long a7, long a8) throws Throwable { return return_I(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); } + protected long invoke_J(long a0, long a1, long a2, long a3, long a4, long a5, long a6, long a7, long a8) throws Throwable { return return_J(targetA9(a0, a1, a2, a3, a4, a5, a6, a7, a8)); } } static class A10 extends Adapter { protected A10(MethodHandle entryPoint) { super(entryPoint); } // to build prototype protected A10(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t) { super(e, i, c, t); } protected A10 makeInstance(MethodHandle e, MethodHandle i, MethodHandle c, MethodHandle t) { return new A10(e, i, c, t); } - protected Object target(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8, Object a9) { return invoker.invoke(target, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); } - protected Object targetA10(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8, Object a9) { return target(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); } - protected Object targetA10(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8, long a9) { return target(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); } - protected Object targetA10(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, long a8, long a9) { return target(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); } - protected Object targetA10(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, long a7, long a8, long a9) { return target(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); } - protected Object targetA10(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, long a6, long a7, long a8, long a9) { return target(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); } - protected Object targetA10(Object a0, Object a1, Object a2, Object a3, Object a4, long a5, long a6, long a7, long a8, long a9) { return target(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); } - protected Object targetA10(Object a0, Object a1, Object a2, Object a3, long a4, long a5, long a6, long a7, long a8, long a9) { return target(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); } - protected Object targetA10(Object a0, Object a1, Object a2, long a3, long a4, long a5, long a6, long a7, long a8, long a9) { return target(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); } - protected Object targetA10(Object a0, Object a1, long a2, long a3, long a4, long a5, long a6, long a7, long a8, long a9) { return target(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); } - protected Object targetA10(Object a0, long a1, long a2, long a3, long a4, long a5, long a6, long a7, long a8, long a9) { return target(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); } - protected Object targetA10(long a0, long a1, long a2, long a3, long a4, long a5, long a6, long a7, long a8, long a9) { return target(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); } - protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8, Object a9) { return return_L(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); } - protected int invoke_I(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8, Object a9) { return return_I(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); } - protected long invoke_J(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8, Object a9) { return return_J(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); } - protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8, long a9) { return return_L(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); } - protected int invoke_I(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8, long a9) { return return_I(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); } - protected long invoke_J(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8, long a9) { return return_J(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); } - protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, long a8, long a9) { return return_L(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); } - protected int invoke_I(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, long a8, long a9) { return return_I(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); } - protected long invoke_J(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, long a8, long a9) { return return_J(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); } - protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, long a7, long a8, long a9) { return return_L(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); } - protected int invoke_I(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, long a7, long a8, long a9) { return return_I(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); } - protected long invoke_J(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, long a7, long a8, long a9) { return return_J(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); } - protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, long a6, long a7, long a8, long a9) { return return_L(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); } - protected int invoke_I(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, long a6, long a7, long a8, long a9) { return return_I(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); } - protected long invoke_J(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, long a6, long a7, long a8, long a9) { return return_J(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); } - protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, Object a4, long a5, long a6, long a7, long a8, long a9) { return return_L(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); } - protected int invoke_I(Object a0, Object a1, Object a2, Object a3, Object a4, long a5, long a6, long a7, long a8, long a9) { return return_I(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); } - protected long invoke_J(Object a0, Object a1, Object a2, Object a3, Object a4, long a5, long a6, long a7, long a8, long a9) { return return_J(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); } - protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, long a4, long a5, long a6, long a7, long a8, long a9) { return return_L(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); } - protected int invoke_I(Object a0, Object a1, Object a2, Object a3, long a4, long a5, long a6, long a7, long a8, long a9) { return return_I(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); } - protected long invoke_J(Object a0, Object a1, Object a2, Object a3, long a4, long a5, long a6, long a7, long a8, long a9) { return return_J(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); } - protected Object invoke_L(Object a0, Object a1, Object a2, long a3, long a4, long a5, long a6, long a7, long a8, long a9) { return return_L(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); } - protected int invoke_I(Object a0, Object a1, Object a2, long a3, long a4, long a5, long a6, long a7, long a8, long a9) { return return_I(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); } - protected long invoke_J(Object a0, Object a1, Object a2, long a3, long a4, long a5, long a6, long a7, long a8, long a9) { return return_J(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); } - protected Object invoke_L(Object a0, Object a1, long a2, long a3, long a4, long a5, long a6, long a7, long a8, long a9) { return return_L(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); } - protected int invoke_I(Object a0, Object a1, long a2, long a3, long a4, long a5, long a6, long a7, long a8, long a9) { return return_I(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); } - protected long invoke_J(Object a0, Object a1, long a2, long a3, long a4, long a5, long a6, long a7, long a8, long a9) { return return_J(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); } - protected Object invoke_L(Object a0, long a1, long a2, long a3, long a4, long a5, long a6, long a7, long a8, long a9) { return return_L(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); } - protected int invoke_I(Object a0, long a1, long a2, long a3, long a4, long a5, long a6, long a7, long a8, long a9) { return return_I(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); } - protected long invoke_J(Object a0, long a1, long a2, long a3, long a4, long a5, long a6, long a7, long a8, long a9) { return return_J(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); } - protected Object invoke_L(long a0, long a1, long a2, long a3, long a4, long a5, long a6, long a7, long a8, long a9) { return return_L(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); } - protected int invoke_I(long a0, long a1, long a2, long a3, long a4, long a5, long a6, long a7, long a8, long a9) { return return_I(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); } - protected long invoke_J(long a0, long a1, long a2, long a3, long a4, long a5, long a6, long a7, long a8, long a9) { return return_J(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); } + protected Object target(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8, Object a9) throws Throwable { return invoker.invoke(target, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); } + protected Object targetA10(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8, Object a9) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); } + protected Object targetA10(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8, long a9) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); } + protected Object targetA10(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, long a8, long a9) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); } + protected Object targetA10(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, long a7, long a8, long a9) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); } + protected Object targetA10(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, long a6, long a7, long a8, long a9) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); } + protected Object targetA10(Object a0, Object a1, Object a2, Object a3, Object a4, long a5, long a6, long a7, long a8, long a9) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); } + protected Object targetA10(Object a0, Object a1, Object a2, Object a3, long a4, long a5, long a6, long a7, long a8, long a9) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); } + protected Object targetA10(Object a0, Object a1, Object a2, long a3, long a4, long a5, long a6, long a7, long a8, long a9) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); } + protected Object targetA10(Object a0, Object a1, long a2, long a3, long a4, long a5, long a6, long a7, long a8, long a9) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); } + protected Object targetA10(Object a0, long a1, long a2, long a3, long a4, long a5, long a6, long a7, long a8, long a9) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); } + protected Object targetA10(long a0, long a1, long a2, long a3, long a4, long a5, long a6, long a7, long a8, long a9) throws Throwable { return target(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); } + protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8, Object a9) throws Throwable { return return_L(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); } + protected int invoke_I(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8, Object a9) throws Throwable { return return_I(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); } + protected long invoke_J(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8, Object a9) throws Throwable { return return_J(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); } + protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8, long a9) throws Throwable { return return_L(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); } + protected int invoke_I(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8, long a9) throws Throwable { return return_I(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); } + protected long invoke_J(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8, long a9) throws Throwable { return return_J(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); } + protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, long a8, long a9) throws Throwable { return return_L(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); } + protected int invoke_I(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, long a8, long a9) throws Throwable { return return_I(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); } + protected long invoke_J(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, long a8, long a9) throws Throwable { return return_J(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); } + protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, long a7, long a8, long a9) throws Throwable { return return_L(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); } + protected int invoke_I(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, long a7, long a8, long a9) throws Throwable { return return_I(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); } + protected long invoke_J(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, long a7, long a8, long a9) throws Throwable { return return_J(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); } + protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, long a6, long a7, long a8, long a9) throws Throwable { return return_L(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); } + protected int invoke_I(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, long a6, long a7, long a8, long a9) throws Throwable { return return_I(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); } + protected long invoke_J(Object a0, Object a1, Object a2, Object a3, Object a4, Object a5, long a6, long a7, long a8, long a9) throws Throwable { return return_J(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); } + protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, Object a4, long a5, long a6, long a7, long a8, long a9) throws Throwable { return return_L(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); } + protected int invoke_I(Object a0, Object a1, Object a2, Object a3, Object a4, long a5, long a6, long a7, long a8, long a9) throws Throwable { return return_I(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); } + protected long invoke_J(Object a0, Object a1, Object a2, Object a3, Object a4, long a5, long a6, long a7, long a8, long a9) throws Throwable { return return_J(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); } + protected Object invoke_L(Object a0, Object a1, Object a2, Object a3, long a4, long a5, long a6, long a7, long a8, long a9) throws Throwable { return return_L(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); } + protected int invoke_I(Object a0, Object a1, Object a2, Object a3, long a4, long a5, long a6, long a7, long a8, long a9) throws Throwable { return return_I(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); } + protected long invoke_J(Object a0, Object a1, Object a2, Object a3, long a4, long a5, long a6, long a7, long a8, long a9) throws Throwable { return return_J(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); } + protected Object invoke_L(Object a0, Object a1, Object a2, long a3, long a4, long a5, long a6, long a7, long a8, long a9) throws Throwable { return return_L(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); } + protected int invoke_I(Object a0, Object a1, Object a2, long a3, long a4, long a5, long a6, long a7, long a8, long a9) throws Throwable { return return_I(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); } + protected long invoke_J(Object a0, Object a1, Object a2, long a3, long a4, long a5, long a6, long a7, long a8, long a9) throws Throwable { return return_J(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); } + protected Object invoke_L(Object a0, Object a1, long a2, long a3, long a4, long a5, long a6, long a7, long a8, long a9) throws Throwable { return return_L(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); } + protected int invoke_I(Object a0, Object a1, long a2, long a3, long a4, long a5, long a6, long a7, long a8, long a9) throws Throwable { return return_I(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); } + protected long invoke_J(Object a0, Object a1, long a2, long a3, long a4, long a5, long a6, long a7, long a8, long a9) throws Throwable { return return_J(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); } + protected Object invoke_L(Object a0, long a1, long a2, long a3, long a4, long a5, long a6, long a7, long a8, long a9) throws Throwable { return return_L(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); } + protected int invoke_I(Object a0, long a1, long a2, long a3, long a4, long a5, long a6, long a7, long a8, long a9) throws Throwable { return return_I(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); } + protected long invoke_J(Object a0, long a1, long a2, long a3, long a4, long a5, long a6, long a7, long a8, long a9) throws Throwable { return return_J(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); } + protected Object invoke_L(long a0, long a1, long a2, long a3, long a4, long a5, long a6, long a7, long a8, long a9) throws Throwable { return return_L(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); } + protected int invoke_I(long a0, long a1, long a2, long a3, long a4, long a5, long a6, long a7, long a8, long a9) throws Throwable { return return_I(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); } + protected long invoke_J(long a0, long a1, long a2, long a3, long a4, long a5, long a6, long a7, long a8, long a9) throws Throwable { return return_J(targetA10(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); } } } diff --git a/src/share/classes/sun/dyn/empty/Empty.java b/src/share/classes/sun/dyn/empty/Empty.java index 4fb72d0be67d5bc88270dfd3dcdb68365c031332..df1ce6b7819b906fd1a7ba0bd6cbf1df76733700 100644 --- a/src/share/classes/sun/dyn/empty/Empty.java +++ b/src/share/classes/sun/dyn/empty/Empty.java @@ -29,6 +29,10 @@ package sun.dyn.empty; * An empty class in an empty package. * Used as a proxy for unprivileged code, since making access checks * against it will only succeed against public methods in public types. + *

    + * This class also stands (internally to sun.dyn) for the type of a + * value that cannot be produced, because the expression of this type + * always returns abnormally. (Cf. Nothing in the closures proposal.) * @author jrose */ public class Empty { diff --git a/src/share/classes/sun/dyn/util/BytecodeSignature.java b/src/share/classes/sun/dyn/util/BytecodeDescriptor.java similarity index 98% rename from src/share/classes/sun/dyn/util/BytecodeSignature.java rename to src/share/classes/sun/dyn/util/BytecodeDescriptor.java index 37d8708cb2938baa6057576e0916349c1fadb7ac..290f2fb431b170e3646297adb4aebdb4d1302640 100644 --- a/src/share/classes/sun/dyn/util/BytecodeSignature.java +++ b/src/share/classes/sun/dyn/util/BytecodeDescriptor.java @@ -33,9 +33,9 @@ import java.util.List; * Utility routines for dealing with bytecode-level signatures. * @author jrose */ -public class BytecodeSignature { +public class BytecodeDescriptor { - private BytecodeSignature() { } // cannot instantiate + private BytecodeDescriptor() { } // cannot instantiate public static List> parseMethod(String bytecodeSignature, ClassLoader loader) { return parseMethod(bytecodeSignature, 0, bytecodeSignature.length(), loader); diff --git a/src/share/classes/sun/dyn/util/BytecodeName.java b/src/share/classes/sun/dyn/util/BytecodeName.java index 2abe780a5ef4aaa99b92b16ce8b98cf97a569d75..e037e699530f0f9c9acc6bc0d1e4b0e4392f88e6 100644 --- a/src/share/classes/sun/dyn/util/BytecodeName.java +++ b/src/share/classes/sun/dyn/util/BytecodeName.java @@ -298,6 +298,8 @@ public class BytecodeName { * The name {@code <init>} will be parsed into { '<', "init", '>'}} * The name {@code foo/bar$:baz} will be parsed into * {@code {"foo", '/', "bar", '$', ':', "baz"}}. + * The name {@code ::\=:foo:\=bar\!baz} will be parsed into + * {@code {':', ':', "", ':', "foo", ':', "bar:baz"}}. */ public static Object[] parseBytecodeName(String s) { int slen = s.length(); @@ -315,7 +317,7 @@ public class BytecodeName { if (lasti < i) { // normal component if (pass != 0) - res[fillp] = s.substring(lasti, i); + res[fillp] = toSourceName(s.substring(lasti, i)); fillp++; lasti = i+1; } @@ -323,13 +325,14 @@ public class BytecodeName { if (pass != 0) res[fillp] = DANGEROUS_CHARS_CA[whichDC]; fillp++; + lasti = i+1; } } if (pass != 0) break; // between passes, build the result array - res = new String[fillp]; - if (fillp <= 1) { - if (fillp != 0) res[0] = s; + res = new Object[fillp]; + if (fillp <= 1 && lasti == 0) { + if (fillp != 0) res[0] = toSourceName(s); break; } } @@ -348,9 +351,19 @@ public class BytecodeName { * @throws NullPointerException if any component is null */ public static String unparseBytecodeName(Object[] components) { - for (Object c : components) { - if (c instanceof String) - checkSafeBytecodeName((String) c); // may fail + Object[] components0 = components; + for (int i = 0; i < components.length; i++) { + Object c = components[i]; + if (c instanceof String) { + String mc = toBytecodeName((String) c); + if (i == 0 && components.length == 1) + return mc; // usual case + if ((Object)mc != c) { + if (components == components0) + components = components.clone(); + components[i] = c = mc; + } + } } return appendAll(components); } @@ -381,6 +394,14 @@ public class BytecodeName { * If the bytecode name contains dangerous characters, * assume that they are being used as punctuation, * and pass them through unchanged. + * Non-empty runs of non-dangerous characters are demangled + * if necessary, and the resulting names are quoted if + * they are not already valid Java identifiers, or if + * they contain a dangerous character (i.e., dollar sign "$"). + * Single quotes are used when quoting. + * Within quoted names, embedded single quotes and backslashes + * are further escaped by prepended backslashes. + * * @param s the original bytecode name (which may be qualified) * @return a human-readable presentation */ @@ -389,10 +410,10 @@ public class BytecodeName { for (int i = 0; i < components.length; i++) { if (!(components[i] instanceof String)) continue; - String c = (String) components[i]; - // pretty up the name by demangling it - String sn = toSourceName(c); - if ((Object)sn != c || !isJavaIdent(sn)) { + String sn = (String) components[i]; + // note that the name is already demangled! + //sn = toSourceName(sn); + if (!isJavaIdent(sn) || sn.indexOf('$') >=0 ) { components[i] = quoteDisplay(sn); } } @@ -401,10 +422,10 @@ public class BytecodeName { private static boolean isJavaIdent(String s) { int slen = s.length(); if (slen == 0) return false; - if (!Character.isUnicodeIdentifierStart(s.charAt(0))) + if (!Character.isJavaIdentifierStart(s.charAt(0))) return false; for (int i = 1; i < slen; i++) { - if (!Character.isUnicodeIdentifierPart(s.charAt(0))) + if (!Character.isJavaIdentifierPart(s.charAt(i))) return false; } return true; @@ -602,110 +623,5 @@ public class BytecodeName { return -1; } - // test driver - static void main(String[] av) { - // If verbose is enabled, quietly check everything. - // Otherwise, print the output for the user to check. - boolean verbose = false; - - int maxlen = 0; - - while (av.length > 0 && av[0].startsWith("-")) { - String flag = av[0].intern(); - av = java.util.Arrays.copyOfRange(av, 1, av.length); // Java 1.6 or later - if (flag == "-" || flag == "--") break; - else if (flag == "-q") - verbose = false; - else if (flag == "-v") - verbose = true; - else if (flag.startsWith("-l")) - maxlen = Integer.valueOf(flag.substring(2)); - else - throw new Error("Illegal flag argument: "+flag); - } - - if (maxlen == 0) - maxlen = (verbose ? 2 : 4); - if (verbose) System.out.println("Note: maxlen = "+maxlen); - - switch (av.length) { - case 0: av = new String[] { - DANGEROUS_CHARS.substring(0) + - REPLACEMENT_CHARS.substring(0, 1) + - NULL_ESCAPE + "x" - }; // and fall through: - case 1: - char[] cv = av[0].toCharArray(); - av = new String[cv.length]; - int avp = 0; - for (char c : cv) { - String s = String.valueOf(c); - if (c == 'x') s = "foo"; // tradition... - av[avp++] = s; - } - } - if (verbose) - System.out.println("Note: Verbose output mode enabled. Use '-q' to suppress."); - Tester t = new Tester(); - t.maxlen = maxlen; - t.verbose = verbose; - t.tokens = av; - t.test("", 0); - } - static class Tester { - boolean verbose; - int maxlen; - java.util.Map map = new java.util.HashMap(); - String[] tokens; - - void test(String stringSoFar, int tokensSoFar) { - test(stringSoFar); - if (tokensSoFar <= maxlen) { - for (String token : tokens) { - if (token.length() == 0) continue; // skip empty tokens - if (stringSoFar.indexOf(token) != stringSoFar.lastIndexOf(token)) - continue; // there are already two occs. of this token - if (token.charAt(0) == ESCAPE_C && token.length() == 1 && maxlen < 4) - test(stringSoFar+token, tokensSoFar); // want lots of \'s - else if (tokensSoFar < maxlen) - test(stringSoFar+token, tokensSoFar+1); - } - } - } - - void test(String s) { - // for small batches, do not test the null string - if (s.length() == 0 && maxlen >=1 && maxlen <= 2) return; - String bn = testSourceName(s); - if (bn == null) return; - if (bn == s) { - //if (verbose) System.out.println(s+" == id"); - } else { - if (verbose) System.out.println(s+" => "+bn+" "+toDisplayName(bn)); - String bnbn = testSourceName(bn); - if (bnbn == null) return; - if (verbose) System.out.println(bn+" => "+bnbn+" "+toDisplayName(bnbn)); - /* - String bn3 = testSourceName(bnbn); - if (bn3 == null) return; - if (verbose) System.out.println(bnbn+" => "+bn3); - */ - } - } - - String testSourceName(String s) { - if (map.containsKey(s)) return null; - String bn = toBytecodeName(s); - map.put(s, bn); - String sn = toSourceName(bn); - if (!sn.equals(s)) { - String bad = (s+" => "+bn+" != "+sn); - if (!verbose) throw new Error("Bad mangling: "+bad); - System.out.println("*** "+bad); - return null; - } - return bn; - } - } } diff --git a/src/share/classes/sun/dyn/util/ValueConversions.java b/src/share/classes/sun/dyn/util/ValueConversions.java index 817c1c5cc29b5b9c78b43125ae93683345ba16bb..9a8bd8fdaddb89144976e689e9446b350bb83079 100644 --- a/src/share/classes/sun/dyn/util/ValueConversions.java +++ b/src/share/classes/sun/dyn/util/ValueConversions.java @@ -27,7 +27,10 @@ package sun.dyn.util; import java.dyn.*; import java.dyn.MethodHandles.Lookup; +import java.util.ArrayList; +import java.util.Arrays; import java.util.EnumMap; +import java.util.List; import sun.dyn.Access; import sun.dyn.AdapterMethodHandle; import sun.dyn.MethodHandleImpl; @@ -37,6 +40,7 @@ public class ValueConversions { private static final Lookup IMPL_LOOKUP = MethodHandleImpl.getLookup(IMPL_TOKEN); private static EnumMap[] newWrapperCaches(int n) { + @SuppressWarnings("unchecked") EnumMap[] caches = (EnumMap[]) new EnumMap[n]; // unchecked warning expected here for (int i = 0; i < n; i++) @@ -114,7 +118,7 @@ public class ValueConversions { } private static MethodType unboxType(Wrapper wrap, boolean raw) { - return MethodType.make(rawWrapper(wrap, raw).primitiveType(), wrap.wrapperType()); + return MethodType.methodType(rawWrapper(wrap, raw).primitiveType(), wrap.wrapperType()); } private static final EnumMap[] @@ -240,7 +244,7 @@ public class ValueConversions { private static MethodType boxType(Wrapper wrap, boolean raw) { // be exact, since return casts are hard to compose Class boxType = wrap.wrapperType(); - return MethodType.make(boxType, rawWrapper(wrap, raw).primitiveType()); + return MethodType.methodType(boxType, rawWrapper(wrap, raw).primitiveType()); } private static Wrapper rawWrapper(Wrapper wrap, boolean raw) { @@ -305,29 +309,47 @@ public class ValueConversions { /// Kludges for when raw values get accidentally boxed. + static int unboxRawInteger(Object x) { + if (x instanceof Integer) + return unboxInteger(x); + else + return (int) unboxLong(x); + } + + static Integer reboxRawInteger(Object x) { + if (x instanceof Integer) + return (Integer) x; + else + return (int) unboxLong(x); + } + static Byte reboxRawByte(Object x) { if (x instanceof Byte) return (Byte) x; - return boxByteRaw(unboxInteger(x)); + return boxByteRaw(unboxRawInteger(x)); } static Short reboxRawShort(Object x) { if (x instanceof Short) return (Short) x; - return boxShortRaw(unboxInteger(x)); + return boxShortRaw(unboxRawInteger(x)); } static Boolean reboxRawBoolean(Object x) { if (x instanceof Boolean) return (Boolean) x; - return boxBooleanRaw(unboxInteger(x)); + return boxBooleanRaw(unboxRawInteger(x)); } static Character reboxRawCharacter(Object x) { if (x instanceof Character) return (Character) x; - return boxCharacterRaw(unboxInteger(x)); + return boxCharacterRaw(unboxRawInteger(x)); } static Float reboxRawFloat(Object x) { if (x instanceof Float) return (Float) x; - return boxFloatRaw(unboxInteger(x)); + return boxFloatRaw(unboxRawInteger(x)); + } + + static Long reboxRawLong(Object x) { + return (Long) x; //never a rebox } static Double reboxRawDouble(Object x) { @@ -337,12 +359,21 @@ public class ValueConversions { private static MethodType reboxType(Wrapper wrap) { Class boxType = wrap.wrapperType(); - return MethodType.make(boxType, Object.class); + return MethodType.methodType(boxType, Object.class); } private static final EnumMap[] REBOX_CONVERSIONS = newWrapperCaches(2); + /** + * Becase we normalize primitive types to reduce the number of signatures, + * primitives are sometimes manipulated under an "erased" type, + * either int (for types other than long/double) or long (for all types). + * When the erased primitive value is then boxed into an Integer or Long, + * the final boxed primitive is sometimes required. This transformation + * is called a "rebox". It takes an Integer or Long and produces some + * other boxed value. + */ public static MethodHandle rebox(Wrapper wrap, boolean exact) { EnumMap cache = REBOX_CONVERSIONS[exact?1:0]; MethodHandle mh = cache.get(wrap); @@ -355,9 +386,6 @@ public class ValueConversions { mh = IDENTITY; break; case VOID: throw new IllegalArgumentException("cannot rebox a void"); - case INT: case LONG: - mh = cast(wrap.wrapperType(), exact); - break; } if (mh != null) { cache.put(wrap, mh); @@ -384,13 +412,21 @@ public class ValueConversions { /// Width-changing conversions between int and long. static long widenInt(int x) { - return x; + return (long) x; + } + + static Long widenBoxedInt(Integer x) { + return (long)(int)x; } static int narrowLong(long x) { return (int) x; } + static Integer narrowBoxedLong(Long x) { + return (int)(long) x; + } + /// Constant functions static void ignore(Object x) { @@ -432,7 +468,7 @@ public class ValueConversions { return mh; } // slow path - MethodType type = MethodType.make(wrap.primitiveType()); + MethodType type = MethodType.methodType(wrap.primitiveType()); switch (wrap) { case VOID: mh = EMPTY; @@ -500,11 +536,11 @@ public class ValueConversions { private static final MethodHandle IDENTITY, CAST_REFERENCE, ALWAYS_NULL, ALWAYS_ZERO, ZERO_OBJECT, IGNORE, EMPTY; static { try { - MethodType idType = MethodType.makeGeneric(1); - MethodType castType = idType.insertParameterType(0, Class.class); + MethodType idType = MethodType.genericMethodType(1); + MethodType castType = idType.insertParameterTypes(0, Class.class); MethodType alwaysZeroType = idType.changeReturnType(int.class); MethodType ignoreType = idType.changeReturnType(void.class); - MethodType zeroObjectType = MethodType.makeGeneric(0); + MethodType zeroObjectType = MethodType.genericMethodType(0); IDENTITY = IMPL_LOOKUP.findStatic(ValueConversions.class, "identity", idType); //CAST_REFERENCE = IMPL_LOOKUP.findVirtual(Class.class, "cast", idType); CAST_REFERENCE = IMPL_LOOKUP.findStatic(ValueConversions.class, "castReference", castType); @@ -512,7 +548,7 @@ public class ValueConversions { ALWAYS_ZERO = IMPL_LOOKUP.findStatic(ValueConversions.class, "alwaysZero", alwaysZeroType); ZERO_OBJECT = IMPL_LOOKUP.findStatic(ValueConversions.class, "zeroObject", zeroObjectType); IGNORE = IMPL_LOOKUP.findStatic(ValueConversions.class, "ignore", ignoreType); - EMPTY = IMPL_LOOKUP.findStatic(ValueConversions.class, "empty", ignoreType.dropParameterType(0)); + EMPTY = IMPL_LOOKUP.findStatic(ValueConversions.class, "empty", ignoreType.dropParameterTypes(0, 1)); } catch (RuntimeException ex) { throw ex; } @@ -543,10 +579,10 @@ public class ValueConversions { else if (VerifyType.isNullType(type)) mh = ALWAYS_NULL; else - mh = MethodHandles.insertArgument(CAST_REFERENCE, 0, type); + mh = MethodHandles.insertArguments(CAST_REFERENCE, 0, type); if (exact) { - MethodType xmt = MethodType.make(type, Object.class); - mh = AdapterMethodHandle.makeRawRetypeOnly(IMPL_TOKEN, xmt, mh); + MethodType xmt = MethodType.methodType(type, Object.class); + mh = AdapterMethodHandle.makeRetypeRaw(IMPL_TOKEN, xmt, mh); } if (cache != null) cache.put(wrap, mh); @@ -560,4 +596,127 @@ public class ValueConversions { private static MethodHandle retype(MethodType type, MethodHandle mh) { return AdapterMethodHandle.makeRetypeOnly(IMPL_TOKEN, type, mh); } + + private static final Object[] NO_ARGS_ARRAY = {}; + private static Object[] makeArray(Object... args) { return args; } + private static Object[] array() { return NO_ARGS_ARRAY; } + private static Object[] array(Object a0) + { return makeArray(a0); } + private static Object[] array(Object a0, Object a1) + { return makeArray(a0, a1); } + private static Object[] array(Object a0, Object a1, Object a2) + { return makeArray(a0, a1, a2); } + private static Object[] array(Object a0, Object a1, Object a2, Object a3) + { return makeArray(a0, a1, a2, a3); } + private static Object[] array(Object a0, Object a1, Object a2, Object a3, + Object a4) + { return makeArray(a0, a1, a2, a3, a4); } + private static Object[] array(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5) + { return makeArray(a0, a1, a2, a3, a4, a5); } + private static Object[] array(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6) + { return makeArray(a0, a1, a2, a3, a4, a5, a6); } + private static Object[] array(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7) + { return makeArray(a0, a1, a2, a3, a4, a5, a6, a7); } + private static Object[] array(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8) + { return makeArray(a0, a1, a2, a3, a4, a5, a6, a7, a8); } + private static Object[] array(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9) + { return makeArray(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); } + static MethodHandle[] makeArrays() { + ArrayList arrays = new ArrayList(); + MethodHandles.Lookup lookup = IMPL_LOOKUP; + for (;;) { + int nargs = arrays.size(); + MethodType type = MethodType.genericMethodType(nargs).changeReturnType(Object[].class); + String name = "array"; + MethodHandle array = null; + try { + array = lookup.findStatic(ValueConversions.class, name, type); + } catch (NoAccessException ex) { + } + if (array == null) break; + arrays.add(array); + } + assert(arrays.size() == 11); // current number of methods + return arrays.toArray(new MethodHandle[0]); + } + static final MethodHandle[] ARRAYS = makeArrays(); + + /** Return a method handle that takes the indicated number of Object + * arguments and returns an Object array of them, as if for varargs. + */ + public static MethodHandle varargsArray(int nargs) { + if (nargs < ARRAYS.length) + return ARRAYS[nargs]; + // else need to spin bytecode or do something else fancy + throw new UnsupportedOperationException("NYI"); + } + + private static final List NO_ARGS_LIST = Arrays.asList(NO_ARGS_ARRAY); + private static List makeList(Object... args) { return Arrays.asList(args); } + private static List list() { return NO_ARGS_LIST; } + private static List list(Object a0) + { return makeList(a0); } + private static List list(Object a0, Object a1) + { return makeList(a0, a1); } + private static List list(Object a0, Object a1, Object a2) + { return makeList(a0, a1, a2); } + private static List list(Object a0, Object a1, Object a2, Object a3) + { return makeList(a0, a1, a2, a3); } + private static List list(Object a0, Object a1, Object a2, Object a3, + Object a4) + { return makeList(a0, a1, a2, a3, a4); } + private static List list(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5) + { return makeList(a0, a1, a2, a3, a4, a5); } + private static List list(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6) + { return makeList(a0, a1, a2, a3, a4, a5, a6); } + private static List list(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7) + { return makeList(a0, a1, a2, a3, a4, a5, a6, a7); } + private static List list(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8) + { return makeList(a0, a1, a2, a3, a4, a5, a6, a7, a8); } + private static List list(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9) + { return makeList(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); } + static MethodHandle[] makeLists() { + ArrayList arrays = new ArrayList(); + MethodHandles.Lookup lookup = IMPL_LOOKUP; + for (;;) { + int nargs = arrays.size(); + MethodType type = MethodType.genericMethodType(nargs).changeReturnType(List.class); + String name = "list"; + MethodHandle array = null; + try { + array = lookup.findStatic(ValueConversions.class, name, type); + } catch (NoAccessException ex) { + } + if (array == null) break; + arrays.add(array); + } + assert(arrays.size() == 11); // current number of methods + return arrays.toArray(new MethodHandle[0]); + } + static final MethodHandle[] LISTS = makeLists(); + + /** Return a method handle that takes the indicated number of Object + * arguments and returns List. + */ + public static MethodHandle varargsList(int nargs) { + if (nargs < LISTS.length) + return LISTS[nargs]; + // else need to spin bytecode or do something else fancy + throw new UnsupportedOperationException("NYI"); + } } + diff --git a/src/share/classes/sun/dyn/util/VerifyAccess.java b/src/share/classes/sun/dyn/util/VerifyAccess.java index 8bee85017ba67d2bff8a6436378242a6d3b1d428..aec90d54e6c652eddffa94a4d1139c3090f0f809 100644 --- a/src/share/classes/sun/dyn/util/VerifyAccess.java +++ b/src/share/classes/sun/dyn/util/VerifyAccess.java @@ -26,8 +26,12 @@ package sun.dyn.util; import java.dyn.LinkagePermission; +import java.dyn.MethodHandles.Lookup; +import java.dyn.NoAccessException; import java.lang.reflect.Modifier; -import sun.dyn.Access; +import sun.dyn.MemberName; +import sun.dyn.MethodHandleImpl; +import sun.dyn.empty.Empty; /** * This class centralizes information about the JVM's linkage access control. @@ -45,21 +49,21 @@ public class VerifyAccess { *

    * Some circumstances require an additional check on the * leading parameter (the receiver) of the method, if it is non-static. - * In the case of {@code invokespecial} ({@code doDispatch} is false), + * In the case of {@code invokespecial} ({@code isSpecialInvoke} is true), * the leading parameter must be the accessing class or a subclass. * In the case of a call to a {@code protected} method outside the same * package, the same constraint applies. * @param m the proposed callee - * @param doDispatch if false, a non-static m will be invoked as if by {@code invokespecial} + * @param isSpecialInvoke if true, a non-static method m is checked as if for {@code invokespecial} * @param lookupClass the class for which the access check is being made * @return null if the method is not accessible, else a receiver type constraint, else {@code Object.class} */ public static Class isAccessible(Class defc, int mods, - boolean doDispatch, Class lookupClass) { + Class lookupClass, boolean isSpecialInvoke) { if (!isAccessible(defc, lookupClass)) return null; Class constraint = Object.class; - if (!doDispatch && !Modifier.isStatic(mods)) { + if (isSpecialInvoke && !Modifier.isStatic(mods)) { constraint = lookupClass; } if (Modifier.isPublic(mods)) @@ -166,4 +170,38 @@ public class VerifyAccess { if (isSamePackage(requestingClass, subjectClass)) return; security.checkPermission(new LinkagePermission(permissionName, requestingClass)); } + + private static RuntimeException checkNameFailed(MemberName self, Lookup lookup, String comment) { + return new NoAccessException("cannot access from "+lookup+": "+self.toString()+": "+comment); + } + public static void checkName(MemberName self, Lookup lookup) { + Class lc = lookup.lookupClass(); + if (lc == null) return; // lookup is privileged + Class dc = self.getDeclaringClass(); + int samepkg = 0; + // First check the containing class. Must be public or local. + if (!Modifier.isPublic(dc.getModifiers())) { + if (lc != Empty.class) + samepkg = (isSamePackage(dc, lc) ? 1 : -1); + if (samepkg <= 0) + throw checkNameFailed(self, lookup, "class is not public"); + } + // At this point dc is known to be accessible. + if (self.isPublic()) { + return; + } else if (lc == Empty.class) { + throw checkNameFailed(self, lookup, "member is not public"); + } else if (self.isProtected()) { + if (dc.isAssignableFrom(lc)) return; + } else if (self.isPrivate()) { + if (isSamePackageMember(dc, lc)) return; + throw checkNameFailed(self, lookup, "member is private"); + } + // Fall-through handles the package-private and protected cases. + if (samepkg == 0) + samepkg = (isSamePackage(dc, lc) ? 1 : -1); + if (samepkg > 0) return; + throw checkNameFailed(self, lookup, + self.isProtected() ? "member is protected" : "member is private to package"); + } } diff --git a/src/share/classes/sun/dyn/util/VerifyType.java b/src/share/classes/sun/dyn/util/VerifyType.java index 9d12c74afa9b69720f554fc7d94063d0779b55ed..14b0827c00edaddc5ac54fee239e2fee0fd9768d 100644 --- a/src/share/classes/sun/dyn/util/VerifyType.java +++ b/src/share/classes/sun/dyn/util/VerifyType.java @@ -26,6 +26,7 @@ package sun.dyn.util; import java.dyn.MethodType; +import sun.dyn.empty.Empty; /** * This class centralizes information about the JVM verifier @@ -73,29 +74,28 @@ public class VerifyType { } /** - * Is the given type either java.lang.Void or java.lang.Null? - * These types serve as markers for bare nulls and therefore - * may be promoted to any type. This is secure, since + * Is the given type java.lang.Null or an equivalent null-only type? */ public static boolean isNullType(Class type) { if (type == null) return false; - return type == NULL_CLASS_1 || type == NULL_CLASS_2; + return type == NULL_CLASS + // This one may also be used as a null type. + // TO DO: Decide if we really want to legitimize it here. + // Probably we do, unless java.lang.Null really makes it into Java 7 + //|| type == Void.class + // Locally known null-only class: + || type == Empty.class + ; } - private static final Class NULL_CLASS_1, NULL_CLASS_2; + private static final Class NULL_CLASS; static { - Class nullClass1 = null, nullClass2 = null; + Class nullClass = null; try { - nullClass1 = Class.forName("java.lang.Null"); + nullClass = Class.forName("java.lang.Null"); } catch (ClassNotFoundException ex) { // OK, we'll cope } - NULL_CLASS_1 = nullClass1; - - // This one may also be used as a null type. - // TO DO: Decide if we really want to legitimize it here. - // Probably we do, unless java.lang.Null really makes it into Java 7 - nullClass2 = Void.class; - NULL_CLASS_2 = nullClass2; + NULL_CLASS = nullClass; } /** @@ -191,6 +191,11 @@ public class VerifyType { // to be captured as a garbage int. // Caller promises that the actual value will be disregarded. return dst == int.class ? 1 : 0; + if (isNullType(src)) + // Special permission for raw conversions: allow a null + // to be reinterpreted as anything. For objects, it is safe, + // and for primitives you get a garbage value (probably zero). + return 1; if (!src.isPrimitive()) return 0; Wrapper sw = Wrapper.forPrimitiveType(src); diff --git a/src/share/classes/sun/dyn/util/Wrapper.java b/src/share/classes/sun/dyn/util/Wrapper.java index 556fda3bc7b928bd7ccfb7f401e29c673e36f211..84747080de7c0932a2c2210991493344d28a1808 100644 --- a/src/share/classes/sun/dyn/util/Wrapper.java +++ b/src/share/classes/sun/dyn/util/Wrapper.java @@ -141,13 +141,19 @@ public enum Wrapper { * @throws IllegalArgumentException for unexpected types */ public static Wrapper forPrimitiveType(Class type) { + Wrapper w = findPrimitiveType(type); + if (w != null) return w; + if (type.isPrimitive()) + throw new InternalError(); // redo hash function + throw newIllegalArgumentException("not primitive: "+type); + } + + static Wrapper findPrimitiveType(Class type) { Wrapper w = FROM_PRIM[hashPrim(type)]; if (w != null && w.primitiveType == type) { return w; } - if (type.isPrimitive()) - throw new InternalError(); // redo hash function - throw newIllegalArgumentException("not primitive: "+type); + return null; } /** Return the wrapper that wraps values into the given wrapper type. @@ -160,7 +166,7 @@ public enum Wrapper { Wrapper w = findWrapperType(type); if (w != null) return w; for (Wrapper x : values()) - if (w.wrapperType == type) + if (x.wrapperType == type) throw new InternalError(); // redo hash function throw newIllegalArgumentException("not wrapper: "+type); } @@ -244,8 +250,10 @@ public enum Wrapper { public Class wrapperType() { return wrapperType; } /** What is the wrapper type for this wrapper? - * The example type must be the wrapper type, + * Otherwise, the example type must be the wrapper type, * or the corresponding primitive type. + * (For {@code OBJECT}, the example type can be any non-primitive, + * and is normalized to {@code Object.class}.) * The resulting class type has the same type parameter. */ public Class wrapperType(Class exampleType) { @@ -290,6 +298,16 @@ public enum Wrapper { return type.isPrimitive(); } + /** What is the bytecode signature character for this type? + * All non-primitives, including array types, report as 'L', the signature character for references. + */ + public static char basicTypeChar(Class type) { + if (!type.isPrimitive()) + return 'L'; + else + return forPrimitiveType(type).basicTypeChar(); + } + /** What is the bytecode signature character for this wrapper's * primitive type? */ @@ -309,7 +327,7 @@ public enum Wrapper { /** Cast a wrapped value to the given type, which may be either a primitive or wrapper type. * Performs standard primitive conversions, including truncation and float conversions. * The given type must be compatible with this wrapper. That is, it must either - * be the wrapper type (or a subtype, in the case of {@code OBJECT} or else + * be the wrapper type (or a subtype, in the case of {@code OBJECT}) or else * it must be the wrapper's primitive type. * @throws ClassCastException if the given type is not compatible with this wrapper */ @@ -326,9 +344,17 @@ public enum Wrapper { * If the target type is a primitive, change it to a wrapper. */ static Class forceType(Class type, Class exampleType) { + boolean z = (type == exampleType || + type.isPrimitive() && forPrimitiveType(type) == findWrapperType(exampleType) || + exampleType.isPrimitive() && forPrimitiveType(exampleType) == findWrapperType(type) || + type == Object.class && !exampleType.isPrimitive()); + if (!z) + System.out.println(type+" <= "+exampleType); assert(type == exampleType || - type == asWrapperType(exampleType) || - type == Object.class && exampleType.isInterface()); + type.isPrimitive() && forPrimitiveType(type) == findWrapperType(exampleType) || + exampleType.isPrimitive() && forPrimitiveType(exampleType) == findWrapperType(type) || + type == Object.class && !exampleType.isPrimitive()); + @SuppressWarnings("unchecked") Class result = (Class) type; // unchecked warning is expected here return result; } diff --git a/src/share/classes/sun/nio/fs/AbstractPath.java b/src/share/classes/sun/nio/fs/AbstractPath.java index 71204bd0a2e3abf8f94448899c4a6eaca4246eea..e81e3eb1f9850fc621331b4573e71a8ae2ee9d1b 100644 --- a/src/share/classes/sun/nio/fs/AbstractPath.java +++ b/src/share/classes/sun/nio/fs/AbstractPath.java @@ -256,8 +256,8 @@ abstract class AbstractPath extends Path { } if (option == null) throw new NullPointerException(); - throw new IllegalArgumentException("'" + option + - "' is not a valid copy option"); + throw new UnsupportedOperationException("'" + option + + "' is not a recognized copy option"); } return result; } @@ -279,9 +279,21 @@ abstract class AbstractPath extends Path { if (attrs.isSymbolicLink()) throw new IOException("Copying of symbolic links not supported"); - // delete target file - if (opts.replaceExisting) - target.deleteIfExists(); + // check if target exists + boolean exists; + if (opts.replaceExisting) { + try { + target.deleteIfExists(); + exists = false; + } catch (DirectoryNotEmptyException x) { + // let exception translate to FileAlreadyExistsException (6895012) + exists = true; + } + } else { + exists = target.exists(); + } + if (exists) + throw new FileAlreadyExistsException(target.toString()); // create directory or file if (attrs.isDirectory()) { @@ -318,7 +330,7 @@ abstract class AbstractPath extends Path { ReadableByteChannel rbc = newByteChannel(); try { // open target file for writing - SeekableByteChannel sbc = target.newByteChannel(CREATE, WRITE); + SeekableByteChannel sbc = target.newByteChannel(CREATE_NEW, WRITE); // simple copy loop try { diff --git a/src/share/classes/sun/nio/fs/AbstractWatchKey.java b/src/share/classes/sun/nio/fs/AbstractWatchKey.java index 8e33f81ed8431c38fce563d0771b59580bb6716f..b00c71d37cd30d77eaba42e464afd18d3bdff43e 100644 --- a/src/share/classes/sun/nio/fs/AbstractWatchKey.java +++ b/src/share/classes/sun/nio/fs/AbstractWatchKey.java @@ -88,27 +88,25 @@ abstract class AbstractWatchKey extends WatchKey { final void signalEvent(WatchEvent.Kind kind, Object context) { synchronized (this) { int size = events.size(); - if (size > 1) { - // don't let list get too big + if (size > 0) { + // if the previous event is an OVERFLOW event or this is a + // repeated event then we simply increment the counter + WatchEvent prev = events.get(size-1); + if ((prev.kind() == StandardWatchEventKind.OVERFLOW) || + ((kind == prev.kind() && + Objects.equals(context, prev.context())))) + { + ((Event)prev).increment(); + return; + } + + // if the list has reached the limit then drop pending events + // and queue an OVERFLOW event if (size >= MAX_EVENT_LIST_SIZE) { + events.clear(); kind = StandardWatchEventKind.OVERFLOW; context = null; } - - // repeated event - WatchEvent prev = events.get(size-1); - if (kind == prev.kind()) { - boolean isRepeat; - if (context == null) { - isRepeat = (prev.context() == null); - } else { - isRepeat = context.equals(prev.context()); - } - if (isRepeat) { - ((Event)prev).increment(); - return; - } - } } // non-repeated event diff --git a/src/share/classes/sun/security/jgss/GSSManagerImpl.java b/src/share/classes/sun/security/jgss/GSSManagerImpl.java index eeb23fc940ac3b19b3f5faf83923887060beae31..5a8143e30f072ad60491ebbdc20fa98b6de32a0f 100644 --- a/src/share/classes/sun/security/jgss/GSSManagerImpl.java +++ b/src/share/classes/sun/security/jgss/GSSManagerImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2000-2010 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -89,6 +89,11 @@ public class GSSManagerImpl extends GSSManager { Oid[] retVal = new Oid[mechs.length]; int pos = 0; + // Compatibility with RFC 2853 old NT_HOSTBASED_SERVICE value. + if (nameType.equals(GSSNameImpl.oldHostbasedServiceName)) { + nameType = GSSName.NT_HOSTBASED_SERVICE; + } + // Iterate thru all mechs in GSS for (int i = 0; i < mechs.length; i++) { // what nametypes does this mech support? diff --git a/src/share/classes/sun/security/jgss/GSSNameImpl.java b/src/share/classes/sun/security/jgss/GSSNameImpl.java index c1834d81dbbf1654bfd0529f8bd098cdb5bfb7e3..1e47fdfa33ee0140ca8ebc62e744d461787be513 100644 --- a/src/share/classes/sun/security/jgss/GSSNameImpl.java +++ b/src/share/classes/sun/security/jgss/GSSNameImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2006 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2000-2010 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -81,6 +81,29 @@ import sun.security.util.DerOutputStream; public class GSSNameImpl implements GSSName { + /** + * The old Oid used in RFC 2853. Now supported as + * input parameters in: + * + * 1. The four overloaded GSSManager.createName(*) methods + * 2. GSSManager.getMechsForName(Oid) + * + * Note that even if a GSSName is created with this old Oid, + * its internal name type and getStringNameType() output are + * always the new value. + */ + final static Oid oldHostbasedServiceName; + + static { + Oid tmp = null; + try { + tmp = new Oid("1.3.6.1.5.6.2"); + } catch (Exception e) { + // should never happen + } + oldHostbasedServiceName = tmp; + } + private GSSManagerImpl gssManager = null; /* @@ -134,6 +157,9 @@ public class GSSNameImpl implements GSSName { Oid mech) throws GSSException { + if (oldHostbasedServiceName.equals(appNameType)) { + appNameType = GSSName.NT_HOSTBASED_SERVICE; + } if (appName == null) throw new GSSExceptionImpl(GSSException.BAD_NAME, "Cannot import null name"); diff --git a/src/share/classes/sun/security/jgss/GSSUtil.java b/src/share/classes/sun/security/jgss/GSSUtil.java index a59bf5dfab2bd52588cce2fe73fea917a5e12e0c..c2c87b5096dac64f67fc49cfebd87453aee3bfb6 100644 --- a/src/share/classes/sun/security/jgss/GSSUtil.java +++ b/src/share/classes/sun/security/jgss/GSSUtil.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2000-2010 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -66,9 +66,6 @@ public class GSSUtil { public static final Oid NT_GSS_KRB5_PRINCIPAL = GSSUtil.createOid("1.2.840.113554.1.2.2.1"); - public static final Oid NT_HOSTBASED_SERVICE2 = - GSSUtil.createOid("1.2.840.113554.1.2.1.4"); - private static final String DEFAULT_HANDLER = "auth.login.defaultCallbackHandler"; diff --git a/src/share/classes/sun/security/jgss/wrapper/GSSNameElement.java b/src/share/classes/sun/security/jgss/wrapper/GSSNameElement.java index d96a47b522d492eceed6774dcb77ead9f9bea1d3..2bab4bc8cc50fd185871e49e64797424ac06fa12 100644 --- a/src/share/classes/sun/security/jgss/wrapper/GSSNameElement.java +++ b/src/share/classes/sun/security/jgss/wrapper/GSSNameElement.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2005-2010 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -55,8 +55,7 @@ public class GSSNameElement implements GSSNameSpi { static final GSSNameElement DEF_ACCEPTOR = new GSSNameElement(); private static Oid getNativeNameType(Oid nameType, GSSLibStub stub) { - if (GSSUtil.NT_GSS_KRB5_PRINCIPAL.equals(nameType) || - GSSName.NT_HOSTBASED_SERVICE.equals(nameType)) { + if (GSSUtil.NT_GSS_KRB5_PRINCIPAL.equals(nameType)) { Oid[] supportedNTs = null; try { supportedNTs = stub.inquireNamesForMech(); @@ -83,15 +82,9 @@ public class GSSNameElement implements GSSNameSpi { if (supportedNTs[i].equals(nameType)) return nameType; } // Special handling the specified name type - if (GSSUtil.NT_GSS_KRB5_PRINCIPAL.equals(nameType)) { - SunNativeProvider.debug("Override " + nameType + - " with mechanism default(null)"); - return null; // Use mechanism specific default - } else { - SunNativeProvider.debug("Override " + nameType + - " with " + GSSUtil.NT_HOSTBASED_SERVICE2); - return GSSUtil.NT_HOSTBASED_SERVICE2; - } + SunNativeProvider.debug("Override " + nameType + + " with mechanism default(null)"); + return null; // Use mechanism specific default } } return nameType; diff --git a/src/share/classes/sun/security/krb5/Config.java b/src/share/classes/sun/security/krb5/Config.java index 283e0d28cbfcf2b3d6fe5443343c016119ec53e5..3cc209c9f21af24620c1803677e3a60d7c370e14 100644 --- a/src/share/classes/sun/security/krb5/Config.java +++ b/src/share/classes/sun/security/krb5/Config.java @@ -109,6 +109,7 @@ public class Config { public static synchronized void refresh() throws KrbException { singleton = new Config(); KeyTab.refresh(); + KrbKdcReq.KdcAccessibility.reset(); } diff --git a/src/share/classes/sun/security/krb5/EncryptionKey.java b/src/share/classes/sun/security/krb5/EncryptionKey.java index adf2cd8ace1c2d300662802783b4fd39abff45a7..15d6d78c04df0ac389da261101d9c24d83a594d2 100644 --- a/src/share/classes/sun/security/krb5/EncryptionKey.java +++ b/src/share/classes/sun/security/krb5/EncryptionKey.java @@ -511,6 +511,23 @@ public class EncryptionKey return findKey(etype, null, keys); } + /** + * Determines if a kvno matches another kvno. Used in the method + * findKey(type, kvno, keys). Always returns true if either input + * is null or zero, in case any side does not have kvno info available. + * + * Note: zero is included because N/A is not a legal value for kvno + * in javax.security.auth.kerberos.KerberosKey. Therefore, the info + * that the kvno is N/A might be lost when converting between this + * class and KerberosKey. + */ + private static boolean versionMatches(Integer v1, Integer v2) { + if (v1 == null || v1 == 0 || v2 == null || v2 == 0) { + return true; + } + return v1.equals(v2); + } + /** * Find a key with given etype and kvno * @param kvno if null, return any (first?) key @@ -525,15 +542,20 @@ public class EncryptionKey } int ktype; + boolean etypeFound = false; for (int i = 0; i < keys.length; i++) { ktype = keys[i].getEType(); if (EType.isSupported(ktype)) { Integer kv = keys[i].getKeyVersionNumber(); - if (etype == ktype && (kvno == null || kvno.equals(kv))) { - return keys[i]; + if (etype == ktype) { + etypeFound = true; + if (versionMatches(kvno, kv)) { + return keys[i]; + } } } } + // Key not found. // allow DES key to be used for the DES etypes if ((etype == EncryptedData.ETYPE_DES_CBC_CRC || @@ -543,12 +565,16 @@ public class EncryptionKey if (ktype == EncryptedData.ETYPE_DES_CBC_CRC || ktype == EncryptedData.ETYPE_DES_CBC_MD5) { Integer kv = keys[i].getKeyVersionNumber(); - if (kvno == null || kvno.equals(kv)) { + etypeFound = true; + if (versionMatches(kvno, kv)) { return new EncryptionKey(etype, keys[i].getBytes()); } } } } + if (etypeFound) { + throw new KrbException(Krb5.KRB_AP_ERR_BADKEYVER); + } return null; } } diff --git a/src/share/classes/sun/security/krb5/KrbKdcReq.java b/src/share/classes/sun/security/krb5/KrbKdcReq.java index b915ff99711dd0fabf8bbf24b835dd3d0e3adce6..389fd04be4efbd1c2cf9079f63a7141b32719016 100644 --- a/src/share/classes/sun/security/krb5/KrbKdcReq.java +++ b/src/share/classes/sun/security/krb5/KrbKdcReq.java @@ -31,25 +31,26 @@ package sun.security.krb5; +import java.security.AccessController; +import java.security.PrivilegedAction; +import java.security.Security; +import java.util.Locale; import sun.security.krb5.internal.Krb5; import sun.security.krb5.internal.UDPClient; import sun.security.krb5.internal.TCPClient; import java.io.IOException; -import java.io.InterruptedIOException; import java.net.SocketTimeoutException; -import java.net.UnknownHostException; import java.util.StringTokenizer; import java.security.AccessController; import java.security.PrivilegedExceptionAction; import java.security.PrivilegedActionException; +import java.util.ArrayList; +import java.util.List; +import java.util.Set; +import java.util.HashSet; public abstract class KrbKdcReq { - /** - * Default port for a KDC. - */ - private static final int DEFAULT_KDC_PORT = Krb5.KDC_INET_DEFAULT_PORT; - // Currently there is no option to specify retries // in the kerberos configuration file @@ -66,7 +67,48 @@ public abstract class KrbKdcReq { private static int udpPrefLimit = -1; + private static final String BAD_POLICY_KEY = "krb5.kdc.bad.policy"; + + /** + * What to do when a KDC is unavailable, specified in the + * java.security file with key krb5.kdc.bad.policy. + * Possible values can be TRY_LAST or TRY_LESS + */ + private enum BpType { + NONE, TRY_LAST, TRY_LESS + } + private static int tryLessMaxRetries = 1; + private static int tryLessTimeout = 5000; + + private static final BpType badPolicy; + static { + String value = AccessController.doPrivileged( + new PrivilegedAction() { + public String run() { + return Security.getProperty(BAD_POLICY_KEY); + } + }); + if (value != null) { + value = value.toLowerCase(Locale.ENGLISH); + String[] ss = value.split(":"); + if ("tryless".equals(ss[0])) { + if (ss.length > 1) { + String[] params = ss[1].split(","); + tryLessMaxRetries = Integer.parseInt(params[0]); + if (params.length > 1) { + tryLessTimeout = Integer.parseInt(params[1]); + } + } + badPolicy = BpType.TRY_LESS; + } else if ("trylast".equals(ss[0])) { + badPolicy = BpType.TRY_LAST; + } else { + badPolicy = BpType.NONE; + } + } else { + badPolicy = BpType.NONE; + } /* * Get default timeout. @@ -131,22 +173,16 @@ public abstract class KrbKdcReq { } } - /* - * Get timeout. - */ - - int timeout = getKdcTimeout(realm); - String kdcList = cfg.getKDCList(realm); if (kdcList == null) { throw new KrbException("Cannot get kdc for realm " + realm); } String tempKdc = null; // may include the port number also - StringTokenizer st = new StringTokenizer(kdcList); - while (st.hasMoreTokens()) { - tempKdc = st.nextToken(); + for (String tmp: KdcAccessibility.list(kdcList)) { + tempKdc = tmp; try { send(realm,tempKdc,useTCP); + KdcAccessibility.removeBad(tempKdc); break; } catch (Exception e) { if (DEBUG) { @@ -154,6 +190,7 @@ public abstract class KrbKdcReq { tempKdc); e.printStackTrace(System.out); } + KdcAccessibility.addBad(tempKdc); savedException = e; } } @@ -174,16 +211,21 @@ public abstract class KrbKdcReq { if (obuf == null) return; - PrivilegedActionException savedException = null; - int port = Krb5.KDC_INET_DEFAULT_PORT; - /* - * Get timeout. - */ + int port = Krb5.KDC_INET_DEFAULT_PORT; + int retries = DEFAULT_KDC_RETRY_LIMIT; int timeout = getKdcTimeout(realm); - /* - * Get port number for this KDC. - */ + + if (badPolicy == BpType.TRY_LESS && + KdcAccessibility.isBad(tempKdc)) { + if (retries > tryLessMaxRetries) { + retries = tryLessMaxRetries; // less retries + } + if (timeout > tryLessTimeout) { + timeout = tryLessTimeout; // less time + } + } + String kdc = null; String portStr = null; @@ -225,12 +267,12 @@ public abstract class KrbKdcReq { + port + ", timeout=" + timeout + ", number of retries =" - + DEFAULT_KDC_RETRY_LIMIT + + retries + ", #bytes=" + obuf.length); } KdcCommunication kdcCommunication = - new KdcCommunication(kdc, port, useTCP, timeout, obuf); + new KdcCommunication(kdc, port, useTCP, timeout, retries, obuf); try { ibuf = AccessController.doPrivileged(kdcCommunication); if (DEBUG) { @@ -258,14 +300,16 @@ public abstract class KrbKdcReq { private int port; private boolean useTCP; private int timeout; + private int retries; private byte[] obuf; public KdcCommunication(String kdc, int port, boolean useTCP, - int timeout, byte[] obuf) { + int timeout, int retries, byte[] obuf) { this.kdc = kdc; this.port = port; this.useTCP = useTCP; this.timeout = timeout; + this.retries = retries; this.obuf = obuf; } @@ -294,7 +338,7 @@ public abstract class KrbKdcReq { } else { // For each KDC we try DEFAULT_KDC_RETRY_LIMIT (3) times to // get the response - for (int i=1; i <= DEFAULT_KDC_RETRY_LIMIT; i++) { + for (int i=1; i <= retries; i++) { UDPClient kdcClient = new UDPClient(kdc, port, timeout); if (DEBUG) { @@ -310,7 +354,7 @@ public abstract class KrbKdcReq { * Send the data to the kdc. */ - kdcClient.send(obuf); + kdcClient.send(obuf); /* * And get a response. @@ -323,7 +367,7 @@ public abstract class KrbKdcReq { System.out.println ("SocketTimeOutException with " + "attempt: " + i); } - if (i == DEFAULT_KDC_RETRY_LIMIT) { + if (i == retries) { ibuf = null; throw se; } @@ -385,4 +429,67 @@ public abstract class KrbKdcReq { return -1; } + + /** + * Maintains a KDC accessible list. Unavailable KDCs are put into a + * blacklist, when a KDC in the blacklist is available, it's removed + * from there. No insertion order in the blacklist. + * + * There are two methods to deal with KDCs in the blacklist. 1. Only try + * them when there's no KDC not on the blacklist. 2. Still try them, but + * with lesser number of retries and smaller timeout value. + */ + static class KdcAccessibility { + // Known bad KDCs + private static Set bads = new HashSet(); + + private static synchronized void addBad(String kdc) { + if (DEBUG) { + System.out.println(">>> KdcAccessibility: add " + kdc); + } + bads.add(kdc); + } + + private static synchronized void removeBad(String kdc) { + if (DEBUG) { + System.out.println(">>> KdcAccessibility: remove " + kdc); + } + bads.remove(kdc); + } + + private static synchronized boolean isBad(String kdc) { + return bads.contains(kdc); + } + + public static synchronized void reset() { + if (DEBUG) { + System.out.println(">>> KdcAccessibility: reset"); + } + bads.clear(); + } + + // Returns a preferred KDC list by putting the bad ones at the end + private static synchronized String[] list(String kdcList) { + StringTokenizer st = new StringTokenizer(kdcList); + List list = new ArrayList(); + if (badPolicy == BpType.TRY_LAST) { + List badkdcs = new ArrayList(); + while (st.hasMoreTokens()) { + String t = st.nextToken(); + if (bads.contains(t)) badkdcs.add(t); + else list.add(t); + } + // Bad KDCs are put at last + list.addAll(badkdcs); + } else { + // All KDCs are returned in their original order, + // This include TRY_LESS and NONE + while (st.hasMoreTokens()) { + list.add(st.nextToken()); + } + } + return list.toArray(new String[list.size()]); + } + } } + diff --git a/src/share/classes/sun/security/krb5/internal/ktab/KeyTabEntry.java b/src/share/classes/sun/security/krb5/internal/ktab/KeyTabEntry.java index 3eb08b5df43e883d3475b685e146b7f131ec5935..49c99fcb9d3d7ca294a5cfb52d2cd922eaefa0e8 100644 --- a/src/share/classes/sun/security/krb5/internal/ktab/KeyTabEntry.java +++ b/src/share/classes/sun/security/krb5/internal/ktab/KeyTabEntry.java @@ -75,7 +75,7 @@ public class KeyTabEntry implements KeyTabConstants { public String getKeyString() { StringBuffer sb = new StringBuffer("0x"); for (int i = 0; i < keyblock.length; i++) { - sb.append(Integer.toHexString(keyblock[i]&0xff)); + sb.append(String.format("%02x", keyblock[i]&0xff)); } return sb.toString(); } diff --git a/src/share/classes/sun/security/provider/certpath/OCSPResponse.java b/src/share/classes/sun/security/provider/certpath/OCSPResponse.java index e7b148fbc7cae379c925082ffd5e6fb24d77b206..c80888f9c1ed8c6f7253f5cd5ef7cb35eca92c84 100644 --- a/src/share/classes/sun/security/provider/certpath/OCSPResponse.java +++ b/src/share/classes/sun/security/provider/certpath/OCSPResponse.java @@ -574,10 +574,18 @@ public final class OCSPResponse { (singleExtDer.length); for (int i = 0; i < singleExtDer.length; i++) { Extension ext = new Extension(singleExtDer[i]); - singleExtensions.put(ext.getId(), ext); if (DEBUG != null) { DEBUG.println("OCSP single extension: " + ext); } + // We don't support any extensions yet. Therefore, if it + // is critical we must throw an exception because we + // don't know how to process it. + if (ext.isCritical()) { + throw new IOException( + "Unsupported OCSP critical extension: " + + ext.getExtensionId()); + } + singleExtensions.put(ext.getId(), ext); } } else { singleExtensions = Collections.emptyMap(); diff --git a/src/share/classes/sun/security/ssl/krb5/KerberosClientKeyExchangeImpl.java b/src/share/classes/sun/security/ssl/krb5/KerberosClientKeyExchangeImpl.java index d0f95758c49564a69b273430dd133740ce6af464..28af066e260ef5baee8942fbaae8c0edf9f7ebc4 100644 --- a/src/share/classes/sun/security/ssl/krb5/KerberosClientKeyExchangeImpl.java +++ b/src/share/classes/sun/security/ssl/krb5/KerberosClientKeyExchangeImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2003-2009 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2003-2010 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -50,11 +50,12 @@ import sun.security.krb5.internal.EncTicketPart; import sun.security.krb5.internal.crypto.KeyUsage; import sun.security.jgss.krb5.Krb5Util; +import sun.security.krb5.KrbException; +import sun.security.krb5.internal.Krb5; import sun.security.ssl.Debug; import sun.security.ssl.HandshakeInStream; import sun.security.ssl.HandshakeOutStream; -import sun.security.ssl.KerberosClientKeyExchange; import sun.security.ssl.ProtocolVersion; /** @@ -188,7 +189,14 @@ public final class KerberosClientKeyExchangeImpl // See if we have the right key to decrypt the ticket to get // the session key. int encPartKeyType = encPart.getEType(); - KerberosKey dkey = findKey(encPartKeyType, serverKeys); + Integer encPartKeyVersion = encPart.getKeyVersionNumber(); + KerberosKey dkey = null; + try { + dkey = findKey(encPartKeyType, encPartKeyVersion, serverKeys); + } catch (KrbException ke) { // a kvno mismatch + throw new IOException( + "Cannot find key matching version number", ke); + } if (dkey == null) { // %%% Should print string repr of etype throw new IOException( @@ -355,12 +363,34 @@ public final class KerberosClientKeyExchangeImpl return localPrincipal; } - private static KerberosKey findKey(int etype, KerberosKey[] keys) { + /** + * Determines if a kvno matches another kvno. Used in the method + * findKey(etype, version, keys). Always returns true if either input + * is null or zero, in case any side does not have kvno info available. + * + * Note: zero is included because N/A is not a legal value for kvno + * in javax.security.auth.kerberos.KerberosKey. Therefore, the info + * that the kvno is N/A might be lost when converting between + * EncryptionKey and KerberosKey. + */ + private static boolean versionMatches(Integer v1, int v2) { + if (v1 == null || v1 == 0 || v2 == 0) { + return true; + } + return v1.equals(v2); + } + + private static KerberosKey findKey(int etype, Integer version, + KerberosKey[] keys) throws KrbException { int ktype; + boolean etypeFound = false; for (int i = 0; i < keys.length; i++) { ktype = keys[i].getKeyType(); if (etype == ktype) { - return keys[i]; + etypeFound = true; + if (versionMatches(version, keys[i].getVersionNumber())) { + return keys[i]; + } } } // Key not found. @@ -370,14 +400,20 @@ public final class KerberosClientKeyExchangeImpl for (int i = 0; i < keys.length; i++) { ktype = keys[i].getKeyType(); if (ktype == EncryptedData.ETYPE_DES_CBC_CRC || - ktype == EncryptedData.ETYPE_DES_CBC_MD5) { - return new KerberosKey(keys[i].getPrincipal(), - keys[i].getEncoded(), - etype, - keys[i].getVersionNumber()); + ktype == EncryptedData.ETYPE_DES_CBC_MD5) { + etypeFound = true; + if (versionMatches(version, keys[i].getVersionNumber())) { + return new KerberosKey(keys[i].getPrincipal(), + keys[i].getEncoded(), + etype, + keys[i].getVersionNumber()); + } } } } + if (etypeFound) { + throw new KrbException(Krb5.KRB_AP_ERR_BADKEYVER); + } return null; } } diff --git a/src/share/classes/sun/text/resources/FormatData_be.java b/src/share/classes/sun/text/resources/FormatData_be.java index 27b02622b20d8091fcb17208fefcef9459af39ac..6912fe9e23bc8eb34ffd1d29b11b120beaf77a1c 100644 --- a/src/share/classes/sun/text/resources/FormatData_be.java +++ b/src/share/classes/sun/text/resources/FormatData_be.java @@ -63,7 +63,7 @@ public class FormatData_be extends ListResourceBundle { "\u0436\u043d\u0456\u045e\u043d\u044f", // august "\u0432\u0435\u0440\u0430\u0441\u043d\u044f", // september "\u043a\u0430\u0441\u0442\u0440\u044b\u0447\u043d\u0456\u043a\u0430", // october - "\u043b\u0438\u0441\u0442\u0430\u043f\u0430\u0434\u0430", // november + "\u043b\u0456\u0441\u0442\u0430\u043f\u0430\u0434\u0430", // november "\u0441\u043d\u0435\u0436\u043d\u044f", // december "" // month 13 if applicable } @@ -80,7 +80,7 @@ public class FormatData_be extends ListResourceBundle { "\u0436\u043d\u0432", // abb august "\u0432\u0440\u0441", // abb september "\u043a\u0441\u0442", // abb october - "\u043b\u0441\u0442", // abb november + "\u043b\u0456\u0441", // abb november "\u0441\u043d\u0436", // abb december "" // abb month 13 if applicable } diff --git a/src/share/classes/sun/text/resources/FormatData_de.java b/src/share/classes/sun/text/resources/FormatData_de.java index 028c17344fecb11542fae6705ad651b5db66c4ab..745216aedad7a9187f44db4ea9fddcc4b72220c2 100644 --- a/src/share/classes/sun/text/resources/FormatData_de.java +++ b/src/share/classes/sun/text/resources/FormatData_de.java @@ -130,7 +130,7 @@ public class FormatData_de extends ListResourceBundle { }, { "DateTimePatterns", new String[] { - "H.mm' Uhr 'z", // full time pattern + "HH:mm' Uhr 'z", // full time pattern "HH:mm:ss z", // long time pattern "HH:mm:ss", // medium time pattern "HH:mm", // short time pattern diff --git a/src/share/classes/sun/text/resources/FormatData_et.java b/src/share/classes/sun/text/resources/FormatData_et.java index 9413c3da6c68907192382de01ace87d477c6b20e..bc699f75a759769e493c49e52f15e230dde974f5 100644 --- a/src/share/classes/sun/text/resources/FormatData_et.java +++ b/src/share/classes/sun/text/resources/FormatData_et.java @@ -50,35 +50,35 @@ public class FormatData_et extends ListResourceBundle { return new Object[][] { { "MonthNames", new String[] { - "Jaanuar", // january - "Veebruar", // february - "M\u00e4rts", // march - "Aprill", // april - "Mai", // may - "Juuni", // june - "Juuli", // july - "August", // august - "September", // september - "Oktoober", // october - "November", // november - "Detsember", // december + "jaanuar", // january + "veebruar", // february + "m\u00e4rts", // march + "aprill", // april + "mai", // may + "juuni", // june + "juuli", // july + "august", // august + "september", // september + "oktoober", // october + "november", // november + "detsember", // december "" // month 13 if applicable } }, { "MonthAbbreviations", new String[] { - "Jaan", // abb january - "Veebr", // abb february - "M\u00e4rts", // abb march - "Apr", // abb april - "Mai", // abb may - "Juuni", // abb june - "Juuli", // abb july - "Aug", // abb august - "Sept", // abb september - "Okt", // abb october - "Nov", // abb november - "Dets", // abb december + "jaan", // abb january + "veebr", // abb february + "m\u00e4rts", // abb march + "apr", // abb april + "mai", // abb may + "juuni", // abb june + "juuli", // abb july + "aug", // abb august + "sept", // abb september + "okt", // abb october + "nov", // abb november + "dets", // abb december "" // abb month 13 if applicable } }, diff --git a/src/share/classes/sun/text/resources/FormatData_fi.java b/src/share/classes/sun/text/resources/FormatData_fi.java index 73956ee588c6b127aec1ee400ef59a2b582f9d21..bad7e14bbb066d11477bf0fdefc96cbda3d1d995 100644 --- a/src/share/classes/sun/text/resources/FormatData_fi.java +++ b/src/share/classes/sun/text/resources/FormatData_fi.java @@ -133,6 +133,12 @@ public class FormatData_fi extends ListResourceBundle { } }, { "DateTimePatternChars", "GanjkHmsSEDFwWxhKzZ" }, + { "AmPmMarkers", + new String[] { + "ap.", // am marker + "ip." // pm marker + } + }, }; } } diff --git a/src/share/classes/sun/text/resources/FormatData_hr_HR.java b/src/share/classes/sun/text/resources/FormatData_hr_HR.java index b6d39d332fab2e33c673ab14768fd152daafd623..0498f93a0067061de0ceb2381dcbee939da045ef 100644 --- a/src/share/classes/sun/text/resources/FormatData_hr_HR.java +++ b/src/share/classes/sun/text/resources/FormatData_hr_HR.java @@ -55,6 +55,19 @@ public class FormatData_hr_HR extends ListResourceBundle { "#,##0%" // percent pattern } }, + { "DateTimePatterns", + new String[] { + "HH:mm:ss z", // full time pattern + "HH:mm:ss z", // long time pattern + "HH:mm:ss", // medium time pattern + "HH:mm", // short time pattern + "yyyy. MMMM dd", // full date pattern + "yyyy. MMMM dd", // long date pattern + "dd.MM.yyyy.", // medium date pattern + "dd.MM.yy.", // short date pattern + "{1} {0}" // date-time pattern + } + } }; } } diff --git a/src/share/classes/sun/text/resources/FormatData_hu_HU.java b/src/share/classes/sun/text/resources/FormatData_hu_HU.java index d0e5a182749a4d83bff389c8a5b251e6443c17d7..1d205068d518d0dcb62cd23d5f5c7ae96f6320f7 100644 --- a/src/share/classes/sun/text/resources/FormatData_hu_HU.java +++ b/src/share/classes/sun/text/resources/FormatData_hu_HU.java @@ -51,7 +51,7 @@ public class FormatData_hu_HU extends ListResourceBundle { { "NumberPatterns", new String[] { "#,##0.###;-#,##0.###", // decimal pattern - "\u00A4#,##0.##;-\u00A4#,##0.##", // currency pattern + "#,##0.## \u00A4;-#,##0.## \u00A4", // currency pattern "#,##0%" // percent pattern } }, diff --git a/src/share/classes/sun/text/resources/FormatData_lt.java b/src/share/classes/sun/text/resources/FormatData_lt.java index e3631389b07e8c9e42d675a745f1388d17778a08..55de246ded057fe79f675b1d6003704a2eefe1d6 100644 --- a/src/share/classes/sun/text/resources/FormatData_lt.java +++ b/src/share/classes/sun/text/resources/FormatData_lt.java @@ -113,7 +113,7 @@ public class FormatData_lt extends ListResourceBundle { { "NumberElements", new String[] { ",", // decimal separator - ".", // group (thousands) separator + "\u00a0", // group (thousands) separator ";", // list separator "%", // percent sign "0", // native 0 digit @@ -133,7 +133,7 @@ public class FormatData_lt extends ListResourceBundle { "HH.mm", // short time pattern "EEEE, yyyy, MMMM d", // full date pattern "EEEE, yyyy, MMMM d", // long date pattern - "yyyy.M.d", // medium date pattern + "yyyy-MM-dd", // medium date pattern "yy.M.d", // short date pattern "{1} {0}" // date-time pattern } diff --git a/src/share/classes/sun/text/resources/FormatData_ro.java b/src/share/classes/sun/text/resources/FormatData_ro.java index 6dde8dcaf53db063a2dfd86f013f7d032cf89a05..cf6a182bf57ddfcdaf471fe811f0298a5a8fdee4 100644 --- a/src/share/classes/sun/text/resources/FormatData_ro.java +++ b/src/share/classes/sun/text/resources/FormatData_ro.java @@ -90,7 +90,7 @@ public class FormatData_ro extends ListResourceBundle { "miercuri", // Wednesday "joi", // Thursday "vineri", // Friday - "s\u00eemb\u0103t\u0103" // Saturday + "s\u00e2mb\u0103t\u0103" // Saturday } }, { "DayAbbreviations", diff --git a/src/share/classes/sun/text/resources/FormatData_uk.java b/src/share/classes/sun/text/resources/FormatData_uk.java index 90f34237c132683fb15627415938520aced3a329..2db4665b79644e04461ed3804a3c0958ff1df4c9 100644 --- a/src/share/classes/sun/text/resources/FormatData_uk.java +++ b/src/share/classes/sun/text/resources/FormatData_uk.java @@ -113,7 +113,7 @@ public class FormatData_uk extends ListResourceBundle { { "NumberElements", new String[] { ",", // decimal separator - ".", // group (thousands) separator + "\u00a0", // group (thousands) separator ";", // list separator "%", // percent sign "0", // native 0 digit diff --git a/src/share/classes/sun/util/resources/CalendarData_ro.properties b/src/share/classes/sun/util/resources/CalendarData_ro.properties index d6d95b6698e5d3a6d63a2502c067a5ac216063ff..3b6d6903439eaf90bd61ab07ca4ed115a9e2b9f8 100644 --- a/src/share/classes/sun/util/resources/CalendarData_ro.properties +++ b/src/share/classes/sun/util/resources/CalendarData_ro.properties @@ -35,9 +35,5 @@ # This notice and attribution to Taligent may not be removed. # Taligent is a registered trademark of Taligent, Inc. - -# This bundle is empty because the data of the base bundle -# is adequate for this locale. -# The bundle is necessary to prevent the resource -# bundle lookup from falling back to the default -# locale. +firstDayOfWeek=2 +minimalDaysInFirstWeek=1 diff --git a/src/share/classes/sun/util/resources/CalendarData_sl.properties b/src/share/classes/sun/util/resources/CalendarData_sl.properties index d6d95b6698e5d3a6d63a2502c067a5ac216063ff..ea7ad98522338a77d36a70ac85129aacdd80a197 100644 --- a/src/share/classes/sun/util/resources/CalendarData_sl.properties +++ b/src/share/classes/sun/util/resources/CalendarData_sl.properties @@ -36,8 +36,4 @@ # Taligent is a registered trademark of Taligent, Inc. -# This bundle is empty because the data of the base bundle -# is adequate for this locale. -# The bundle is necessary to prevent the resource -# bundle lookup from falling back to the default -# locale. +firstDayOfWeek=2 diff --git a/src/share/classes/sun/util/resources/CurrencyNames_en_CA.properties b/src/share/classes/sun/util/resources/CurrencyNames_en_CA.properties index 62c976ff10073c538628e5b42d0a82805163659d..e902e799d8220b83bb2929db432eb68a8985edd0 100644 --- a/src/share/classes/sun/util/resources/CurrencyNames_en_CA.properties +++ b/src/share/classes/sun/util/resources/CurrencyNames_en_CA.properties @@ -36,3 +36,4 @@ # Taligent is a registered trademark of Taligent, Inc. CAD=$ +USD=US$ diff --git a/src/share/classes/sun/util/resources/CurrencyNames_tr_TR.properties b/src/share/classes/sun/util/resources/CurrencyNames_tr_TR.properties index 4f9c764c5d2bff534964c00798831f47b36c1e30..51ed4758556186f760624dfc8348e2ebf25d4427 100644 --- a/src/share/classes/sun/util/resources/CurrencyNames_tr_TR.properties +++ b/src/share/classes/sun/util/resources/CurrencyNames_tr_TR.properties @@ -36,4 +36,4 @@ # Taligent is a registered trademark of Taligent, Inc. TRL=TL -TRY=YTL +TRY=TL diff --git a/src/share/classes/sun/util/resources/CurrencyNames_uk_UA.properties b/src/share/classes/sun/util/resources/CurrencyNames_uk_UA.properties index 20ed61b81b78f4475e045e0eb1fee50126c81bc5..f83822dd221fb3dae2cfb2429cea2cffe52ad1a7 100644 --- a/src/share/classes/sun/util/resources/CurrencyNames_uk_UA.properties +++ b/src/share/classes/sun/util/resources/CurrencyNames_uk_UA.properties @@ -35,4 +35,4 @@ # This notice and attribution to Taligent may not be removed. # Taligent is a registered trademark of Taligent, Inc. -UAH=\u0433\u0440\u0432. +UAH=\u0433\u0440\u043b. diff --git a/src/share/classes/sun/util/resources/LocaleNames_es.properties b/src/share/classes/sun/util/resources/LocaleNames_es.properties index 302629c050395d3be39c6baecf16e7a314841d40..d7cd4eacb6612ea9ebc37667eb199c61b3694fc4 100644 --- a/src/share/classes/sun/util/resources/LocaleNames_es.properties +++ b/src/share/classes/sun/util/resources/LocaleNames_es.properties @@ -38,7 +38,7 @@ # language names # key is ISO 639 language code -aa=afarense +aa=afar ab=abjasio ae=av\u00e9stico af=afrikaans @@ -47,16 +47,16 @@ am=am\u00e1rico an=aragon\u00e9s ar=\u00e1rabe as=asam\u00e9s -av=avaro +av=avar ay=aimara -az=azerbaiyano -ba=bashkiro +az=azer\u00ed +ba=bashkir be=bielorruso bg=b\u00falgaro -bh=bihar\u00ed +bh=bihari bi=bislama bm=bambara -bn=bengal\u00e9s +bn=bengal\u00ed bo=tibetano br=bret\u00f3n bs=bosnio @@ -66,37 +66,37 @@ ch=chamorro co=corso cr=cree cs=checo -cu=glagol\u00edtico +cu=eslavo eclesi\u00e1stico cv=chuvash cy=gal\u00e9s da=dan\u00e9s de=alem\u00e1n dv=divehi -dz=butan\u00e9s +dz=dzongkha ee=ewe el=griego en=ingl\u00e9s eo=esperanto es=espa\u00f1ol et=estonio -eu=vascuence -fa=farsi -ff=fulb\u00e9 +eu=vasco +fa=persa +ff=fula fi=fin\u00e9s -fj=fijiano -fo=faro\u00e9s +fj=fidjiano +fo=fero\u00e9s fr=franc\u00e9s -fy=frisio +fy=fris\u00f3n ga=irland\u00e9s gd=ga\u00e9lico escoc\u00e9s gl=gallego gn=guaran\u00ed -gu=gujarat\u00ed -gv=manx +gu=gujarati +gv=ga\u00e9lico man\u00e9s ha=hausa he=hebreo -hi=hind\u00fa -ho=hiri Motu +hi=hindi +ho=hiri motu hr=croata ht=haitiano hu=h\u00fangaro @@ -104,10 +104,10 @@ hy=armenio hz=herero ia=interlingua id=indonesio -ie=interlingua -ig=ibo -ii=yi de sichuan -ik=inupiak +ie=interlingue +ig=igbo +ii=sichuan yi +ik=inupiaq in=indonesio io=ido is=island\u00e9s @@ -118,20 +118,20 @@ ja=japon\u00e9s ji=y\u00eddish jv=javan\u00e9s ka=georgiano -kg=kikongo -ki=gikuyu -kj=kwanyama -kk=kazajio +kg=kongo +ki=kikuyu +kj=kuanyama +kk=kazajo kl=groenland\u00e9s -km=camboyano -kn=kanada +km=jemer +kn=canar\u00e9s ko=coreano kr=kanuri -ks=cachemir\u00ed -ku=curdo +ks=cachemiro +ku=kurdo kv=komi kw=c\u00f3rnico -ky=kirgu\u00eds +ky=kirghiz la=lat\u00edn lb=luxemburgu\u00e9s lg=ganda @@ -139,7 +139,7 @@ li=limburgu\u00e9s ln=lingala lo=laosiano lt=lituano -lu=tshiluba +lu=luba-katanga lv=let\u00f3n mg=malgache mh=marshal\u00e9s @@ -148,82 +148,82 @@ mk=macedonio ml=malayalam mn=mongol mo=moldavo -mr=m\u00e1rata +mr=marathi ms=malayo mt=malt\u00e9s my=birmano na=nauruano -nb=noruego (bokm\u00e5l) -nd=ndebele (norte) +nb=bokmal noruego +nd=ndebele septentrional ne=nepal\u00ed ng=ndonga nl=neerland\u00e9s -nn=noruego (nynorsk) +nn=nynorsk noruego no=noruego -nr=ndebele (sur) +nr=ndebele meridional nv=navajo ny=nyanja oc=occitano oj=ojibwa om=oromo or=oriya -os=osetio +os=os\u00e9tico pa=punjab\u00ed pi=pali pl=polaco ps=pashto pt=portugu\u00e9s qu=quechua -rm=retorromano -rn=rund\u00ed +rm=retorrom\u00e1nico +rn=kiroundi ro=rumano ru=ruso -rw=ruand\u00e9s +rw=kinyarwanda sa=s\u00e1nscrito sc=sardo -sd=sindino -se=sami del norte +sd=sindhi +se=sami septentrional sg=sango si=cingal\u00e9s sk=eslovaco -sl=eslovenio +sl=esloveno sm=samoano -sn=son\u00e9s +sn=shona so=somal\u00ed sq=alban\u00e9s sr=serbio -ss=suaziland\u00e9s -st=sesot\u00e9s -su=sudan\u00e9s +ss=siswati +st=sesotho +su=sundan\u00e9s sv=sueco -sw=suajili +sw=swahili ta=tamil te=telugu -tg=tajik +tg=tayiko th=tailand\u00e9s -ti=tigri\u00f1es +ti=tigri\u00f1a tk=turcomano tl=tagalo -tn=sechuan\u00e9s -to=tongu\u00e9s +tn=setchwana +to=tongano tr=turco ts=tsonga tt=t\u00e1rtaro -tw=tui -ty=taitiano -ug=uighur -uk=ucranio +tw=twi +ty=tahitiano +ug=uigur +uk=ucraniano ur=urdu -uz=uzbeco +uz=uzbeko ve=venda vi=vietnamita -vo=volapuk +vo=volap\u00fck wa=val\u00f3n wo=uolof xh=xhosa yi=y\u00eddish yo=yoruba -za=chuang +za=zhuang zh=chino zu=zul\u00fa diff --git a/src/share/classes/sun/util/resources/LocaleNames_fi.properties b/src/share/classes/sun/util/resources/LocaleNames_fi.properties index a055e55acd854d7312438fca6a7c3cd57b3d5cf8..831b1a9cd7aef148ec786b90ca9254ee26226ad8 100644 --- a/src/share/classes/sun/util/resources/LocaleNames_fi.properties +++ b/src/share/classes/sun/util/resources/LocaleNames_fi.properties @@ -49,7 +49,7 @@ el=kreikka en=englanti es=espanja fi=suomi -fr=franska +fr=ranska he=heprea iw=heprea hi=hindi @@ -80,7 +80,7 @@ DE=Saksa DK=Tanska ES=Espanja FI=Suomi -FR=Franska +FR=Ranska GB=Iso-Britannia GR=Kreikka IE=Irlanti diff --git a/src/share/classes/sun/util/resources/LocaleNames_nl.properties b/src/share/classes/sun/util/resources/LocaleNames_nl.properties index 1f5bb150cc4f873348a5779bfef36d874e5040ec..da85201e6748694beed069590d83b2878cab02ef 100644 --- a/src/share/classes/sun/util/resources/LocaleNames_nl.properties +++ b/src/share/classes/sun/util/resources/LocaleNames_nl.properties @@ -34,14 +34,436 @@ # This notice and attribution to Taligent may not be removed. # Taligent is a registered trademark of Taligent, Inc. - # language names # key is ISO 639 language code +aa=Afar +ab=Abchazisch +ae=Avestisch +af=Afrikaans +ak=Akan +am=Amhaars +an=Aragonees +ar=Arabisch +as=Assamees +av=Avarisch +ay=Aymara +az=Azerbeidzjaans +ba=Basjkiers +be=Wit-Russisch +bg=Bulgaars +bh=Bihari +bi=Bislama +bm=Bambara +bn=Bengalees +bo=Tibetaans +br=Bretons +bs=Bosnisch +ca=Catalaans +ce=Chechen +ch=Chamorro +co=Corsicaans +cr=Cree +cs=Tsjechisch +cu=Kerkslavisch +cv=Tsjoevasjisch +cy=Welsh +da=Deens +de=Duits +dv=Divehi +dz=Dzongkha +ee=Ewe +el=Grieks +en=Engels +eo=Esperanto +es=Spaans +et=Estlands +eu=Baskisch +fa=Perzisch +ff=Fulah +fi=Fins +fj=Fijisch +fo=Faer\u00f6ers +fr=Frans +fy=Fries +ga=Iers +gd=Schots Gaelic +gl=Galicisch +gn=Guarani +gu=Gujarati +gv=Manx +ha=Hausa +he=Hebreeuws +hi=Hindi +ho=Hiri Motu +hr=Kroatisch +ht=Ha\u00eftiaans +hu=Hongaars +hy=Armeens +hz=Herero +ia=Interlingua +id=Indonesisch +ie=Interlingue +ig=Igbo +ii=Sichuan Yi +ik=Inupiaq +io=Ido +is=IJslands +it=Italiaans +iu=Inuktitut +ja=Japans +jv=Javaans +ka=Georgisch +kg=Kongo +ki=Kikuyu +kj=Kuanyama +kk=Kazachs +kl=Kalaallisut +km=Khmer +kn=Kannada +ko=Koreaans +kr=Kanuri +ks=Kashmiri +ku=Koerdisch +kv=Komi +kw=Cornish +ky=Kirgizisch +la=Latijn +lb=Luxemburgs +lg=Ganda +li=Limburgs +ln=Lingala +lo=Lao +lt=Litouws +lu=Luba-Katanga +lv=Letlands +mg=Malagasisch +mh=Marshallees +mi=Maori +mk=Macedonisch +ml=Malayalam +mn=Mongools +mo=Moldavisch +mr=Marathi +ms=Maleis +mt=Maltees +my=Birmees +na=Nauru +nb=Noors - Bokm\u00e5l +nd=Noord-Ndbele +ne=Nepalees +ng=Ndonga nl=Nederlands +nn=Noors - Nynorsk +no=Noors +nr=Zuid-Ndbele +nv=Navajo +ny=Nyanja +oc=Occitaans +oj=Ojibwa +om=Oromo +or=Oriya +os=Ossetisch +pa=Punjabi +pi=Pali +pl=Pools +ps=Pasjtoe +pt=Portugees +qu=Quechua +rm=Reto-Romaans +rn=Rundi +ro=Roemeens +ru=Russisch +rw=Kinyarwanda +sa=Sanskriet +sc=Sardinisch +sd=Sindhi +se=Noord-Samisch +sg=Sango +si=Singalees +sk=Slowaaks +sl=Sloveens +sm=Samoaans +sn=Shona +so=Somalisch +sq=Albanees +sr=Servisch +ss=Swati +st=Zuid-Sotho +su=Soendanees +sv=Zweeds +sw=Swahili +ta=Tamil +te=Teloegoe +tg=Tadzjieks +th=Thais +ti=Tigrinya +tk=Turkmeens +tl=Tagalog +tn=Tswana +to=Tonga +tr=Turks +ts=Tsonga +tt=Tataars +tw=Twi +ty=Tahitisch +ug=Oeigoers +uk=Oekra\u00efens +ur=Urdu +uz=Oezbeeks +ve=Venda +vi=Vietnamees +vo=Volap\u00fck +wa=Wallonisch +wo=Wolof +xh=Xhosa +yi=Jiddisch +yo=Yoruba +za=Zhuang +zh=Chinees +zu=Zulu # country names # key is ISO 3166 country code -NL=Nederland +AD=Andorra +AE=Verenigde Arabische Emiraten +AF=Afghanistan +AG=Antigua en Barbuda +AI=Anguilla +AL=Albani\u00eb +AM=Armeni\u00eb +AN=Nederlandse Antillen +AO=Angola +AQ=Antarctica +AR=Argentini\u00eb +AS=Amerikaans Samoa +AT=Oostenrijk +AU=Australi\u00eb +AW=Aruba +AX=Alandeilanden +AZ=Azerbeidzjan +BA=Bosni\u00eb en Herzegovina +BB=Barbados +BD=Bangladesh BE=Belgi\u00eb +BF=Burkina Faso +BG=Bulgarije +BH=Bahrein +BI=Burundi +BJ=Benin +BM=Bermuda +BN=Brunei +BO=Bolivia +BR=Brazili\u00eb +BS=Bahama\u2019s +BT=Bhutan +BV=Bouveteiland +BW=Botswana +BY=Wit-Rusland +BZ=Belize +CA=Canada +CC=Cocoseilanden +CD=Congo-Kinshasa +CF=Centraal-Afrikaanse Republiek +CG=Congo +CH=Zwitserland +CI=Ivoorkust +CK=Cookeilanden +CL=Chili +CM=Kameroen +CN=China +CO=Colombia +CR=Costa Rica +CS=Servi\u00eb en Montenegro +CU=Cuba +CV=Kaapverdi\u00eb +CX=Christmaseiland +CY=Cyprus +CZ=Tsjechi\u00eb +DE=Duitsland +DJ=Djibouti +DK=Denemarken +DM=Dominica +DO=Dominicaanse Republiek +DZ=Algerije +EC=Ecuador +EE=Estland +EG=Egypte +EH=Westelijke Sahara +ER=Eritrea +ES=Spanje +ET=Ethiopi\u00eb +FI=Finland +FJ=Fiji +FK=Falklandeilanden +FM=Micronesi\u00eb +FO=Faer\u00f6er +FR=Frankrijk +GA=Gabon +GB=Verenigd Koninkrijk +GD=Grenada +GE=Georgi\u00eb +GF=Frans-Guyana +GH=Ghana +GI=Gibraltar +GL=Groenland +GM=Gambia +GN=Guinee +GP=Guadeloupe +GQ=Equatoriaal-Guinea +GR=Griekenland +GS=Zuid-Georgi\u00eb en Zuidelijke Sandwicheilanden +GT=Guatemala +GU=Guam +GW=Guinee-Bissau +GY=Guyana +HK=Hongkong SAR van China +HM=Heard- en McDonaldeilanden +HN=Honduras +HR=Kroati\u00eb +HT=Ha\u00efti +HU=Hongarije +ID=Indonesi\u00eb +IE=Ierland +IL=Isra\u00ebl +IN=India +IO=Britse Gebieden in de Indische Oceaan +IQ=Irak +IR=Iran +IS=IJsland +IT=Itali\u00eb +JM=Jamaica +JO=Jordani\u00eb +JP=Japan +KE=Kenia +KG=Kirgizi\u00eb +KH=Cambodja +KI=Kiribati +KM=Comoren +KN=Saint Kitts en Nevis +KP=Noord-Korea +KR=Zuid-Korea +KW=Koeweit +KY=Caymaneilanden +KZ=Kazachstan +LA=Laos +LB=Libanon +LC=Saint Lucia +LI=Liechtenstein +LK=Sri Lanka +LR=Liberia +LS=Lesotho +LT=Litouwen +LU=Luxemburg +LV=Letland +LY=Libi\u00eb +MA=Marokko +MC=Monaco +MD=Moldavi\u00eb +ME=Montenegro +MG=Madagaskar +MH=Marshalleilanden +MK=Macedoni\u00eb +ML=Mali +MM=Myanmar +MN=Mongoli\u00eb +MO=Macao SAR van China +MP=Noordelijke Marianeneilanden +MQ=Martinique +MR=Mauritani\u00eb +MS=Montserrat +MT=Malta +MU=Mauritius +MV=Maldiven +MW=Malawi +MX=Mexico +MY=Maleisi\u00eb +MZ=Mozambique +NA=Namibi\u00eb +NC=Nieuw-Caledoni\u00eb +NE=Niger +NF=Norfolkeiland +NG=Nigeria +NI=Nicaragua +NL=Nederland +NO=Noorwegen +NP=Nepal +NR=Nauru +NU=Niue +NZ=Nieuw-Zeeland +OM=Oman +PA=Panama +PE=Peru +PF=Frans-Polynesi\u00eb +PG=Papoea-Nieuw-Guinea +PH=Filipijnen +PK=Pakistan +PL=Polen +PM=Saint Pierre en Miquelon +PN=Pitcairn +PR=Puerto Rico +PS=Palestijns Gebied +PT=Portugal +PW=Palau +PY=Paraguay +QA=Qatar +RE=R\u00e9union +RO=Roemeni\u00eb +RS=Servi\u00eb +RU=Rusland +RW=Rwanda +SA=Saoedi-Arabi\u00eb +SB=Salomonseilanden +SC=Seychellen +SD=Soedan +SE=Zweden +SG=Singapore +SH=Sint-Helena +SI=Sloveni\u00eb +SJ=Svalbard en Jan Mayen +SK=Slowakije +SL=Sierra Leone +SM=San Marino +SN=Senegal +SO=Somali\u00eb +SR=Suriname +ST=Sao Tom\u00e9 en Principe +SV=El Salvador +SY=Syri\u00eb +SZ=Swaziland +TC=Turks- en Caicoseilanden +TD=Tsjaad +TF=Franse Gebieden in de zuidelijke Indische Oceaan +TG=Togo +TH=Thailand +TJ=Tadzjikistan +TK=Tokelau +TL=Oost-Timor +TM=Turkmenistan +TN=Tunesi\u00eb +TO=Tonga +TR=Turkije +TT=Trinidad en Tobago +TV=Tuvalu +TW=Taiwan +TZ=Tanzania +UA=Oekra\u00efne +UG=Oeganda +UM=Amerikaanse kleinere afgelegen eilanden +US=Verenigde Staten +UY=Uruguay +UZ=Oezbekistan +VA=Vaticaanstad +VC=Saint Vincent en de Grenadines +VE=Venezuela +VG=Britse Maagdeneilanden +VI=Amerikaanse Maagdeneilanden +VN=Vietnam +VU=Vanuatu +WF=Wallis en Futuna +WS=Samoa +YE=Jemen +YT=Mayotte +ZA=Zuid-Afrika +ZM=Zambia diff --git a/src/share/classes/sun/util/resources/TimeZoneNames_de.java b/src/share/classes/sun/util/resources/TimeZoneNames_de.java index 896d72a5c532c9126049c80840dde32c479ce5ac..eaef647eb8bc74a42fa9a0f4b4ddb397278f94ce 100644 --- a/src/share/classes/sun/util/resources/TimeZoneNames_de.java +++ b/src/share/classes/sun/util/resources/TimeZoneNames_de.java @@ -71,8 +71,8 @@ public final class TimeZoneNames_de extends TimeZoneNamesBundle { "Bhutanische Sommerzeit", "BTST"}; String CAT[] = new String[] {"Zentralafrikanische Zeit", "CAT", "Zentralafrikanische Sommerzeit", "CAST"}; - String CET[] = new String[] {"Zentraleurop\u00e4ische Zeit", "CET", - "Zentraleurop\u00e4ische Sommerzeit", "CEST"}; + String CET[] = new String[] {"Mitteleurop\u00e4ische Zeit", "MEZ", + "Mitteleurop\u00e4ische Sommerzeit", "MESZ"}; String CHAST[] = new String[] {"Chatham Normalzeit", "CHAST", "Chatham Sommerzeit", "CHADT"}; String CIT[] = new String[] {"Zentralindonesische Zeit", "CIT", @@ -83,8 +83,8 @@ public final class TimeZoneNames_de extends TimeZoneNamesBundle { "Zentrale Sommerzeit", "CDT"}; String CTT[] = new String[] {"Chinesische Normalzeit", "CST", "Chinesische Sommerzeit", "CDT"}; - String CUBA[] = new String[] {"Cuba Standard Time", "CST", - "Cuba Daylight Time", "CDT"}; + String CUBA[] = new String[] {"Kubanische Normalzeit", "CST", + "Kubanische Sommerzeit", "CDT"}; String DARWIN[] = new String[] {"Zentrale Normalzeit (Northern Territory)", "CST", "Zentrale Sommerzeit (Northern Territory)", "CST"}; String DUBLIN[] = new String[] {"Greenwich Zeit", "GMT", @@ -93,8 +93,8 @@ public final class TimeZoneNames_de extends TimeZoneNamesBundle { "Ostafrikanische Sommerzeit", "EAST"}; String EASTER[] = new String[] {"Osterinseln Zeit", "EAST", "Osterinseln Sommerzeit", "EASST"}; - String EET[] = new String[] {"Osteurop\u00e4ische Zeit", "EET", - "Osteurop\u00e4ische Sommerzeit", "EEST"}; + String EET[] = new String[] {"Osteurop\u00e4ische Zeit", "OEZ", + "Osteurop\u00e4ische Sommerzeit", "OESZ"}; String EGT[] = new String[] {"Ostgr\u00f6nl\u00e4ndische Zeit", "EGT", "Ostgr\u00f6nl\u00e4ndische Sommerzeit", "EGST"}; String EST[] = new String[] {"\u00d6stliche Normalzeit", "EST", @@ -173,12 +173,12 @@ public final class TimeZoneNames_de extends TimeZoneNamesBundle { "Truk Sommerzeit", "TRUST"}; String ULAT[]= new String[] {"Ulaanbaatar Zeit", "ULAT", "Ulaanbaatar Sommerzeit", "ULAST"}; - String WART[] = new String[] {"Argentinische Zeit", "WART", - "Argentinische Sommerzeit", "WARST"}; + String WART[] = new String[] {"Westargentinische Zeit", "WART", + "Westargentinische Sommerzeit", "WARST"}; String WAT[] = new String[] {"Westafrikanische Zeit", "WAT", "Westafrikanische Sommerzeit", "WAST"}; - String WET[] = new String[] {"Westeurop\u00e4ische Zeit", "WET", - "Westeurop\u00e4ische Sommerzeit", "WEST"}; + String WET[] = new String[] {"Westeurop\u00e4ische Zeit", "WEZ", + "Westeurop\u00e4ische Sommerzeit", "WESZ"}; String WIT[] = new String[] {"Westindonesische Zeit", "WIT", "Westindonesische Sommerzeit", "WIST"}; String WST_AUS[] = new String[] {"Westliche Normalzeit (Australien)", "WST", @@ -594,8 +594,8 @@ public final class TimeZoneNames_de extends TimeZoneNamesBundle { {"Australia/Canberra", EST_NSW}, {"Australia/Currie", EST_NSW}, {"Australia/Darwin", DARWIN}, - {"Australia/Eucla", new String[] {"Central Western Standard Time (Australia)", "CWST", - "Central Western Summer Time (Australia)", "CWST"}}, + {"Australia/Eucla", new String[] {"Zentral-Westliche Normalzeit (Australien)", "CWST", + "Zentral-Westliche Sommerzeit (Australien)", "CWST"}}, {"Australia/Hobart", TASMANIA}, {"Australia/LHI", LORD_HOWE}, {"Australia/Lindeman", BRISBANE}, diff --git a/src/share/classes/sun/util/resources/TimeZoneNames_es.java b/src/share/classes/sun/util/resources/TimeZoneNames_es.java index 20605d1187a332dde3f255583b07a12ef8aa650b..75f67f2a0a248fc476994c2af6c07acc3e6ab534 100644 --- a/src/share/classes/sun/util/resources/TimeZoneNames_es.java +++ b/src/share/classes/sun/util/resources/TimeZoneNames_es.java @@ -83,8 +83,8 @@ public final class TimeZoneNames_es extends TimeZoneNamesBundle { "Hora de verano Central", "CDT"}; String CTT[] = new String[] {"Hora est\u00e1ndar de China", "CST", "Hora de verano de China", "CDT"}; - String CUBA[] = new String[] {"Cuba Standard Time", "CST", - "Cuba Daylight Time", "CDT"}; + String CUBA[] = new String[] {"Hora est\u00e1ndar de Cuba", "CST", + "Hora de verano de Cuba", "CDT"}; String DARWIN[] = new String[] {"Hora est\u00e1ndar Central (territorio del Norte)", "CST", "Hora de verano Central (territorio del Norte)", "CST"}; String DUBLIN[] = new String[] {"Hora del Meridiano de Greenwich", "GMT", @@ -173,8 +173,8 @@ public final class TimeZoneNames_es extends TimeZoneNamesBundle { "Hora de verano de Truk", "TRUST"}; String ULAT[]= new String[] {"Hora de Ulan Bator", "ULAT", "Hora de verano de Ulan Bator", "ULAST"}; - String WART[] = new String[] {"Hora de Argentina", "WART", - "Hora de verano de Argentina", "WARST"}; + String WART[] = new String[] {"Hora de Argentina Occidental", "WART", + "Hora de verano de Argentina Occidental", "WARST"}; String WAT[] = new String[] {"Hora de \u00c1frica Occidental", "WAT", "Hora de verano de \u00c1frica Occidental", "WAST"}; String WET[] = new String[] {"Hora de Europa Occidental", "WET", @@ -595,8 +595,8 @@ public final class TimeZoneNames_es extends TimeZoneNamesBundle { {"Australia/Canberra", EST_NSW}, {"Australia/Currie", EST_NSW}, {"Australia/Darwin", DARWIN}, - {"Australia/Eucla", new String[] {"Central Western Standard Time (Australia)", "CWST", - "Central Western Summer Time (Australia)", "CWST"}}, + {"Australia/Eucla", new String[] {"Hora est\u00e1ndar de Australia Central y Occidental", "CWST", + "Hora de verano de Australia Central y Occidental", "CWST"}}, {"Australia/Hobart", TASMANIA}, {"Australia/LHI", LORD_HOWE}, {"Australia/Lindeman", BRISBANE}, diff --git a/src/share/classes/sun/util/resources/TimeZoneNames_fr.java b/src/share/classes/sun/util/resources/TimeZoneNames_fr.java index e3f8205584a730e79a2bc7a26ad35989418aae5e..0e68b42e93ca09266d320d9a8d21ec2fbd996391 100644 --- a/src/share/classes/sun/util/resources/TimeZoneNames_fr.java +++ b/src/share/classes/sun/util/resources/TimeZoneNames_fr.java @@ -83,8 +83,8 @@ public final class TimeZoneNames_fr extends TimeZoneNamesBundle { "Heure avanc\u00e9e du Centre", "CDT"} ; String CTT[] = new String[] {"Heure normale de Chine", "CST", "Heure avanc\u00e9e de Chine", "CDT"} ; - String CUBA[] = new String[] {"Cuba Standard Time", "CST", - "Cuba Daylight Time", "CDT"}; + String CUBA[] = new String[] {"Heure standard de Cuba", "CST", + "Heure d'\u00e9t\u00e9 de Cuba", "CDT"}; String DARWIN[] = new String[] {"Heure standard d'Australie centrale (Territoire du Nord)", "CST", "Heure d'\u00e9t\u00e9 d'Australie centrale (Territoire du Nord)", "CST"}; String DUBLIN[] = new String[] {"Heure du m\u00e9ridien de Greenwich", "GMT", @@ -173,8 +173,8 @@ public final class TimeZoneNames_fr extends TimeZoneNamesBundle { "Heure d'\u00e9t\u00e9 de Truk", "TRUST"}; String ULAT[]= new String[] {"Heure de l'Ulaanbaatar", "ULAT", "Heure d'\u00e9t\u00e9 de l'Ulaanbaatar", "ULAST"} ; - String WART[] = new String[] {"Heure D'Argentine", "WART", - "Heure d'\u00e9t\u00e9 D'Argentine", "WARST"} ; + String WART[] = new String[] {"Heure D'Argentine de l'Ouest", "WART", + "Heure d'\u00e9t\u00e9 D'Argentine de l'Ouest", "WARST"} ; String WAT[] = new String[] {"Heure d'Afrique de l'Ouest", "WAT", "Heure d'\u00e9t\u00e9 d'Afrique de l'Ouest", "WAST"} ; String WET[] = new String[] {"Heure d'Europe de l'Ouest", "WET", @@ -594,8 +594,8 @@ public final class TimeZoneNames_fr extends TimeZoneNamesBundle { {"Australia/Canberra", EST_NSW}, {"Australia/Currie", EST_NSW}, {"Australia/Darwin", DARWIN}, - {"Australia/Eucla", new String[] {"Central Western Standard Time (Australia)", "CWST", - "Central Western Summer Time (Australia)", "CWST"}}, + {"Australia/Eucla", new String[] {"Heure standard de l'Australie occidentale (centre)", "CWST", + "Heure d'\u00e9t\u00e9 de l'Australie occidentale (centre)", "CWST"}}, {"Australia/Hobart", TASMANIA}, {"Australia/LHI", LORD_HOWE}, {"Australia/Lindeman", BRISBANE}, diff --git a/src/share/classes/sun/util/resources/TimeZoneNames_it.java b/src/share/classes/sun/util/resources/TimeZoneNames_it.java index e464618f2af92eed9bb5719bcb633b97eb5bc24b..a461f464c76d38fac828b1dc30a18dafc9c72974 100644 --- a/src/share/classes/sun/util/resources/TimeZoneNames_it.java +++ b/src/share/classes/sun/util/resources/TimeZoneNames_it.java @@ -83,8 +83,8 @@ public final class TimeZoneNames_it extends TimeZoneNamesBundle { "Ora legale USA centrale", "CDT"}; String CTT[] = new String[] {"Ora solare della Cina", "CST", "Ora legale della Cina", "CDT"}; - String CUBA[] = new String[] {"Cuba Standard Time", "CST", - "Cuba Daylight Time", "CDT"}; + String CUBA[] = new String[] {"Ora solare Cuba", "CST", + "Ora legale Cuba", "CDT"}; String DARWIN[] = new String[] {"Ora centrale standard (Territori del Nord)", "CST", "Ora estiva centrale (Territori del Nord)", "CST"}; String DUBLIN[] = new String[] {"Ora media di Greenwich", "GMT", @@ -173,8 +173,8 @@ public final class TimeZoneNames_it extends TimeZoneNamesBundle { "Ora estiva di Truk", "TRUST"}; String ULAT[]= new String[] {"Ora di Ulaanbaatar", "ULAT", "Ora estiva di Ulaanbaatar", "ULAST"}; - String WART[] = new String[] {"Ora dell'Argentina", "WART", - "Ora estiva dell'Argentina", "WARST"}; + String WART[] = new String[] {"Ora dell'Argentina occidentale", "WART", + "Ora estiva dell'Argentina occidentale", "WARST"}; String WAT[] = new String[] {"Ora dell'Africa occidentale", "WAT", "Ora estiva dell'Africa occidentale", "WAST"}; String WET[] = new String[] {"Ora dell'Europa occidentale", "WET", @@ -594,8 +594,8 @@ public final class TimeZoneNames_it extends TimeZoneNamesBundle { {"Australia/Canberra", EST_NSW}, {"Australia/Currie", EST_NSW}, {"Australia/Darwin", DARWIN}, - {"Australia/Eucla", new String[] {"Central Western Standard Time (Australia)", "CWST", - "Central Western Summer Time (Australia)", "CWST"}}, + {"Australia/Eucla", new String[] {"Ora solare Australia centrorientale", "CWST", + "Ora estiva Australia centrorientale", "CWST"}}, {"Australia/Hobart", TASMANIA}, {"Australia/LHI", LORD_HOWE}, {"Australia/Lindeman", BRISBANE}, diff --git a/src/share/classes/sun/util/resources/TimeZoneNames_ja.java b/src/share/classes/sun/util/resources/TimeZoneNames_ja.java index 1292e4b8045b59e1914d8319425c3af1f578c170..6587b2171da3dcb764ae84be50d214a2db0b442e 100644 --- a/src/share/classes/sun/util/resources/TimeZoneNames_ja.java +++ b/src/share/classes/sun/util/resources/TimeZoneNames_ja.java @@ -83,8 +83,8 @@ public final class TimeZoneNames_ja extends TimeZoneNamesBundle { "\u4e2d\u90e8\u590f\u6642\u9593", "CDT"}; String CTT[] = new String[] {"\u4e2d\u56fd\u6a19\u6e96\u6642", "CST", "\u4e2d\u56fd\u590f\u6642\u9593", "CDT"}; - String CUBA[] = new String[] {"Cuba Standard Time", "CST", - "Cuba Daylight Time", "CDT"}; + String CUBA[] = new String[] {"\u30ad\u30e5\u30fc\u30d0\u6a19\u6e96\u6642", "CST", + "\u30ad\u30e5\u30fc\u30d0\u590f\u6642\u9593", "CDT"}; String DARWIN[] = new String[] {"\u4e2d\u90e8\u6a19\u6e96\u6642 (\u30ce\u30fc\u30b6\u30f3\u30c6\u30ea\u30c8\u30ea\u30fc)", "CST", "\u4e2d\u90e8\u590f\u6642\u9593 (\u30ce\u30fc\u30b6\u30f3\u30c6\u30ea\u30c8\u30ea\u30fc)", "CST"}; String DUBLIN[] = new String[] {"\u30b0\u30ea\u30cb\u30c3\u30b8\u6a19\u6e96\u6642", "GMT", @@ -173,8 +173,8 @@ public final class TimeZoneNames_ja extends TimeZoneNamesBundle { "\u30c8\u30e9\u30c3\u30af\u590f\u6642\u9593", "TRUST"}; String ULAT[]= new String[] {"\u30a6\u30e9\u30fc\u30f3\u30d0\u30fc\u30c8\u30eb\u6642\u9593", "ULAT", "\u30a6\u30e9\u30fc\u30f3\u30d0\u30fc\u30c8\u30eb\u590f\u6642\u9593", "ULAST"}; - String WART[] = new String[] {"\u30a2\u30eb\u30bc\u30f3\u30c1\u30f3\u6642\u9593", "WART", - "\u30a2\u30eb\u30bc\u30f3\u30c1\u30f3\u590f\u6642\u9593", "WARST"}; + String WART[] = new String[] {"\u897f\u30a2\u30eb\u30bc\u30f3\u30c1\u30f3\u6642\u9593", "WART", + "\u897f\u30a2\u30eb\u30bc\u30f3\u30c1\u30f3\u590f\u6642\u9593", "WARST"}; String WAT[] = new String[] {"\u897f\u30a2\u30d5\u30ea\u30ab\u6642\u9593", "WAT", "\u897f\u30a2\u30d5\u30ea\u30ab\u590f\u6642\u9593", "WAST"}; String WET[] = new String[] {"\u897f\u30e8\u30fc\u30ed\u30c3\u30d1\u6642\u9593", "WET", @@ -594,8 +594,8 @@ public final class TimeZoneNames_ja extends TimeZoneNamesBundle { {"Australia/Canberra", EST_NSW}, {"Australia/Currie", EST_NSW}, {"Australia/Darwin", DARWIN}, - {"Australia/Eucla", new String[] {"Central Western Standard Time (Australia)", "CWST", - "Central Western Summer Time (Australia)", "CWST"}}, + {"Australia/Eucla", new String[] {"\u4e2d\u897f\u90e8\u6a19\u6e96\u6642 (\u30aa\u30fc\u30b9\u30c8\u30e9\u30ea\u30a2)", "CWST", + "\u4e2d\u897f\u90e8\u590f\u6642\u9593 (\u30aa\u30fc\u30b9\u30c8\u30e9\u30ea\u30a2)", "CWST"}}, {"Australia/Hobart", TASMANIA}, {"Australia/LHI", LORD_HOWE}, {"Australia/Lindeman", BRISBANE}, diff --git a/src/share/classes/sun/util/resources/TimeZoneNames_ko.java b/src/share/classes/sun/util/resources/TimeZoneNames_ko.java index f69e08b250eb62135da6934b8307113206e1f85b..7106b89bf26ed8683766c27b52821674a6f66797 100644 --- a/src/share/classes/sun/util/resources/TimeZoneNames_ko.java +++ b/src/share/classes/sun/util/resources/TimeZoneNames_ko.java @@ -83,8 +83,8 @@ public final class TimeZoneNames_ko extends TimeZoneNamesBundle { "\uc911\ubd80 \uc77c\uad11\uc808\uc57d\uc2dc\uac04", "CDT"}; String CTT[] = new String[] {"\uc911\uad6d \ud45c\uc900\uc2dc", "CST", "\uc911\uad6d \uc77c\uad11\uc808\uc57d\uc2dc\uac04", "CDT"}; - String CUBA[] = new String[] {"Cuba Standard Time", "CST", - "Cuba Daylight Time", "CDT"}; + String CUBA[] = new String[] {"\ucfe0\ubc14 \ud45c\uc900\uc2dc", "CST", + "\ucfe0\ubc14 \uc77c\uad11\uc808\uc57d\uc2dc\uac04", "CDT"}; String DARWIN[] = new String[] {"\uc911\ubd80 \ud45c\uc900\uc2dc(\ub178\ub358 \uc9c0\uc5ed)", "CST", "\uc911\ubd80 \uc77c\uad11\uc808\uc57d\uc2dc\uac04(\ub178\ub358 \uc9c0\uc5ed)", "CST"}; String DUBLIN[] = new String[] {"\uadf8\ub9ac\ub2c8\uce58 \ud45c\uc900\uc2dc", "GMT", @@ -173,8 +173,8 @@ public final class TimeZoneNames_ko extends TimeZoneNamesBundle { "\ud2b8\ub8e8\ud06c \uc77c\uad11\uc808\uc57d\uc2dc\uac04", "TRUST"}; String ULAT[]= new String[] {"\uc6b8\ub780\ubc14\ud0c0\ub974 \uc2dc\uac04", "ULAT", "\uc6b8\ub780\ubc14\ud0c0\ub974 \uc77c\uad11\uc808\uc57d\uc2dc\uac04", "ULAST"}; - String WART[] = new String[] {"\uc544\ub974\ud5e8\ud2f0\ub098 \uc2dc\uac04", "WART", - "\uc544\ub974\ud5e8\ud2f0\ub098 \uc77c\uad11\uc808\uc57d\uc2dc\uac04", "WARST"}; + String WART[] = new String[] {"\uc11c\ubd80 \uc544\ub974\ud5e8\ud2f0\ub098 \uc2dc\uac04", "WART", + "\uc11c\ubd80 \uc544\ub974\ud5e8\ud2f0\ub098 \uc77c\uad11\uc808\uc57d\uc2dc\uac04", "WARST"}; String WAT[] = new String[] {"\uc11c\ubd80 \uc544\ud504\ub9ac\uce74 \uc2dc\uac04", "WAT", "\uc11c\ubd80 \uc544\ud504\ub9ac\uce74 \uc77c\uad11\uc808\uc57d\uc2dc\uac04", "WAST"}; String WET[] = new String[] {"\uc11c\uc720\ub7fd \uc2dc\uac04", "WET", @@ -594,8 +594,8 @@ public final class TimeZoneNames_ko extends TimeZoneNamesBundle { {"Australia/Canberra", EST_NSW}, {"Australia/Currie", EST_NSW}, {"Australia/Darwin", DARWIN}, - {"Australia/Eucla", new String[] {"Central Western Standard Time (Australia)", "CWST", - "Central Western Summer Time (Australia)", "CWST"}}, + {"Australia/Eucla", new String[] {"\uc911\uc11c\ubd80 \ud45c\uc900\uc2dc(\uc624\uc2a4\ud2b8\ub808\uc77c\ub9ac\uc544)", "CWST", + "\uc911\uc11c\ubd80 \uc77c\uad11\uc808\uc57d\uc2dc\uac04(\uc624\uc2a4\ud2b8\ub808\uc77c\ub9ac\uc544)", "CWST"}}, {"Australia/Hobart", TASMANIA}, {"Australia/LHI", LORD_HOWE}, {"Australia/Lindeman", BRISBANE}, diff --git a/src/share/classes/sun/util/resources/TimeZoneNames_sv.java b/src/share/classes/sun/util/resources/TimeZoneNames_sv.java index 35ce2d11c5170dd19ada97f65d4b2fd53fcee656..1b75fd47e12041a8b9053dcc9c77accb8fcede6d 100644 --- a/src/share/classes/sun/util/resources/TimeZoneNames_sv.java +++ b/src/share/classes/sun/util/resources/TimeZoneNames_sv.java @@ -45,8 +45,8 @@ public final class TimeZoneNames_sv extends TimeZoneNamesBundle { protected final Object[][] getContents() { String ACT[] = new String[] {"Acre, normaltid", "ACT", "Acre, sommartid", "ACST"}; - String ADELAIDE[] = new String[] {"Central Standard Time (S\u00f6dra Australien)", "CST", - "Central Summer Time (S\u00f6dra Australien)", "CST"}; + String ADELAIDE[] = new String[] {"Central normaltid (S\u00f6dra Australien)", "CST", + "Central sommartid (S\u00f6dra Australien)", "CST"}; String AGT[] = new String[] {"Argentina, normaltid", "ART", "Argentina, sommartid", "ARST"}; String AKST[] = new String[] {"Alaska, normaltid", "AKST", @@ -61,10 +61,10 @@ public final class TimeZoneNames_sv extends TimeZoneNamesBundle { "Atlantisk sommartid", "ADT"}; String BDT[] = new String[] {"Bangladesh, normaltid", "BDT", "Bangladesh, sommartid", "BDST"}; - String BRISBANE[] = new String[] {"Eastern Standard Time (Queensland)", "EST", - "Eastern Summer Time (Queensland)", "EST"}; - String BROKEN_HILL[] = new String[] {"Central Standard Time (S\u00f6dra Australien/Nya Sydwales)", "CST", - "Central Summer Time (S\u00f6dra Australien/Nya Sydwales)", "CST"}; + String BRISBANE[] = new String[] {"\u00d6stlig normaltid (Queensland)", "EST", + "\u00d6stlig sommartid (Queensland)", "EST"}; + String BROKEN_HILL[] = new String[] {"Central normaltid (S\u00f6dra Australien/Nya Sydwales)", "CST", + "Central sommartid (S\u00f6dra Australien/Nya Sydwales)", "CST"}; String BRT[] = new String[] {"Brasilien, normaltid", "BRT", "Brasilien, sommartid", "BRST"}; String BTT[] = new String[] {"Bhutan, normaltid", "BTT", @@ -83,10 +83,10 @@ public final class TimeZoneNames_sv extends TimeZoneNamesBundle { "Central sommartid", "CDT"}; String CTT[] = new String[] {"Kina, normaltid", "CST", "Kina, sommartid", "CDT"}; - String CUBA[] = new String[] {"Cuba Standard Time", "CST", - "Cuba Daylight Time", "CDT"}; - String DARWIN[] = new String[] {"Central Standard Time (Nordterritoriet)", "CST", - "Central Summer Time (Nordterritoriet)", "CST"}; + String CUBA[] = new String[] {"Kuba, normaltid", "CST", + "Kuba, sommartid", "CDT"}; + String DARWIN[] = new String[] {"Central normaltid (Nordterritoriet)", "CST", + "Central sommartid (Nordterritoriet)", "CST"}; String DUBLIN[] = new String[] {"Greenwichtid", "GMT", "Irland, sommartid", "IST"}; String EAT[] = new String[] {"\u00d6stafrikansk tid", "EAT", @@ -99,8 +99,8 @@ public final class TimeZoneNames_sv extends TimeZoneNamesBundle { "\u00d6stgr\u00f6nl\u00e4ndsk sommartid", "EGST"}; String EST[] = new String[] {"Eastern, normaltid", "EST", "Eastern, sommartid", "EDT"}; - String EST_NSW[] = new String[] {"Eastern Standard Time (Nya Sydwales)", "EST", - "Eastern Summer Time (Nya Sydwales)", "EST"}; + String EST_NSW[] = new String[] {"Eastern, normaltid (Nya Sydwales)", "EST", + "Eastern, sommartid (Nya Sydwales)", "EST"}; String GHMT[] = new String[] {"Ghana, normaltid", "GMT", "Ghana, sommartid", "GHST"}; String GAMBIER[] = new String[] {"Gambier, normaltid", "GAMT", @@ -163,34 +163,34 @@ public final class TimeZoneNames_sv extends TimeZoneNamesBundle { "Salomon\u00f6arna, sommartid", "SBST"}; String SGT[] = new String[] {"Singapore, normaltid", "SGT", "Singapore, sommartid", "SGST"}; - String SLST[] = new String[] {"Greenwich Mean Time", "GMT", + String SLST[] = new String[] {"Greenwichtid", "GMT", "Sierra Leone, sommartid", "SLST"}; - String TASMANIA[] = new String[] {"Eastern Standard Time (Tasmanien)", "EST", - "Eastern Summer Time (Tasmanien)", "EST"}; + String TASMANIA[] = new String[] {"Eastern, normaltid (Tasmanien)", "EST", + "Eastern, sommartid (Tasmanien)", "EST"}; String TMT[] = new String[] {"Turkmenistan, normaltid", "TMT", "Turkmenistan, sommartid", "TMST"}; String TRUT[] = new String[] {"Truk, normaltid", "TRUT", "Truk, sommartid", "TRUST"}; String ULAT[]= new String[] {"Ulaanbaatar, normaltid", "ULAT", "Ulaanbaatar, sommartid", "ULAST"}; - String WART[] = new String[] {"Argentina, normaltid", "WART", - "Argentina, sommartid", "WARST"}; + String WART[] = new String[] {"V\u00e4stargentina, normaltid", "WART", + "V\u00e4stargentina, sommartid", "WARST"}; String WAT[] = new String[] {"V\u00e4stafrikansk tid", "WAT", "V\u00e4stafrikansk sommartid", "WAST"}; String WET[] = new String[] {"V\u00e4steuropeisk tid", "WET", "V\u00e4steuropeisk sommartid", "WEST"}; String WIT[] = new String[] {"V\u00e4stindonesisk tid", "WIT", "V\u00e4stindonesisk sommartid", "WIST"}; - String WST_AUS[] = new String[] {"Western Standard Time (Australien)", "WST", - "Western Summer Time (Australien)", "WST"}; + String WST_AUS[] = new String[] {"V\u00e4stlig normaltid (Australien)", "WST", + "V\u00e4stlig sommartid (Australien)", "WST"}; String SAMOA[] = new String[] {"Samoa, normaltid", "SST", "Samoa, sommartid", "SDT"}; String WST_SAMOA[] = new String[] {"V\u00e4stsamoansk tid", "WST", "V\u00e4stsamoansk sommartid", "WSST"}; String ChST[] = new String[] {"Chamorro, normaltid", "ChST", "Chamorro, sommartid", "ChDT"}; - String VICTORIA[] = new String[] {"Eastern Standard Time (Victoria)", "EST", - "Eastern Summer Time (Victoria)", "EST"}; + String VICTORIA[] = new String[] {"\u00d6stlig normaltid (Victoria)", "EST", + "\u00d6stlig sommartid (Victoria)", "EST"}; String UTC[] = new String[] {"Koordinerad universell tid", "UTC", "Koordinerad universell tid", "UTC"}; String UZT[] = new String[] {"Uzbekistan, normaltid", "UZT", @@ -594,8 +594,8 @@ public final class TimeZoneNames_sv extends TimeZoneNamesBundle { {"Australia/Canberra", EST_NSW}, {"Australia/Currie", EST_NSW}, {"Australia/Darwin", DARWIN}, - {"Australia/Eucla", new String[] {"Central Western Standard Time (Australia)", "CWST", - "Central Western Summer Time (Australia)", "CWST"}}, + {"Australia/Eucla", new String[] {"Central v\u00e4stlig normaltid (Australien)", "CWST", + "Central v\u00e4stlig sommartid (Australien)", "CWST"}}, {"Australia/Hobart", TASMANIA}, {"Australia/LHI", LORD_HOWE}, {"Australia/Lindeman", BRISBANE}, diff --git a/src/share/classes/sun/util/resources/TimeZoneNames_zh_CN.java b/src/share/classes/sun/util/resources/TimeZoneNames_zh_CN.java index 70cdbd0a9879551e5f070f023e2aacbcaf9158b4..f63c322c6ff81117411ee11fbce08499099041f2 100644 --- a/src/share/classes/sun/util/resources/TimeZoneNames_zh_CN.java +++ b/src/share/classes/sun/util/resources/TimeZoneNames_zh_CN.java @@ -83,8 +83,8 @@ public final class TimeZoneNames_zh_CN extends TimeZoneNamesBundle { "\u4e2d\u592e\u590f\u4ee4\u65f6", "CDT"}; String CTT[] = new String[] {"\u4e2d\u56fd\u6807\u51c6\u65f6\u95f4", "CST", "\u4e2d\u56fd\u590f\u4ee4\u65f6", "CDT"}; - String CUBA[] = new String[] {"Cuba Standard Time", "CST", - "Cuba Daylight Time", "CDT"}; + String CUBA[] = new String[] {"\u53e4\u5df4\u6807\u51c6\u65f6\u95f4", "CST", + "\u53e4\u5df4\u590f\u4ee4\u65f6", "CDT"}; String DARWIN[] = new String[] {"\u4e2d\u592e\u6807\u51c6\u65f6\u95f4\uff08\u5317\u9886\u5730\uff09", "CST", "\u4e2d\u592e\u590f\u4ee4\u65f6\uff08\u5317\u9886\u5730\uff09", "CST"}; String DUBLIN[] = new String[] {"\u683c\u6797\u5a01\u6cbb\u65f6\u95f4", "GMT", @@ -173,8 +173,8 @@ public final class TimeZoneNames_zh_CN extends TimeZoneNamesBundle { "\u7279\u9c81\u514b\u590f\u4ee4\u65f6", "TRUST"}; String ULAT[]= new String[] {"\u5e93\u4f26\u65f6\u95f4", "ULAT", "\u5e93\u4f26\u590f\u4ee4\u65f6", "ULAST"}; - String WART[] = new String[] {"\u963f\u6839\u5ef7\u65f6\u95f4", "WART", - "\u963f\u6839\u5ef7\u590f\u4ee4\u65f6", "WARST"}; + String WART[] = new String[] {"\u897f\u963f\u6839\u5ef7\u65f6\u95f4", "WART", + "\u897f\u963f\u6839\u5ef7\u590f\u4ee4\u65f6", "WARST"}; String WAT[] = new String[] {"\u897f\u975e\u65f6\u95f4", "WAT", "\u897f\u975e\u590f\u4ee4\u65f6", "WAST"}; String WET[] = new String[] {"\u897f\u6b27\u65f6\u95f4", "WET", @@ -594,8 +594,8 @@ public final class TimeZoneNames_zh_CN extends TimeZoneNamesBundle { {"Australia/Canberra", EST_NSW}, {"Australia/Currie", EST_NSW}, {"Australia/Darwin", DARWIN}, - {"Australia/Eucla", new String[] {"Central Western Standard Time (Australia)", "CWST", - "Central Western Summer Time (Australia)", "CWST"}}, + {"Australia/Eucla", new String[] {"\u4e2d\u897f\u90e8\u6807\u51c6\u65f6\u95f4\uff08\u6fb3\u5927\u5229\u4e9a\uff09", "CWST", + "\u4e2d\u897f\u90e8\u590f\u4ee4\u65f6\uff08\u6fb3\u5927\u5229\u4e9a\uff09", "CWST"}}, {"Australia/Hobart", TASMANIA}, {"Australia/LHI", LORD_HOWE}, {"Australia/Lindeman", BRISBANE}, diff --git a/src/share/classes/sun/util/resources/TimeZoneNames_zh_TW.java b/src/share/classes/sun/util/resources/TimeZoneNames_zh_TW.java index f5b89286ed07754a72a75222cbc030ddf674b57d..91a1620c79b56a87838db643d4f0fea2eaeba335 100644 --- a/src/share/classes/sun/util/resources/TimeZoneNames_zh_TW.java +++ b/src/share/classes/sun/util/resources/TimeZoneNames_zh_TW.java @@ -83,8 +83,8 @@ public final class TimeZoneNames_zh_TW extends TimeZoneNamesBundle { "\u4e2d\u592e\u65e5\u5149\u7bc0\u7d04\u6642\u9593", "CDT"}; String CTT[] = new String[] {"\u4e2d\u570b\u6a19\u6e96\u6642\u9593", "CST", "\u4e2d\u570b\u65e5\u5149\u7bc0\u7d04\u6642\u9593", "CDT"}; - String CUBA[] = new String[] {"Cuba Standard Time", "CST", - "Cuba Daylight Time", "CDT"}; + String CUBA[] = new String[] {"\u53e4\u5df4\u6a19\u6e96\u6642\u9593", "CST", + "\u53e4\u5df4\u65e5\u5149\u7bc0\u7d04\u6642\u9593", "CDT"}; String DARWIN[] = new String[] {"\u4e2d\u90e8\u6a19\u6e96\u6642\u9593 (\u5317\u90e8\u5404\u5730\u5340)", "CST", "\u4e2d\u90e8\u590f\u4ee4\u6642\u9593 (\u5317\u90e8\u5404\u5730\u5340)", "CST"}; String DUBLIN[] = new String[] {"\u683c\u6797\u5a01\u6cbb\u5e73\u5747\u6642\u9593", "GMT", @@ -173,8 +173,8 @@ public final class TimeZoneNames_zh_TW extends TimeZoneNamesBundle { "\u7279\u9b6f\u514b\u590f\u4ee4\u6642\u9593", "TRUST"}; String ULAT[]= new String[] {"\u5eab\u502b\u6642\u9593", "ULAT", "\u5eab\u502b\u590f\u4ee4\u6642\u9593", "ULAST"}; - String WART[] = new String[] {"\u963f\u6839\u5ef7\u6642\u9593", "WART", - "\u963f\u6839\u5ef7\u590f\u4ee4\u6642\u9593", "WARST"}; + String WART[] = new String[] {"\u897f\u963f\u6839\u5ef7\u6642\u9593", "WART", + "\u897f\u963f\u6839\u5ef7\u590f\u4ee4\u6642\u9593", "WARST"}; String WAT[] = new String[] {"\u897f\u975e\u6642\u9593", "WAT", "\u897f\u975e\u590f\u4ee4\u6642\u9593", "WAST"}; String WET[] = new String[] {"\u897f\u6b50\u6642\u9593", "WET", @@ -551,7 +551,8 @@ public final class TimeZoneNames_zh_TW extends TimeZoneNamesBundle { {"Asia/Samarkand", UZT}, {"Asia/Seoul", KST}, {"Asia/Singapore", SGT}, - {"Asia/Taipei", CTT}, + {"Asia/Taipei", new String[] {"\u53f0\u7063\u6a19\u6e96\u6642\u9593", "TST", + "\u53f0\u7063\u590f\u4ee4\u6642\u9593", "TDT"}}, {"Asia/Tel_Aviv", ISRAEL}, {"Asia/Tashkent", UZT}, {"Asia/Tbilisi", new String[] {"\u55ac\u6cbb\u4e9e\u6642\u9593", "GET", @@ -594,8 +595,8 @@ public final class TimeZoneNames_zh_TW extends TimeZoneNamesBundle { {"Australia/Canberra", EST_NSW}, {"Australia/Currie", EST_NSW}, {"Australia/Darwin", DARWIN}, - {"Australia/Eucla", new String[] {"Central Western Standard Time (Australia)", "CWST", - "Central Western Summer Time (Australia)", "CWST"}}, + {"Australia/Eucla", new String[] {"\u4e2d\u897f\u90e8\u6a19\u6e96\u6642\u9593 (\u6fb3\u5927\u5229\u4e9e)", "CWST", + "\u4e2d\u897f\u90e8\u65e5\u5149\u7bc0\u7d04\u6642\u9593 (\u6fb3\u5927\u5229\u4e9e)", "CWST"}}, {"Australia/Hobart", TASMANIA}, {"Australia/LHI", LORD_HOWE}, {"Australia/Lindeman", BRISBANE}, diff --git a/src/share/lib/security/java.security b/src/share/lib/security/java.security index b975f25e1e513d737b2b34e9816311da64735f28..7d386b715ae0616d9567612a4b3337acee1c256e 100644 --- a/src/share/lib/security/java.security +++ b/src/share/lib/security/java.security @@ -55,10 +55,10 @@ security.provider.9=sun.security.smartcardio.SunPCSC # # Select the source of seed data for SecureRandom. By default an -# attempt is made to use the entropy gathering device specified by +# attempt is made to use the entropy gathering device specified by # the securerandom.source property. If an exception occurs when -# accessing the URL then the traditional system/thread activity -# algorithm is used. +# accessing the URL then the traditional system/thread activity +# algorithm is used. # # On Solaris and Linux systems, if file:/dev/urandom is specified and it # exists, a special SecureRandom implementation is activated by default. @@ -72,7 +72,7 @@ securerandom.source=file:/dev/urandom # The entropy gathering device is described as a URL and can also # be specified with the system property "java.security.egd". For example, # -Djava.security.egd=file:/dev/urandom -# Specifying this system property will override the securerandom.source +# Specifying this system property will override the securerandom.source # setting. # @@ -149,7 +149,7 @@ package.access=sun.,com.sun.imageio. security.overridePropertiesFile=true # -# Determines the default key and trust manager factory algorithms for +# Determines the default key and trust manager factory algorithms for # the javax.net.ssl package. # ssl.KeyManagerFactory.algorithm=SunX509 @@ -168,10 +168,10 @@ ssl.TrustManagerFactory.algorithm=PKIX # is to cache for 30 seconds. # # NOTE: setting this to anything other than the default value can have -# serious security implications. Do not set it unless +# serious security implications. Do not set it unless # you are sure you are not exposed to DNS spoofing attack. # -#networkaddress.cache.ttl=-1 +#networkaddress.cache.ttl=-1 # The Java-level namelookup cache policy for failed lookups: # @@ -183,7 +183,7 @@ ssl.TrustManagerFactory.algorithm=PKIX # the WINS name service in addition to DNS, name service lookups # that fail may take a noticeably long time to return (approx. 5 seconds). # For this reason the default caching policy is to maintain these -# results for 10 seconds. +# results for 10 seconds. # # networkaddress.cache.negative.ttl=10 @@ -192,7 +192,7 @@ networkaddress.cache.negative.ttl=10 # Properties to configure OCSP for certificate revocation checking # -# Enable OCSP +# Enable OCSP # # By default, OCSP is not used for certificate revocation checking. # This property enables the use of OCSP when set to the value "true". @@ -201,7 +201,7 @@ networkaddress.cache.negative.ttl=10 # # Example, # ocsp.enable=true - + # # Location of the OCSP responder # @@ -213,15 +213,15 @@ networkaddress.cache.negative.ttl=10 # # Example, # ocsp.responderURL=http://ocsp.example.net:80 - + # # Subject name of the OCSP responder's certificate # # By default, the certificate of the OCSP responder is that of the issuer # of the certificate being validated. This property identifies the certificate -# of the OCSP responder when the default does not apply. Its value is a string -# distinguished name (defined in RFC 2253) which identifies a certificate in -# the set of certificates supplied during cert path validation. In cases where +# of the OCSP responder when the default does not apply. Its value is a string +# distinguished name (defined in RFC 2253) which identifies a certificate in +# the set of certificates supplied during cert path validation. In cases where # the subject name alone is not sufficient to uniquely identify the certificate # then both the "ocsp.responderCertIssuerName" and # "ocsp.responderCertSerialNumber" properties must be used instead. When this @@ -237,14 +237,14 @@ networkaddress.cache.negative.ttl=10 # of the certificate being validated. This property identifies the certificate # of the OCSP responder when the default does not apply. Its value is a string # distinguished name (defined in RFC 2253) which identifies a certificate in -# the set of certificates supplied during cert path validation. When this -# property is set then the "ocsp.responderCertSerialNumber" property must also -# be set. When the "ocsp.responderCertSubjectName" property is set then this +# the set of certificates supplied during cert path validation. When this +# property is set then the "ocsp.responderCertSerialNumber" property must also +# be set. When the "ocsp.responderCertSubjectName" property is set then this # property is ignored. # # Example, # ocsp.responderCertIssuerName="CN=Enterprise CA, O=XYZ Corp" - + # # Serial number of the OCSP responder's certificate # @@ -259,4 +259,31 @@ networkaddress.cache.negative.ttl=10 # # Example, # ocsp.responderCertSerialNumber=2A:FF:00 - + +# +# Policy for failed Kerberos KDC lookups: +# +# When a KDC is unavailable (network error, service failure, etc), it is +# put inside a blacklist and accessed less often for future requests. The +# value (case-insensitive) for this policy can be: +# +# tryLast +# KDCs in the blacklist are always tried after those not on the list. +# +# tryLess[:max_retries,timeout] +# KDCs in the blacklist are still tried by their order in the configuration, +# but with smaller max_retries and timeout values. max_retries and timeout +# are optional numerical parameters (default 1 and 5000, which means once +# and 5 seconds). Please notes that if any of the values defined here is +# more than what is defined in krb5.conf, it will be ignored. +# +# Whenever a KDC is detected as available, it is removed from the blacklist. +# The blacklist is reset when krb5.conf is reloaded. You can add +# refreshKrb5Config=true to a JAAS configuration file so that krb5.conf is +# reloaded whenever a JAAS authentication is attempted. +# +# Example, +# krb5.kdc.bad.policy = tryLast +# krb5.kdc.bad.policy = tryLess:2,2000 +krb5.kdc.bad.policy = tryLast + diff --git a/src/share/native/java/lang/StrictMath.c b/src/share/native/java/lang/StrictMath.c index 2bf12e3b71e911961a6c88a0b8daf0bce0e4fb3b..01024b309d34adcd88eb547a11f8b9620cb4395b 100644 --- a/src/share/native/java/lang/StrictMath.c +++ b/src/share/native/java/lang/StrictMath.c @@ -94,18 +94,6 @@ Java_java_lang_StrictMath_cbrt(JNIEnv *env, jclass unused, jdouble d) return (jdouble) jcbrt((double)d); } -JNIEXPORT jdouble JNICALL -Java_java_lang_StrictMath_ceil(JNIEnv *env, jclass unused, jdouble d) -{ - return (jdouble) jceil((double)d); -} - -JNIEXPORT jdouble JNICALL -Java_java_lang_StrictMath_floor(JNIEnv *env, jclass unused, jdouble d) -{ - return (jdouble) jfloor((double)d); -} - JNIEXPORT jdouble JNICALL Java_java_lang_StrictMath_atan2(JNIEnv *env, jclass unused, jdouble d1, jdouble d2) { diff --git a/src/share/native/java/util/zip/zlib-1.2.3/zutil.h b/src/share/native/java/util/zip/zlib-1.2.3/zutil.h index 55e8f36db6e41d6f36728ae406cf677f213f2513..7f26e6259278956053850da49cd63a1fc7289c65 100644 --- a/src/share/native/java/util/zip/zlib-1.2.3/zutil.h +++ b/src/share/native/java/util/zip/zlib-1.2.3/zutil.h @@ -220,7 +220,8 @@ extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ # endif # ifdef WIN32 /* In Win32, vsnprintf is available as the "non-ANSI" _vsnprintf. */ -# if !defined(vsnprintf) && !defined(NO_vsnprintf) +# if !defined(vsnprintf) && !defined(NO_vsnprintf) && (!defined(_MSC_VER) || (_MSC_VER < 1500)) + /* Only needed before Visual Studio 2008 */ # define vsnprintf _vsnprintf # endif # endif diff --git a/src/solaris/classes/sun/nio/ch/SctpChannelImpl.java b/src/solaris/classes/sun/nio/ch/SctpChannelImpl.java index d7842570a2cb958755b8e17a4c9a3c007feddff1..2d577c2e1b1885d1ac0da4c7410089b98816509d 100644 --- a/src/solaris/classes/sun/nio/ch/SctpChannelImpl.java +++ b/src/solaris/classes/sun/nio/ch/SctpChannelImpl.java @@ -38,7 +38,6 @@ import java.nio.channels.SelectionKey; import java.nio.channels.ClosedChannelException; import java.nio.channels.ConnectionPendingException; import java.nio.channels.NoConnectionPendingException; -import java.nio.channels.AlreadyBoundException; import java.nio.channels.AlreadyConnectedException; import java.nio.channels.NotYetBoundException; import java.nio.channels.NotYetConnectedException; @@ -54,7 +53,6 @@ import com.sun.nio.sctp.MessageInfo; import com.sun.nio.sctp.NotificationHandler; import com.sun.nio.sctp.SctpChannel; import com.sun.nio.sctp.SctpSocketOption; -import sun.nio.ch.NativeDispatcher; import sun.nio.ch.PollArrayWrapper; import sun.nio.ch.SelChImpl; import static com.sun.nio.sctp.SctpStandardSocketOption.*; @@ -69,9 +67,6 @@ import static sun.nio.ch.SctpResultContainer.SHUTDOWN; public class SctpChannelImpl extends SctpChannel implements SelChImpl { - /* Used to make native close and preClose calls */ - private static NativeDispatcher nd; - private final FileDescriptor fd; private final int fdVal; @@ -182,7 +177,7 @@ public class SctpChannelImpl extends SctpChannel synchronized (stateLock) { ensureOpenAndUnconnected(); if (isBound()) - throw new AlreadyBoundException(); + SctpNet.throwAlreadyBoundException(); InetSocketAddress isa = (local == null) ? new InetSocketAddress(0) : Net.checkAddress(local); Net.bind(fd, isa.getAddress(), isa.getPort()); @@ -234,7 +229,7 @@ public class SctpChannelImpl extends SctpChannel if (add) { for (InetSocketAddress addr : localAddresses) { if (addr.getAddress().equals(address)) { - throw new AlreadyBoundException(); + SctpNet.throwAlreadyBoundException(); } } } else { /*removing */ @@ -370,7 +365,7 @@ public class SctpChannelImpl extends SctpChannel InetAddress ia = isa.getAddress(); if (ia.isAnyLocalAddress()) ia = InetAddress.getLocalHost(); - n = Net.connect(fd, ia, isa.getPort()); + n = SctpNet.connect(fdVal, ia, isa.getPort()); if ( (n == IOStatus.INTERRUPTED) && isOpen()) continue; @@ -556,7 +551,7 @@ public class SctpChannelImpl extends SctpChannel @Override public void implCloseSelectableChannel() throws IOException { synchronized (stateLock) { - nd.preClose(fd); + SctpNet.preClose(fdVal); if (receiverThread != 0) NativeThread.signal(receiverThread); @@ -662,7 +657,7 @@ public class SctpChannelImpl extends SctpChannel /* Postpone the kill if there is a waiting reader * or writer thread. */ if (receiverThread == 0 && senderThread == 0) { - nd.close(fd); + SctpNet.close(fdVal); state = ChannelState.KILLED; } else { state = ChannelState.KILLPENDING; @@ -874,8 +869,8 @@ public class SctpChannelImpl extends SctpChannel public HandlerResult handleNotification( AssociationChangeNotification not, T unused) { if (not.event().equals( - AssociationChangeNotification.AssocChangeEvent.COMM_UP)) { - assert association == null; + AssociationChangeNotification.AssocChangeEvent.COMM_UP) && + association == null) { SctpAssocChange sac = (SctpAssocChange) not; association = new SctpAssociationImpl (sac.assocId(), sac.maxInStreams(), sac.maxOutStreams()); @@ -987,17 +982,17 @@ public class SctpChannelImpl extends SctpChannel SocketAddress target = messageInfo.address(); boolean unordered = messageInfo.isUnordered(); int ppid = messageInfo.payloadProtocolID(); - int pos = src.position(); - int lim = src.limit(); - - assert (pos <= lim && streamNumber >= 0); - int rem = (pos <= lim ? lim - pos : 0); if (src instanceof DirectBuffer) - return sendFromNativeBuffer(fd, src, rem, pos, target, streamNumber, + return sendFromNativeBuffer(fd, src, target, streamNumber, unordered, ppid); /* Substitute a native buffer */ + int pos = src.position(); + int lim = src.limit(); + assert (pos <= lim && streamNumber >= 0); + + int rem = (pos <= lim ? lim - pos : 0); ByteBuffer bb = Util.getTemporaryDirectBuffer(rem); try { bb.put(src); @@ -1005,7 +1000,7 @@ public class SctpChannelImpl extends SctpChannel /* Do not update src until we see how many bytes were written */ src.position(pos); - int n = sendFromNativeBuffer(fd, bb, rem, pos, target, streamNumber, + int n = sendFromNativeBuffer(fd, bb, target, streamNumber, unordered, ppid); if (n > 0) { /* now update src */ @@ -1019,13 +1014,16 @@ public class SctpChannelImpl extends SctpChannel private int sendFromNativeBuffer(int fd, ByteBuffer bb, - int rem, - int pos, SocketAddress target, int streamNumber, boolean unordered, int ppid) throws IOException { + int pos = bb.position(); + int lim = bb.limit(); + assert (pos <= lim); + int rem = (pos <= lim ? lim - pos : 0); + int written = send0(fd, ((DirectBuffer)bb).address() + pos, rem, target, -1 /*121*/, streamNumber, unordered, ppid); if (written > 0) @@ -1097,6 +1095,5 @@ public class SctpChannelImpl extends SctpChannel java.security.AccessController.doPrivileged( new sun.security.action.LoadLibraryAction("sctp")); initIDs(); - nd = new SctpSocketDispatcher(); } } diff --git a/src/solaris/classes/sun/nio/ch/SctpMultiChannelImpl.java b/src/solaris/classes/sun/nio/ch/SctpMultiChannelImpl.java index b8457fdba274518d064f2e5aa1688cf6711ef24c..45a360ddfeed591540bbd054f63e2e43a6390f12 100644 --- a/src/solaris/classes/sun/nio/ch/SctpMultiChannelImpl.java +++ b/src/solaris/classes/sun/nio/ch/SctpMultiChannelImpl.java @@ -38,7 +38,6 @@ import java.util.HashSet; import java.util.HashMap; import java.nio.ByteBuffer; import java.nio.channels.SelectionKey; -import java.nio.channels.AlreadyBoundException; import java.nio.channels.ClosedChannelException; import java.nio.channels.NotYetBoundException; import java.nio.channels.spi.SelectorProvider; @@ -63,9 +62,6 @@ import static sun.nio.ch.SctpResultContainer.*; public class SctpMultiChannelImpl extends SctpMultiChannel implements SelChImpl { - /* Used to make native close and preClose calls */ - private static NativeDispatcher nd; - private final FileDescriptor fd; private final int fdVal; @@ -140,7 +136,7 @@ public class SctpMultiChannelImpl extends SctpMultiChannel synchronized (stateLock) { ensureOpen(); if (isBound()) - throw new AlreadyBoundException(); + SctpNet.throwAlreadyBoundException(); InetSocketAddress isa = (local == null) ? new InetSocketAddress(0) : Net.checkAddress(local); @@ -155,7 +151,7 @@ public class SctpMultiChannelImpl extends SctpMultiChannel if (isa.getAddress().isAnyLocalAddress()) wildcard = true; - Net.listen(fd, backlog < 1 ? 50 : backlog); + SctpNet.listen(fdVal, backlog < 1 ? 50 : backlog); } } } @@ -196,7 +192,7 @@ public class SctpMultiChannelImpl extends SctpMultiChannel if (add) { for (InetSocketAddress addr : localAddresses) { if (addr.getAddress().equals(address)) { - throw new AlreadyBoundException(); + SctpNet.throwAlreadyBoundException(); } } } else { /*removing */ @@ -284,7 +280,7 @@ public class SctpMultiChannelImpl extends SctpMultiChannel @Override public void implCloseSelectableChannel() throws IOException { synchronized (stateLock) { - nd.preClose(fd); + SctpNet.preClose(fdVal); if (receiverThread != 0) NativeThread.signal(receiverThread); @@ -375,7 +371,7 @@ public class SctpMultiChannelImpl extends SctpMultiChannel /* Postpone the kill if there is a thread sending or receiving. */ if (receiverThread == 0 && senderThread == 0) { - nd.close(fd); + SctpNet.close(fdVal); state = ChannelState.KILLED; } else { state = ChannelState.KILLPENDING; @@ -846,16 +842,17 @@ public class SctpMultiChannelImpl extends SctpMultiChannel int streamNumber = messageInfo.streamNumber(); boolean unordered = messageInfo.isUnordered(); int ppid = messageInfo.payloadProtocolID(); - int pos = src.position(); - int lim = src.limit(); - assert (pos <= lim && streamNumber >= 0); - int rem = (pos <= lim ? lim - pos : 0); if (src instanceof DirectBuffer) - return sendFromNativeBuffer(fd, src, rem, pos, target, assocId, + return sendFromNativeBuffer(fd, src, target, assocId, streamNumber, unordered, ppid); /* Substitute a native buffer */ + int pos = src.position(); + int lim = src.limit(); + assert (pos <= lim && streamNumber >= 0); + + int rem = (pos <= lim ? lim - pos : 0); ByteBuffer bb = Util.getTemporaryDirectBuffer(rem); try { bb.put(src); @@ -863,7 +860,7 @@ public class SctpMultiChannelImpl extends SctpMultiChannel /* Do not update src until we see how many bytes were written */ src.position(pos); - int n = sendFromNativeBuffer(fd, bb, rem, pos, target, assocId, + int n = sendFromNativeBuffer(fd, bb, target, assocId, streamNumber, unordered, ppid); if (n > 0) { /* now update src */ @@ -877,14 +874,17 @@ public class SctpMultiChannelImpl extends SctpMultiChannel private int sendFromNativeBuffer(int fd, ByteBuffer bb, - int rem, - int pos, SocketAddress target, int assocId, int streamNumber, boolean unordered, int ppid) throws IOException { + int pos = bb.position(); + int lim = bb.limit(); + assert (pos <= lim); + int rem = (pos <= lim ? lim - pos : 0); + int written = send0(fd, ((DirectBuffer)bb).address() + pos, rem, target, assocId, streamNumber, unordered, ppid); if (written > 0) @@ -981,6 +981,5 @@ public class SctpMultiChannelImpl extends SctpMultiChannel Util.load(); /* loads nio & net native libraries */ java.security.AccessController.doPrivileged( new sun.security.action.LoadLibraryAction("sctp")); - nd = new SctpSocketDispatcher(); } } diff --git a/src/solaris/classes/sun/nio/ch/SctpNet.java b/src/solaris/classes/sun/nio/ch/SctpNet.java index f4cd5005f1589008c832fc19de61972f3ea8b7d4..39019e7fd0a8d96475bf454977419e888e9d6d7f 100644 --- a/src/solaris/classes/sun/nio/ch/SctpNet.java +++ b/src/solaris/classes/sun/nio/ch/SctpNet.java @@ -29,6 +29,7 @@ import java.io.IOException; import java.net.InetAddress; import java.net.InetSocketAddress; import java.net.SocketAddress; +import java.nio.channels.AlreadyBoundException; import java.util.Set; import java.util.HashSet; import java.security.AccessController; @@ -52,8 +53,29 @@ public class SctpNet { return false; } + static boolean throwAlreadyBoundException() throws IOException { + throw new AlreadyBoundException(); + } + + static void listen(int fd, int backlog) throws IOException { + listen0(fd, backlog); + } + + static int connect(int fd, InetAddress remote, int remotePort) + throws IOException { + return connect0(fd, remote, remotePort); + } + + static void close(int fd) throws IOException { + close0(fd); + } + + static void preClose(int fd) throws IOException { + preClose0(fd); + } + /** - * @param oneToone + * @param oneToOne * if {@code true} returns a one-to-one sctp socket, otherwise * returns a one-to-many sctp socket */ @@ -240,6 +262,15 @@ public class SctpNet { /* Native Methods */ static native int socket0(boolean oneToOne) throws IOException; + static native void listen0(int fd, int backlog) throws IOException; + + static native int connect0(int fd, InetAddress remote, int remotePort) + throws IOException; + + static native void close0(int fd) throws IOException; + + static native void preClose0(int fd) throws IOException; + static native void bindx(int fd, InetAddress[] addrs, int port, int length, boolean add, boolean preferIPv6) throws IOException; @@ -271,5 +302,11 @@ public class SctpNet { throws IOException; static native void shutdown0(int fd, int assocId); + + static native void init(); + + static { + init(); + } } diff --git a/src/solaris/classes/sun/nio/ch/SctpServerChannelImpl.java b/src/solaris/classes/sun/nio/ch/SctpServerChannelImpl.java index 5381591b7f0e33937126aad7b3356885b72c4ba8..740905a09419571e9da668e54d7b85c81a1470d8 100644 --- a/src/solaris/classes/sun/nio/ch/SctpServerChannelImpl.java +++ b/src/solaris/classes/sun/nio/ch/SctpServerChannelImpl.java @@ -33,7 +33,6 @@ import java.util.Collections; import java.util.Set; import java.util.HashSet; import java.nio.channels.SelectionKey; -import java.nio.channels.AlreadyBoundException; import java.nio.channels.ClosedChannelException; import java.nio.channels.NotYetBoundException; import java.nio.channels.spi.SelectorProvider; @@ -49,9 +48,6 @@ import com.sun.nio.sctp.SctpStandardSocketOption; public class SctpServerChannelImpl extends SctpServerChannel implements SelChImpl { - /* Used to make native close and preClose calls */ - private static NativeDispatcher nd; - private final FileDescriptor fd; private final int fdVal; @@ -103,7 +99,7 @@ public class SctpServerChannelImpl extends SctpServerChannel if (!isOpen()) throw new ClosedChannelException(); if (isBound()) - throw new AlreadyBoundException(); + SctpNet.throwAlreadyBoundException(); InetSocketAddress isa = (local == null) ? new InetSocketAddress(0) : Net.checkAddress(local); @@ -118,7 +114,7 @@ public class SctpServerChannelImpl extends SctpServerChannel if (isa.getAddress().isAnyLocalAddress()) wildcard = true; - Net.listen(fd, backlog < 1 ? 50 : backlog); + SctpNet.listen(fdVal, backlog < 1 ? 50 : backlog); } } return this; @@ -156,7 +152,7 @@ public class SctpServerChannelImpl extends SctpServerChannel if (add) { for (InetSocketAddress addr : localAddresses) { if (addr.getAddress().equals(address)) { - throw new AlreadyBoundException(); + SctpNet.throwAlreadyBoundException(); } } } else { /*removing */ @@ -261,7 +257,7 @@ public class SctpServerChannelImpl extends SctpServerChannel @Override public void implCloseSelectableChannel() throws IOException { synchronized (stateLock) { - nd.preClose(fd); + SctpNet.preClose(fdVal); if (thread != 0) NativeThread.signal(thread); if (!isRegistered()) @@ -282,7 +278,7 @@ public class SctpServerChannelImpl extends SctpServerChannel // Postpone the kill if there is a thread in accept if (thread == 0) { - nd.close(fd); + SctpNet.close(fdVal); state = ChannelState.KILLED; } else { state = ChannelState.KILLPENDING; @@ -423,7 +419,6 @@ public class SctpServerChannelImpl extends SctpServerChannel Util.load(); // loads nio & net native libraries java.security.AccessController.doPrivileged( new sun.security.action.LoadLibraryAction("sctp")); - nd = new SctpSocketDispatcher(); initIDs(); } } diff --git a/src/solaris/classes/sun/nio/ch/SctpSocketDispatcher.java b/src/solaris/classes/sun/nio/ch/SctpSocketDispatcher.java deleted file mode 100644 index 937a7392496daab9aa6a8b40a6bd780da5f7c274..0000000000000000000000000000000000000000 --- a/src/solaris/classes/sun/nio/ch/SctpSocketDispatcher.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -package sun.nio.ch; - -import java.io.IOException; -import java.io.FileDescriptor; - -/** - * Only used for {@code close} and {@code preclose}. All other methods - * throw {@code IOException}. - */ -class SctpSocketDispatcher extends NativeDispatcher { - @Override - @SuppressWarnings("unused") - int read(FileDescriptor fd, long address, int len) throws IOException { - throw new IOException("Operation Unsupported"); - } - - @Override - @SuppressWarnings("unused") - long readv(FileDescriptor fd, long address, int len) throws IOException { - throw new IOException("Operation Unsupported"); - } - - @Override - @SuppressWarnings("unused") - int write(FileDescriptor fd, long address, int len) throws IOException { - throw new IOException("Operation Unsupported"); - } - - @Override - @SuppressWarnings("unused") - long writev(FileDescriptor fd, long address, int len) throws IOException { - throw new IOException("Operation Unsupported"); - } - - @Override - void close(FileDescriptor fd) throws IOException { - FileDispatcherImpl.close0(fd); - } - - @Override - void preClose(FileDescriptor fd) throws IOException { - FileDispatcherImpl.preClose0(fd); - } -} diff --git a/src/solaris/native/sun/nio/ch/SctpNet.c b/src/solaris/native/sun/nio/ch/SctpNet.c index 85611bd0d9dc4f06b284cd4720accd69a0545a94..61d7764d23edab02ecb12c75cceb5883158bc0c4 100644 --- a/src/solaris/native/sun/nio/ch/SctpNet.c +++ b/src/solaris/native/sun/nio/ch/SctpNet.c @@ -48,6 +48,9 @@ JNIEXPORT jint JNICALL JNI_OnLoad return JNI_VERSION_1_2; } +static int preCloseFD = -1; /* File descriptor to which we dup other fd's + before closing them for real */ + /** * Loads the native sctp library that contains the socket extension * functions, as well as locating the individual functions. @@ -107,6 +110,55 @@ jboolean loadSocketExtensionFuncs return JNI_TRUE; } +jint +handleSocketError(JNIEnv *env, jint errorValue) +{ + char *xn; + switch (errorValue) { + case EINPROGRESS: /* Non-blocking connect */ + return 0; + case EPROTO: + xn= JNU_JAVANETPKG "ProtocolException"; + break; + case ECONNREFUSED: + xn = JNU_JAVANETPKG "ConnectException"; + break; + case ETIMEDOUT: + xn = JNU_JAVANETPKG "ConnectException"; + break; + case EHOSTUNREACH: + xn = JNU_JAVANETPKG "NoRouteToHostException"; + break; + case EADDRINUSE: /* Fall through */ + case EADDRNOTAVAIL: + xn = JNU_JAVANETPKG "BindException"; + break; + default: + xn = JNU_JAVANETPKG "SocketException"; + break; + } + errno = errorValue; + JNU_ThrowByNameWithLastError(env, xn, "NioSocketError"); + return IOS_THROWN; +} + +/* + * Class: sun_nio_ch_SctpNet + * Method: init + * Signature: ()V + */ +JNIEXPORT void JNICALL +Java_sun_nio_ch_SctpNet_init + (JNIEnv *env, jclass cl) { + int sp[2]; + if (socketpair(PF_UNIX, SOCK_STREAM, 0, sp) < 0) { + JNU_ThrowIOExceptionWithLastError(env, "socketpair failed"); + return; + } + preCloseFD = sp[0]; + close(sp[1]); +} + /* * Class: sun_nio_ch_SctpNet * Method: socket0 @@ -184,6 +236,76 @@ JNIEXPORT void JNICALL Java_sun_nio_ch_SctpNet_bindx free(sap); } +/* + * Class: sun_nio_ch_SctpNet + * Method: listen0 + * Signature: (II)V + */ +JNIEXPORT void JNICALL +Java_sun_nio_ch_SctpNet_listen0 + (JNIEnv *env, jclass cl, jint fd, jint backlog) { + if (listen(fd, backlog) < 0) + handleSocketError(env, errno); +} + +/* + * Class: sun_nio_ch_SctpNet + * Method: connect0 + * Signature: (ILjava/net/InetAddress;I)I + */ +JNIEXPORT jint JNICALL +Java_sun_nio_ch_SctpNet_connect0 + (JNIEnv *env, jclass clazz, int fd, jobject iao, jint port) { + SOCKADDR sa; + int sa_len = SOCKADDR_LEN; + int rv; + + if (NET_InetAddressToSockaddr(env, iao, port, (struct sockaddr *) &sa, + &sa_len, JNI_TRUE) != 0) { + return IOS_THROWN; + } + + rv = connect(fd, (struct sockaddr *)&sa, sa_len); + if (rv != 0) { + if (errno == EINPROGRESS) { + return IOS_UNAVAILABLE; + } else if (errno == EINTR) { + return IOS_INTERRUPTED; + } + return handleSocketError(env, errno); + } + return 1; +} + +/* + * Class: sun_nio_ch_SctpNet + * Method: close0 + * Signature: (I)V + */ +JNIEXPORT void JNICALL +Java_sun_nio_ch_SctpNet_close0 + (JNIEnv *env, jclass clazz, jint fd) { + if (fd != -1) { + int rv = close(fd); + if (rv < 0) + JNU_ThrowIOExceptionWithLastError(env, "Close failed"); + } +} + +/* + * Class: sun_nio_ch_SctpNet + * Method: preClose0 + * Signature: (I)V + */ +JNIEXPORT void JNICALL +Java_sun_nio_ch_SctpNet_preClose0 + (JNIEnv *env, jclass clazz, jint fd) { + if (preCloseFD >= 0) { + if (dup2(preCloseFD, fd) < 0) + JNU_ThrowIOExceptionWithLastError(env, "dup2 failed"); + } +} + void initializeISA (JNIEnv* env) { if (isaCls == 0) { @@ -394,7 +516,7 @@ JNIEXPORT void JNICALL Java_sun_nio_ch_SctpNet_setIntOption0 arglen = sizeof(arg); } - if (setsockopt(fd, klevel, kopt, parg, arglen) < 0) { + if (NET_SetSockOpt(fd, klevel, kopt, parg, arglen) < 0) { JNU_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException", "sun_nio_ch_SctpNet.setIntOption0"); } @@ -427,7 +549,7 @@ JNIEXPORT int JNICALL Java_sun_nio_ch_SctpNet_getIntOption0 arglen = sizeof(result); } - if (getsockopt(fd, klevel, kopt, arg, &arglen) < 0) { + if (NET_GetSockOpt(fd, klevel, kopt, arg, &arglen) < 0) { JNU_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException", "sun.nio.ch.Net.getIntOption"); return -1; diff --git a/src/windows/classes/sun/nio/ch/WindowsAsynchronousFileChannelImpl.java b/src/windows/classes/sun/nio/ch/WindowsAsynchronousFileChannelImpl.java index 0b43ab0d5168c50c93c666cf768820b2e14124a2..e14ac2fc6590bf89d999aa4f2714578cb1d021ba 100644 --- a/src/windows/classes/sun/nio/ch/WindowsAsynchronousFileChannelImpl.java +++ b/src/windows/classes/sun/nio/ch/WindowsAsynchronousFileChannelImpl.java @@ -445,20 +445,17 @@ public class WindowsAsynchronousFileChannelImpl // allocate OVERLAPPED overlapped = ioCache.add(result); - // synchronize on result to allow this thread handle the case - // where the read completes immediately. - synchronized (result) { - n = readFile(handle, address, rem, position, overlapped); - if (n == IOStatus.UNAVAILABLE) { - // I/O is pending - return; - } - // read completed immediately: - // 1. update buffer position - // 2. release waiters - updatePosition(n); + // initiate read + n = readFile(handle, address, rem, position, overlapped); + if (n == IOStatus.UNAVAILABLE) { + // I/O is pending + return; + } else if (n == IOStatus.EOF) { result.setResult(n); + } else { + throw new InternalError("Unexpected result: " + n); } + } catch (Throwable x) { // failed to initiate read result.setFailure(toIOException(x)); @@ -466,12 +463,9 @@ public class WindowsAsynchronousFileChannelImpl end(); } - // read failed or EOF so completion port will not be notified - if (n < 0 && overlapped != 0L) { + // release resources + if (overlapped != 0L) ioCache.remove(overlapped); - } - - // return direct buffer to cache if substituted releaseBufferIfSubstituted(); // invoke completion handler @@ -634,20 +628,15 @@ public class WindowsAsynchronousFileChannelImpl // allocate an OVERLAPPED structure overlapped = ioCache.add(result); - // synchronize on result to allow this thread handle the case - // where the read completes immediately. - synchronized (result) { - n = writeFile(handle, address, rem, position, overlapped); - if (n == IOStatus.UNAVAILABLE) { - // I/O is pending - return; - } - // read completed immediately: - // 1. update buffer position - // 2. release waiters - updatePosition(n); - result.setResult(n); + // initiate the write + n = writeFile(handle, address, rem, position, overlapped); + if (n == IOStatus.UNAVAILABLE) { + // I/O is pending + return; + } else { + throw new InternalError("Unexpected result: " + n); } + } catch (Throwable x) { // failed to initiate read: result.setFailure(toIOException(x)); diff --git a/src/windows/native/java/net/SocketInputStream.c b/src/windows/native/java/net/SocketInputStream.c index 54c9a8a88feff33e662f870f0a183cb4a316bf96..bbf6a9ac6fc0ef90da5c2d053f4f7c03a4ee5d6d 100644 --- a/src/windows/native/java/net/SocketInputStream.c +++ b/src/windows/native/java/net/SocketInputStream.c @@ -121,6 +121,9 @@ Java_java_net_SocketInputStream_socketRead0(JNIEnv *env, jobject this, newfd = (*env)->GetIntField(env, fdObj, IO_fd_fdID); if (newfd == -1) { NET_ThrowSocketException(env, "Socket Closed"); + if (bufP != BUF) { + free(bufP); + } return -1; } } diff --git a/src/windows/native/sun/nio/ch/WindowsAsynchronousFileChannelImpl.c b/src/windows/native/sun/nio/ch/WindowsAsynchronousFileChannelImpl.c index d8346ba3e7a14c97ece8f55ad563eeb025647b25..cf742116c790e0667a34480c6230930b02e35742 100644 --- a/src/windows/native/sun/nio/ch/WindowsAsynchronousFileChannelImpl.c +++ b/src/windows/native/sun/nio/ch/WindowsAsynchronousFileChannelImpl.c @@ -39,7 +39,6 @@ Java_sun_nio_ch_WindowsAsynchronousFileChannelImpl_readFile(JNIEnv* env, jclass jlong handle, jlong address, jint len, jlong offset, jlong ov) { BOOL res; - DWORD nread = 0; OVERLAPPED* lpOverlapped = (OVERLAPPED*)jlong_to_ptr(ov); lpOverlapped->Offset = (DWORD)offset; @@ -49,7 +48,7 @@ Java_sun_nio_ch_WindowsAsynchronousFileChannelImpl_readFile(JNIEnv* env, jclass res = ReadFile((HANDLE) jlong_to_ptr(handle), (LPVOID) jlong_to_ptr(address), (DWORD)len, - &nread, + NULL, lpOverlapped); if (res == 0) { @@ -62,7 +61,7 @@ Java_sun_nio_ch_WindowsAsynchronousFileChannelImpl_readFile(JNIEnv* env, jclass return IOS_THROWN; } - return (jint)nread; + return IOS_UNAVAILABLE; } JNIEXPORT jint JNICALL @@ -70,7 +69,6 @@ Java_sun_nio_ch_WindowsAsynchronousFileChannelImpl_writeFile(JNIEnv* env, jclass jlong handle, jlong address, jint len, jlong offset, jlong ov) { BOOL res; - DWORD nwritten = 0; OVERLAPPED* lpOverlapped = (OVERLAPPED*)jlong_to_ptr(ov); lpOverlapped->Offset = (DWORD)offset; @@ -80,18 +78,18 @@ Java_sun_nio_ch_WindowsAsynchronousFileChannelImpl_writeFile(JNIEnv* env, jclass res = WriteFile((HANDLE)jlong_to_ptr(handle), (LPVOID) jlong_to_ptr(address), (DWORD)len, - &nwritten, + NULL, lpOverlapped); if (res == 0) { int error = GetLastError(); - if (error == ERROR_IO_PENDING) { + if (error == ERROR_IO_PENDING) return IOS_UNAVAILABLE; - } JNU_ThrowIOExceptionWithLastError(env, "WriteFile failed"); return IOS_THROWN; } - return (jint)nwritten; + + return IOS_UNAVAILABLE; } JNIEXPORT jint JNICALL diff --git a/test/Makefile b/test/Makefile index 25f0dc1ed6fcb3b32e218d4eda4a2fa2f462e4d3..bffa3ad7cb06a346d9e7354502bef3c81ca862e0 100644 --- a/test/Makefile +++ b/test/Makefile @@ -291,7 +291,7 @@ TESTEXIT = \ fi ; \ testExitCode=`$(CAT) $(EXITCODE)`; \ $(ECHO) "EXIT CODE: $${testExitCode}"; \ - exit ${testExitCode} + exit $${testExitCode} BUNDLE_UP_AND_EXIT = \ ( \ @@ -300,7 +300,7 @@ BUNDLE_UP_AND_EXIT = \ $(RM) -f $(STATS_TXT) $(RUNLIST) $(PASSLIST) $(FAILLIST) $(EXITCODE); \ $(ECHO) "$${jtregExitCode}" > $(EXITCODE); \ if [ -r "$${_summary}" ] ; then \ - $(ECHO) "Summary: $${_summary}" > $(STATS_TXT); \ + $(ECHO) "Summary: $(UNIQUE_DIR)" > $(STATS_TXT); \ $(EXPAND) $${_summary} | $(EGREP) -v ' Not run\.' > $(RUNLIST); \ $(EGREP) ' Passed\.' $(RUNLIST) \ | $(EGREP) -v ' Error\.' \ @@ -370,7 +370,8 @@ ifndef USE_JTREG_SAMEVM endif # With samevm, you cannot use -javaoptions? ifeq ($(USE_JTREG_SAMEVM),true) - EXTRA_JTREG_OPTIONS += -samevm $(JAVA_ARGS) $(JAVA_ARGS:%=-vmoption:%) + JTREG_SAMEVM_OPTION = -samevm + EXTRA_JTREG_OPTIONS += $(JTREG_SAMEVM_OPTION) $(JAVA_ARGS) $(JAVA_ARGS:%=-vmoption:%) JTREG_TEST_OPTIONS = $(JAVA_VM_ARGS:%=-vmoption:%) else JTREG_TEST_OPTIONS = $(JAVA_ARGS:%=-javaoptions:%) $(JAVA_VM_ARGS:%=-vmoption:%) @@ -418,8 +419,9 @@ $(ECHO) "Running tests in othervm mode: $(call TestDirs, $?)" $(MAKE) TESTDIRS="$(call TestDirs, $?)" USE_JTREG_SAMEVM=false UNIQUE_DIR=$@ jtreg_tests endef define SummaryInfo -$(ECHO) "Summary for: $?" +$(ECHO) "########################################################" $(CAT) $(?:%=$(ABS_TEST_OUTPUT_DIR)/%/$(STATS_TXT_NAME)) +$(ECHO) "########################################################" endef # ------------------------------------------------------------------ @@ -446,10 +448,14 @@ JDK_ALL_TARGETS += jdk_beans2 jdk_beans2: java/beans/Beans java/beans/EventHandler java/beans/XMLDecoder \ java/beans/PropertyEditor $(call RunOthervmBatch) + +# Stable othervm testruns (minus items from PROBLEM_LIST) +# Using samevm has serious problems with these tests JDK_ALL_TARGETS += jdk_beans3 jdk_beans3: java/beans/XMLEncoder $(call RunOthervmBatch) +# All beans tests jdk_beans: jdk_beans1 jdk_beans2 jdk_beans3 @$(SummaryInfo) @@ -475,6 +481,7 @@ JDK_ALL_TARGETS += jdk_management2 jdk_management2: com/sun/jmx com/sun/management sun/management $(call RunOthervmBatch) +# All management tests jdk_management: jdk_management1 jdk_management2 @$(SummaryInfo) @@ -506,10 +513,14 @@ JDK_ALL_TARGETS += jdk_nio2 jdk_nio2: java/nio/Buffer java/nio/ByteOrder \ java/nio/channels java/nio/BufferPoolMXBean java/nio/MappedByteBuffer $(call RunOthervmBatch) + +# Stable othervm testruns (minus items from PROBLEM_LIST) +# Using samevm has serious problems with these tests JDK_ALL_TARGETS += jdk_nio3 jdk_nio3: com/sun/nio sun/nio $(call RunOthervmBatch) +# All nio tests jdk_nio: jdk_nio1 jdk_nio2 jdk_nio3 @$(SummaryInfo) @@ -529,10 +540,14 @@ jdk_security1: java/security JDK_ALL_TARGETS += jdk_security2 jdk_security2: javax/crypto com/sun/crypto $(call RunOthervmBatch) + +# Stable othervm testruns (minus items from PROBLEM_LIST) +# Using samevm has serious problems with these tests JDK_ALL_TARGETS += jdk_security3 jdk_security3: com/sun/security lib/security javax/security sun/security $(call RunOthervmBatch) +# All security tests jdk_security: jdk_security1 jdk_security2 jdk_security3 @$(SummaryInfo) @@ -547,15 +562,18 @@ JDK_ALL_TARGETS += jdk_text jdk_text: java/text sun/text $(call RunSamevmBatch) -# Stable othervm testruns (minus items from PROBLEM_LIST) -# Using samevm has serious problems with these tests +# Stable samevm testruns (minus items from PROBLEM_LIST) JDK_ALL_TARGETS += jdk_tools1 jdk_tools1: com/sun/jdi $(call RunSamevmBatch) + +# Stable othervm testruns (minus items from PROBLEM_LIST) +# Using samevm has serious problems with these tests JDK_ALL_TARGETS += jdk_tools2 jdk_tools2: com/sun/tools sun/jvmstat sun/tools tools vm com/sun/servicetag com/sun/tracing $(call RunOthervmBatch) +# All tools tests jdk_tools: jdk_tools1 jdk_tools2 @$(SummaryInfo) @@ -567,7 +585,9 @@ jdk_util: java/util sun/util # ------------------------------------------------------------------ # Run all tests -jdk_all: $(filter-out jdk_awt jdk_rmi jdk_swing, $(JDK_ALL_TARGETS)) +FILTER_OUT_LIST=jdk_awt jdk_rmi jdk_swing +JDK_ALL_STABLE_TARGETS := $(filter-out $(FILTER_OUT_LIST), $(JDK_ALL_TARGETS)) +jdk_all: $(JDK_ALL_STABLE_TARGETS) @$(SummaryInfo) # These are all phony targets @@ -581,16 +601,22 @@ JTREG = $(JT_HOME)/win32/bin/jtreg JTREG_BASIC_OPTIONS += $(EXTRA_JTREG_OPTIONS) # Only run automatic tests JTREG_BASIC_OPTIONS += -a +# Always turn on assertions +JTREG_ASSERT_OPTION = -ea -esa +JTREG_BASIC_OPTIONS += $(JTREG_ASSERT_OPTION) # Report details on all failed or error tests, times too JTREG_BASIC_OPTIONS += -v:fail,error,time # Retain all files for failing tests JTREG_BASIC_OPTIONS += -retain:fail,error # Ignore tests are not run and completely silent about it -JTREG_BASIC_OPTIONS += -ignore:quiet -# Multiple by 2 the timeout numbers -JTREG_BASIC_OPTIONS += -timeoutFactor:2 +JTREG_IGNORE_OPTION = -ignore:quiet +JTREG_BASIC_OPTIONS += $(JTREG_IGNORE_OPTION) +# Multiple by 4 the timeout numbers +JTREG_TIMEOUT_OPTION = -timeoutFactor:4 +JTREG_BASIC_OPTIONS += $(JTREG_TIMEOUT_OPTION) # Boost the max memory for jtreg to avoid gc thrashing -JTREG_BASIC_OPTIONS += -J-Xmx512m +JTREG_MEMORY_OPTION = -J-Xmx512m +JTREG_BASIC_OPTIONS += $(JTREG_MEMORY_OPTION) # Make sure jtreg exists $(JTREG): $(JT_HOME) diff --git a/test/ProblemList.txt b/test/ProblemList.txt index 2edcfd4d59502614b29122531660724ce476ac91..43d53e18b12a07157723e28453eefd1948c06d39 100644 --- a/test/ProblemList.txt +++ b/test/ProblemList.txt @@ -431,6 +431,11 @@ java/lang/ClassLoader/deadlock/TestCrossDelegate.sh generic-all # jdk_management +# Fails on Windows 2000, Test failed for iiop java.lang.NullPointerException +# at org.omg.stub.javax.management.remote.rmi._RMIConnectionImpl_Tie._invoke(Unknown Source) +# at com.sun.corba.se.impl.protocol.CorbaServerRequestDispatcherImpl.dispatchToServant(CorbaServerRequestDispatcherImpl.java:653) +javax/management/remote/mandatory/connection/ReconnectTest.java generic-all + # Solaris 10 sparc, NPE from org.omg.stub.javax.management.remote.rmi._RMIConnectionImpl_Tie._invoke javax/management/remote/mandatory/threads/ExecutorTest.java generic-all @@ -494,10 +499,6 @@ javax/management/monitor/AttributeArbitraryDataTypeTest.java generic-all # Problems with rounding add failures on solaris-sparcv9 and -server java/math/BigDecimal/AddTests.java solaris-sparcv9 -# Problems on windows with samevm, missing inputstream close()? -# Also times out on solaris-sparcv9 -server -java/math/BigInteger/BigIntegerTest.java generic-all - # Should be samevm? But seems problematic with samevm on windows java/math/BigInteger/ModPow65537.java generic-all @@ -570,6 +571,7 @@ javax/print/attribute/ChromaticityValues.java generic-all javax/print/attribute/GetCopiesSupported.java generic-all javax/print/attribute/SidesPageRangesTest.java generic-all javax/print/attribute/SupportedPrintableAreas.java generic-all +javax/print/attribute/AttributeTest.java generic-all # Only print test left, excluding just because all print tests have been javax/print/attribute/MediaMappingsTest.java generic-all @@ -581,6 +583,14 @@ javax/print/attribute/MediaMappingsTest.java generic-all # Suspect many of these tests auffer from using fixed ports, no concrete # evidence. +# Dies on Solaris 10 sparc and sparcv9, Linux -ea -esa with +# Interrupted or IO exception, maybe writing to non-unique named file? +com/sun/net/httpserver/bugs/B6373555.java generic-all + +# Dies on pretty much all platforms when run with -ea -esa, Assertion error +java/net/CookieHandler/TestHttpCookie.java generic-all +java/net/URLClassLoader/closetest/CloseTest.java generic-all + # Fails on OpenSolaris, BindException unexpected java/net/BindException/Test.java generic-all @@ -717,6 +727,9 @@ sun/net/www/http/KeepAliveCache/KeepAliveTimerThread.java generic-all # Connection refused, windows samevm sun/net/www/protocol/http/DigestTest.java generic-all +# Fails on Fedora 9 32bit & 64bit & Solaris 10, wrong proxy for http://localhost/index.html +java/net/ProxySelector/B6737819.java generic-all + ############################################################################ # jdk_nio @@ -724,6 +737,33 @@ sun/net/www/protocol/http/DigestTest.java generic-all # Suspect many of these tests auffer from using fixed ports, no concrete # evidence. +# Fails with -ea -esa, Assertion error, but only on Solaris 10 machines? +com/sun/nio/sctp/SctpChannel/Send.java generic-all +com/sun/nio/sctp/SctpChannel/Shutdown.java generic-all + +# Fails on Windows 2000, Can't delete test directory .\x.SetLastModified.dir +# at SetLastModified.main(SetLastModified.java:107) +java/io/File/SetLastModified.java generic-all + +# Fails on Solaris 10 x64, address already in use +java/nio/channels/DatagramChannel/SRTest.java generic-all + +# Fails on Solaris 10 x86, times out +java/nio/channels/DatagramChannel/Sender.java generic-all + +# Fails on Fedora 9 x86, address in use +java/nio/channels/Selector/SelectWrite.java generic-all + +# Fails on Fedora 9 32bit times out +java/nio/channels/DatagramChannel/EmptyBuffer.java generic-all + +# Fails on Windows 2000, ExceptionInInitializerError +# in WindowsAsynchronousServerSocketChannelImpl.java:316 +java/nio/channels/AsynchronousChannelGroup/Unbounded.java generic-all + +# Fails on Windows 2000, times out +java/nio/channels/FileChannel/Transfer.java generic-all + # Fails on OpenSolaris, IllegalStateException: Cannot add or remove addresses # from a channel that is bound to the wildcard address com/sun/nio/sctp/SctpChannel/Bind.java generic-all @@ -893,6 +933,48 @@ java/rmi/server/UnicastRemoteObject/unexportObject/UnexportLeak.java generic-all # jdk_security +# Fails with -ea -esa, but only on Solaris sparc? Suspect it is timing out +sun/security/tools/keytool/standard.sh generic-all + +# Fails on Solaris 10 X64, address already in use +sun/security/krb5/auto/HttpNegotiateServer.java generic-all + +# Fails on almost all platforms +# java.lang.UnsupportedClassVersionError: SerialTest : +# Unsupported major.minor version 51.0 +# at java.lang.ClassLoader.defineClass1(Native Method) +sun/security/util/Oid/S11N.sh generic-all + +# Fails on Fedora 9 32bit +# GSSException: Failure unspecified at GSS-API level (Mechanism level: +# Invalid argument (400) - Cannot find key of appropriate type to decrypt +# AP REP - DES CBC mode with MD5) +# at sun.security.jgss.krb5.Krb5Context.acceptSecContext(Krb5Context.java:778) +sun/security/krb5/auto/NonMutualSpnego.java generic-all + +# Fails on Solaris 10 sparc, GSSException: Failure unspecified at GSS-API level +# Also fails on Windows 2000 similar way +sun/security/krb5/auto/ok-as-delegate.sh generic-all + +# Fails on Windows 2000, GSSException: Failure unspecified at GSS-API level +# (Mechanism level: Request is a replay (34)) +sun/security/krb5/auto/ok-as-delegate-xrealm.sh generic-all + +# Fails on Windows 2000, ExceptionInInitializerError +sun/security/mscapi/AccessKeyStore.sh generic-all + +# Fails on Windows 2000, UnsatisfiedLinkError: libnspr4.dll: Access is denied +sun/security/pkcs11/KeyAgreement/TestDH.java generic-all + +# Fails on Windows 2000, UnsatisfiedLinkError: libnspr4.dll: Access is denied +sun/security/pkcs11/fips/ClientJSSEServerJSSE.java generic-all + +# Fails on Solaris 10, KrbException: Additional pre-authentication required (25) +sun/security/krb5/auto/basic.sh generic-all + +# Fails on Fedora 9 64bit, PKCS11Exception: CKR_DEVICE_ERROR +sun/security/pkcs11/KeyAgreement/TestDH.java generic-all + # Run too slow on Solaris 10 sparc sun/security/ssl/com/sun/net/ssl/internal/ssl/InputRecord/SSLSocketTimeoutNulls.java solaris-sparc sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/ClientTimeout.java solaris-sparc @@ -1088,6 +1170,16 @@ java/text/Bidi/Bug6665028.java linux-x64 # So most if not all tools tests are now being run with "othervm" mode. # Some of these tools tests have a tendency to use fixed ports, bad idea. +# Fails with -ea -esa on Solaris, Assertion error (Solaris specific test) +com/sun/tracing/BasicFunctionality.java generic-all + +# Fails on Fedora 9 32bit, jps output differs problem +sun/tools/jstatd/jstatdDefaults.sh generic-all + +# Fails on Linux Fedora 9 32bit, Could not read data for remote JVM 16133 +# jstat output differs from expected output +sun/tools/jstatd/jstatdExternalRegistry.sh generic-all + # Output of jps differs from expected output. # Invalid argument count on solaris-sparc and x64 sun/tools/jstatd/jstatdPort.sh generic-all @@ -1099,6 +1191,11 @@ sun/tools/jps/jps-lm.sh generic-all sun/tools/jps/jps-Vvml_2.sh generic-all sun/tools/jps/jps-m_2.sh generic-all +# Fails on Solaris 10 sparcv9, shell exits with 1 +# Turning off use of shared archive because of choice of garbage collector or large pages +# Could not synchronize with target +sun/tools/jps/jps-v_1.sh generic-all + # Fails on OpenSolaris "Could not synchronize with target" sun/tools/jps/jps-Defaults.sh generic-all sun/tools/jps/jps-V_2.sh generic-all @@ -1160,6 +1257,12 @@ tools/jar/index/MetaInf.java windows-all # jdk_util +# Fails with -ea -esa on all platforms with Assertion error +java/util/ResourceBundle/Test4300693.java generic-all + +# Failing on all -client 32bit platforms starting with b77? See 6908348. +java/util/concurrent/BlockingQueue/CancelledProducerConsumerLoops.java generic-all + # Assert error, failures, on Linux Fedora 9 -server # Windows samevm failure, assert error "Passed = 134, failed = 2" java/util/Arrays/ArrayObjectMethods.java generic-all diff --git a/test/com/sun/jdi/NoLaunchOptionTest.java b/test/com/sun/jdi/NoLaunchOptionTest.java index b65b375c85e3eeea22cf80fd80bce4ad658de995..14e6acd2c5d2b6af0770250d9c8fd43e6250d784 100644 --- a/test/com/sun/jdi/NoLaunchOptionTest.java +++ b/test/com/sun/jdi/NoLaunchOptionTest.java @@ -31,6 +31,9 @@ * @build VMConnection * @run main/othervm NoLaunchOptionTest */ + +import java.net.ServerSocket; + public class NoLaunchOptionTest extends Object { private Process subprocess; private int subprocessStatus; @@ -121,12 +124,19 @@ public class NoLaunchOptionTest extends Object { } public static void main(String[] args) throws Exception { + // find a free port + ServerSocket ss = new ServerSocket(0); + int port = ss.getLocalPort(); + ss.close(); + String address = String.valueOf(port); + String javaExe = System.getProperty("java.home") + java.io.File.separator + "bin" + java.io.File.separator + "java"; String targetClass = "NotAClass"; String cmds [] = {javaExe, - "-agentlib:jdwp=transport=dt_socket,address=8000," + + "-agentlib:jdwp=transport=dt_socket,address=" + + address + "," + "onthrow=java.lang.ClassNotFoundException,suspend=n", targetClass}; NoLaunchOptionTest myTest = new NoLaunchOptionTest(); diff --git a/test/com/sun/jdi/OptionTest.java b/test/com/sun/jdi/OptionTest.java index e3d6eb60b2dadeca0c03f9db6631805bd4e228f3..f6124d3e02abd00e6b90f6832a68935ad8aa5384 100644 --- a/test/com/sun/jdi/OptionTest.java +++ b/test/com/sun/jdi/OptionTest.java @@ -32,6 +32,9 @@ * @run compile -g VMConnection.java * @run main/othervm OptionTest */ + +import java.net.ServerSocket; + public class OptionTest extends Object { private Process subprocess; private int subprocessStatus; @@ -122,12 +125,18 @@ public class OptionTest extends Object { } public static void main(String[] args) throws Exception { + // find a free port + ServerSocket ss = new ServerSocket(0); + int port = ss.getLocalPort(); + ss.close(); + String address = String.valueOf(port); + String javaExe = System.getProperty("java.home") + java.io.File.separator + "bin" + java.io.File.separator + "java"; String targetClass = "HelloWorld"; String baseOptions = "transport=dt_socket" + - ",address=8000" + + ",address=" + address + ",server=y" + ",suspend=n"; diff --git a/test/com/sun/jdi/ProcessAttachTest.sh b/test/com/sun/jdi/ProcessAttachTest.sh index 38ce59fc240e5e1a87a7b2ee1d6acc8287119c4c..e1ec05996f79c55b991dd984db253af515f91e1c 100644 --- a/test/com/sun/jdi/ProcessAttachTest.sh +++ b/test/com/sun/jdi/ProcessAttachTest.sh @@ -54,10 +54,14 @@ JAVA="${TESTJAVA}/bin/java" OS=`uname -s` case "$OS" in - Windows* | CYGWIN_NT*) + Windows*) PS=";" OS="Windows" ;; + CYGWIN*) + PS=";" + OS="CYGWIN" + ;; * ) PS=":" ;; @@ -67,16 +71,23 @@ startDebuggee() { OUTPUTFILE=${TESTCLASSES}/Debuggee.out ${JAVA} "$@" > ${OUTPUTFILE} & - pid="$!" + startpid="$!" + pid="${startpid}" + # CYGWIN startpid is not the native windows PID we want, get the WINPID + if [ "${OS}" = "CYGWIN" ]; then + sleep 2 + ps -l -p ${startpid} + pid=`ps -l -p ${startpid} | tail -1 | awk '{print $4;}'` + fi + # MKS creates an intermediate shell to launch ${JAVA} so - # ${pid} is not the actual pid. We have put in a small sleep + # ${startpid} is not the actual pid. We have put in a small sleep # to give the intermediate shell process time to launch the # "java" process. if [ "$OS" = "Windows" ]; then sleep 2 - realpid=`ps -o pid,ppid,comm|grep ${pid}|grep "java"|cut -c1-6` - pid=${realpid} + pid=`ps -o pid,ppid,comm|grep ${startpid}|grep "java"|cut -c1-6` fi echo "Waiting for Debuggee to initialize..." @@ -91,7 +102,7 @@ startDebuggee() echo "Waiting $attempts second(s) ..." done - echo "Debuggee is process $pid" + echo "Debuggee is process $pid (startpid=${startpid})" } stopDebuggee() @@ -100,7 +111,7 @@ stopDebuggee() if [ $? != 0 ] ; then echo "Error: ShutdownDebuggee failed" failures=`expr $failures + 1` - kill -9 $pid + kill -9 ${startpid} fi } @@ -123,7 +134,7 @@ startDebuggee \ -agentlib:jdwp=transport=dt_socket,server=y,suspend=n \ -classpath "${TESTCLASSES}" ProcessAttachDebuggee "${PORTFILE}" -$JAVA -classpath ${TESTCLASSES}${PS}${TESTJAVA}/lib/tools.jar \ +$JAVA -classpath "${TESTCLASSES}${PS}${TESTJAVA}/lib/tools.jar" \ ProcessAttachDebugger $pid 2>&1 if [ $? != 0 ]; then failures=`expr $failures + 1`; fi @@ -141,7 +152,7 @@ startDebuggee \ -agentlib:jdwp=transport=dt_socket,server=y,suspend=y \ -classpath "${TESTCLASSES}" ProcessAttachDebuggee "${PORTFILE}" -$JAVA -classpath ${TESTCLASSES}${PS}${TESTJAVA}/lib/tools.jar \ +$JAVA -classpath "${TESTCLASSES}${PS}${TESTJAVA}/lib/tools.jar" \ ProcessAttachDebugger $pid 2>&1 # The debuggee is suspended and doesn't run until the debugger diff --git a/test/com/sun/jdi/connect/spi/JdiLoadedByCustomLoader.sh b/test/com/sun/jdi/connect/spi/JdiLoadedByCustomLoader.sh index 6331d5629878cfa4d8ad71fb09918d6356dde19a..c9570cd0b357d749fe287862cbacb73111f7a9eb 100644 --- a/test/com/sun/jdi/connect/spi/JdiLoadedByCustomLoader.sh +++ b/test/com/sun/jdi/connect/spi/JdiLoadedByCustomLoader.sh @@ -51,7 +51,7 @@ case "$OS" in Linux ) PS=":" ;; - Windows* ) + Windows* | CYGWIN*) PS=";" ;; * ) @@ -71,7 +71,7 @@ SOMEOTHERDIR="${TESTCLASSES}"/someotherdir $JAVAC -d "${TESTCLASSES}" "${TESTSRC}"/JdiLoadedByCustomLoader.java mkdir "${SOMEOTHERDIR}" -$JAVAC -d "${SOMEOTHERDIR}" -classpath ${TESTSRC}${PS}${TESTJAVA}/lib/tools.jar \ +$JAVAC -d "${SOMEOTHERDIR}" -classpath "${TESTSRC}${PS}${TESTJAVA}/lib/tools.jar" \ "${TESTSRC}"/ListConnectors.java # Run the test diff --git a/test/com/sun/nio/sctp/SctpChannel/Connect.java b/test/com/sun/nio/sctp/SctpChannel/Connect.java index 78cb52770baeb62198dedf2fa9b8bdfe4b4c9908..33f4441d356154894f83dfaeb3f0cc107c455480 100644 --- a/test/com/sun/nio/sctp/SctpChannel/Connect.java +++ b/test/com/sun/nio/sctp/SctpChannel/Connect.java @@ -192,6 +192,18 @@ public class Connect { testCCE(new Callable() { public Void call() throws IOException { cceChannel.finishConnect(); return null; } }); + + /* TEST 8: IOException: Connection refused. Exercises handleSocketError. + * Assumption: no sctp socket listening on 3456 */ + SocketAddress addr = new InetSocketAddress("localhost", 3456); + channel = SctpChannel.open(); + try { + channel.connect(addr); + fail("should have thrown ConnectException: Connection refused"); + } catch (IOException ioe) { + pass(); + } + } catch (IOException ioe) { unexpected(ioe); } finally { diff --git a/test/com/sun/nio/sctp/SctpChannel/Send.java b/test/com/sun/nio/sctp/SctpChannel/Send.java index 3cee201d7394ccb9a2d50a92e94f27960fdfb08e..3a62147e9dcc2d2f3d42dff0674691a3e96c6ec9 100644 --- a/test/com/sun/nio/sctp/SctpChannel/Send.java +++ b/test/com/sun/nio/sctp/SctpChannel/Send.java @@ -112,9 +112,6 @@ public class Send { /* Receive CommUp */ channel.receive(buffer, null, handler); - /* save for TEST 8 */ - Association association = channel.association(); - /* TEST 2: send small message */ int streamNumber = 0; debug("sending on stream number: " + streamNumber); @@ -250,6 +247,29 @@ public class Send { pass(); debug("OK, caught " + e); } + + /* TEST 9: Send from heap buffer to force implementation to + * substitute with a native buffer, then check that its position + * is updated correctly */ + buffer.clear(); + info = MessageInfo.createOutgoing(null, 0); + buffer.put(Util.SMALL_MESSAGE.getBytes("ISO-8859-1")); + buffer.flip(); + final int offset = 1; + buffer.position(offset); + remaining = buffer.remaining(); + + debug("sending small message: " + buffer); + try { + sent = channel.send(buffer, info); + + check(sent == remaining, "sent should be equal to remaining"); + check(buffer.position() == (offset + sent), + "buffers position should have been incremented by sent"); + } catch (IllegalArgumentException iae) { + fail(iae + ", Error updating buffers position"); + } + } catch (IOException ioe) { unexpected(ioe); } finally { @@ -335,6 +355,30 @@ public class Send { /* TEST 7 ++ */ sc2 = ssc.accept(); + /* TEST 9 */ + ByteBuffer expected = ByteBuffer.allocate(Util.SMALL_BUFFER); + expected.put(Util.SMALL_MESSAGE.getBytes("ISO-8859-1")); + expected.flip(); + final int offset = 1; + expected.position(offset); + buffer.clear(); + do { + info = sc2.receive(buffer, null, null); + if (info == null) { + fail("Server: unexpected null from receive"); + return; + } + } while (!info.isComplete()); + + buffer.flip(); + check(info != null, "info is null"); + check(info.streamNumber() == 0, "message not sent on the correct stream"); + check(info.bytes() == expected.remaining(), + "bytes received not equal to message length"); + check(info.bytes() == buffer.remaining(), "bytes != remaining"); + check(expected.equals(buffer), + "received message not the same as sent message"); + clientFinishedLatch.await(10L, TimeUnit.SECONDS); serverFinishedLatch.countDown(); } catch (IOException ioe) { diff --git a/test/com/sun/nio/sctp/SctpChannel/SocketOptionTests.java b/test/com/sun/nio/sctp/SctpChannel/SocketOptionTests.java index d5715b17198fa10213a1b2beb88e4e79f5ee2476..f5814a17bc5c805f82a2710cbed67b5c250eac0c 100644 --- a/test/com/sun/nio/sctp/SctpChannel/SocketOptionTests.java +++ b/test/com/sun/nio/sctp/SctpChannel/SocketOptionTests.java @@ -104,7 +104,9 @@ public class SocketOptionTests { sc.setOption(SCTP_NODELAY, true); checkOption(sc, SCTP_NODELAY, true); sc.setOption(SO_SNDBUF, 16*1024); + checkOption(sc, SO_SNDBUF, 16*1024); sc.setOption(SO_RCVBUF, 16*1024); + checkOption(sc, SO_RCVBUF, 16*1024); checkOption(sc, SO_LINGER, -1); /* default should be negative */ sc.setOption(SO_LINGER, 2000); checkOption(sc, SO_LINGER, 2000); diff --git a/test/com/sun/nio/sctp/SctpMultiChannel/Send.java b/test/com/sun/nio/sctp/SctpMultiChannel/Send.java index b7d1379d174b96ba5223d4cd85db57938b3f31e3..1f56c5df67e45913451438ffd819e0b850fd3b67 100644 --- a/test/com/sun/nio/sctp/SctpMultiChannel/Send.java +++ b/test/com/sun/nio/sctp/SctpMultiChannel/Send.java @@ -185,6 +185,27 @@ public class Send { /* TEST 5: getRemoteAddresses(Association) */ channel.getRemoteAddresses(assoc); + /* TEST 6: Send from heap buffer to force implementation to + * substitute with a native buffer, then check that its position + * is updated correctly */ + info = MessageInfo.createOutgoing(assoc, null, 0); + buffer.clear(); + buffer.put(Util.SMALL_MESSAGE.getBytes("ISO-8859-1")); + buffer.flip(); + final int offset = 1; + buffer.position(offset); + remaining = buffer.remaining(); + + try { + sent = channel.send(buffer, info); + + check(sent == remaining, "sent should be equal to remaining"); + check(buffer.position() == (offset + sent), + "buffers position should have been incremented by sent"); + } catch (IllegalArgumentException iae) { + fail(iae + ", Error updating buffers position"); + } + } catch (IOException ioe) { unexpected(ioe); } finally { @@ -284,6 +305,30 @@ public class Send { bytes = serverChannel.send(buffer, info); debug("Server: sent " + bytes + "bytes"); + /* TEST 6 */ + ByteBuffer expected = ByteBuffer.allocate(Util.SMALL_BUFFER); + expected.put(Util.SMALL_MESSAGE.getBytes("ISO-8859-1")); + expected.flip(); + final int offset = 1; + expected.position(offset); + buffer.clear(); + do { + info = serverChannel.receive(buffer, null, null); + if (info == null) { + fail("Server: unexpected null from receive"); + return; + } + } while (!info.isComplete()); + + buffer.flip(); + check(info != null, "info is null"); + check(info.streamNumber() == 0, "message not sent on the correct stream"); + check(info.bytes() == expected.remaining(), + "bytes received not equal to message length"); + check(info.bytes() == buffer.remaining(), "bytes != remaining"); + check(expected.equals(buffer), + "received message not the same as sent message"); + clientFinishedLatch.await(10L, TimeUnit.SECONDS); serverFinishedLatch.countDown(); } catch (IOException ioe) { diff --git a/test/com/sun/tools/attach/ApplicationSetup.sh b/test/com/sun/tools/attach/ApplicationSetup.sh index fa8509ec394281f4f2c12fb6c9717ff5e8d0768b..0bd7a1b5693daebc686bfd0a0fcae895abdce0d9 100644 --- a/test/com/sun/tools/attach/ApplicationSetup.sh +++ b/test/com/sun/tools/attach/ApplicationSetup.sh @@ -49,7 +49,11 @@ startApplication() # "java" process. if [ "$OS" = "Windows" ]; then sleep 2 - realpid=`ps -o pid,ppid,comm|grep ${pid}|grep "java"|cut -c1-6` + if [ "${isCygwin}" = "true" ] ; then + realpid=`ps -p ${pid} | tail -1 | awk '{print $4;}'` + else + realpid=`ps -o pid,ppid,comm|grep ${pid}|grep "java"|cut -c1-6` + fi pid=${realpid} fi @@ -57,7 +61,7 @@ startApplication() attempts=0 while true; do sleep 1 - port=`tail -1 ${OUTPUTFILE}` + port=`tail -1 ${OUTPUTFILE} | sed -e 's@\\r@@g' ` if [ ! -z "$port" ]; then # In case of errors wait time for output to be flushed sleep 1 diff --git a/test/com/sun/tools/attach/BasicTests.sh b/test/com/sun/tools/attach/BasicTests.sh index a960b40e15d01dd6341b536021338692d7350287..f5c4076581e8ae8e8663fe1b2cf02363fb433bf4 100644 --- a/test/com/sun/tools/attach/BasicTests.sh +++ b/test/com/sun/tools/attach/BasicTests.sh @@ -48,7 +48,7 @@ failures=0 echo "Running tests ..." -$JAVA -classpath ${TESTCLASSES}${PS}${TESTJAVA}/lib/tools.jar \ +$JAVA -classpath "${TESTCLASSES}${PS}${TESTJAVA}/lib/tools.jar" \ BasicTests $pid $agent $badagent $redefineagent 2>&1 if [ $? != 0 ]; then failures=`expr $failures + 1`; fi diff --git a/test/com/sun/tools/attach/CommonSetup.sh b/test/com/sun/tools/attach/CommonSetup.sh index 1520ca72b57c76fb3db50b0e39507623e4ed8340..66d90fafddd0cf979eab3f8b97a0cafdab60f60e 100644 --- a/test/com/sun/tools/attach/CommonSetup.sh +++ b/test/com/sun/tools/attach/CommonSetup.sh @@ -49,6 +49,12 @@ case "$OS" in OS="Windows" FS="\\" ;; + CYGWIN* ) + PS=";" + OS="Windows" + FS="\\" + isCygwin=true + ;; * ) echo "Unrecognized system!" exit 1; diff --git a/test/com/sun/tools/attach/PermissionTests.sh b/test/com/sun/tools/attach/PermissionTests.sh index 908e93ec0770828717dac7fbb6010f4726588f81..54a7e61a7e0a58296ebeddaa63c40fe5a5a4dd1d 100644 --- a/test/com/sun/tools/attach/PermissionTests.sh +++ b/test/com/sun/tools/attach/PermissionTests.sh @@ -48,7 +48,7 @@ startApplication echo "Deny test" # deny -$JAVA -classpath ${TESTCLASSES}${PS}${TESTJAVA}/lib/tools.jar \ +$JAVA -classpath "${TESTCLASSES}${PS}${TESTJAVA}/lib/tools.jar" \ -Djava.security.manager \ -Djava.security.policy=${TESTSRC}/java.policy.deny \ PermissionTest $pid true 2>&1 @@ -56,7 +56,7 @@ if [ $? != 0 ]; then failures=`expr $failures + 1`; fi # allow echo "Allow test" -$JAVA -classpath ${TESTCLASSES}${PS}${TESTJAVA}/lib/tools.jar \ +$JAVA -classpath "${TESTCLASSES}${PS}${TESTJAVA}/lib/tools.jar" \ -Djava.security.manager \ -Djava.security.policy=${TESTSRC}/java.policy.allow \ PermissionTest $pid false 2>&1 diff --git a/test/com/sun/tools/attach/ProviderTests.sh b/test/com/sun/tools/attach/ProviderTests.sh index caca75af0e71d81f8a0e88110b291a2c652caf71..36a90b13535352ad6cdc308dbc96b7335650376a 100644 --- a/test/com/sun/tools/attach/ProviderTests.sh +++ b/test/com/sun/tools/attach/ProviderTests.sh @@ -46,6 +46,6 @@ $JAR -cf ${TESTCLASSES}/SimpleProvider.jar \ echo "Running test ..." $JAVA -classpath \ - ${TESTCLASSES}${PS}${TESTCLASSES}/SimpleProvider.jar${PS}${TESTJAVA}/lib/tools.jar \ + "${TESTCLASSES}${PS}${TESTCLASSES}/SimpleProvider.jar${PS}${TESTJAVA}/lib/tools.jar" \ ProviderTest diff --git a/test/java/beans/Introspector/Test5102804.java b/test/java/beans/Introspector/Test5102804.java index 71f23f9294133bde362ee45fee71b338323b0d74..cc207bdc80b3ab89263e2bb7f8988994409c80a7 100644 --- a/test/java/beans/Introspector/Test5102804.java +++ b/test/java/beans/Introspector/Test5102804.java @@ -24,6 +24,7 @@ /* * @test * @bug 5102804 + * @ignore This test is not predictable with regards to GC * @summary Tests memory leak * @author Sergey Malenkov */ diff --git a/test/java/dyn/MethodHandlesTest.java b/test/java/dyn/MethodHandlesTest.java new file mode 100644 index 0000000000000000000000000000000000000000..a482d58a53cb134670bb6e725113aebf1aaa3c41 --- /dev/null +++ b/test/java/dyn/MethodHandlesTest.java @@ -0,0 +1,1839 @@ +/* + * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Sun designates this + * particular file as subject to the "Classpath" exception as provided + * by Sun in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ + +/* @test + * @summary unit tests for java.dyn.MethodHandles + * @compile -XDinvokedynamic MethodHandlesTest.java + * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableInvokeDynamic jdk.java.dyn.MethodHandlesTest + */ + +package jdk.java.dyn; + +import java.dyn.*; +import java.dyn.MethodHandles.Lookup; +import java.lang.reflect.*; +import java.util.*; +import java.util.logging.Level; +import java.util.logging.Logger; +import org.junit.*; +import static org.junit.Assert.*; + + +/** + * + * @author jrose + */ +public class MethodHandlesTest { + // How much output? + static int verbosity = 1; + + // Set this true during development if you want to fast-forward to + // a particular new, non-working test. Tests which are known to + // work (or have recently worked) test this flag and return on true. + static boolean CAN_SKIP_WORKING = false; + //static { CAN_SKIP_WORKING = true; } + + // Set true to test more calls. If false, some tests are just + // lookups, without exercising the actual method handle. + static boolean DO_MORE_CALLS = false; + + + @Test + public void testFirst() throws Throwable { + verbosity += 9; try { + // left blank for debugging + } finally { verbosity -= 9; } + } + + // current failures + @Test @Ignore("failure in call to makeRawRetypeOnly in ToGeneric") + public void testFail_1() throws Throwable { + testSpreadArguments(int.class, 0, 6); + } + @Test @Ignore("failure in JVM when expanding the stack") + public void testFail_2() throws Throwable { + // if CONV_OP_IMPLEMENTED_MASK includes OP_SPREAD_ARGS, this crashes: + testSpreadArguments(Object.class, 0, 2); + } + @Test @Ignore("IllArgEx failure in call to ToGeneric.make") + public void testFail_3() throws Throwable { + testSpreadArguments(int.class, 1, 2); + } + @Test @Ignore("IllArgEx failure in call to ToGeneric.make") + public void testFail_4() throws Throwable { + testCollectArguments(int.class, 1, 2); + } + @Test @Ignore("cannot collect leading primitive types") + public void testFail_5() throws Throwable { + testInvokers(MethodType.genericMethodType(2).changeParameterType(0, int.class)); + } + @Test @Ignore("should not insert arguments beyond MethodHandlePushLimit") + public void testFail_6() throws Throwable { + testInsertArguments(0, 0, MAX_ARG_INCREASE+1); + } + static final int MAX_ARG_INCREASE = 3; + + public MethodHandlesTest() { + } + + String testName; + int posTests, negTests; + @After + public void printCounts() { + if (verbosity >= 1 && (posTests | negTests) != 0) { + System.out.println(); + if (posTests != 0) System.out.println("=== "+testName+": "+posTests+" positive test cases run"); + if (negTests != 0) System.out.println("=== "+testName+": "+negTests+" negative test cases run"); + } + } + void countTest(boolean positive) { + if (positive) ++posTests; + else ++negTests; + } + void countTest() { countTest(true); } + void startTest(String name) { + if (testName != null) printCounts(); + if (verbosity >= 0) + System.out.println(name); + posTests = negTests = 0; + testName = name; + } + + @BeforeClass + public static void setUpClass() throws Exception { + calledLog.clear(); + calledLog.add(null); + nextArg = 1000000; + } + + @AfterClass + public static void tearDownClass() throws Exception { + } + + static List calledLog = new ArrayList(); + static Object logEntry(String name, Object... args) { + return Arrays.asList(name, Arrays.asList(args)); + } + static Object called(String name, Object... args) { + Object entry = logEntry(name, args); + calledLog.add(entry); + return entry; + } + static void assertCalled(String name, Object... args) { + Object expected = logEntry(name, args); + Object actual = calledLog.get(calledLog.size() - 1); + if (expected.equals(actual)) return; + System.out.println("assertCalled "+name+":"); + System.out.println("expected: "+expected); + System.out.println("actual: "+actual); + System.out.println("ex. types: "+getClasses(expected)); + System.out.println("act. types: "+getClasses(actual)); + assertEquals("previous method call types", expected, actual); + assertEquals("previous method call", expected, actual); + } + static void printCalled(MethodHandle target, String name, Object... args) { + if (verbosity >= 2) + System.out.println("calling "+logEntry(name, args)+" on "+target); + } + + static Object castToWrapper(Object value, Class dst) { + Object wrap = null; + if (value instanceof Number) + wrap = castToWrapperOrNull(((Number)value).longValue(), dst); + if (value instanceof Character) + wrap = castToWrapperOrNull((char)(Character)value, dst); + if (wrap != null) return wrap; + return dst.cast(value); + } + + static Object castToWrapperOrNull(long value, Class dst) { + if (dst == int.class || dst == Integer.class) + return (int)(value); + if (dst == long.class || dst == Long.class) + return (long)(value); + if (dst == char.class || dst == Character.class) + return (char)(value); + if (dst == short.class || dst == Short.class) + return (short)(value); + if (dst == float.class || dst == Float.class) + return (float)(value); + if (dst == double.class || dst == Double.class) + return (double)(value); + if (dst == byte.class || dst == Byte.class) + return (byte)(value); + if (dst == boolean.class || dst == boolean.class) + return ((value % 29) & 1) == 0; + return null; + } + + static int nextArg; + static Object randomArg(Class param) { + Object wrap = castToWrapperOrNull(nextArg, param); + if (wrap != null) { + nextArg++; + return wrap; + } +// import sun.dyn.util.Wrapper; +// Wrapper wrap = Wrapper.forBasicType(dst); +// if (wrap == Wrapper.OBJECT && Wrapper.isWrapperType(dst)) +// wrap = Wrapper.forWrapperType(dst); +// if (wrap != Wrapper.OBJECT) +// return wrap.wrap(nextArg++); + if (param.isInterface() || param.isAssignableFrom(String.class)) + return "#"+(nextArg++); + else + try { + return param.newInstance(); + } catch (InstantiationException ex) { + } catch (IllegalAccessException ex) { + } + return null; // random class not Object, String, Integer, etc. + } + static Object[] randomArgs(Class... params) { + Object[] args = new Object[params.length]; + for (int i = 0; i < args.length; i++) + args[i] = randomArg(params[i]); + return args; + } + static Object[] randomArgs(int nargs, Class param) { + Object[] args = new Object[nargs]; + for (int i = 0; i < args.length; i++) + args[i] = randomArg(param); + return args; + } + + static T[] array(Class atype, E... a) { + return Arrays.copyOf(a, a.length, atype); + } + static T[] cat(T[] a, T... b) { + int alen = a.length, blen = b.length; + if (blen == 0) return a; + T[] c = Arrays.copyOf(a, alen + blen); + System.arraycopy(b, 0, c, alen, blen); + return c; + } + static Integer[] boxAll(int... vx) { + Integer[] res = new Integer[vx.length]; + for (int i = 0; i < res.length; i++) { + res[i] = vx[i]; + } + return res; + } + static Object getClasses(Object x) { + if (x == null) return x; + if (x instanceof String) return x; // keep the name + if (x instanceof List) { + // recursively report classes of the list elements + Object[] xa = ((List)x).toArray(); + for (int i = 0; i < xa.length; i++) + xa[i] = getClasses(xa[i]); + return Arrays.asList(xa); + } + return x.getClass().getSimpleName(); + } + + static MethodHandle changeArgTypes(MethodHandle target, Class argType) { + return changeArgTypes(target, 0, 999, argType); + } + static MethodHandle changeArgTypes(MethodHandle target, + int beg, int end, Class argType) { + MethodType targetType = target.type(); + end = Math.min(end, targetType.parameterCount()); + ArrayList> argTypes = new ArrayList>(targetType.parameterList()); + Collections.fill(argTypes.subList(beg, end), argType); + MethodType ttype2 = MethodType.methodType(targetType.returnType(), argTypes); + return MethodHandles.convertArguments(target, ttype2); + } + + // This lookup is good for all members in and under MethodHandlesTest. + static final Lookup PRIVATE = MethodHandles.lookup(); + // This lookup is good for package-private members but not private ones. + static final Lookup PACKAGE = PackageSibling.lookup(); + // This lookup is good only for public members. + static final Lookup PUBLIC = MethodHandles.publicLookup(); + + // Subject methods... + static class Example implements IntExample { + final String name; + public Example() { name = "Example#"+(nextArg++); } + protected Example(String name) { this.name = name; } + protected Example(int x) { this(); called("protected ", this, x); } + @Override public String toString() { return name; } + + public void v0() { called("v0", this); } + void pkg_v0() { called("pkg_v0", this); } + private void pri_v0() { called("pri_v0", this); } + public static void s0() { called("s0"); } + static void pkg_s0() { called("pkg_s0"); } + private static void pri_s0() { called("pri_s0"); } + + public Object v1(Object x) { return called("v1", this, x); } + public Object v2(Object x, Object y) { return called("v2", this, x, y); } + public Object v2(Object x, int y) { return called("v2", this, x, y); } + public Object v2(int x, Object y) { return called("v2", this, x, y); } + public Object v2(int x, int y) { return called("v2", this, x, y); } + public static Object s1(Object x) { return called("s1", x); } + public static Object s2(int x) { return called("s2", x); } + public static Object s3(long x) { return called("s3", x); } + public static Object s4(int x, int y) { return called("s4", x, y); } + public static Object s5(long x, int y) { return called("s5", x, y); } + public static Object s6(int x, long y) { return called("s6", x, y); } + public static Object s7(float x, double y) { return called("s7", x, y); } + } + public static class PubExample extends Example { + } + static class SubExample extends Example { + @Override public void v0() { called("Sub/v0", this); } + @Override void pkg_v0() { called("Sub/pkg_v0", this); } + private SubExample(int x) { called("", this, x); } + public SubExample() { super("SubExample#"+(nextArg++)); } + } + public static interface IntExample { + public void v0(); + static class Impl implements IntExample { + public void v0() { called("Int/v0", this); } + final String name; + public Impl() { name = "Example#"+(nextArg++); } + } + } + + static final Object[][][] ACCESS_CASES = { + { { false, PUBLIC }, { false, PACKAGE }, { false, PRIVATE } }, + { { false, PUBLIC }, { false, PACKAGE }, { true, PRIVATE } }, + { { false, PUBLIC }, { true, PACKAGE }, { true, PRIVATE } }, + { { true, PUBLIC }, { true, PACKAGE }, { true, PRIVATE } }, + }; + + static Object[][] accessCases(Class defc, String name) { + if (name.contains("pri_")) { + return ACCESS_CASES[1]; // PRIVATE only + } else if (name.contains("pkg_")) { + return ACCESS_CASES[2]; // not PUBLIC + } else { + assertTrue(name.indexOf('_') < 0); + boolean pubc = Modifier.isPublic(defc.getModifiers()); + if (pubc) + return ACCESS_CASES[3]; // all access levels + return ACCESS_CASES[2]; // PACKAGE but not PUBLIC + } + } + + @Test + public void testFindStatic() throws Throwable { + if (CAN_SKIP_WORKING) return; + startTest("findStatic"); + testFindStatic(PubExample.class, void.class, "s0"); + testFindStatic(Example.class, void.class, "s0"); + testFindStatic(Example.class, void.class, "pkg_s0"); + testFindStatic(Example.class, void.class, "pri_s0"); + + testFindStatic(Example.class, Object.class, "s1", Object.class); + testFindStatic(Example.class, Object.class, "s2", int.class); + testFindStatic(Example.class, Object.class, "s3", long.class); + testFindStatic(Example.class, Object.class, "s4", int.class, int.class); + testFindStatic(Example.class, Object.class, "s5", long.class, int.class); + testFindStatic(Example.class, Object.class, "s6", int.class, long.class); + testFindStatic(Example.class, Object.class, "s7", float.class, double.class); + + testFindStatic(false, PRIVATE, Example.class, void.class, "bogus"); + } + + void testFindStatic(Class defc, Class ret, String name, Class... params) throws Throwable { + for (Object[] ac : accessCases(defc, name)) { + testFindStatic((Boolean)ac[0], (Lookup)ac[1], defc, ret, name, params); + } + } + void testFindStatic(Lookup lookup, Class defc, Class ret, String name, Class... params) throws Throwable { + testFindStatic(true, lookup, defc, ret, name, params); + } + void testFindStatic(boolean positive, Lookup lookup, Class defc, Class ret, String name, Class... params) throws Throwable { + countTest(positive); + MethodType type = MethodType.methodType(ret, params); + MethodHandle target = null; + RuntimeException noAccess = null; + try { + target = lookup.findStatic(defc, name, type); + } catch (NoAccessException ex) { + noAccess = ex; + } + if (verbosity >= 2) + System.out.println("findStatic "+lookup+": "+defc+"."+name+"/"+type+" => "+target + +(noAccess == null ? "" : " !! "+noAccess)); + if (positive && noAccess != null) throw noAccess; + assertEquals(positive ? "positive test" : "negative test erroneously passed", positive, target != null); + if (!positive) return; // negative test failed as expected + assertEquals(type, target.type()); + assertTrue(target.toString().contains(name)); // rough check + if (!DO_MORE_CALLS && lookup != PRIVATE) return; + Object[] args = randomArgs(params); + printCalled(target, name, args); + target.invokeVarargs(args); + assertCalled(name, args); + System.out.print(':'); + } + + @Test + public void testFindVirtual() throws Throwable { + if (CAN_SKIP_WORKING) return; + startTest("findVirtual"); + testFindVirtual(Example.class, void.class, "v0"); + testFindVirtual(Example.class, void.class, "pkg_v0"); + testFindVirtual(Example.class, void.class, "pri_v0"); + testFindVirtual(Example.class, Object.class, "v1", Object.class); + testFindVirtual(Example.class, Object.class, "v2", Object.class, Object.class); + testFindVirtual(Example.class, Object.class, "v2", Object.class, int.class); + testFindVirtual(Example.class, Object.class, "v2", int.class, Object.class); + testFindVirtual(Example.class, Object.class, "v2", int.class, int.class); + testFindVirtual(false, PRIVATE, Example.class, Example.class, void.class, "bogus"); + // test dispatch + testFindVirtual(SubExample.class, SubExample.class, void.class, "Sub/v0"); + testFindVirtual(SubExample.class, Example.class, void.class, "Sub/v0"); + testFindVirtual(SubExample.class, IntExample.class, void.class, "Sub/v0"); + testFindVirtual(SubExample.class, SubExample.class, void.class, "Sub/pkg_v0"); + testFindVirtual(SubExample.class, Example.class, void.class, "Sub/pkg_v0"); + testFindVirtual(Example.class, IntExample.class, void.class, "v0"); + testFindVirtual(IntExample.Impl.class, IntExample.class, void.class, "Int/v0"); + } + + void testFindVirtual(Class defc, Class ret, String name, Class... params) throws Throwable { + Class rcvc = defc; + testFindVirtual(rcvc, defc, ret, name, params); + } + void testFindVirtual(Class rcvc, Class defc, Class ret, String name, Class... params) throws Throwable { + for (Object[] ac : accessCases(defc, name)) { + testFindVirtual((Boolean)ac[0], (Lookup)ac[1], rcvc, defc, ret, name, params); + } + } + void testFindVirtual(Lookup lookup, Class rcvc, Class defc, Class ret, String name, Class... params) throws Throwable { + testFindVirtual(true, lookup, rcvc, defc, ret, name, params); + } + void testFindVirtual(boolean positive, Lookup lookup, Class rcvc, Class defc, Class ret, String name, Class... params) throws Throwable { + countTest(positive); + String methodName = name.substring(1 + name.indexOf('/')); // foo/bar => foo + MethodType type = MethodType.methodType(ret, params); + MethodHandle target = null; + RuntimeException noAccess = null; + try { + target = lookup.findVirtual(defc, methodName, type); + } catch (NoAccessException ex) { + noAccess = ex; + } + if (verbosity >= 2) + System.out.println("findVirtual "+lookup+": "+defc+"."+name+"/"+type+" => "+target + +(noAccess == null ? "" : " !! "+noAccess)); + if (positive && noAccess != null) throw noAccess; + assertEquals(positive ? "positive test" : "negative test erroneously passed", positive, target != null); + if (!positive) return; // negative test failed as expected + Class[] paramsWithSelf = cat(array(Class[].class, (Class)defc), params); + MethodType typeWithSelf = MethodType.methodType(ret, paramsWithSelf); + MethodType ttype = target.type(); + ttype = ttype.changeParameterType(0, defc); // FIXME: test this + assertEquals(typeWithSelf, ttype); + assertTrue(target.toString().contains(methodName)); // rough check + if (!DO_MORE_CALLS && lookup != PRIVATE) return; + Object[] argsWithSelf = randomArgs(paramsWithSelf); + if (rcvc != defc) argsWithSelf[0] = randomArg(rcvc); + printCalled(target, name, argsWithSelf); + target.invokeVarargs(argsWithSelf); + assertCalled(name, argsWithSelf); + System.out.print(':'); + } + + @Test + public void testFindSpecial() throws Throwable { + if (CAN_SKIP_WORKING) return; + startTest("findSpecial"); + testFindSpecial(Example.class, void.class, "v0"); + testFindSpecial(Example.class, void.class, "pkg_v0"); + testFindSpecial(false, PRIVATE, Example.class, void.class, "", int.class); + testFindSpecial(false, PRIVATE, Example.class, void.class, "bogus"); + } + + void testFindSpecial(Class defc, Class ret, String name, Class... params) throws Throwable { + testFindSpecial(true, PRIVATE, defc, ret, name, params); + testFindSpecial(false, PACKAGE, defc, ret, name, params); + testFindSpecial(false, PUBLIC, defc, ret, name, params); + } + void testFindSpecial(boolean positive, Lookup lookup, Class defc, Class ret, String name, Class... params) throws Throwable { + countTest(positive); + MethodType type = MethodType.methodType(ret, params); + MethodHandle target = null; + RuntimeException noAccess = null; + try { + target = lookup.findSpecial(defc, name, type, defc); + } catch (NoAccessException ex) { + noAccess = ex; + } + if (verbosity >= 2) + System.out.println("findSpecial "+defc+"."+name+"/"+type+" => "+target + +(noAccess == null ? "" : " !! "+noAccess)); + if (positive && noAccess != null) throw noAccess; + assertEquals(positive ? "positive test" : "negative test erroneously passed", positive, target != null); + if (!positive) return; // negative test failed as expected + Class[] paramsWithSelf = cat(array(Class[].class, (Class)defc), params); + MethodType typeWithSelf = MethodType.methodType(ret, paramsWithSelf); + MethodType ttype = target.type(); + ttype = ttype.changeParameterType(0, defc); // FIXME: test this + assertEquals(typeWithSelf, ttype); + assertTrue(target.toString().contains(name)); // rough check + if (!DO_MORE_CALLS && lookup != PRIVATE) return; + Object[] args = randomArgs(paramsWithSelf); + printCalled(target, name, args); + target.invokeVarargs(args); + assertCalled(name, args); + System.out.print(':'); + } + + @Test + public void testBind() throws Throwable { + if (CAN_SKIP_WORKING) return; + startTest("bind"); + testBind(Example.class, void.class, "v0"); + testBind(Example.class, void.class, "pkg_v0"); + testBind(Example.class, void.class, "pri_v0"); + testBind(Example.class, Object.class, "v1", Object.class); + testBind(Example.class, Object.class, "v2", Object.class, Object.class); + testBind(Example.class, Object.class, "v2", Object.class, int.class); + testBind(Example.class, Object.class, "v2", int.class, Object.class); + testBind(Example.class, Object.class, "v2", int.class, int.class); + testBind(false, PRIVATE, Example.class, void.class, "bogus"); + testBind(SubExample.class, void.class, "Sub/v0"); + testBind(SubExample.class, void.class, "Sub/pkg_v0"); + testBind(IntExample.Impl.class, void.class, "Int/v0"); + } + + void testBind(Class defc, Class ret, String name, Class... params) throws Throwable { + for (Object[] ac : accessCases(defc, name)) { + testBind((Boolean)ac[0], (Lookup)ac[1], defc, ret, name, params); + } + } + + void testBind(boolean positive, Lookup lookup, Class defc, Class ret, String name, Class... params) throws Throwable { + countTest(positive); + String methodName = name.substring(1 + name.indexOf('/')); // foo/bar => foo + MethodType type = MethodType.methodType(ret, params); + Object receiver = randomArg(defc); + MethodHandle target = null; + RuntimeException noAccess = null; + try { + target = lookup.bind(receiver, methodName, type); + } catch (NoAccessException ex) { + noAccess = ex; + } + if (verbosity >= 2) + System.out.println("bind "+receiver+"."+name+"/"+type+" => "+target + +(noAccess == null ? "" : " !! "+noAccess)); + if (positive && noAccess != null) throw noAccess; + assertEquals(positive ? "positive test" : "negative test erroneously passed", positive, target != null); + if (!positive) return; // negative test failed as expected + assertEquals(type, target.type()); + Object[] args = randomArgs(params); + printCalled(target, name, args); + target.invokeVarargs(args); + Object[] argsWithReceiver = cat(array(Object[].class, receiver), args); + assertCalled(name, argsWithReceiver); + System.out.print(':'); + } + + @Test + public void testUnreflect() throws Throwable { + if (CAN_SKIP_WORKING) return; + startTest("unreflect"); + testUnreflect(Example.class, true, void.class, "s0"); + testUnreflect(Example.class, true, void.class, "pkg_s0"); + testUnreflect(Example.class, true, void.class, "pri_s0"); + + testUnreflect(Example.class, true, Object.class, "s1", Object.class); + testUnreflect(Example.class, true, Object.class, "s2", int.class); + //testUnreflect(Example.class, true, Object.class, "s3", long.class); + //testUnreflect(Example.class, true, Object.class, "s4", int.class, int.class); + //testUnreflect(Example.class, true, Object.class, "s5", long.class, int.class); + //testUnreflect(Example.class, true, Object.class, "s6", int.class, long.class); + + testUnreflect(Example.class, false, void.class, "v0"); + testUnreflect(Example.class, false, void.class, "pkg_v0"); + testUnreflect(Example.class, false, void.class, "pri_v0"); + testUnreflect(Example.class, false, Object.class, "v1", Object.class); + testUnreflect(Example.class, false, Object.class, "v2", Object.class, Object.class); + testUnreflect(Example.class, false, Object.class, "v2", Object.class, int.class); + testUnreflect(Example.class, false, Object.class, "v2", int.class, Object.class); + testUnreflect(Example.class, false, Object.class, "v2", int.class, int.class); + } + + void testUnreflect(Class defc, boolean isStatic, Class ret, String name, Class... params) throws Throwable { + for (Object[] ac : accessCases(defc, name)) { + testUnreflect((Boolean)ac[0], (Lookup)ac[1], defc, isStatic, ret, name, params); + } + } + void testUnreflect(boolean positive, Lookup lookup, Class defc, boolean isStatic, Class ret, String name, Class... params) throws Throwable { + countTest(positive); + MethodType type = MethodType.methodType(ret, params); + Method rmethod = null; + MethodHandle target = null; + RuntimeException noAccess = null; + try { + rmethod = defc.getDeclaredMethod(name, params); + } catch (NoSuchMethodException ex) { + throw new NoAccessException(ex); + } + assertEquals(isStatic, Modifier.isStatic(rmethod.getModifiers())); + try { + target = lookup.unreflect(rmethod); + } catch (NoAccessException ex) { + noAccess = ex; + } + if (verbosity >= 2) + System.out.println("unreflect "+defc+"."+name+"/"+type+" => "+target + +(noAccess == null ? "" : " !! "+noAccess)); + if (positive && noAccess != null) throw noAccess; + assertEquals(positive ? "positive test" : "negative test erroneously passed", positive, target != null); + if (!positive) return; // negative test failed as expected + Class[] paramsMaybeWithSelf = params; + if (!isStatic) { + paramsMaybeWithSelf = cat(array(Class[].class, (Class)defc), params); + } + MethodType typeMaybeWithSelf = MethodType.methodType(ret, paramsMaybeWithSelf); + MethodType ttype = target.type(); + if (!isStatic) + ttype = ttype.changeParameterType(0, defc); // FIXME: test this + assertEquals(typeMaybeWithSelf, ttype); + Object[] argsMaybeWithSelf = randomArgs(paramsMaybeWithSelf); + printCalled(target, name, argsMaybeWithSelf); + target.invokeVarargs(argsMaybeWithSelf); + assertCalled(name, argsMaybeWithSelf); + System.out.print(':'); + } + + @Test @Ignore("unimplemented") + public void testUnreflectSpecial() throws Throwable { + Lookup lookup = PRIVATE; // FIXME: test more lookups than this one + startTest("unreflectSpecial"); + Method m = null; + MethodHandle expResult = null; + MethodHandle result = lookup.unreflectSpecial(m, Example.class); + assertEquals(expResult, result); + fail("The test case is a prototype."); + } + + public static class HasFields { + boolean fZ = false; + byte fB = (byte)'B'; + short fS = (short)'S'; + char fC = 'C'; + int fI = 'I'; + long fJ = 'J'; + float fF = 'F'; + double fD = 'D'; + static boolean sZ = true; + static byte sB = 1+(byte)'B'; + static short sS = 1+(short)'S'; + static char sC = 1+'C'; + static int sI = 1+'I'; + static long sJ = 1+'J'; + static float sF = 1+'F'; + static double sD = 1+'D'; + + Object fL = 'L'; + String fR = "R"; + static Object sL = 'M'; + static String sR = "S"; + + static final Object[][] CASES; + static { + ArrayList cases = new ArrayList(); + Object types[][] = { + {'L',Object.class}, {'R',String.class}, + {'I',int.class}, {'J',long.class}, + {'F',float.class}, {'D',double.class}, + {'Z',boolean.class}, {'B',byte.class}, + {'S',short.class}, {'C',char.class}, + }; + HasFields fields = new HasFields(); + for (Object[] t : types) { + for (int kind = 0; kind <= 1; kind++) { + boolean isStatic = (kind != 0); + char btc = (Character)t[0]; + String name = (isStatic ? "s" : "f") + btc; + Class type = (Class) t[1]; + Object value; + Field field; + try { + field = HasFields.class.getDeclaredField(name); + } catch (Exception ex) { + throw new InternalError("no field HasFields."+name); + } + try { + value = field.get(fields); + } catch (Exception ex) { + throw new InternalError("cannot fetch field HasFields."+name); + } + if (type == float.class) { + float v = 'F'; + if (isStatic) v++; + assert(value.equals(v)); + } + assert(name.equals(field.getName())); + assert(type.equals(field.getType())); + assert(isStatic == (Modifier.isStatic(field.getModifiers()))); + cases.add(new Object[]{ field, value }); + } + } + CASES = cases.toArray(new Object[0][]); + } + } + + @Test + public void testUnreflectGetter() throws Throwable { + Lookup lookup = PRIVATE; // FIXME: test more lookups than this one + startTest("unreflectGetter"); + for (Object[] c : HasFields.CASES) { + Field f = (Field)c[0]; + Object value = c[1]; + Class type = f.getType(); + if (type.isPrimitive() && type != int.class) + continue; //FIXME + testUnreflectGetter(lookup, f, type, value); + } + } + public void testUnreflectGetter(MethodHandles.Lookup lookup, + Field f, Class type, Object value) throws Throwable { + countTest(true); + boolean isStatic = Modifier.isStatic(f.getModifiers()); + MethodType expType = MethodType.methodType(type, HasFields.class); + if (isStatic) expType = expType.dropParameterTypes(0, 1); + MethodHandle mh = lookup.unreflectGetter(f); + assertSame(mh.type(), expType); + assertEquals(mh.toString(), f.getName()); + HasFields fields = new HasFields(); + Object sawValue; + Class rtype = type; + if (type != int.class) rtype = Object.class; + mh = MethodHandles.convertArguments(mh, mh.type().generic().changeReturnType(rtype)); + Object expValue = value; + for (int i = 0; i <= 1; i++) { + if (isStatic) { + if (type == int.class) + sawValue = mh.invoke(); // do these exactly + else + sawValue = mh.invoke(); + } else { + if (type == int.class) + sawValue = mh.invoke((Object) fields); + else + sawValue = mh.invoke((Object) fields); + } + assertEquals(sawValue, expValue); + Object random = randomArg(type); + f.set(fields, random); + expValue = random; + } + f.set(fields, value); // put it back + } + + + @Test + public void testUnreflectSetter() throws Throwable { + Lookup lookup = PRIVATE; // FIXME: test more lookups than this one + startTest("unreflectSetter"); + for (Object[] c : HasFields.CASES) { + Field f = (Field)c[0]; + Object value = c[1]; + Class type = f.getType(); + if (type.isPrimitive() && type != int.class) + continue; //FIXME + testUnreflectSetter(lookup, f, type, value); + } + } + public void testUnreflectSetter(MethodHandles.Lookup lookup, + Field f, Class type, Object value) throws Throwable { + countTest(true); + boolean isStatic = Modifier.isStatic(f.getModifiers()); + MethodType expType = MethodType.methodType(void.class, HasFields.class, type); + if (isStatic) expType = expType.dropParameterTypes(0, 1); + MethodHandle mh = lookup.unreflectSetter(f); + assertSame(mh.type(), expType); + assertEquals(mh.toString(), f.getName()); + HasFields fields = new HasFields(); + Object sawValue; + Class vtype = type; + if (type != int.class) vtype = Object.class; + int last = mh.type().parameterCount() - 1; + mh = MethodHandles.convertArguments(mh, mh.type().generic().changeReturnType(void.class).changeParameterType(last, vtype)); + assertEquals(f.get(fields), value); // clean to start with + for (int i = 0; i <= 1; i++) { + Object putValue = randomArg(type); + if (isStatic) { + if (type == int.class) + mh.invoke((int)(Integer)putValue); // do these exactly + else + mh.invoke(putValue); + } else { + if (type == int.class) + mh.invoke((Object) fields, (int)(Integer)putValue); + else + mh.invoke((Object) fields, putValue); + } + assertEquals(f.get(fields), putValue); + } + f.set(fields, value); // put it back + } + + @Test + public void testArrayElementGetter() throws Throwable { + startTest("arrayElementGetter"); + testArrayElementGetterSetter(new Object[10], false); + testArrayElementGetterSetter(new String[10], false); + testArrayElementGetterSetter(new int[10], false); + // FIXME: Do the other primitive types. + //testArrayElementGetterSetter(new float[10], false); + } + + @Test + public void testArrayElementSetter() throws Throwable { + startTest("arrayElementSetter"); + testArrayElementGetterSetter(new Object[10], true); + testArrayElementGetterSetter(new String[10], true); + testArrayElementGetterSetter(new int[10], true); + // FIXME: Do the other primitive types. + //testArrayElementGetterSetter(new float[10], true); + } + + public void testArrayElementGetterSetter(Object array, boolean testSetter) throws Throwable { + countTest(true); + Class arrayType = array.getClass(); + Class elemType = arrayType.getComponentType(); + MethodType expType = !testSetter + ? MethodType.methodType(elemType, arrayType, int.class) + : MethodType.methodType(void.class, arrayType, int.class, elemType); + MethodHandle mh = !testSetter + ? MethodHandles.arrayElementGetter(arrayType) + : MethodHandles.arrayElementSetter(arrayType); + assertSame(mh.type(), expType); + //assertEquals(mh.toString(), f.getName()); + Object sawValue, expValue; + List model = array2list(array); + int length = Array.getLength(array); + for (int i = 0; i < length; i++) { + // update array element + Object random = randomArg(elemType); + model.set(i, random); + if (testSetter) { + if (elemType == int.class) + mh.invoke((int[]) array, i, (int)(Integer)random); + else + mh.invokeGeneric(array, i, random); + assertEquals(model, array2list(array)); + } else { + Array.set(array, i, random); + + } + // observe array element + sawValue = Array.get(array, i); + if (!testSetter) { + expValue = sawValue; + if (elemType == int.class) + sawValue = mh.invoke((int[]) array, i); + else + sawValue = mh.invokeGeneric(array, i); + assertEquals(sawValue, expValue); + assertEquals(model, array2list(array)); + } + } + } + + List array2list(Object array) { + int length = Array.getLength(array); + ArrayList model = new ArrayList(length); + for (int i = 0; i < length; i++) + model.add(Array.get(array, i)); + return model; + } + + static class Callee { + static Object id() { return called("id"); } + static Object id(Object x) { return called("id", x); } + static Object id(Object x, Object y) { return called("id", x, y); } + static Object id(Object x, Object y, Object z) { return called("id", x, y, z); } + static Object id(Object... vx) { return called("id", vx); } + static MethodHandle ofType(int n) { + return ofType(Object.class, n); + } + static MethodHandle ofType(Class rtype, int n) { + if (n == -1) + return ofType(MethodType.methodType(rtype, Object[].class)); + return ofType(MethodType.genericMethodType(n).changeReturnType(rtype)); + } + static MethodHandle ofType(Class rtype, Class... ptypes) { + return ofType(MethodType.methodType(rtype, ptypes)); + } + static MethodHandle ofType(MethodType type) { + Class rtype = type.returnType(); + String pfx = ""; + if (rtype != Object.class) + pfx = rtype.getSimpleName().substring(0, 1).toLowerCase(); + String name = pfx+"id"; + return PRIVATE.findStatic(Callee.class, name, type); + } + } + + @Test + public void testConvertArguments() throws Throwable { + if (CAN_SKIP_WORKING) return; + startTest("convertArguments"); + testConvert(Callee.ofType(1), null, "id", int.class); + testConvert(Callee.ofType(1), null, "id", String.class); + testConvert(Callee.ofType(1), null, "id", Integer.class); + testConvert(Callee.ofType(1), null, "id", short.class); + } + + void testConvert(MethodHandle id, Class rtype, String name, Class... params) throws Throwable { + testConvert(true, id, rtype, name, params); + } + + void testConvert(boolean positive, MethodHandle id, Class rtype, String name, Class... params) throws Throwable { + countTest(positive); + MethodType idType = id.type(); + if (rtype == null) rtype = idType.returnType(); + for (int i = 0; i < params.length; i++) { + if (params[i] == null) params[i] = idType.parameterType(i); + } + // simulate the pairwise conversion + MethodType newType = MethodType.methodType(rtype, params); + Object[] args = randomArgs(newType.parameterArray()); + Object[] convArgs = args.clone(); + for (int i = 0; i < args.length; i++) { + Class src = newType.parameterType(i); + Class dst = idType.parameterType(i); + if (src != dst) + convArgs[i] = castToWrapper(convArgs[i], dst); + } + Object convResult = id.invokeVarargs(convArgs); + { + Class dst = newType.returnType(); + Class src = idType.returnType(); + if (src != dst) + convResult = castToWrapper(convResult, dst); + } + MethodHandle target = null; + RuntimeException error = null; + try { + target = MethodHandles.convertArguments(id, newType); + } catch (RuntimeException ex) { + error = ex; + } + if (verbosity >= 2) + System.out.println("convert "+id+ " to "+newType+" => "+target + +(error == null ? "" : " !! "+error)); + if (positive && error != null) throw error; + assertEquals(positive ? "positive test" : "negative test erroneously passed", positive, target != null); + if (!positive) return; // negative test failed as expected + assertEquals(newType, target.type()); + printCalled(target, id.toString(), args); + Object result = target.invokeVarargs(args); + assertCalled(name, convArgs); + assertEquals(convResult, result); + System.out.print(':'); + } + + @Test + public void testPermuteArguments() throws Throwable { + if (CAN_SKIP_WORKING) return; + startTest("permuteArguments"); + testPermuteArguments(4, Integer.class, 2, String.class, 0); + //testPermuteArguments(6, Integer.class, 0, null, 30); + //testPermuteArguments(4, Integer.class, 1, int.class, 6); + } + public void testPermuteArguments(int max, Class type1, int t2c, Class type2, int dilution) throws Throwable { + if (verbosity >= 1) + System.out.println("permuteArguments "+max+"*"+type1.getName() + +(t2c==0?"":"/"+t2c+"*"+type2.getName()) + +(dilution > 0 ? " with dilution "+dilution : "")); + int t2pos = t2c == 0 ? 0 : 1; + for (int inargs = t2pos+1; inargs <= max; inargs++) { + Class[] types = new Class[inargs]; + Arrays.fill(types, type1); + if (t2c != 0) { + // Fill in a middle range with type2: + Arrays.fill(types, t2pos, Math.min(t2pos+t2c, inargs), type2); + } + Object[] args = randomArgs(types); + int numcases = 1; + for (int outargs = 0; outargs <= max; outargs++) { + if (outargs - inargs >= MAX_ARG_INCREASE) continue; + int[] reorder = new int[outargs]; + int casStep = dilution + 1; + // Avoid some common factors: + while ((casStep > 2 && casStep % 2 == 0 && inargs % 2 == 0) || + (casStep > 3 && casStep % 3 == 0 && inargs % 3 == 0)) + casStep++; + for (int cas = 0; cas < numcases; cas += casStep) { + for (int i = 0, c = cas; i < outargs; i++) { + reorder[i] = c % inargs; + c /= inargs; + } + testPermuteArguments(args, types, reorder); + } + numcases *= inargs; + if (dilution > 10 && outargs >= 4) { + // Do some special patterns, which we probably missed. + // Replication of a single argument or argument pair. + for (int i = 0; i < inargs; i++) { + Arrays.fill(reorder, i); + testPermuteArguments(args, types, reorder); + for (int d = 1; d <= 2; d++) { + if (i + d >= inargs) continue; + for (int j = 1; j < outargs; j += 2) + reorder[j] += 1; + testPermuteArguments(args, types, reorder); + testPermuteArguments(args, types, reverse(reorder)); + } + } + // Repetition of a sequence of 3 or more arguments. + for (int i = 1; i < inargs; i++) { + for (int len = 3; len <= inargs; len++) { + for (int j = 0; j < outargs; j++) + reorder[j] = (i + (j % len)) % inargs; + testPermuteArguments(args, types, reorder); + testPermuteArguments(args, types, reverse(reorder)); + } + } + } + } + } + } + + static int[] reverse(int[] reorder) { + reorder = reorder.clone(); + for (int i = 0, imax = reorder.length / 2; i < imax; i++) { + int j = reorder.length - 1 - i; + int tem = reorder[i]; + reorder[i] = reorder[j]; + reorder[j] = tem; + } + return reorder; + } + + void testPermuteArguments(Object[] args, Class[] types, int[] reorder) throws Throwable { + countTest(); + if (args == null && types == null) { + int max = 0; + for (int j : reorder) { + if (max < j) max = j; + } + args = randomArgs(max+1, Integer.class); + } + if (args == null) { + args = randomArgs(types); + } + if (types == null) { + types = new Class[args.length]; + for (int i = 0; i < args.length; i++) + types[i] = args[i].getClass(); + } + int inargs = args.length, outargs = reorder.length; + assert(inargs == types.length); + if (verbosity >= 2) + System.out.println("permuteArguments "+Arrays.toString(reorder)); + Object[] permArgs = new Object[outargs]; + Class[] permTypes = new Class[outargs]; + for (int i = 0; i < outargs; i++) { + permArgs[i] = args[reorder[i]]; + permTypes[i] = types[reorder[i]]; + } + if (verbosity >= 3) { + System.out.println("in args: "+Arrays.asList(args)); + System.out.println("out args: "+Arrays.asList(permArgs)); + System.out.println("in types: "+Arrays.asList(types)); + System.out.println("out types: "+Arrays.asList(permTypes)); + } + MethodType inType = MethodType.methodType(Object.class, types); + MethodType outType = MethodType.methodType(Object.class, permTypes); + MethodHandle target = MethodHandles.convertArguments(ValueConversions.varargsList(outargs), outType); + MethodHandle newTarget = MethodHandles.permuteArguments(target, inType, reorder); + Object result = newTarget.invokeVarargs(args); + Object expected = Arrays.asList(permArgs); + assertEquals(expected, result); + } + + + @Test + public void testSpreadArguments() throws Throwable { + if (CAN_SKIP_WORKING) return; + startTest("spreadArguments"); + for (Class argType : new Class[]{Object.class, Integer.class, int.class}) { + if (verbosity >= 2) + System.out.println("spreadArguments "+argType); + for (int nargs = 0; nargs < 10; nargs++) { + if (argType == int.class && nargs >= 6) continue; // FIXME Fail_1 + for (int pos = 0; pos < nargs; pos++) { + if (argType == int.class && pos > 0) continue; // FIXME Fail_3 + testSpreadArguments(argType, pos, nargs); + } + } + } + } + public void testSpreadArguments(Class argType, int pos, int nargs) throws Throwable { + countTest(); + MethodHandle target = ValueConversions.varargsArray(nargs); + MethodHandle target2 = changeArgTypes(target, argType); + if (verbosity >= 2) + System.out.println("spread into "+target2+" ["+pos+".."+nargs+"]"); + Object[] args = randomArgs(target2.type().parameterArray()); + // make sure the target does what we think it does: + if (pos == 0 && nargs < 5) { + Object[] check = (Object[]) target.invokeVarargs(args); + assertArrayEquals(args, check); + switch (nargs) { + case 0: + check = target.invoke(); + assertArrayEquals(args, check); + break; + case 1: + check = target.invoke(args[0]); + assertArrayEquals(args, check); + break; + case 2: + check = target.invoke(args[0], args[1]); + assertArrayEquals(args, check); + break; + } + } + List> newParams = new ArrayList>(target2.type().parameterList()); + { // modify newParams in place + List> spreadParams = newParams.subList(pos, nargs); + spreadParams.clear(); spreadParams.add(Object[].class); + } + MethodType newType = MethodType.methodType(Object.class, newParams); + MethodHandle result = MethodHandles.spreadArguments(target2, newType); + Object[] returnValue; + if (pos == 0) { + returnValue = (Object[]) result.invoke(args); + } else { + Object[] args1 = Arrays.copyOfRange(args, 0, pos+1); + args1[pos] = Arrays.copyOfRange(args, pos, args.length); + returnValue = (Object[]) result.invokeVarargs(args1); + } + assertArrayEquals(args, returnValue); + } + + @Test + public void testCollectArguments() throws Throwable { + if (CAN_SKIP_WORKING) return; + startTest("collectArguments"); + for (Class argType : new Class[]{Object.class, Integer.class, int.class}) { + if (verbosity >= 2) + System.out.println("collectArguments "+argType); + for (int nargs = 0; nargs < 10; nargs++) { + for (int pos = 0; pos < nargs; pos++) { + if (argType == int.class) continue; // FIXME Fail_4 + testCollectArguments(argType, pos, nargs); + } + } + } + } + public void testCollectArguments(Class argType, int pos, int nargs) throws Throwable { + countTest(); + // fake up a MH with the same type as the desired adapter: + MethodHandle fake = ValueConversions.varargsArray(nargs); + fake = changeArgTypes(fake, argType); + MethodType newType = fake.type(); + Object[] args = randomArgs(newType.parameterArray()); + // here is what should happen: + Object[] collectedArgs = Arrays.copyOfRange(args, 0, pos+1); + collectedArgs[pos] = Arrays.copyOfRange(args, pos, args.length); + // here is the MH which will witness the collected argument tail: + MethodHandle target = ValueConversions.varargsArray(pos+1); + target = changeArgTypes(target, 0, pos, argType); + target = changeArgTypes(target, pos, pos+1, Object[].class); + if (verbosity >= 2) + System.out.println("collect from "+Arrays.asList(args)+" ["+pos+".."+nargs+"]"); + MethodHandle result = MethodHandles.collectArguments(target, newType); + Object[] returnValue = (Object[]) result.invokeVarargs(args); +// assertTrue(returnValue.length == pos+1 && returnValue[pos] instanceof Object[]); +// returnValue[pos] = Arrays.asList((Object[]) returnValue[pos]); +// collectedArgs[pos] = Arrays.asList((Object[]) collectedArgs[pos]); + assertArrayEquals(collectedArgs, returnValue); + } + + @Test + public void testInsertArguments() throws Throwable { + if (CAN_SKIP_WORKING) return; + startTest("insertArguments"); + for (int nargs = 0; nargs <= 4; nargs++) { + for (int ins = 0; ins <= 4; ins++) { + if (ins > MAX_ARG_INCREASE) continue; // FIXME Fail_6 + for (int pos = 0; pos <= nargs; pos++) { + testInsertArguments(nargs, pos, ins); + } + } + } + } + + void testInsertArguments(int nargs, int pos, int ins) throws Throwable { + countTest(); + MethodHandle target = ValueConversions.varargsArray(nargs + ins); + Object[] args = randomArgs(target.type().parameterArray()); + List resList = Arrays.asList(args); + List argsToPass = new ArrayList(resList); + List argsToInsert = argsToPass.subList(pos, pos + ins); + if (verbosity >= 2) + System.out.println("insert: "+argsToInsert+" into "+target); + MethodHandle target2 = MethodHandles.insertArguments(target, pos, + (Object[]) argsToInsert.toArray()); + argsToInsert.clear(); // remove from argsToInsert + Object res2 = target2.invokeVarargs(argsToPass); + Object res2List = Arrays.asList((Object[])res2); + if (verbosity >= 2) + System.out.println("result: "+res2List); + //if (!resList.equals(res2List)) + // System.out.println("*** fail at n/p/i = "+nargs+"/"+pos+"/"+ins+": "+resList+" => "+res2List); + assertEquals(resList, res2List); + } + + @Test + public void testFilterArguments() throws Throwable { + if (CAN_SKIP_WORKING) return; + startTest("filterArguments"); + for (int nargs = 1; nargs <= 6; nargs++) { + for (int pos = 0; pos < nargs; pos++) { + testFilterArguments(nargs, pos); + } + } + } + + void testFilterArguments(int nargs, int pos) throws Throwable { + countTest(); + MethodHandle target = ValueConversions.varargsList(nargs); + MethodHandle filter = ValueConversions.varargsList(1); + filter = MethodHandles.convertArguments(filter, filter.type().generic()); + Object[] argsToPass = randomArgs(nargs, Object.class); + if (verbosity >= 2) + System.out.println("filter "+target+" at "+pos+" with "+filter); + MethodHandle[] filters = new MethodHandle[pos*2+1]; + filters[pos] = filter; + MethodHandle target2 = MethodHandles.filterArguments(target, filters); + // Simulate expected effect of filter on arglist: + Object[] filteredArgs = argsToPass.clone(); + filteredArgs[pos] = filter.invoke(filteredArgs[pos]); + List expected = Arrays.asList(filteredArgs); + Object result = target2.invokeVarargs(argsToPass); + if (verbosity >= 2) + System.out.println("result: "+result); + if (!expected.equals(result)) + System.out.println("*** fail at n/p = "+nargs+"/"+pos+": "+argsToPass+" => "+result); + assertEquals(expected, result); + } + + @Test + public void testFoldArguments() throws Throwable { + if (CAN_SKIP_WORKING) return; + startTest("foldArguments"); + for (int nargs = 0; nargs <= 4; nargs++) { + for (int fold = 0; fold <= nargs; fold++) { + for (int pos = 0; pos <= nargs; pos++) { + testFoldArguments(nargs, pos, fold); + } + } + } + } + + void testFoldArguments(int nargs, int pos, int fold) throws Throwable { + if (pos != 0) return; // can fold only at pos=0 for now + countTest(); + MethodHandle target = ValueConversions.varargsList(1 + nargs); + MethodHandle combine = ValueConversions.varargsList(fold); + List argsToPass = Arrays.asList(randomArgs(nargs, Object.class)); + if (verbosity >= 2) + System.out.println("fold "+target+" with "+combine); + MethodHandle target2 = MethodHandles.foldArguments(target, combine); + // Simulate expected effect of combiner on arglist: + List expected = new ArrayList(argsToPass); + List argsToFold = expected.subList(pos, pos + fold); + if (verbosity >= 2) + System.out.println("fold: "+argsToFold+" into "+target2); + Object foldedArgs = combine.invokeVarargs(argsToFold); + argsToFold.add(0, foldedArgs); + Object result = target2.invokeVarargs(argsToPass); + if (verbosity >= 2) + System.out.println("result: "+result); + if (!expected.equals(result)) + System.out.println("*** fail at n/p/f = "+nargs+"/"+pos+"/"+fold+": "+argsToPass+" => "+result); + assertEquals(expected, result); + } + + @Test + public void testDropArguments() throws Throwable { + if (CAN_SKIP_WORKING) return; + startTest("dropArguments"); + for (int nargs = 0; nargs <= 4; nargs++) { + for (int drop = 1; drop <= 4; drop++) { + for (int pos = 0; pos <= nargs; pos++) { + testDropArguments(nargs, pos, drop); + } + } + } + } + + void testDropArguments(int nargs, int pos, int drop) throws Throwable { + countTest(); + MethodHandle target = ValueConversions.varargsArray(nargs); + Object[] args = randomArgs(target.type().parameterArray()); + MethodHandle target2 = MethodHandles.dropArguments(target, pos, + Collections.nCopies(drop, Object.class).toArray(new Class[0])); + List resList = Arrays.asList(args); + List argsToDrop = new ArrayList(resList); + for (int i = drop; i > 0; i--) { + argsToDrop.add(pos, "blort#"+i); + } + Object res2 = target2.invokeVarargs(argsToDrop); + Object res2List = Arrays.asList((Object[])res2); + //if (!resList.equals(res2List)) + // System.out.println("*** fail at n/p/d = "+nargs+"/"+pos+"/"+drop+": "+argsToDrop+" => "+res2List); + assertEquals(resList, res2List); + } + + @Test + public void testInvokers() throws Throwable { + if (CAN_SKIP_WORKING) return; + startTest("exactInvoker, genericInvoker, varargsInvoker, dynamicInvoker"); + // exactInvoker, genericInvoker, varargsInvoker[0..N], dynamicInvoker + Set done = new HashSet(); + for (int i = 0; i <= 6; i++) { + MethodType gtype = MethodType.genericMethodType(i); + for (Class argType : new Class[]{Object.class, Integer.class, int.class}) { + for (int j = -1; j < i; j++) { + MethodType type = gtype; + if (j < 0) + type = type.changeReturnType(argType); + else if (argType == void.class) + continue; + else + type = type.changeParameterType(j, argType); + if (argType.isPrimitive() && j != i-1) continue; // FIXME Fail_5 + if (done.add(type)) + testInvokers(type); + MethodType vtype = type.changeReturnType(void.class); + if (done.add(vtype)) + testInvokers(vtype); + } + } + } + } + + public void testInvokers(MethodType type) throws Throwable { + if (verbosity >= 2) + System.out.println("test invokers for "+type); + int nargs = type.parameterCount(); + boolean testRetCode = type.returnType() != void.class; + MethodHandle target = PRIVATE.findStatic(MethodHandlesTest.class, "invokee", + MethodType.genericMethodType(0, true)); + target = MethodHandles.collectArguments(target, type); + Object[] args = randomArgs(type.parameterArray()); + List targetPlusArgs = new ArrayList(Arrays.asList(args)); + targetPlusArgs.add(0, target); + int code = (Integer) invokee(args); + Object log = logEntry("invokee", args); + assertEquals(log.hashCode(), code); + assertCalled("invokee", args); + MethodHandle inv; + Object result; + // exact invoker + countTest(); + calledLog.clear(); + inv = MethodHandles.exactInvoker(type); + result = inv.invokeVarargs(targetPlusArgs); + if (testRetCode) assertEquals(code, result); + assertCalled("invokee", args); + // generic invoker + countTest(); + inv = MethodHandles.genericInvoker(type); + if (nargs <= 3) { + calledLog.clear(); + switch (nargs) { + case 0: + result = inv.invoke(target); + break; + case 1: + result = inv.invoke(target, args[0]); + break; + case 2: + result = inv.invoke(target, args[0], args[1]); + break; + case 3: + result = inv.invoke(target, args[0], args[1], args[2]); + break; + } + if (testRetCode) assertEquals(code, result); + assertCalled("invokee", args); + } + calledLog.clear(); + result = inv.invokeVarargs(targetPlusArgs); + if (testRetCode) assertEquals(code, result); + assertCalled("invokee", args); + // varargs invoker #0 + calledLog.clear(); + inv = MethodHandles.varargsInvoker(type, 0); + result = inv.invoke(target, args); + if (testRetCode) assertEquals(code, result); + assertCalled("invokee", args); + if (nargs >= 1) { + // varargs invoker #1 + calledLog.clear(); + inv = MethodHandles.varargsInvoker(type, 1); + result = inv.invoke(target, args[0], Arrays.copyOfRange(args, 1, nargs)); + if (testRetCode) assertEquals(code, result); + assertCalled("invokee", args); + } + if (nargs >= 2) { + // varargs invoker #2 + calledLog.clear(); + inv = MethodHandles.varargsInvoker(type, 2); + result = inv.invoke(target, args[0], args[1], Arrays.copyOfRange(args, 2, nargs)); + if (testRetCode) assertEquals(code, result); + assertCalled("invokee", args); + } + if (nargs >= 3) { + // varargs invoker #3 + calledLog.clear(); + inv = MethodHandles.varargsInvoker(type, 3); + result = inv.invoke(target, args[0], args[1], args[2], Arrays.copyOfRange(args, 3, nargs)); + if (testRetCode) assertEquals(code, result); + assertCalled("invokee", args); + } + for (int k = 0; k <= nargs; k++) { + // varargs invoker #0..N + countTest(); + calledLog.clear(); + inv = MethodHandles.varargsInvoker(type, k); + List targetPlusVarArgs = new ArrayList(targetPlusArgs); + List tailList = targetPlusVarArgs.subList(1+k, 1+nargs); + Object[] tail = tailList.toArray(); + tailList.clear(); tailList.add(tail); + result = inv.invokeVarargs(targetPlusVarArgs); + if (testRetCode) assertEquals(code, result); + assertCalled("invokee", args); + } + // dynamic invoker + countTest(); + CallSite site = new CallSite(MethodHandlesTest.class, "foo", type); + inv = MethodHandles.dynamicInvoker(site); + site.setTarget(target); + calledLog.clear(); + result = inv.invokeVarargs(args); + if (testRetCode) assertEquals(code, result); + assertCalled("invokee", args); + } + + static Object invokee(Object... args) { + return called("invokee", args).hashCode(); + } + + private static final String MISSING_ARG = "missingArg"; + static Object targetIfEquals() { + return called("targetIfEquals"); + } + static Object fallbackIfNotEquals() { + return called("fallbackIfNotEquals"); + } + static Object targetIfEquals(Object x) { + assertEquals(x, MISSING_ARG); + return called("targetIfEquals", x); + } + static Object fallbackIfNotEquals(Object x) { + assertFalse(x.toString(), x.equals(MISSING_ARG)); + return called("fallbackIfNotEquals", x); + } + static Object targetIfEquals(Object x, Object y) { + assertEquals(x, y); + return called("targetIfEquals", x, y); + } + static Object fallbackIfNotEquals(Object x, Object y) { + assertFalse(x.toString(), x.equals(y)); + return called("fallbackIfNotEquals", x, y); + } + static Object targetIfEquals(Object x, Object y, Object z) { + assertEquals(x, y); + return called("targetIfEquals", x, y, z); + } + static Object fallbackIfNotEquals(Object x, Object y, Object z) { + assertFalse(x.toString(), x.equals(y)); + return called("fallbackIfNotEquals", x, y, z); + } + + @Test + public void testGuardWithTest() throws Throwable { + if (CAN_SKIP_WORKING) return; + startTest("guardWithTest"); + for (int nargs = 0; nargs <= 3; nargs++) { + if (nargs != 2) continue; // FIXME: test more later + testGuardWithTest(nargs, Object.class); + testGuardWithTest(nargs, String.class); + } + } + void testGuardWithTest(int nargs, Class argClass) throws Throwable { + countTest(); + MethodHandle test = PRIVATE.findVirtual(Object.class, "equals", MethodType.methodType(boolean.class, Object.class)); + MethodHandle target = PRIVATE.findStatic(MethodHandlesTest.class, "targetIfEquals", MethodType.genericMethodType(nargs)); + MethodHandle fallback = PRIVATE.findStatic(MethodHandlesTest.class, "fallbackIfNotEquals", MethodType.genericMethodType(nargs)); + while (test.type().parameterCount() < nargs) + test = MethodHandles.dropArguments(test, test.type().parameterCount()-1, Object.class); + while (test.type().parameterCount() > nargs) + test = MethodHandles.insertArguments(test, 0, MISSING_ARG); + if (argClass != Object.class) { + test = changeArgTypes(test, argClass); + target = changeArgTypes(target, argClass); + fallback = changeArgTypes(fallback, argClass); + } + MethodHandle mh = MethodHandles.guardWithTest(test, target, fallback); + assertEquals(target.type(), mh.type()); + Object[][] argLists = { + { }, + { "foo" }, { MISSING_ARG }, + { "foo", "foo" }, { "foo", "bar" }, + { "foo", "foo", "baz" }, { "foo", "bar", "baz" } + }; + for (Object[] argList : argLists) { + if (argList.length != nargs) continue; + boolean equals; + switch (nargs) { + case 0: equals = true; break; + case 1: equals = MISSING_ARG.equals(argList[0]); break; + default: equals = argList[0].equals(argList[1]); break; + } + String willCall = (equals ? "targetIfEquals" : "fallbackIfNotEquals"); + if (verbosity >= 2) + System.out.println(logEntry(willCall, argList)); + Object result = mh.invokeVarargs(argList); + assertCalled(willCall, argList); + } + } + + @Test + public void testCatchException() throws Throwable { + if (CAN_SKIP_WORKING) return; + startTest("catchException"); + for (int nargs = 2; nargs <= 6; nargs++) { + for (int ti = 0; ti <= 1; ti++) { + boolean throwIt = (ti != 0); + testCatchException(int.class, new ClassCastException("testing"), throwIt, nargs); + testCatchException(void.class, new java.io.IOException("testing"), throwIt, nargs); + testCatchException(String.class, new LinkageError("testing"), throwIt, nargs); + } + } + } + + private static + Object throwOrReturn(Object normal, T exception) throws T { + if (exception != null) throw exception; + return normal; + } + + void testCatchException(Class returnType, Throwable thrown, boolean throwIt, int nargs) throws Throwable { + countTest(); + if (verbosity >= 2) + System.out.println("catchException rt="+returnType+" throw="+throwIt+" nargs="+nargs); + Class exType = thrown.getClass(); + MethodHandle throwOrReturn + = PRIVATE.findStatic(MethodHandlesTest.class, "throwOrReturn", + MethodType.methodType(Object.class, Object.class, Throwable.class)); + MethodHandle thrower = throwOrReturn; + while (thrower.type().parameterCount() < nargs) + thrower = MethodHandles.dropArguments(thrower, thrower.type().parameterCount(), Object.class); + MethodHandle target = MethodHandles.catchException(thrower, + thrown.getClass(), ValueConversions.varargsList(1+nargs)); + assertEquals(thrower.type(), target.type()); + //System.out.println("catching with "+target+" : "+throwOrReturn); + Object[] args = randomArgs(nargs, Object.class); + args[1] = (throwIt ? thrown : null); + Object returned = target.invokeVarargs(args); + //System.out.println("return from "+target+" : "+returned); + if (!throwIt) { + assertSame(args[0], returned); + } else { + List catchArgs = new ArrayList(Arrays.asList(args)); + catchArgs.add(0, thrown); + assertEquals(catchArgs, returned); + } + } + + @Test + public void testThrowException() throws Throwable { + if (CAN_SKIP_WORKING) return; + startTest("throwException"); + testThrowException(int.class, new ClassCastException("testing")); + testThrowException(void.class, new java.io.IOException("testing")); + testThrowException(String.class, new LinkageError("testing")); + } + + void testThrowException(Class returnType, Throwable thrown) throws Throwable { + countTest(); + Class exType = thrown.getClass(); + MethodHandle target = MethodHandles.throwException(returnType, exType); + //System.out.println("throwing with "+target+" : "+thrown); + MethodType expectedType = MethodType.methodType(returnType, exType); + assertEquals(expectedType, target.type()); + Throwable caught = null; + try { + Object res = target.invokeGeneric(thrown); + fail("got "+res+" instead of throwing "+thrown); + } catch (Throwable ex) { + if (ex != thrown) { + if (ex instanceof Error) throw (Error)ex; + if (ex instanceof RuntimeException) throw (RuntimeException)ex; + } + caught = ex; + } + assertSame(thrown, caught); + } + + @Test + public void testCastFailure() throws Throwable { + if (CAN_SKIP_WORKING) return; + startTest("testCastFailure"); + testCastFailure("cast/argument", 11000); + testCastFailure("unbox/argument", 11000); + testCastFailure("cast/return", 11000); + testCastFailure("unbox/return", 11000); + } + + static class Surprise extends JavaMethodHandle { + Surprise() { super("value"); } + Object value(Object x) { + trace("value", x); + if (boo != null) return boo; + return x; + } + Object boo; + void boo(Object x) { boo = x; } + + static void trace(String x, Object y) { + if (verbosity > 8) System.out.println(x+"="+y); + } + static Object refIdentity(Object x) { trace("ref.x", x); return x; } + static Integer boxIdentity(Integer x) { trace("box.x", x); return x; } + static int intIdentity(int x) { trace("int.x", x); return x; } + static MethodHandle REF_IDENTITY = PRIVATE.findStatic( + Surprise.class, "refIdentity", + MethodType.methodType(Object.class, Object.class)); + static MethodHandle BOX_IDENTITY = PRIVATE.findStatic( + Surprise.class, "boxIdentity", + MethodType.methodType(Integer.class, Integer.class)); + static MethodHandle INT_IDENTITY = PRIVATE.findStatic( + Surprise.class, "intIdentity", + MethodType.methodType(int.class, int.class)); + } + + void testCastFailure(String mode, int okCount) throws Throwable { + countTest(false); + if (verbosity > 1) System.out.println("mode="+mode); + Surprise boo = new Surprise(); + MethodHandle identity = Surprise.REF_IDENTITY, surprise = boo; + if (mode.endsWith("/return")) { + if (mode.equals("unbox/return")) { + // fail on return to ((Integer)surprise).intValue + surprise = MethodHandles.convertArguments(surprise, MethodType.methodType(int.class, Object.class)); + identity = MethodHandles.convertArguments(identity, MethodType.methodType(int.class, Object.class)); + } else if (mode.equals("cast/return")) { + // fail on return to (Integer)surprise + surprise = MethodHandles.convertArguments(surprise, MethodType.methodType(Integer.class, Object.class)); + identity = MethodHandles.convertArguments(identity, MethodType.methodType(Integer.class, Object.class)); + } + } else if (mode.endsWith("/argument")) { + MethodHandle callee = null; + if (mode.equals("unbox/argument")) { + // fail on handing surprise to int argument + callee = Surprise.INT_IDENTITY; + } else if (mode.equals("cast/argument")) { + // fail on handing surprise to Integer argument + callee = Surprise.BOX_IDENTITY; + } + if (callee != null) { + callee = MethodHandles.convertArguments(callee, MethodType.genericMethodType(1)); + surprise = MethodHandles.filterArguments(callee, surprise); + identity = MethodHandles.filterArguments(callee, identity); + } + } + assertNotSame(mode, surprise, boo); + identity = MethodHandles.convertArguments(identity, MethodType.genericMethodType(1)); + surprise = MethodHandles.convertArguments(surprise, MethodType.genericMethodType(1)); + Object x = 42; + for (int i = 0; i < okCount; i++) { + Object y = identity.invoke(x); + assertEquals(x, y); + Object z = surprise.invoke(x); + assertEquals(x, z); + } + boo.boo("Boo!"); + Object y = identity.invoke(x); + assertEquals(x, y); + try { + Object z = surprise.invoke(x); + System.out.println("Failed to throw; got z="+z); + assertTrue(false); + } catch (Exception ex) { + if (verbosity > 1) + System.out.println("caught "+ex); + if (verbosity > 2) + ex.printStackTrace(); + assertTrue(ex instanceof ClassCastException + // FIXME: accept only one of the two for any given unit test + || ex instanceof WrongMethodTypeException + ); + } + } + +} +// Local abbreviated copy of sun.dyn.util.ValueConversions +class ValueConversions { + private static final Lookup IMPL_LOOKUP = MethodHandles.lookup(); + private static final Object[] NO_ARGS_ARRAY = {}; + private static Object[] makeArray(Object... args) { return args; } + private static Object[] array() { return NO_ARGS_ARRAY; } + private static Object[] array(Object a0) + { return makeArray(a0); } + private static Object[] array(Object a0, Object a1) + { return makeArray(a0, a1); } + private static Object[] array(Object a0, Object a1, Object a2) + { return makeArray(a0, a1, a2); } + private static Object[] array(Object a0, Object a1, Object a2, Object a3) + { return makeArray(a0, a1, a2, a3); } + private static Object[] array(Object a0, Object a1, Object a2, Object a3, + Object a4) + { return makeArray(a0, a1, a2, a3, a4); } + private static Object[] array(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5) + { return makeArray(a0, a1, a2, a3, a4, a5); } + private static Object[] array(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6) + { return makeArray(a0, a1, a2, a3, a4, a5, a6); } + private static Object[] array(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7) + { return makeArray(a0, a1, a2, a3, a4, a5, a6, a7); } + private static Object[] array(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8) + { return makeArray(a0, a1, a2, a3, a4, a5, a6, a7, a8); } + private static Object[] array(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9) + { return makeArray(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); } + static MethodHandle[] makeArrays() { + ArrayList arrays = new ArrayList(); + MethodHandles.Lookup lookup = IMPL_LOOKUP; + for (;;) { + int nargs = arrays.size(); + MethodType type = MethodType.genericMethodType(nargs).changeReturnType(Object[].class); + String name = "array"; + MethodHandle array = null; + try { + array = lookup.findStatic(ValueConversions.class, name, type); + } catch (NoAccessException ex) { + } + if (array == null) break; + arrays.add(array); + } + assert(arrays.size() == 11); // current number of methods + return arrays.toArray(new MethodHandle[0]); + } + static final MethodHandle[] ARRAYS = makeArrays(); + + /** Return a method handle that takes the indicated number of Object + * arguments and returns an Object array of them, as if for varargs. + */ + public static MethodHandle varargsArray(int nargs) { + if (nargs < ARRAYS.length) + return ARRAYS[nargs]; + // else need to spin bytecode or do something else fancy + throw new UnsupportedOperationException("NYI"); + } + + private static final List NO_ARGS_LIST = Arrays.asList(NO_ARGS_ARRAY); + private static List makeList(Object... args) { return Arrays.asList(args); } + private static List list() { return NO_ARGS_LIST; } + private static List list(Object a0) + { return makeList(a0); } + private static List list(Object a0, Object a1) + { return makeList(a0, a1); } + private static List list(Object a0, Object a1, Object a2) + { return makeList(a0, a1, a2); } + private static List list(Object a0, Object a1, Object a2, Object a3) + { return makeList(a0, a1, a2, a3); } + private static List list(Object a0, Object a1, Object a2, Object a3, + Object a4) + { return makeList(a0, a1, a2, a3, a4); } + private static List list(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5) + { return makeList(a0, a1, a2, a3, a4, a5); } + private static List list(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6) + { return makeList(a0, a1, a2, a3, a4, a5, a6); } + private static List list(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7) + { return makeList(a0, a1, a2, a3, a4, a5, a6, a7); } + private static List list(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8) + { return makeList(a0, a1, a2, a3, a4, a5, a6, a7, a8); } + private static List list(Object a0, Object a1, Object a2, Object a3, + Object a4, Object a5, Object a6, Object a7, + Object a8, Object a9) + { return makeList(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); } + static MethodHandle[] makeLists() { + ArrayList arrays = new ArrayList(); + MethodHandles.Lookup lookup = IMPL_LOOKUP; + for (;;) { + int nargs = arrays.size(); + MethodType type = MethodType.genericMethodType(nargs).changeReturnType(List.class); + String name = "list"; + MethodHandle array = null; + try { + array = lookup.findStatic(ValueConversions.class, name, type); + } catch (NoAccessException ex) { + } + if (array == null) break; + arrays.add(array); + } + assert(arrays.size() == 11); // current number of methods + return arrays.toArray(new MethodHandle[0]); + } + static final MethodHandle[] LISTS = makeLists(); + + /** Return a method handle that takes the indicated number of Object + * arguments and returns List. + */ + public static MethodHandle varargsList(int nargs) { + if (nargs < LISTS.length) + return LISTS[nargs]; + // else need to spin bytecode or do something else fancy + throw new UnsupportedOperationException("NYI"); + } +} +// This guy tests access from outside the same package member, but inside +// the package itself. +class PackageSibling { + static Lookup lookup() { + return MethodHandles.lookup(); + } +} diff --git a/test/java/io/File/Basic.java b/test/java/io/File/Basic.java index a57c6ccddef839538bc6c7d4e5f9a5f082f47277..cbb8259e5fea64488d9d419887dcb489516c84ce 100644 --- a/test/java/io/File/Basic.java +++ b/test/java/io/File/Basic.java @@ -75,7 +75,7 @@ public class Basic { if (!f.canRead()) fail(f, "is not readable"); if (f.canWrite() != writeable) fail(f, writeable ? "is not writeable" : "is writeable"); - int rwLen = (File.separatorChar == '/' ? 6 : 7); + int rwLen = 6; if (f.length() != length) fail(f, "has wrong length"); } @@ -89,7 +89,7 @@ public class Basic { if (nonExistantFile.exists()) fail(nonExistantFile, "exists"); show(rwFile); - testFile(rwFile, true, File.separatorChar == '/' ? 6 : 7); + testFile(rwFile, true, 6); rwFile.delete(); if (rwFile.exists()) fail(rwFile, "could not delete"); diff --git a/test/java/io/File/basic.sh b/test/java/io/File/basic.sh index fa11c66536b41345ec67351329ff8b0194c72825..cc87ac32e840356ef1a0896c0353cb29c159651e 100644 --- a/test/java/io/File/basic.sh +++ b/test/java/io/File/basic.sh @@ -32,10 +32,10 @@ fi rm -rf x.Basic.* rm -f x.Basic.non -echo xyzzy > x.Basic.rw +printf "%s" "xyzzyN" > x.Basic.rw touch x.Basic.ro; chmod ugo-w x.Basic.ro mkdir x.Basic.dir -if $TESTJAVA/bin/java $* -classpath $TESTCLASSES Basic; then +if $TESTJAVA/bin/java $* -classpath "$TESTCLASSES" Basic; then [ -f x.Basic.rw ] && (echo "x.Basic.rw not deleted"; exit 1) ([ -d x.Basic.dir ] || [ \! -d x.Basic.dir2 ]) \ && (echo "x.Basic.dir not renamed"; exit 1) diff --git a/test/java/io/Serializable/evolution/RenamePackage/run.sh b/test/java/io/Serializable/evolution/RenamePackage/run.sh index 2f194c06123d05b2af699adcac3ca2aaeacff97b..df76b738308a1ebad311e5b46fc99664206462cf 100644 --- a/test/java/io/Serializable/evolution/RenamePackage/run.sh +++ b/test/java/io/Serializable/evolution/RenamePackage/run.sh @@ -43,7 +43,7 @@ OS=`uname -s` case "$OS" in SunOS | Linux ) PS=":" ;; -Windows* ) +Windows* | CYGWIN* ) PS=";" ;; * ) echo "Unrecognized system!" @@ -85,14 +85,14 @@ CLASSPATH=${TESTCLASSES}/share; export CLASSPATH; ${JAVAC} -d ${TESTCLASSES}/nclasses ${TESTSRC}/install/SerialDriver.java # Run Case 1. Map test.SerialDriver within stream to install.SerialDriver. -CLASSPATH=${TESTCLASSES}/oclasses${PS}${TESTCLASSES}/share; export CLASSPATH; +CLASSPATH="${TESTCLASSES}/oclasses${PS}${TESTCLASSES}/share"; export CLASSPATH; ${JAVA} test.SerialDriver -s -CLASSPATH=${TESTCLASSES}/nclasses${PS}${TESTCLASSES}/share; export CLASSPATH; +CLASSPATH="${TESTCLASSES}/nclasses${PS}${TESTCLASSES}/share"; export CLASSPATH; ${JAVA} install.SerialDriver -d rm stream.ser # Run Case 2. Map install.SerialDriver within stream to test.SerialDriver. -CLASSPATH=${TESTCLASSES}/nclasses${PS}${TESTCLASSES}/share; export CLASSPATH; +CLASSPATH="${TESTCLASSES}/nclasses${PS}${TESTCLASSES}/share"; export CLASSPATH; ${JAVA} install.SerialDriver -s -CLASSPATH=${TESTCLASSES}/oclasses${PS}${TESTCLASSES}/share; export CLASSPATH; +CLASSPATH="${TESTCLASSES}/oclasses${PS}${TESTCLASSES}/share"; export CLASSPATH; ${JAVA} test.SerialDriver -d diff --git a/test/java/io/Serializable/serialver/classpath/run.sh b/test/java/io/Serializable/serialver/classpath/run.sh index aa3251e47982735ac4c35f3d1e17ad0a423adc67..6fb127f89fa41454581c684a511dd6d2edf3a007 100644 --- a/test/java/io/Serializable/serialver/classpath/run.sh +++ b/test/java/io/Serializable/serialver/classpath/run.sh @@ -49,7 +49,7 @@ OS=`uname -s` case "$OS" in SunOS | Linux ) PS=":" ;; - Windows* ) + Windows* | CYGWIN* ) PS=";" ;; * ) echo "Unrecognized system!" diff --git a/test/java/io/Serializable/serialver/nested/run.sh b/test/java/io/Serializable/serialver/nested/run.sh index 57b0ca0a759aa7292f5e87465f6472fc7a294b41..9b53f756f1e84a277f8d096db37137e736059de0 100644 --- a/test/java/io/Serializable/serialver/nested/run.sh +++ b/test/java/io/Serializable/serialver/nested/run.sh @@ -49,7 +49,7 @@ OS=`uname -s` case "$OS" in SunOS | Linux ) PS=":" ;; - Windows* ) + Windows* | CYGWIN* ) PS=";" ;; * ) echo "Unrecognized system!" diff --git a/test/java/lang/ClassLoader/deadlock/TestOneWayDelegate.sh b/test/java/lang/ClassLoader/deadlock/TestOneWayDelegate.sh index 1f6a08ff34252113a977b07bb5d6c6ee717773f0..e4aac0ddd608da8119730603b847ff49ed6289fe 100644 --- a/test/java/lang/ClassLoader/deadlock/TestOneWayDelegate.sh +++ b/test/java/lang/ClassLoader/deadlock/TestOneWayDelegate.sh @@ -55,7 +55,7 @@ case "$OS" in Linux ) FS="/" ;; - Windows* ) + Windows* | CYGWIN* ) FS="\\" ;; esac diff --git a/test/java/lang/Math/CeilAndFloorTests.java b/test/java/lang/Math/CeilAndFloorTests.java new file mode 100644 index 0000000000000000000000000000000000000000..12d899d8180899eed2a2619b19d0539f2c40ad3a --- /dev/null +++ b/test/java/lang/Math/CeilAndFloorTests.java @@ -0,0 +1,201 @@ +/* + * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ + +/* + * @test + * @bug 6908131 + * @summary Check for correct implementation of Math.ceil and Math.floor + */ + +import sun.misc.FpUtils; +import sun.misc.DoubleConsts; + +public class CeilAndFloorTests { + private static int testCeilCase(double input, double expected) { + int failures = 0; + failures += Tests.test("Math.ceil", input, Math.ceil(input), expected); + failures += Tests.test("StrictMath.ceil", input, StrictMath.ceil(input), expected); + return failures; + } + + private static int testFloorCase(double input, double expected) { + int failures = 0; + failures += Tests.test("Math.floor", input, Math.floor(input), expected); + failures += Tests.test("StrictMath.floor", input, StrictMath.floor(input), expected); + return failures; + } + + private static int nearIntegerTests() { + int failures = 0; + + double [] fixedPoints = { + -0.0, + 0.0, + -1.0, + 1.0, + -0x1.0p52, + 0x1.0p52, + -Double.MAX_VALUE, + Double.MAX_VALUE, + Double.NEGATIVE_INFINITY, + Double.POSITIVE_INFINITY, + Double.NaN, + }; + + for(double fixedPoint : fixedPoints) { + failures += testCeilCase(fixedPoint, fixedPoint); + failures += testFloorCase(fixedPoint, fixedPoint); + } + + for(int i = Double.MIN_EXPONENT; i <= Double.MAX_EXPONENT; i++) { + double powerOfTwo = Math.scalb(1.0, i); + double neighborDown = FpUtils.nextDown(powerOfTwo); + double neighborUp = Math.nextUp(powerOfTwo); + + if (i < 0) { + failures += testCeilCase( powerOfTwo, 1.0); + failures += testCeilCase(-powerOfTwo, -0.0); + + failures += testFloorCase( powerOfTwo, 0.0); + failures += testFloorCase(-powerOfTwo, -1.0); + + failures += testCeilCase( neighborDown, 1.0); + failures += testCeilCase(-neighborDown, -0.0); + + failures += testFloorCase( neighborUp, 0.0); + failures += testFloorCase(-neighborUp, -1.0); + } else { + failures += testCeilCase(powerOfTwo, powerOfTwo); + failures += testFloorCase(powerOfTwo, powerOfTwo); + + if (neighborDown==Math.rint(neighborDown)) { + failures += testCeilCase( neighborDown, neighborDown); + failures += testCeilCase(-neighborDown, -neighborDown); + + failures += testFloorCase( neighborDown, neighborDown); + failures += testFloorCase(-neighborDown,-neighborDown); + } else { + failures += testCeilCase( neighborDown, powerOfTwo); + failures += testFloorCase(-neighborDown, -powerOfTwo); + } + + if (neighborUp==Math.rint(neighborUp)) { + failures += testCeilCase(neighborUp, neighborUp); + failures += testCeilCase(-neighborUp, -neighborUp); + + failures += testFloorCase(neighborUp, neighborUp); + failures += testFloorCase(-neighborUp, -neighborUp); + } else { + failures += testFloorCase(neighborUp, powerOfTwo); + failures += testCeilCase(-neighborUp, -powerOfTwo); + } + } + } + + for(int i = -(0x10000); i <= 0x10000; i++) { + double d = (double) i; + double neighborDown = FpUtils.nextDown(d); + double neighborUp = Math.nextUp(d); + + failures += testCeilCase( d, d); + failures += testCeilCase(-d, -d); + + failures += testFloorCase( d, d); + failures += testFloorCase(-d, -d); + + if (Math.abs(d) > 1.0) { + failures += testCeilCase( neighborDown, d); + failures += testCeilCase(-neighborDown, -d+1); + + failures += testFloorCase( neighborUp, d); + failures += testFloorCase(-neighborUp, -d-1); + } + } + + return failures; + } + + public static int roundingTests() { + int failures = 0; + double [][] testCases = { + { Double.MIN_VALUE, 1.0}, + {-Double.MIN_VALUE, -0.0}, + { FpUtils.nextDown(DoubleConsts.MIN_NORMAL), 1.0}, + {-FpUtils.nextDown(DoubleConsts.MIN_NORMAL), -0.0}, + { DoubleConsts.MIN_NORMAL, 1.0}, + {-DoubleConsts.MIN_NORMAL, -0.0}, + + { 0.1, 1.0}, + {-0.1, -0.0}, + + { 0.5, 1.0}, + {-0.5, -0.0}, + + { 1.5, 2.0}, + {-1.5, -1.0}, + + { 2.5, 3.0}, + {-2.5, -2.0}, + + { FpUtils.nextDown(1.0), 1.0}, + { FpUtils.nextDown(-1.0), -1.0}, + + { Math.nextUp(1.0), 2.0}, + { Math.nextUp(-1.0), -0.0}, + + { 0x1.0p51, 0x1.0p51}, + {-0x1.0p51, -0x1.0p51}, + + { FpUtils.nextDown(0x1.0p51), 0x1.0p51}, + {-Math.nextUp(0x1.0p51), -0x1.0p51}, + + { Math.nextUp(0x1.0p51), 0x1.0p51+1}, + {-FpUtils.nextDown(0x1.0p51), -0x1.0p51+1}, + + { FpUtils.nextDown(0x1.0p52), 0x1.0p52}, + {-Math.nextUp(0x1.0p52), -0x1.0p52-1.0}, + + { Math.nextUp(0x1.0p52), 0x1.0p52+1.0}, + {-FpUtils.nextDown(0x1.0p52), -0x1.0p52+1.0}, + }; + + for(double[] testCase : testCases) { + failures += testCeilCase(testCase[0], testCase[1]); + failures += testFloorCase(-testCase[0], -testCase[1]); + } + return failures; + } + + public static void main(String... args) { + int failures = 0; + + failures += nearIntegerTests(); + failures += roundingTests(); + + if (failures > 0) { + System.err.println("Testing {Math, StrictMath}.ceil incurred " + + failures + " failures."); + throw new RuntimeException(); + } + } +} diff --git a/test/java/lang/StringCoding/CheckEncodings.sh b/test/java/lang/StringCoding/CheckEncodings.sh index 6fa20c4d5a62de7a3935f1822508b7a5a0b9a69e..9bfe2f7aad666a9bb686ba97dfa2dc679055ccd4 100644 --- a/test/java/lang/StringCoding/CheckEncodings.sh +++ b/test/java/lang/StringCoding/CheckEncodings.sh @@ -31,7 +31,7 @@ OS=`uname -s` case "$OS" in SunOS | Linux ) ;; - Windows* ) + Windows* | CYGWIN* ) echo "Passed"; exit 0 ;; * ) echo "Unrecognized system!" ; exit 1 ;; esac diff --git a/test/java/lang/System/finalization/FinExit.sh b/test/java/lang/System/finalization/FinExit.sh index d2e48da8fe30c9f22a076f22e0a5ef59d8ced89e..c08fb6fdd5d0e0bb865edcd27a0c95d19fe7caec 100644 --- a/test/java/lang/System/finalization/FinExit.sh +++ b/test/java/lang/System/finalization/FinExit.sh @@ -24,7 +24,9 @@ # # -x=`$TESTJAVA/bin/java -cp $TESTCLASSES FinExit` + +# We only want the first character, Windows might add CRLF +x=`$TESTJAVA/bin/java -cp "$TESTCLASSES" FinExit | cut -c1` echo $x if [ "x$x" != "x1" ]; then echo On-exit finalizer invoked twice diff --git a/test/java/lang/annotation/loaderLeak/LoaderLeak.sh b/test/java/lang/annotation/loaderLeak/LoaderLeak.sh index d8a47462f9b81453398c9df66861005e0fcc155e..28ac016d42326087bf4ccbde6445b44ab30606e8 100644 --- a/test/java/lang/annotation/loaderLeak/LoaderLeak.sh +++ b/test/java/lang/annotation/loaderLeak/LoaderLeak.sh @@ -49,6 +49,11 @@ case "$OS" in PS=":" FS="/" ;; + CYGWIN* ) + NULL=/dev/null + PS=";" + FS="/" + ;; Windows* ) NULL=NUL PS=";" diff --git a/test/java/lang/instrument/appendToClassLoaderSearch/CommonSetup.sh b/test/java/lang/instrument/appendToClassLoaderSearch/CommonSetup.sh index 0fdce4ba0a4adea85bab717eaf8d43729f7b2f8c..c2b1a763bb84ea427feeb3f109538ee367478b67 100644 --- a/test/java/lang/instrument/appendToClassLoaderSearch/CommonSetup.sh +++ b/test/java/lang/instrument/appendToClassLoaderSearch/CommonSetup.sh @@ -43,11 +43,17 @@ case "$OS" in PS=":" FS="/" ;; - Windows* | CYGWIN*) + Windows*) PS=";" OS="Windows" FS="\\" ;; + CYGWIN*) + PS=";" + OS="Windows" + FS="\\" + isCygwin=true + ;; * ) echo "Unrecognized system!" exit 1; diff --git a/test/java/math/BigInteger/BigIntegerTest.java b/test/java/math/BigInteger/BigIntegerTest.java index 75ce0033779ca60178c4e8172fdffac368d8c62f..c5196eb7252262dfb487ce14d1e83cdf784c9987 100644 --- a/test/java/math/BigInteger/BigIntegerTest.java +++ b/test/java/math/BigInteger/BigIntegerTest.java @@ -642,37 +642,71 @@ public class BigIntegerTest { for(int i = 0; i < bitPatterns.length; i++) { BigInteger b1 = new BigInteger(bitPatterns[i], 16); + BigInteger b2 = null; File f = new File("serialtest"); FileOutputStream fos = new FileOutputStream(f); - ObjectOutputStream oos = new ObjectOutputStream(fos); - oos.writeObject(b1); - oos.flush(); - oos.close(); - FileInputStream fis = new FileInputStream(f); - ObjectInputStream ois = new ObjectInputStream(fis); - BigInteger b2 = (BigInteger)ois.readObject(); + try { + ObjectOutputStream oos = new ObjectOutputStream(fos); + try { + oos.writeObject(b1); + oos.flush(); + } finally { + oos.close(); + } - if (!b1.equals(b2) || - !b1.equals(b1.or(b2))) { - failCount++; - System.err.println("Serialized failed for hex " + - b1.toString(16)); + FileInputStream fis = new FileInputStream(f); + try { + ObjectInputStream ois = new ObjectInputStream(fis); + try { + b2 = (BigInteger)ois.readObject(); + } finally { + ois.close(); + } + } finally { + fis.close(); + } + + if (!b1.equals(b2) || + !b1.equals(b1.or(b2))) { + failCount++; + System.err.println("Serialized failed for hex " + + b1.toString(16)); + } + } finally { + fos.close(); } f.delete(); } for(int i=0; i<10; i++) { BigInteger b1 = fetchNumber(rnd.nextInt(100)); + BigInteger b2 = null; File f = new File("serialtest"); FileOutputStream fos = new FileOutputStream(f); - ObjectOutputStream oos = new ObjectOutputStream(fos); - oos.writeObject(b1); - oos.flush(); - oos.close(); - FileInputStream fis = new FileInputStream(f); - ObjectInputStream ois = new ObjectInputStream(fis); - BigInteger b2 = (BigInteger)ois.readObject(); + try { + ObjectOutputStream oos = new ObjectOutputStream(fos); + try { + oos.writeObject(b1); + oos.flush(); + } finally { + oos.close(); + } + + FileInputStream fis = new FileInputStream(f); + try { + ObjectInputStream ois = new ObjectInputStream(fis); + try { + b2 = (BigInteger)ois.readObject(); + } finally { + ois.close(); + } + } finally { + fis.close(); + } + } finally { + fos.close(); + } if (!b1.equals(b2) || !b1.equals(b1.or(b2))) diff --git a/test/java/nio/Buffer/Basic-X.java.template b/test/java/nio/Buffer/Basic-X.java.template index 6612771def4d2c49d9298d3fe7baeb79be39d0a7..93cbe8eb5ee1b1de66fb2546ed1f43ad03e020df 100644 --- a/test/java/nio/Buffer/Basic-X.java.template +++ b/test/java/nio/Buffer/Basic-X.java.template @@ -38,6 +38,26 @@ public class Basic$Type$ extends Basic { + private static final $type$[] VALUES = { + $Fulltype$.MIN_VALUE, + ($type$) -1, + ($type$) 0, + ($type$) 1, + $Fulltype$.MAX_VALUE, +#if[float] + $Fulltype$.NEGATIVE_INFINITY, + $Fulltype$.POSITIVE_INFINITY, + $Fulltype$.NaN, + ($type$) -0.0, +#end[float] +#if[double] + $Fulltype$.NEGATIVE_INFINITY, + $Fulltype$.POSITIVE_INFINITY, + $Fulltype$.NaN, + ($type$) -0.0, +#end[double] + }; + private static void relGet($Type$Buffer b) { int n = b.capacity(); $type$ v; @@ -309,6 +329,12 @@ public class Basic$Type$ #end[byte] + private static void fail(String problem, + $Type$Buffer xb, $Type$Buffer yb, + $type$ x, $type$ y) { + fail(problem + String.format(": x=%s y=%s", x, y), xb, yb); + } + private static void tryCatch(Buffer b, Class ex, Runnable thunk) { boolean caught = false; try { @@ -522,6 +548,42 @@ public class Basic$Type$ if (b.compareTo(b2) <= 0) fail("Comparison to lesser buffer <= 0", b, b2); + // Check equals and compareTo with interesting values + for ($type$ x : VALUES) { + $Type$Buffer xb = $Type$Buffer.wrap(new $type$[] { x }); + if (xb.compareTo(xb) != 0) { + fail("compareTo not reflexive", xb, xb, x, x); + } + if (! xb.equals(xb)) { + fail("equals not reflexive", xb, xb, x, x); + } + for ($type$ y : VALUES) { + $Type$Buffer yb = $Type$Buffer.wrap(new $type$[] { y }); + if (xb.compareTo(yb) != - yb.compareTo(xb)) { + fail("compareTo not anti-symmetric", + xb, yb, x, y); + } + if ((xb.compareTo(yb) == 0) != xb.equals(yb)) { + fail("compareTo inconsistent with equals", + xb, yb, x, y); + } + if (xb.compareTo(yb) != $Fulltype$.compare(x, y)) { +#if[float] + if (x == 0.0 && y == 0.0) continue; +#end[float] +#if[double] + if (x == 0.0 && y == 0.0) continue; +#end[double] + fail("Incorrect results for $Type$Buffer.compareTo", + xb, yb, x, y); + } + if (xb.equals(yb) != ((x == y) || ((x != x) && (y != y)))) { + fail("Incorrect results for $Type$Buffer.equals", + xb, yb, x, y); + } + } + } + // Sub, dup relPut(b); diff --git a/test/java/nio/Buffer/BasicByte.java b/test/java/nio/Buffer/BasicByte.java index 7e259a1416ded179ab076c0b7c9dab17c3718be3..78b209936d76ec5dce341d0e2a15e709245865e5 100644 --- a/test/java/nio/Buffer/BasicByte.java +++ b/test/java/nio/Buffer/BasicByte.java @@ -38,6 +38,26 @@ public class BasicByte extends Basic { + private static final byte[] VALUES = { + Byte.MIN_VALUE, + (byte) -1, + (byte) 0, + (byte) 1, + Byte.MAX_VALUE, + + + + + + + + + + + + + }; + private static void relGet(ByteBuffer b) { int n = b.capacity(); byte v; @@ -309,6 +329,12 @@ public class BasicByte + private static void fail(String problem, + ByteBuffer xb, ByteBuffer yb, + byte x, byte y) { + fail(problem + String.format(": x=%s y=%s", x, y), xb, yb); + } + private static void tryCatch(Buffer b, Class ex, Runnable thunk) { boolean caught = false; try { @@ -522,6 +548,42 @@ public class BasicByte if (b.compareTo(b2) <= 0) fail("Comparison to lesser buffer <= 0", b, b2); + // Check equals and compareTo with interesting values + for (byte x : VALUES) { + ByteBuffer xb = ByteBuffer.wrap(new byte[] { x }); + if (xb.compareTo(xb) != 0) { + fail("compareTo not reflexive", xb, xb, x, x); + } + if (! xb.equals(xb)) { + fail("equals not reflexive", xb, xb, x, x); + } + for (byte y : VALUES) { + ByteBuffer yb = ByteBuffer.wrap(new byte[] { y }); + if (xb.compareTo(yb) != - yb.compareTo(xb)) { + fail("compareTo not anti-symmetric", + xb, yb, x, y); + } + if ((xb.compareTo(yb) == 0) != xb.equals(yb)) { + fail("compareTo inconsistent with equals", + xb, yb, x, y); + } + if (xb.compareTo(yb) != Byte.compare(x, y)) { + + + + + + + fail("Incorrect results for ByteBuffer.compareTo", + xb, yb, x, y); + } + if (xb.equals(yb) != ((x == y) || ((x != x) && (y != y)))) { + fail("Incorrect results for ByteBuffer.equals", + xb, yb, x, y); + } + } + } + // Sub, dup relPut(b); diff --git a/test/java/nio/Buffer/BasicChar.java b/test/java/nio/Buffer/BasicChar.java index a0df9fcf3a92dc00751f41301af8025f4831730b..9f3c5e4219c15154268c4934ebfef137a8a2b3a3 100644 --- a/test/java/nio/Buffer/BasicChar.java +++ b/test/java/nio/Buffer/BasicChar.java @@ -38,6 +38,26 @@ public class BasicChar extends Basic { + private static final char[] VALUES = { + Character.MIN_VALUE, + (char) -1, + (char) 0, + (char) 1, + Character.MAX_VALUE, + + + + + + + + + + + + + }; + private static void relGet(CharBuffer b) { int n = b.capacity(); char v; @@ -308,6 +328,12 @@ public class BasicChar + + private static void fail(String problem, + CharBuffer xb, CharBuffer yb, + char x, char y) { + fail(problem + String.format(": x=%s y=%s", x, y), xb, yb); + } private static void tryCatch(Buffer b, Class ex, Runnable thunk) { boolean caught = false; @@ -522,6 +548,42 @@ public class BasicChar if (b.compareTo(b2) <= 0) fail("Comparison to lesser buffer <= 0", b, b2); + // Check equals and compareTo with interesting values + for (char x : VALUES) { + CharBuffer xb = CharBuffer.wrap(new char[] { x }); + if (xb.compareTo(xb) != 0) { + fail("compareTo not reflexive", xb, xb, x, x); + } + if (! xb.equals(xb)) { + fail("equals not reflexive", xb, xb, x, x); + } + for (char y : VALUES) { + CharBuffer yb = CharBuffer.wrap(new char[] { y }); + if (xb.compareTo(yb) != - yb.compareTo(xb)) { + fail("compareTo not anti-symmetric", + xb, yb, x, y); + } + if ((xb.compareTo(yb) == 0) != xb.equals(yb)) { + fail("compareTo inconsistent with equals", + xb, yb, x, y); + } + if (xb.compareTo(yb) != Character.compare(x, y)) { + + + + + + + fail("Incorrect results for CharBuffer.compareTo", + xb, yb, x, y); + } + if (xb.equals(yb) != ((x == y) || ((x != x) && (y != y)))) { + fail("Incorrect results for CharBuffer.equals", + xb, yb, x, y); + } + } + } + // Sub, dup relPut(b); diff --git a/test/java/nio/Buffer/BasicDouble.java b/test/java/nio/Buffer/BasicDouble.java index a627d0e919469911e73b09a61195896b0374ae74..97f5fa200de192b295e36b821534e98c8945b6b7 100644 --- a/test/java/nio/Buffer/BasicDouble.java +++ b/test/java/nio/Buffer/BasicDouble.java @@ -38,6 +38,26 @@ public class BasicDouble extends Basic { + private static final double[] VALUES = { + Double.MIN_VALUE, + (double) -1, + (double) 0, + (double) 1, + Double.MAX_VALUE, + + + + + + + + Double.NEGATIVE_INFINITY, + Double.POSITIVE_INFINITY, + Double.NaN, + (double) -0.0, + + }; + private static void relGet(DoubleBuffer b) { int n = b.capacity(); double v; @@ -308,6 +328,12 @@ public class BasicDouble + + private static void fail(String problem, + DoubleBuffer xb, DoubleBuffer yb, + double x, double y) { + fail(problem + String.format(": x=%s y=%s", x, y), xb, yb); + } private static void tryCatch(Buffer b, Class ex, Runnable thunk) { boolean caught = false; @@ -522,6 +548,42 @@ public class BasicDouble if (b.compareTo(b2) <= 0) fail("Comparison to lesser buffer <= 0", b, b2); + // Check equals and compareTo with interesting values + for (double x : VALUES) { + DoubleBuffer xb = DoubleBuffer.wrap(new double[] { x }); + if (xb.compareTo(xb) != 0) { + fail("compareTo not reflexive", xb, xb, x, x); + } + if (! xb.equals(xb)) { + fail("equals not reflexive", xb, xb, x, x); + } + for (double y : VALUES) { + DoubleBuffer yb = DoubleBuffer.wrap(new double[] { y }); + if (xb.compareTo(yb) != - yb.compareTo(xb)) { + fail("compareTo not anti-symmetric", + xb, yb, x, y); + } + if ((xb.compareTo(yb) == 0) != xb.equals(yb)) { + fail("compareTo inconsistent with equals", + xb, yb, x, y); + } + if (xb.compareTo(yb) != Double.compare(x, y)) { + + + + + if (x == 0.0 && y == 0.0) continue; + + fail("Incorrect results for DoubleBuffer.compareTo", + xb, yb, x, y); + } + if (xb.equals(yb) != ((x == y) || ((x != x) && (y != y)))) { + fail("Incorrect results for DoubleBuffer.equals", + xb, yb, x, y); + } + } + } + // Sub, dup relPut(b); diff --git a/test/java/nio/Buffer/BasicFloat.java b/test/java/nio/Buffer/BasicFloat.java index 730dcbeac956a4eb296dced253c73c37d2932819..46bdfe163cb29d3debe3cb36aa2c259ecd75ef58 100644 --- a/test/java/nio/Buffer/BasicFloat.java +++ b/test/java/nio/Buffer/BasicFloat.java @@ -38,6 +38,26 @@ public class BasicFloat extends Basic { + private static final float[] VALUES = { + Float.MIN_VALUE, + (float) -1, + (float) 0, + (float) 1, + Float.MAX_VALUE, + + Float.NEGATIVE_INFINITY, + Float.POSITIVE_INFINITY, + Float.NaN, + (float) -0.0, + + + + + + + + }; + private static void relGet(FloatBuffer b) { int n = b.capacity(); float v; @@ -308,6 +328,12 @@ public class BasicFloat + + private static void fail(String problem, + FloatBuffer xb, FloatBuffer yb, + float x, float y) { + fail(problem + String.format(": x=%s y=%s", x, y), xb, yb); + } private static void tryCatch(Buffer b, Class ex, Runnable thunk) { boolean caught = false; @@ -522,6 +548,42 @@ public class BasicFloat if (b.compareTo(b2) <= 0) fail("Comparison to lesser buffer <= 0", b, b2); + // Check equals and compareTo with interesting values + for (float x : VALUES) { + FloatBuffer xb = FloatBuffer.wrap(new float[] { x }); + if (xb.compareTo(xb) != 0) { + fail("compareTo not reflexive", xb, xb, x, x); + } + if (! xb.equals(xb)) { + fail("equals not reflexive", xb, xb, x, x); + } + for (float y : VALUES) { + FloatBuffer yb = FloatBuffer.wrap(new float[] { y }); + if (xb.compareTo(yb) != - yb.compareTo(xb)) { + fail("compareTo not anti-symmetric", + xb, yb, x, y); + } + if ((xb.compareTo(yb) == 0) != xb.equals(yb)) { + fail("compareTo inconsistent with equals", + xb, yb, x, y); + } + if (xb.compareTo(yb) != Float.compare(x, y)) { + + if (x == 0.0 && y == 0.0) continue; + + + + + fail("Incorrect results for FloatBuffer.compareTo", + xb, yb, x, y); + } + if (xb.equals(yb) != ((x == y) || ((x != x) && (y != y)))) { + fail("Incorrect results for FloatBuffer.equals", + xb, yb, x, y); + } + } + } + // Sub, dup relPut(b); diff --git a/test/java/nio/Buffer/BasicInt.java b/test/java/nio/Buffer/BasicInt.java index b20e4bb1056e0329298e6db753f50a71383d9b3c..478debd76e136f615dd3460ac7eeb15a11d605d1 100644 --- a/test/java/nio/Buffer/BasicInt.java +++ b/test/java/nio/Buffer/BasicInt.java @@ -38,6 +38,26 @@ public class BasicInt extends Basic { + private static final int[] VALUES = { + Integer.MIN_VALUE, + (int) -1, + (int) 0, + (int) 1, + Integer.MAX_VALUE, + + + + + + + + + + + + + }; + private static void relGet(IntBuffer b) { int n = b.capacity(); int v; @@ -308,6 +328,12 @@ public class BasicInt + + private static void fail(String problem, + IntBuffer xb, IntBuffer yb, + int x, int y) { + fail(problem + String.format(": x=%s y=%s", x, y), xb, yb); + } private static void tryCatch(Buffer b, Class ex, Runnable thunk) { boolean caught = false; @@ -522,6 +548,42 @@ public class BasicInt if (b.compareTo(b2) <= 0) fail("Comparison to lesser buffer <= 0", b, b2); + // Check equals and compareTo with interesting values + for (int x : VALUES) { + IntBuffer xb = IntBuffer.wrap(new int[] { x }); + if (xb.compareTo(xb) != 0) { + fail("compareTo not reflexive", xb, xb, x, x); + } + if (! xb.equals(xb)) { + fail("equals not reflexive", xb, xb, x, x); + } + for (int y : VALUES) { + IntBuffer yb = IntBuffer.wrap(new int[] { y }); + if (xb.compareTo(yb) != - yb.compareTo(xb)) { + fail("compareTo not anti-symmetric", + xb, yb, x, y); + } + if ((xb.compareTo(yb) == 0) != xb.equals(yb)) { + fail("compareTo inconsistent with equals", + xb, yb, x, y); + } + if (xb.compareTo(yb) != Integer.compare(x, y)) { + + + + + + + fail("Incorrect results for IntBuffer.compareTo", + xb, yb, x, y); + } + if (xb.equals(yb) != ((x == y) || ((x != x) && (y != y)))) { + fail("Incorrect results for IntBuffer.equals", + xb, yb, x, y); + } + } + } + // Sub, dup relPut(b); diff --git a/test/java/nio/Buffer/BasicLong.java b/test/java/nio/Buffer/BasicLong.java index 0d4c568e1e3beeda4560291e88dbd665dd3127be..0abc7cdf2f42f4c70f743319ce329d61db6c6f77 100644 --- a/test/java/nio/Buffer/BasicLong.java +++ b/test/java/nio/Buffer/BasicLong.java @@ -38,6 +38,26 @@ public class BasicLong extends Basic { + private static final long[] VALUES = { + Long.MIN_VALUE, + (long) -1, + (long) 0, + (long) 1, + Long.MAX_VALUE, + + + + + + + + + + + + + }; + private static void relGet(LongBuffer b) { int n = b.capacity(); long v; @@ -308,6 +328,12 @@ public class BasicLong + + private static void fail(String problem, + LongBuffer xb, LongBuffer yb, + long x, long y) { + fail(problem + String.format(": x=%s y=%s", x, y), xb, yb); + } private static void tryCatch(Buffer b, Class ex, Runnable thunk) { boolean caught = false; @@ -522,6 +548,42 @@ public class BasicLong if (b.compareTo(b2) <= 0) fail("Comparison to lesser buffer <= 0", b, b2); + // Check equals and compareTo with interesting values + for (long x : VALUES) { + LongBuffer xb = LongBuffer.wrap(new long[] { x }); + if (xb.compareTo(xb) != 0) { + fail("compareTo not reflexive", xb, xb, x, x); + } + if (! xb.equals(xb)) { + fail("equals not reflexive", xb, xb, x, x); + } + for (long y : VALUES) { + LongBuffer yb = LongBuffer.wrap(new long[] { y }); + if (xb.compareTo(yb) != - yb.compareTo(xb)) { + fail("compareTo not anti-symmetric", + xb, yb, x, y); + } + if ((xb.compareTo(yb) == 0) != xb.equals(yb)) { + fail("compareTo inconsistent with equals", + xb, yb, x, y); + } + if (xb.compareTo(yb) != Long.compare(x, y)) { + + + + + + + fail("Incorrect results for LongBuffer.compareTo", + xb, yb, x, y); + } + if (xb.equals(yb) != ((x == y) || ((x != x) && (y != y)))) { + fail("Incorrect results for LongBuffer.equals", + xb, yb, x, y); + } + } + } + // Sub, dup relPut(b); diff --git a/test/java/nio/Buffer/BasicShort.java b/test/java/nio/Buffer/BasicShort.java index 58e5a3e6d6851c3f758113cf8f3c12aea0833927..861d356b6df5fb4bb6d7afec0c85904601c51d15 100644 --- a/test/java/nio/Buffer/BasicShort.java +++ b/test/java/nio/Buffer/BasicShort.java @@ -38,6 +38,26 @@ public class BasicShort extends Basic { + private static final short[] VALUES = { + Short.MIN_VALUE, + (short) -1, + (short) 0, + (short) 1, + Short.MAX_VALUE, + + + + + + + + + + + + + }; + private static void relGet(ShortBuffer b) { int n = b.capacity(); short v; @@ -308,6 +328,12 @@ public class BasicShort + + private static void fail(String problem, + ShortBuffer xb, ShortBuffer yb, + short x, short y) { + fail(problem + String.format(": x=%s y=%s", x, y), xb, yb); + } private static void tryCatch(Buffer b, Class ex, Runnable thunk) { boolean caught = false; @@ -522,6 +548,42 @@ public class BasicShort if (b.compareTo(b2) <= 0) fail("Comparison to lesser buffer <= 0", b, b2); + // Check equals and compareTo with interesting values + for (short x : VALUES) { + ShortBuffer xb = ShortBuffer.wrap(new short[] { x }); + if (xb.compareTo(xb) != 0) { + fail("compareTo not reflexive", xb, xb, x, x); + } + if (! xb.equals(xb)) { + fail("equals not reflexive", xb, xb, x, x); + } + for (short y : VALUES) { + ShortBuffer yb = ShortBuffer.wrap(new short[] { y }); + if (xb.compareTo(yb) != - yb.compareTo(xb)) { + fail("compareTo not anti-symmetric", + xb, yb, x, y); + } + if ((xb.compareTo(yb) == 0) != xb.equals(yb)) { + fail("compareTo inconsistent with equals", + xb, yb, x, y); + } + if (xb.compareTo(yb) != Short.compare(x, y)) { + + + + + + + fail("Incorrect results for ShortBuffer.compareTo", + xb, yb, x, y); + } + if (xb.equals(yb) != ((x == y) || ((x != x) && (y != y)))) { + fail("Incorrect results for ShortBuffer.equals", + xb, yb, x, y); + } + } + } + // Sub, dup relPut(b); diff --git a/test/java/nio/Buffer/genBasic.sh b/test/java/nio/Buffer/genBasic.sh index da5fca5df33e7776f35008177ddfa1cdda53890f..009cf2dbb1b8c2ca7b83697b34e44530b09444b0 100644 --- a/test/java/nio/Buffer/genBasic.sh +++ b/test/java/nio/Buffer/genBasic.sh @@ -36,5 +36,3 @@ gen int Int Integer gen long Long Long gen float Float Float gen double Double Double - -rm -rf build diff --git a/test/java/nio/channels/AsynchronousFileChannel/LotsOfWrites.java b/test/java/nio/channels/AsynchronousFileChannel/LotsOfWrites.java new file mode 100644 index 0000000000000000000000000000000000000000..dd2c27ddbd4437618dd7a00c0a32f2f3afe71fbb --- /dev/null +++ b/test/java/nio/channels/AsynchronousFileChannel/LotsOfWrites.java @@ -0,0 +1,162 @@ +/* + * Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ + +/* @test + * @bug 6913877 + * @summary Stress AsynchronousFileChannel.write + */ + +import java.io.*; +import java.nio.ByteBuffer; +import static java.nio.file.StandardOpenOption.*; +import java.nio.channels.*; +import java.util.Random; +import java.util.concurrent.CountDownLatch; + +public class LotsOfWrites { + static final Random rand = new Random(); + + /** + * Asynchronously writes a known pattern to a file up to a given size, + * counting down a latch to release waiters when done. + */ + static class Writer implements CompletionHandler { + private final File file; + private final long size; + private final CountDownLatch latch; + private final AsynchronousFileChannel channel; + + private volatile long position; + private volatile byte nextByte; + + private long updatePosition(long nwrote) { + position += nwrote; + return position; + } + + private ByteBuffer genNextBuffer() { + int n = Math.min(8192 + rand.nextInt(8192), (int)(size - position)); + ByteBuffer buf = ByteBuffer.allocate(n); + for (int i=0; i= size) { + done(); + return; + } + buf = genNextBuffer(); + } + channel.write(buf, pos, buf, this); + } + + @Override + public void failed(Throwable exc, ByteBuffer buf) { + exc.printStackTrace(); + done(); + } + } + + public static void main(String[] args) throws Exception { + // random number of writers + int count = 20 + rand.nextInt(16); + Writer[] writers = new Writer[count]; + CountDownLatch latch = new CountDownLatch(count); + + // initiate writing to each file + for (int i=0; i 0) { + for (int j=0; j env = Collections.emptyMap(); + URI uri = URI.create("pass:///"); + return provider.newFileSystem(uri, env); + } + + @Override + public FileSystemProvider provider() { + return provider; + } + + @Override + public void close() throws IOException { + delegate.close(); + } + + @Override + public boolean isOpen() { + return delegate.isOpen(); + } + + @Override + public boolean isReadOnly() { + return delegate.isReadOnly(); + } + + @Override + public String getSeparator() { + return delegate.getSeparator(); + } + + @Override + public Iterable getRootDirectories() { + final Iterable roots = delegate.getRootDirectories(); + return new Iterable() { + @Override + public Iterator iterator() { + final Iterator itr = roots.iterator(); + return new Iterator() { + @Override + public boolean hasNext() { + return itr.hasNext(); + } + @Override + public Path next() { + return new PassThroughPath(delegate, itr.next()); + } + @Override + public void remove() { + itr.remove(); + } + }; + } + }; + } + + @Override + public Iterable getFileStores() { + // assume that unwrapped objects aren't exposed + return delegate.getFileStores(); + } + + @Override + public Set supportedFileAttributeViews() { + // assume that unwrapped objects aren't exposed + return delegate.supportedFileAttributeViews(); + } + + @Override + public Path getPath(String path) { + return new PassThroughPath(this, delegate.getPath(path)); + } + + @Override + public PathMatcher getPathMatcher(String syntaxAndPattern) { + final PathMatcher matcher = delegate.getPathMatcher(syntaxAndPattern); + return new PathMatcher() { + @Override + public boolean matches(Path path) { + return matcher.matches(PassThroughPath.unwrap(path)); + } + }; + } + + @Override + public UserPrincipalLookupService getUserPrincipalLookupService() { + // assume that unwrapped objects aren't exposed + return delegate.getUserPrincipalLookupService(); + } + + @Override + public WatchService newWatchService() throws IOException { + // to keep it simple + throw new UnsupportedOperationException(); + } + + static class PassThroughProvider extends FileSystemProvider { + private static final String SCHEME = "pass"; + private static volatile PassThroughFileSystem delegate; + + public PassThroughProvider() { } + + @Override + public String getScheme() { + return SCHEME; + } + + private void checkScheme(URI uri) { + if (!uri.getScheme().equalsIgnoreCase(SCHEME)) + throw new IllegalArgumentException(); + } + + private void checkUri(URI uri) { + checkScheme(uri); + if (!uri.getSchemeSpecificPart().equals("///")) + throw new IllegalArgumentException(); + } + + @Override + public FileSystem newFileSystem(URI uri, Map env) + throws IOException + { + checkUri(uri); + synchronized (PassThroughProvider.class) { + if (delegate != null) + throw new FileSystemAlreadyExistsException(); + PassThroughFileSystem result = + new PassThroughFileSystem(this, FileSystems.getDefault()); + delegate = result; + return result; + } + } + + @Override + public FileSystem getFileSystem(URI uri) { + checkUri(uri); + FileSystem result = delegate; + if (result == null) + throw new FileSystemNotFoundException(); + return result; + } + + @Override + public Path getPath(URI uri) { + checkScheme(uri); + if (delegate == null) + throw new FileSystemNotFoundException(); + uri = URI.create(delegate.provider().getScheme() + ":" + + uri.getSchemeSpecificPart()); + return new PassThroughPath(delegate, delegate.provider().getPath(uri)); + } + } + + static class PassThroughPath extends Path { + private final FileSystem fs; + private final Path delegate; + + PassThroughPath(FileSystem fs, Path delegate) { + this.fs = fs; + this.delegate = delegate; + } + + private Path wrap(Path path) { + return (path != null) ? new PassThroughPath(fs, path) : null; + } + + static Path unwrap(Path wrapper) { + if (!(wrapper instanceof PassThroughPath)) + throw new ProviderMismatchException(); + return ((PassThroughPath)wrapper).delegate; + } + + @Override + public FileSystem getFileSystem() { + return fs; + } + + @Override + public boolean isAbsolute() { + return delegate.isAbsolute(); + } + + @Override + public Path getRoot() { + return wrap(delegate.getRoot()); + } + + + @Override + public Path getName() { + return wrap(delegate.getName()); + } + + @Override + public Path getParent() { + return wrap(delegate.getParent()); + } + + @Override + public int getNameCount() { + return delegate.getNameCount(); + } + + @Override + public Path getName(int index) { + return wrap(delegate.getName(index)); + } + + @Override + public Path subpath(int beginIndex, int endIndex) { + return wrap(delegate.subpath(beginIndex, endIndex)); + } + + @Override + public boolean startsWith(Path other) { + return delegate.startsWith(unwrap(other)); + } + + @Override + public boolean endsWith(Path other) { + return delegate.endsWith(unwrap(other)); + } + + @Override + public Path normalize() { + return wrap(delegate.normalize()); + } + + @Override + public Path resolve(Path other) { + return wrap(delegate.resolve(unwrap(other))); + } + + @Override + public Path resolve(String other) { + return wrap(delegate.resolve(other)); + } + + @Override + public Path relativize(Path other) { + return wrap(delegate.relativize(unwrap(other))); + } + + @Override + public void setAttribute(String attribute, Object value, LinkOption... options) + throws IOException + { + delegate.setAttribute(attribute, value, options); + } + + @Override + public Object getAttribute(String attribute, LinkOption... options) + throws IOException + { + // assume that unwrapped objects aren't exposed + return delegate.getAttribute(attribute, options); + } + + @Override + public Map readAttributes(String attributes, LinkOption... options) + throws IOException + { + // assume that unwrapped objects aren't exposed + return delegate.readAttributes(attributes, options); + } + + @Override + public V getFileAttributeView(Class type, + LinkOption... options) + { + return delegate.getFileAttributeView(type, options); + } + + @Override + public void delete() throws IOException { + delegate.delete(); + } + + @Override + public void deleteIfExists() throws IOException { + delegate.deleteIfExists(); + } + + @Override + public Path createSymbolicLink(Path target, FileAttribute... attrs) + throws IOException + { + delegate.createSymbolicLink(unwrap(target), attrs); + return this; + } + + @Override + public Path createLink(Path existing) throws IOException { + delegate.createLink(unwrap(existing)); + return this; + } + + @Override + public Path readSymbolicLink() throws IOException { + return wrap(delegate.readSymbolicLink()); + } + + @Override + public URI toUri() { + String ssp = delegate.toUri().getSchemeSpecificPart(); + return URI.create(fs.provider().getScheme() + ":" + ssp); + } + + @Override + public Path toAbsolutePath() { + return wrap(delegate.toAbsolutePath()); + } + + @Override + public Path toRealPath(boolean resolveLinks) throws IOException { + return wrap(delegate.toRealPath(resolveLinks)); + } + + @Override + public Path copyTo(Path target, CopyOption... options) throws IOException { + return wrap(delegate.copyTo(unwrap(target), options)); + } + + @Override + public Path moveTo(Path target, CopyOption... options) throws IOException { + return wrap(delegate.copyTo(unwrap(target), options)); + } + + private DirectoryStream wrap(final DirectoryStream stream) { + return new DirectoryStream() { + @Override + public Iterator iterator() { + final Iterator itr = stream.iterator(); + return new Iterator() { + @Override + public boolean hasNext() { + return itr.hasNext(); + } + @Override + public Path next() { + return wrap(itr.next()); + } + @Override + public void remove() { + itr.remove(); + } + }; + } + @Override + public void close() throws IOException { + stream.close(); + } + }; + } + + @Override + public DirectoryStream newDirectoryStream() throws IOException { + return wrap(delegate.newDirectoryStream()); + } + + @Override + public DirectoryStream newDirectoryStream(String glob) + throws IOException + { + return wrap(delegate.newDirectoryStream(glob)); + } + + @Override + public DirectoryStream newDirectoryStream(DirectoryStream.Filter filter) + throws IOException + { + return wrap(delegate.newDirectoryStream(filter)); + } + + @Override + public Path createFile(FileAttribute... attrs) throws IOException { + delegate.createFile(attrs); + return this; + } + + @Override + public Path createDirectory(FileAttribute... attrs) + throws IOException + { + delegate.createDirectory(attrs); + return this; + } + + @Override + public SeekableByteChannel newByteChannel(Set options, + FileAttribute... attrs) + throws IOException + { + return delegate.newByteChannel(options, attrs); + } + + @Override + public SeekableByteChannel newByteChannel(OpenOption... options) + throws IOException + { + return delegate.newByteChannel(options); + } + + @Override + public InputStream newInputStream(OpenOption... options) throws IOException { + return delegate.newInputStream(); + } + + @Override + public OutputStream newOutputStream(OpenOption... options) + throws IOException + { + return delegate.newOutputStream(options); + } + + @Override + public boolean isHidden() throws IOException { + return delegate.isHidden(); + } + + @Override + public void checkAccess(AccessMode... modes) throws IOException { + delegate.checkAccess(modes); + } + + @Override + public boolean exists() { + return delegate.exists(); + } + + @Override + public boolean notExists() { + return delegate.notExists(); + } + + @Override + public FileStore getFileStore() throws IOException { + return delegate.getFileStore(); + } + + @Override + public WatchKey register(WatchService watcher, + WatchEvent.Kind[] events, + WatchEvent.Modifier... modifiers) + { + throw new UnsupportedOperationException(); + } + + @Override + public WatchKey register(WatchService watcher, + WatchEvent.Kind... events) + { + throw new UnsupportedOperationException(); + } + + + @Override + public Iterator iterator() { + final Iterator itr = delegate.iterator(); + return new Iterator() { + @Override + public boolean hasNext() { + return itr.hasNext(); + } + @Override + public Path next() { + return wrap(itr.next()); + } + @Override + public void remove() { + itr.remove(); + } + }; + } + + @Override + public int compareTo(Path other) { + return delegate.compareTo(unwrap(other)); + } + + @Override + public boolean isSameFile(Path other) throws IOException { + return delegate.isSameFile(unwrap(other)); + } + + + @Override + public boolean equals(Object other) { + if (!(other instanceof PassThroughPath)) + return false; + return delegate.equals(unwrap((PassThroughPath)other)); + } + + @Override + public int hashCode() { + return delegate.hashCode(); + } + + @Override + public String toString() { + return delegate.toString(); + } + } +} diff --git a/test/java/nio/file/Path/delete_on_close.sh b/test/java/nio/file/Path/delete_on_close.sh index 198e99d7201a422d99f6a73e22b5871792990d35..c7f3299e144a63de26c18587a35cef871db566c5 100644 --- a/test/java/nio/file/Path/delete_on_close.sh +++ b/test/java/nio/file/Path/delete_on_close.sh @@ -40,7 +40,7 @@ fi OS=`uname -s` case "$OS" in - Windows_* ) + Windows_* | CYGWIN* ) CLASSPATH="${TESTCLASSES};${TESTSRC}" ;; * ) diff --git a/test/java/nio/file/TestUtil.java b/test/java/nio/file/TestUtil.java index 2436a45992c5b217d1c09717312ef776ef3e4fd2..972dc250d87d8aa4fcf0a5e8321893dca25d704c 100644 --- a/test/java/nio/file/TestUtil.java +++ b/test/java/nio/file/TestUtil.java @@ -30,17 +30,20 @@ public class TestUtil { private TestUtil() { } - public static Path createTemporaryDirectory() throws IOException { - Path tmpdir = Paths.get(System.getProperty("java.io.tmpdir")); + static Path createTemporaryDirectory(String where) throws IOException { + Path top = FileSystems.getDefault().getPath(where); Random r = new Random(); - Path dir; do { - dir = tmpdir.resolve("name" + r.nextInt()); + dir = top.resolve("name" + r.nextInt()); } while (dir.exists()); return dir.createDirectory(); } + static Path createTemporaryDirectory() throws IOException { + return createTemporaryDirectory(System.getProperty("java.io.tmpdir")); + } + static void removeAll(Path dir) { Files.walkFileTree(dir, new FileVisitor() { @Override diff --git a/test/java/nio/file/WatchService/OverflowEventIsLoner.java b/test/java/nio/file/WatchService/OverflowEventIsLoner.java new file mode 100644 index 0000000000000000000000000000000000000000..0b48a942d844b7d90b1c1bfd48bf1e2e12bb9c35 --- /dev/null +++ b/test/java/nio/file/WatchService/OverflowEventIsLoner.java @@ -0,0 +1,122 @@ +/* + * Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ + +/* @test + * @bug 6907760 + * @summary Check that the OVERFLOW event is not retrieved with other events + * @library .. + */ + +import java.nio.file.*; +import static java.nio.file.StandardWatchEventKind.*; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.TimeUnit; + +public class OverflowEventIsLoner { + + static void drainEvents(WatchService watcher, + WatchEvent.Kind expectedKind, + int count) + throws IOException, InterruptedException + { + // wait for key to be signalled - the timeout is long to allow for + // polling implementations + WatchKey key = watcher.poll(15, TimeUnit.SECONDS); + if (key != null && count == 0) + throw new RuntimeException("Key was signalled (unexpected)"); + if (key == null && count > 0) + throw new RuntimeException("Key not signalled (unexpected)"); + + int nread = 0; + boolean gotOverflow = false; + do { + List> events = key.pollEvents(); + for (WatchEvent event: events) { + WatchEvent.Kind kind = event.kind(); + if (kind == expectedKind) { + // expected event kind + if (++nread > count) + throw new RuntimeException("More events than expected!!"); + } else if (kind == OVERFLOW) { + // overflow event should not be retrieved with other events + if (events.size() > 1) + throw new RuntimeException("Overflow retrieved with other events"); + gotOverflow = true; + } else { + throw new RuntimeException("Unexpected event '" + kind + "'"); + } + } + if (!key.reset()) + throw new RuntimeException("Key is no longer valid"); + key = watcher.poll(2, TimeUnit.SECONDS); + } while (key != null); + + // check that all expected events were received or there was an overflow + if (nread < count && !gotOverflow) + throw new RuntimeException("Insufficient events"); + } + + + static void test(Path dir) throws IOException, InterruptedException { + WatchService watcher = dir.getFileSystem().newWatchService(); + try { + WatchKey key = dir.register(watcher, ENTRY_CREATE, ENTRY_DELETE); + + // create a lot of files + int n = 1024; + Path[] files = new Path[n]; + for (int i=0; i(CAPACITY), pairs, iters); oneRun(new LinkedBlockingQueue(CAPACITY), pairs, iters); oneRun(new LinkedBlockingDeque(CAPACITY), pairs, iters); - oneRun(new LinkedTransferQueue(), pairs, iters); - oneRun(new LTQasSQ(), pairs, iters); - oneRun(new HalfSyncLTQ(), pairs, iters); oneRun(new SynchronousQueue(), pairs, iters / 8); - /* PriorityBlockingQueue is unbounded + /* TODO: unbounded queue implementations are prone to OOME oneRun(new PriorityBlockingQueue(iters / 2 * pairs), pairs, iters / 4); + oneRun(new LinkedTransferQueue(), pairs, iters); + oneRun(new LTQasSQ(), pairs, iters); + oneRun(new HalfSyncLTQ(), pairs, iters); */ } diff --git a/test/java/util/jar/JarFile/TurkCert.java b/test/java/util/jar/JarFile/TurkCert.java index 8be8fd837ab156cb8cb3df8f9b5d81880a3629c6..da044a9ace6f1112d59ddfa0eae204b9585710b2 100644 --- a/test/java/util/jar/JarFile/TurkCert.java +++ b/test/java/util/jar/JarFile/TurkCert.java @@ -26,6 +26,7 @@ * @bug 4624534 * @summary Make sure jar certificates work for Turkish locale * @author kladko + * @run main/othervm TurkCert */ import java.util.*; diff --git a/test/javax/imageio/stream/StreamCloserLeak/run_test.sh b/test/javax/imageio/stream/StreamCloserLeak/run_test.sh index af3e428cb30a98664d4ad96f4a33998b8897d0dc..f60cfd5d52ab4c82facd96b854c96097d651a6cc 100644 --- a/test/javax/imageio/stream/StreamCloserLeak/run_test.sh +++ b/test/javax/imageio/stream/StreamCloserLeak/run_test.sh @@ -92,7 +92,7 @@ case "$OS" in TMP="/tmp" ;; - Windows_95 | Windows_98 | Windows_NT | Windows_ME ) + Windows_95 | Windows_98 | Windows_NT | Windows_ME | CYGWIN* ) VAR="A different value for Win32" DEFAULT_JDK=/usr/local/java/jdk1.2/win32 FILESEP="\\" diff --git a/test/javax/print/DialogMargins.java b/test/javax/print/DialogMargins.java new file mode 100644 index 0000000000000000000000000000000000000000..5168bb140d1bc34421367488d2dde7fc9bc067a7 --- /dev/null +++ b/test/javax/print/DialogMargins.java @@ -0,0 +1,244 @@ +/* + * Copyright 2001-2010 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Sun designates this + * particular file as subject to the "Classpath" exception as provided + * by Sun in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ + +/** + * @test + * @bug 4485755 6361370 6448717 5080051 + * @summary dialog doesn't have way to specify margins + * for 6361370, verify exception for offline printer in Windows + * for 6448717, faster display of print dialog + * for 6500903, verify status of printer if accepting jobs or not + * @author prr + * @run main/manual DialogMargins + */ + +import java.awt.*; +import java.awt.event.*; +import java.awt.print.*; +import javax.print.*; +import javax.print.attribute.*; +import javax.print.attribute.standard.*; + +public class DialogMargins extends Frame { + + public DialogMargins() { + super("Dialog Margins Test"); + + Button printButton = new Button ("Print ..."); + add("Center", printButton); + printButton.addActionListener(new ActionListener() { + public void actionPerformed (ActionEvent e) { + new MarginsPrinter(); + } + }); + + addWindowListener (new WindowAdapter() { + public void windowClosing (WindowEvent e) { + dispose(); + } + + }); + + pack(); + setVisible (true); + } + +class MarginsPrinter implements Printable { + + PrinterJob myPrinterJob; + PageFormat myPageFormat; + + public MarginsPrinter() { + PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet(); + //aset.add(MediaSizeName.ISO_A4); + //aset.add(new MediaPrintableArea(0f,0f,210f,297f,MediaPrintableArea.MM)); + myPrinterJob = PrinterJob.getPrinterJob(); + myPageFormat = myPrinterJob.pageDialog(aset); + myPrinterJob.setPrintable(this, myPageFormat); + //myPrinterJob.setPrintable(this); + if (myPrinterJob.printDialog(aset)) { + try { + //PrintRequestAttributeSet newaset = + //new HashPrintRequestAttributeSet(); + myPrinterJob.print(aset); + + } catch (PrinterException pe ) { + System.out.println("DialogMargins Exception caught:" + pe); + } + } + } + + public int print(Graphics graphics, PageFormat pageFormat, int pageIndex) { + + if (pageIndex > 0) { + return Printable.NO_SUCH_PAGE; + } + + Graphics2D g2d = (Graphics2D)graphics; + g2d.translate(pageFormat.getImageableX(), pageFormat.getImageableY()); + g2d.drawString("ORIGIN("+pageFormat.getImageableX()+","+ + pageFormat.getImageableY()+")", 20, 20); + g2d.drawString("X THIS WAY", 200, 50); + g2d.drawString("Y THIS WAY", 60 , 200); + g2d.drawString("Graphics is " + g2d.getClass().getName(), 100, 100); + g2d.drawRect(0,0,(int)pageFormat.getImageableWidth(), + (int)pageFormat.getImageableHeight()); + g2d.setColor(Color.black); + g2d.drawRect(1,1,(int)pageFormat.getImageableWidth()-2, + (int)pageFormat.getImageableHeight()-2); + + return Printable.PAGE_EXISTS; + } + +} + public static void main( String[] args) { + + String[] instructions = + { + "You must have a printer available to perform this test", + "Specify various pageformats and compare the printed results with the", + "request." + }; + Sysout.createDialog( ); + Sysout.printInstructions( instructions ); + + new DialogMargins(); + } +} + + +class Sysout { + private static TestDialog dialog; + + public static void createDialogWithInstructions( String[] instructions ) + { + dialog = new TestDialog( new Frame(), "Instructions" ); + dialog.printInstructions( instructions ); + dialog.show(); + println( "Any messages for the tester will display here." ); + } + + public static void createDialog( ) + { + dialog = new TestDialog( new Frame(), "Instructions" ); + String[] defInstr = { "Instructions will appear here. ", "" } ; + dialog.printInstructions( defInstr ); + dialog.show(); + println( "Any messages for the tester will display here." ); + } + + + public static void printInstructions( String[] instructions ) + { + dialog.printInstructions( instructions ); + } + + + public static void println( String messageIn ) + { + dialog.displayMessage( messageIn ); + } + +}// Sysout class + +/** + This is part of the standard test machinery. It provides a place for the + test instructions to be displayed, and a place for interactive messages + to the user to be displayed. + To have the test instructions displayed, see Sysout. + To have a message to the user be displayed, see Sysout. + Do not call anything in this dialog directly. + */ +class TestDialog extends Dialog { + + TextArea instructionsText; + TextArea messageText; + int maxStringLength = 80; + + //DO NOT call this directly, go through Sysout + public TestDialog( Frame frame, String name ) + { + super( frame, name ); + int scrollBoth = TextArea.SCROLLBARS_BOTH; + instructionsText = new TextArea( "", 15, maxStringLength, scrollBoth ); + add( "North", instructionsText ); + + messageText = new TextArea( "", 5, maxStringLength, scrollBoth ); + add("Center", messageText); + + pack(); + + show(); + }// TestDialog() + + //DO NOT call this directly, go through Sysout + public void printInstructions( String[] instructions ) + { + //Clear out any current instructions + instructionsText.setText( "" ); + + //Go down array of instruction strings + + String printStr, remainingStr; + for( int i=0; i < instructions.length; i++ ) + { + //chop up each into pieces maxSringLength long + remainingStr = instructions[ i ]; + while( remainingStr.length() > 0 ) + { + //if longer than max then chop off first max chars to print + if( remainingStr.length() >= maxStringLength ) + { + //Try to chop on a word boundary + int posOfSpace = remainingStr. + lastIndexOf( ' ', maxStringLength - 1 ); + + if( posOfSpace <= 0 ) posOfSpace = maxStringLength - 1; + + printStr = remainingStr.substring( 0, posOfSpace + 1 ); + remainingStr = remainingStr.substring( posOfSpace + 1 ); + } + //else just print + else + { + printStr = remainingStr; + remainingStr = ""; + } + + instructionsText.append( printStr + "\n" ); + + }// while + + }// for + + }//printInstructions() + + //DO NOT call this directly, go through Sysout + public void displayMessage( String messageIn ) + { + messageText.append( messageIn + "\n" ); + } + + }// TestDialog class diff --git a/test/javax/print/StreamPrintingOrientation.java b/test/javax/print/StreamPrintingOrientation.java new file mode 100644 index 0000000000000000000000000000000000000000..d0a4ec534a33f9a4872f0278340ea678794345a4 --- /dev/null +++ b/test/javax/print/StreamPrintingOrientation.java @@ -0,0 +1,120 @@ +/* + * Copyright 2003-2010 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Sun designates this + * particular file as subject to the "Classpath" exception as provided + * by Sun in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ + +/* + * @test + * @bug 4904236 + * @summary You would see a cross-platform print dialog being popped up. Check whether orientation is shown as LANDSCAPE. Click 'OK'. 'streamexample.ps' will be created in the same dir where this application was executed. Pass if the orientation in the ps file is landscape. + * @run main/manual StreamPrintingOrientation + */ + +import java.awt.*; +import java.awt.print.*; +import javax.print.*; +import javax.print.attribute.standard.*; +import javax.print.attribute.*; +import java.io.FileOutputStream; +import java.io.File; +import java.util.Locale; + +class StreamPrintingOrientation implements Printable { + /** + * Constructor + */ + public StreamPrintingOrientation() { + super(); + } + /** + * Starts the application. + */ + public static void main(java.lang.String[] args) { + StreamPrintingOrientation pd = new StreamPrintingOrientation(); + PrinterJob pj = PrinterJob.getPrinterJob(); + HashPrintRequestAttributeSet prSet = new HashPrintRequestAttributeSet(); + PrintService service = null; + + FileOutputStream fos = null; + File f = null, f1 = null; + String mType = "application/postscript"; + + try { + f = new File("streamexample.ps"); + fos = new FileOutputStream(f); + StreamPrintServiceFactory[] factories = PrinterJob.lookupStreamPrintServices(mType); + if (factories.length > 0) + service = factories[0].getPrintService(fos); + + if (service != null) { + System.out.println("Stream Print Service "+service); + pj.setPrintService(service); + } else { + throw new RuntimeException("No stream Print Service available."); + } + } catch (Exception e) { + e.printStackTrace(); + } + + pj.setPrintable(pd); + prSet.add(OrientationRequested.LANDSCAPE); + prSet.add(new Copies(3)); + prSet.add(new JobName("orientation test", null)); + System.out.println("open PrintDialog.."); + if (pj.printDialog(prSet)) { + try { + System.out.println("\nValues in attr set passed to print method"); + Attribute attr[] = prSet.toArray(); + for (int x = 0; x < attr.length; x ++) { + System.out.println("Name "+attr[x].getName()+" "+attr[x]); + } + System.out.println("About to print the data ..."); + if (service != null) { + System.out.println("TEST: calling Print"); + pj.print(prSet); + System.out.println("TEST: Printed"); + } + } + catch (PrinterException pe) { + pe.printStackTrace(); + } + } + + } + + //printable interface + public int print(Graphics g, PageFormat pf, int pi) throws PrinterException { + + if (pi > 0) { + return Printable.NO_SUCH_PAGE; + } + // Simply draw two rectangles + Graphics2D g2 = (Graphics2D)g; + g2.setColor(Color.black); + g2.translate(pf.getImageableX(), pf.getImageableY()); + System.out.println("StreamPrinting Test Width "+pf.getWidth()+" Height "+pf.getHeight()); + g2.drawRect(1,1,200,300); + g2.drawRect(1,1,25,25); + return Printable.PAGE_EXISTS; + } +} diff --git a/test/javax/print/attribute/AttributeTest.java b/test/javax/print/attribute/AttributeTest.java new file mode 100644 index 0000000000000000000000000000000000000000..c9ea142686f54967aa1e5aa05f6549a7d376075a --- /dev/null +++ b/test/javax/print/attribute/AttributeTest.java @@ -0,0 +1,70 @@ +/* + * Copyright 2006-2010 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ + +/* + * @test + * @bug 6387255 + * @summary Tests conflict of Media values returned by isAttrValueSupported and getSupportedAttrValues. No runtime exception should be thrown. + * @run main AttributeTest + */ +import javax.print.*; +import javax.print.attribute.standard.*; +import javax.print.attribute.*; + +public class AttributeTest { + + public AttributeTest() { + + PrintService service[] = PrintServiceLookup.lookupPrintServices(null, null); + + if (service.length == 0) { + throw new RuntimeException("No printer found. TEST ABORTED"); + } + + for (int x = 0; x < service.length; x ++) { + DocFlavor flavors[] = service[x].getSupportedDocFlavors(); + + for (int y = 0; y < flavors.length; y ++) { + Object attrVal = service[x].getSupportedAttributeValues(Media.class, flavors[y], null); + if (attrVal == null) { + continue; + } + Media attr[] = (Media[]) attrVal; + for (int z = 0; z < attr.length; z ++) { + if (!service[x].isAttributeValueSupported(attr[z], flavors[y], null)) { + throw new RuntimeException("ERROR: There is a conflict between getSupportedAttrValues " + + " and isAttributeValueSupported, for the attribute: " + attr[z] + + ", where the flavor is: " + flavors[y] + " and the print service is: " + + service[x] + "\n"); + } + } + } + } + + System.out.println("Test Passed"); + } + + public static void main (String args[]) { + AttributeTest test = new AttributeTest(); + } +} diff --git a/test/javax/print/attribute/ServiceDialogTest.java b/test/javax/print/attribute/ServiceDialogTest.java new file mode 100644 index 0000000000000000000000000000000000000000..a1d6006b8e39fb68339f208274d640e1c720a446 --- /dev/null +++ b/test/javax/print/attribute/ServiceDialogTest.java @@ -0,0 +1,307 @@ +/* + * Copyright 2004-2009 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ + + +/** + * @test + * @bug 4910388 4871089 4998624 + * @summary Confirm that + * 1. After choosing Reverse Landscape in the system default print + * Print Service (2nd in the list), it + * will reset to portrait in "Test Printer" + * 2. Print To File button is not cleared when switching between the + * 2nd service (system default printer) and Test Printer. + * 3. Make sure "Postscript" printer is the default and make sure the + * "print to file" button is disabled. File Dialog should not be + * shown after pressing print button. + * + * @run main/manual ServiceDialogTest + */ +import java.awt.*; +import javax.print.*; +import javax.print.attribute.standard.*; +import javax.print.attribute.*; +import javax.print.event.*; +import java.io.*; +import java.util.Locale; + +public class ServiceDialogTest { + /** + * Constructor + */ + public ServiceDialogTest() { + super(); + } + /** + * Starts the application. + */ + public static void main(java.lang.String[] args) { + ServiceDialogTest pd = new ServiceDialogTest(); + PrintService services[] = new PrintService[3]; + services[1] = PrintServiceLookup.lookupDefaultPrintService(); + + FileOutputStream fos = null; + File f = null; + String mType = "application/postscript"; + DocFlavor flavor = DocFlavor.INPUT_STREAM.JPEG; + try { + f = new File("streamexample.ps"); + fos = new FileOutputStream(f); + StreamPrintServiceFactory[] factories = StreamPrintServiceFactory.lookupStreamPrintServiceFactories(flavor, mType); + if (factories.length > 0) { + services[0] = factories[0].getPrintService(fos); + } else { + throw new RuntimeException("No StreamPrintService available which would support "+flavor"); + } + + services[2] = new TestPrintService("Test Printer"); + + //System.out.println("is "+flavor+" supported? "+services[0].isDocFlavorSupported(flavor)); + //System.out.println("is Orientation supported? "+services[0].isAttributeCategorySupported(OrientationRequested.class)); + //System.out.println("is REVERSE PORTRAIT supported ? "+services[0].isAttributeValueSupported(OrientationRequested.REVERSE_PORTRAIT, flavor, null)); + + HashPrintRequestAttributeSet prSet = new HashPrintRequestAttributeSet(); + prSet.add(new Destination(new File("./dest.prn").toURI())); + PrintService selService = ServiceUI.printDialog(null, 200, 200, services, services[0], flavor, prSet); + Attribute attr[] = prSet.toArray(); + for (int x = 0; x < attr.length; x ++) { + System.out.println(attr[x]); + } + + //DocPrintJob pj = service.createPrintJob(); + //PrintDocument prDoc = new PrintDocument(); + //pj.print(prDoc, null); + + } catch (Exception e) { + e.printStackTrace(); + } + } +} + + +class TestPrintService implements PrintService +{ + + private static DocFlavor textByteFlavor = null; + private static final DocFlavor supportedDocFlavors[] = (new DocFlavor[] { + javax.print.DocFlavor.INPUT_STREAM.JPEG + }); + + private static final Class serviceAttrCats[] = (new Class[] { + javax.print.attribute.standard.PrinterName.class + }); + + private static final Class otherAttrCats[] = (new Class [] { + javax.print.attribute.standard.Copies.class, + javax.print.attribute.standard.OrientationRequested.class, + javax.print.attribute.standard.Destination.class, + }); + + private String printer = null; + + public TestPrintService() { + } + + public TestPrintService(String printerName) { + if (printerName == null) { + throw new IllegalArgumentException("null printer name"); + } else { + printer = printerName; + } + } + + public String getName() + { + return printer; + } + + + public DocPrintJob createPrintJob() + { + return null; + } + + public PrintServiceAttributeSet getUpdatedAttributes() + { + return null; + } + + + public void addPrintServiceAttributeListener(PrintServiceAttributeListener printserviceattributelistener) + { + } + + public void removePrintServiceAttributeListener(PrintServiceAttributeListener printserviceattributelistener) + { + } + + public PrintServiceAttribute getAttribute(Class category) + { + return null; + } + + public PrintServiceAttributeSet getAttributes() + { + HashPrintServiceAttributeSet aSet = new HashPrintServiceAttributeSet(); + return aSet; + } + + public DocFlavor[] getSupportedDocFlavors() + { + int i = supportedDocFlavors.length; + DocFlavor adocflavor[] = new DocFlavor[i]; + System.arraycopy(supportedDocFlavors, 0, adocflavor, 0, i); + return adocflavor; + } + + public boolean isDocFlavorSupported(DocFlavor docflavor) + { + for (int i = 0; i < supportedDocFlavors.length; i++) { + if (docflavor.equals(supportedDocFlavors[i])) { + return true; + } + } + return false; + } + + public Class[] getSupportedAttributeCategories() + { + int i = otherAttrCats.length; + Class aclass[] = new Class[i]; + System.arraycopy(otherAttrCats, 0, aclass, 0, otherAttrCats.length); + return aclass; + } + + public boolean isAttributeCategorySupported(Class category) + { + if (category == null) { + throw new NullPointerException("null category"); + } + + for (int i = 0; i < otherAttrCats.length; i++) { + if (category == otherAttrCats[i]) { + return true; + } + } + return false; + } + + public boolean isAttributeValueSupported(Attribute attrval, DocFlavor flavor, AttributeSet attributes) { + + if (attrval == OrientationRequested.PORTRAIT) + return true; + else if (attrval == OrientationRequested.LANDSCAPE) + return true; + else + return false; + } + + public Object getDefaultAttributeValue(Class category) + { + if (category == null) { + throw new NullPointerException("null category"); + } + if (category == javax.print.attribute.standard.Copies.class) + return new Copies(1); + + if (category == javax.print.attribute.standard.OrientationRequested.class) + return OrientationRequested.PORTRAIT; + + return null; + } + + public Object getSupportedAttributeValues(Class category, DocFlavor docflavor, AttributeSet attributeset) + { + if (category == null) { + throw new NullPointerException("null category"); + } + + if (docflavor != null) { + if (!isDocFlavorSupported(docflavor)) { + throw new IllegalArgumentException(docflavor + " is an unsupported flavor"); + } + } + if (!isAttributeCategorySupported(category)) { + return null; + } + if (category == javax.print.attribute.standard.Copies.class ) { + return new CopiesSupported(1, 5); + } + if (category == javax.print.attribute.standard.OrientationRequested.class ) { + OrientationRequested req[] = { OrientationRequested.PORTRAIT, OrientationRequested.LANDSCAPE }; + return req; + } + + return null; + } + + public AttributeSet getUnsupportedAttributes(DocFlavor docflavor, AttributeSet attributeset) { + + if (docflavor != null && !isDocFlavorSupported(docflavor)) { + throw new IllegalArgumentException("flavor " + docflavor + "is not supported"); + } + if (attributeset == null) { + return null; + } + + HashAttributeSet hashattributeset = new HashAttributeSet(); + Attribute attributearray[] = attributeset.toArray(); + for (int i = 0; i < attributearray.length; i++) { + try { + Attribute attribute = attributearray[i]; + if (!isAttributeCategorySupported(attribute.getCategory())) { + hashattributeset.add(attribute); + } else { + if (!isAttributeValueSupported(attribute, docflavor, attributeset)) { + hashattributeset.add(attribute); + } + } + } + catch (ClassCastException classcastexception) { + + } + } + + if (hashattributeset.isEmpty()) { + return null; + } + return hashattributeset; + } + + public ServiceUIFactory getServiceUIFactory() { + return null; + } + + public String toString() { + return "Printer : " + getName(); + } + + public boolean equals(Object obj) { + return obj == this || (obj instanceof TestPrintService) && ((TestPrintService)obj).getName().equals(getName()); + } + + public int hashCode() { + return getClass().hashCode() + getName().hashCode(); + } + +} diff --git a/test/javax/print/attribute/SidesPageRangesTest.java b/test/javax/print/attribute/SidesPageRangesTest.java index cf48761613701f76fd0da5f509db229b25c7dafb..73c23a7ed42f1be2188caa3d87c17de1f5f4bf63 100644 --- a/test/javax/print/attribute/SidesPageRangesTest.java +++ b/test/javax/print/attribute/SidesPageRangesTest.java @@ -64,7 +64,7 @@ public class SidesPageRangesTest { System.out.println("\nPageRanges Attribute category is supported"); } else { System.out.println("\nPageRanges Attribute category is not supported. terminating..."); - System.exit(1); + return; } flavors = defService.getSupportedDocFlavors(); diff --git a/test/javax/script/CommonSetup.sh b/test/javax/script/CommonSetup.sh index e76da82125b848dd80bde5a0ea465652334e6db9..4a66829131fdd40da91542a6a54a2d1e1a05200f 100644 --- a/test/javax/script/CommonSetup.sh +++ b/test/javax/script/CommonSetup.sh @@ -49,6 +49,12 @@ case "$OS" in OS="Windows" FS="\\" ;; + CYGWIN* ) + PS=";" + OS="Windows" + FS="\\" + isCygwin=true + ;; * ) echo "Unrecognized system!" exit 1; diff --git a/test/javax/script/ProviderTest.sh b/test/javax/script/ProviderTest.sh index 211d9edc1d90f9865de021b6a5635535f0175bc6..a32383e4078e5d4c443425b7d32b4fbe30be4e81 100644 --- a/test/javax/script/ProviderTest.sh +++ b/test/javax/script/ProviderTest.sh @@ -46,5 +46,5 @@ $JAR -cf ${TESTCLASSES}/dummy.jar \ echo "Running test ..." $JAVA -classpath \ - ${TESTCLASSES}${PS}${TESTCLASSES}/dummy.jar \ + "${TESTCLASSES}${PS}${TESTCLASSES}/dummy.jar" \ ProviderTest diff --git a/test/javax/xml/crypto/dsig/GenerationTests.java b/test/javax/xml/crypto/dsig/GenerationTests.java index 13881966d327b267dc6582776867ef348ecfdf52..1ed649cd83ad7afc3a474d62e5286612cb543498 100644 --- a/test/javax/xml/crypto/dsig/GenerationTests.java +++ b/test/javax/xml/crypto/dsig/GenerationTests.java @@ -23,7 +23,7 @@ /** * @test - * @bug 4635230 6283345 6303830 6824440 + * @bug 4635230 6283345 6303830 6824440 6867348 * @summary Basic unit tests for generating XML Signatures with JSR 105 * @compile -XDignore.symbol.file KeySelectors.java SignatureValidator.java * X509KeySelector.java GenerationTests.java @@ -126,13 +126,14 @@ public class GenerationTests { test_create_signature_x509_is(); test_create_signature_x509_ski(); test_create_signature_x509_sn(); -// test_create_signature(); + test_create_signature(); test_create_exc_signature(); test_create_sign_spec(); test_create_signature_enveloping_sha256_dsa(); test_create_signature_enveloping_sha384_rsa_sha256(); test_create_signature_enveloping_sha512_rsa_sha384(); test_create_signature_enveloping_sha512_rsa_sha512(); + test_create_signature_reference_dependency(); } private static void setup() throws Exception { @@ -410,6 +411,55 @@ public class GenerationTests { System.out.println(); } + static void test_create_signature_reference_dependency() throws Exception { + System.out.println("* Generating signature-reference-dependency.xml"); + // create references + List refs = Collections.singletonList + (fac.newReference("#object-1", sha1)); + + // create SignedInfo + SignedInfo si = fac.newSignedInfo(withoutComments, rsaSha1, refs); + + // create objects + List objs = new ArrayList(); + + // Object 1 + List manRefs = Collections.singletonList + (fac.newReference("#object-2", sha1)); + objs.add(fac.newXMLObject(Collections.singletonList + (fac.newManifest(manRefs, "manifest-1")), "object-1", null, null)); + + // Object 2 + Document doc = db.newDocument(); + Element nc = doc.createElementNS(null, "NonCommentandus"); + nc.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns", ""); + nc.appendChild(doc.createComment(" Commentandum ")); + objs.add(fac.newXMLObject(Collections.singletonList + (new DOMStructure(nc)), "object-2", null, null)); + + // create XMLSignature + XMLSignature sig = fac.newXMLSignature(si, rsa, objs, "signature", null); + DOMSignContext dsc = new DOMSignContext(getPrivateKey("RSA"), doc); + + sig.sign(dsc); + +// dumpDocument(doc, new PrintWriter(System.out)); + + DOMValidateContext dvc = new DOMValidateContext + (kvks, doc.getDocumentElement()); + XMLSignature sig2 = fac.unmarshalXMLSignature(dvc); + + if (sig.equals(sig2) == false) { + throw new Exception + ("Unmarshalled signature is not equal to generated signature"); + } + if (sig2.validate(dvc) == false) { + throw new Exception("Validation of generated signature failed"); + } + + System.out.println(); + } + static void test_create_signature() throws Exception { System.out.println("* Generating signature.xml"); @@ -645,6 +695,7 @@ public class GenerationTests { envDoc.getElementsByTagName("YoursSincerely").item(0); DOMSignContext dsc = new DOMSignContext(signingKey, ys); + dsc.setURIDereferencer(httpUd); sig.sign(dsc); @@ -660,6 +711,7 @@ public class GenerationTests { DOMValidateContext dvc = new DOMValidateContext (new X509KeySelector(ks), sigElement); + dvc.setURIDereferencer(httpUd); File f = new File( System.getProperty("dir.test.vector.baltimore") + System.getProperty("file.separator") + diff --git a/test/sun/jvmstat/testlibrary/utils.sh b/test/sun/jvmstat/testlibrary/utils.sh index d3b0495637329df2218f2342f802ac14ae7127e3..8bd4215d0885368bb69d7ee78d06b2b464399936 100644 --- a/test/sun/jvmstat/testlibrary/utils.sh +++ b/test/sun/jvmstat/testlibrary/utils.sh @@ -40,7 +40,7 @@ setup() { OS=`uname -s` case ${OS} in - Windows_*) + Windows_* | CYGWIN*) PS=";" FS="\\" ;; @@ -54,7 +54,7 @@ setup() { verify_os() { OS=`uname -s` case ${OS} in - Windows_95 | Windows_98 | Windows_ME) + Windows_95 | Windows_98 | Windows_ME | CYGWIN* ) echo "Test bypassed: jvmstat feature not supported on ${OS}" exit 0 ;; diff --git a/test/sun/management/jmxremote/bootstrap/GeneratePropertyPassword.sh b/test/sun/management/jmxremote/bootstrap/GeneratePropertyPassword.sh index b06a4073b61fb04772334365dde9061edcc87c56..283c6cde2ab176a4efa4499b9a5e4e1eaf42cb5b 100644 --- a/test/sun/management/jmxremote/bootstrap/GeneratePropertyPassword.sh +++ b/test/sun/management/jmxremote/bootstrap/GeneratePropertyPassword.sh @@ -45,7 +45,7 @@ cat < ${TMP_FILE} s^@TEST-SRC@/^${TESTCLASSES}${DFILESEP}^g EOF ;; -Windows_95 | Windows_98 | Windows_NT | Windows_ME) +Windows_95 | Windows_98 | Windows_NT | Windows_ME | CYGWIN*) PATHSEP=";" FILESEP="\\" DFILESEP=$FILESEP$FILESEP diff --git a/test/sun/misc/URLClassPath/ClassnameCharTest.sh b/test/sun/misc/URLClassPath/ClassnameCharTest.sh index 9cc5c58b555754f97b01357c366490678b9707e5..3e1db07e0173efcc232098db7649ed9bb6bf8578 100644 --- a/test/sun/misc/URLClassPath/ClassnameCharTest.sh +++ b/test/sun/misc/URLClassPath/ClassnameCharTest.sh @@ -44,7 +44,7 @@ case "$OS" in PS=":" FS="/" ;; - Windows* ) + Windows* | CYGWIN* ) PS=";" FS="\\" ;; @@ -59,6 +59,6 @@ cd ${TESTCLASSES} ${TESTJAVA}${FS}bin${FS}jar xvf testclasses.jar "fo o.class" ${TESTJAVA}${FS}bin${FS}javac -d ${TESTCLASSES} ${TESTSRC}${FS}ClassnameCharTest.java -${TESTJAVA}${FS}bin${FS}java -classpath ${TESTCLASSES}${PS}${TESTCLASSES}${FS}sun${FS}misc${FS}URLClassPath ClassnameCharTest +${TESTJAVA}${FS}bin${FS}java -classpath "${TESTCLASSES}${PS}${TESTCLASSES}${FS}sun${FS}misc${FS}URLClassPath" ClassnameCharTest rm -rf "fo o.class" testclasses.jar diff --git a/test/sun/security/krb5/auto/BadKdc.java b/test/sun/security/krb5/auto/BadKdc.java new file mode 100644 index 0000000000000000000000000000000000000000..e4c5267271eabd17e53ce7f5f27af69abe507aca --- /dev/null +++ b/test/sun/security/krb5/auto/BadKdc.java @@ -0,0 +1,113 @@ +/* + * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ + +import java.io.*; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import sun.security.krb5.Config; + +public class BadKdc { + + // Matches the krb5 debug output: + // >>> KDCCommunication: kdc=kdc.rabbit.hole UDP:14319, timeout=2000,... + // ^ kdc# ^ timeout + static final Pattern re = Pattern.compile( + ">>> KDCCommunication: kdc=kdc.rabbit.hole UDP:(\\d)...., " + + "timeout=(\\d)000,"); + public static void go(int[]... expected) + throws Exception { + System.setProperty("sun.security.krb5.debug", "true"); + + // Make sure KDCs' ports starts with 1 and 2 and 3, + // useful for checking debug output. + int p1 = 10000 + new java.util.Random().nextInt(10000); + int p2 = 20000 + new java.util.Random().nextInt(10000); + int p3 = 30000 + new java.util.Random().nextInt(10000); + + FileWriter fw = new FileWriter("alternative-krb5.conf"); + + fw.write("[libdefaults]\n" + + "default_realm = " + OneKDC.REALM + "\n" + + "kdc_timeout = 2000\n"); + fw.write("[realms]\n" + OneKDC.REALM + " = {\n" + + "kdc = " + OneKDC.KDCHOST + ":" + p1 + "\n" + + "kdc = " + OneKDC.KDCHOST + ":" + p2 + "\n" + + "kdc = " + OneKDC.KDCHOST + ":" + p3 + "\n" + + "}\n"); + + fw.close(); + System.setProperty("java.security.krb5.conf", "alternative-krb5.conf"); + Config.refresh(); + + // Turn on k3 only + KDC k3 = on(p3); + + test(expected[0]); + test(expected[1]); + Config.refresh(); + test(expected[2]); + + k3.terminate(); // shutdown k3 + on(p2); // k2 is on + test(expected[3]); + on(p1); // k1 and k2 is on + test(expected[4]); + } + + private static KDC on(int p) throws Exception { + KDC k = new KDC(OneKDC.REALM, OneKDC.KDCHOST, p, true); + k.addPrincipal(OneKDC.USER, OneKDC.PASS); + k.addPrincipalRandKey("krbtgt/" + OneKDC.REALM); + return k; + } + + /** + * One round of test for max_retries and timeout. + * @param timeout the expected timeout + * @param expected the expected kdc# timeout kdc# timeout... + */ + private static void test(int... expected) throws Exception { + ByteArrayOutputStream bo = new ByteArrayOutputStream(); + PrintStream oldout = System.out; + System.setOut(new PrintStream(bo)); + Context c = Context.fromUserPass(OneKDC.USER, OneKDC.PASS, false); + System.setOut(oldout); + + String[] lines = new String(bo.toByteArray()).split("\n"); + System.out.println("----------------- TEST -----------------"); + int count = 0; + for (String line: lines) { + Matcher m = re.matcher(line); + if (m.find()) { + System.out.println(line); + if (Integer.parseInt(m.group(1)) != expected[count++] || + Integer.parseInt(m.group(2)) != expected[count++]) { + throw new Exception("Fail here"); + } + } + } + if (count != expected.length) { + throw new Exception("Less rounds"); + } + } +} diff --git a/test/sun/security/krb5/auto/BadKdc1.java b/test/sun/security/krb5/auto/BadKdc1.java new file mode 100644 index 0000000000000000000000000000000000000000..584edc3889abe922a3fc18e8b247c2f6312cc2eb --- /dev/null +++ b/test/sun/security/krb5/auto/BadKdc1.java @@ -0,0 +1,53 @@ +/* + * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ + +/* + * @test + * @bug 6843127 + * @run main/timeout=300 BadKdc1 + * @summary krb5 should not try to access unavailable kdc too often + */ + +import java.io.*; +import java.security.Security; + +public class BadKdc1 { + + public static void main(String[] args) + throws Exception { + Security.setProperty("krb5.kdc.bad.policy", "tryLess"); + BadKdc.go( + new int[]{1,2,1,2,1,2,2,2,2,2,2,2,3,2,1,2,2,2,3,2}, // 1, 2 + // The above line means try kdc1 for 2 seconds, then kdc1 + // for 2 seconds,..., finally kdc3 for 2 seconds. + new int[]{1,2,2,2,3,2,1,2,2,2,3,2}, // 1, 2 + // refresh + new int[]{1,2,1,2,1,2,2,2,2,2,2,2,3,2,1,2,2,2,3,2}, // 1, 2 + // k3 off, k2 on + new int[]{1,2,2,2,1,2,2,2}, // 1 + // k1 on + new int[]{1,2,1,2} // empty + ); + } +} + diff --git a/test/sun/security/krb5/auto/BadKdc2.java b/test/sun/security/krb5/auto/BadKdc2.java new file mode 100644 index 0000000000000000000000000000000000000000..f9c017e8dadc37e0a9c3255b177fa4e227fd154f --- /dev/null +++ b/test/sun/security/krb5/auto/BadKdc2.java @@ -0,0 +1,50 @@ +/* + * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ + +/* + * @test + * @bug 6843127 + * @run main/timeout=300 BadKdc2 + * @summary krb5 should not try to access unavailable kdc too often + */ + +import java.io.*; +import java.security.Security; + +public class BadKdc2 { + + public static void main(String[] args) + throws Exception { + Security.setProperty("krb5.kdc.bad.policy", "tryLess:2,1000"); + BadKdc.go( + new int[]{1,2,1,2,1,2,2,2,2,2,2,2,3,2,1,1,1,1,2,1,2,1,3,2}, // 1, 2 + new int[]{1,1,1,1,2,1,2,1,3,2,1,1,1,1,2,1,2,1,3,2}, // 1, 2 + // refresh + new int[]{1,2,1,2,1,2,2,2,2,2,2,2,3,2,1,1,1,1,2,1,2,1,3,2}, // 1, 2 + // k3 off, k2 on + new int[]{1,1,1,1,2,1,1,1,1,1,2,2}, // 1 + // k1 on + new int[]{1,1,1,2} // empty + ); + } +} diff --git a/test/sun/security/krb5/auto/BadKdc3.java b/test/sun/security/krb5/auto/BadKdc3.java new file mode 100644 index 0000000000000000000000000000000000000000..547e91578aaef0de1c9e63b7a0364646d8531bb6 --- /dev/null +++ b/test/sun/security/krb5/auto/BadKdc3.java @@ -0,0 +1,50 @@ +/* + * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ + +/* + * @test + * @bug 6843127 + * @run main/timeout=300 BadKdc3 + * @summary krb5 should not try to access unavailable kdc too often + */ + +import java.io.*; +import java.security.Security; + +public class BadKdc3 { + + public static void main(String[] args) + throws Exception { + Security.setProperty("krb5.kdc.bad.policy", "tryLast"); + BadKdc.go( + new int[]{1,2,1,2,1,2,2,2,2,2,2,2,3,2,3,2}, // 1, 2 + new int[]{3,2,3,2}, // 1, 2 + // refresh + new int[]{1,2,1,2,1,2,2,2,2,2,2,2,3,2,3,2}, // 1, 2 + // k3 off, k2 on + new int[]{3,2,3,2,3,2,1,2,1,2,1,2,2,2,2,2}, // 1, 3 + // k1 on + new int[]{2,2,2,2} // 1, 3 + ); + } +} diff --git a/test/sun/security/krb5/auto/BadKdc4.java b/test/sun/security/krb5/auto/BadKdc4.java new file mode 100644 index 0000000000000000000000000000000000000000..6774b76c3aef18fc6916d0a86f44ecdf011958e4 --- /dev/null +++ b/test/sun/security/krb5/auto/BadKdc4.java @@ -0,0 +1,50 @@ +/* + * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ + +/* + * @test + * @bug 6843127 + * @run main/timeout=300 BadKdc4 + * @summary krb5 should not try to access unavailable kdc too often + */ + +import java.io.*; +import java.security.Security; + +public class BadKdc4 { + + public static void main(String[] args) + throws Exception { + Security.setProperty("krb5.kdc.bad.policy", ""); + BadKdc.go( + new int[]{1,2,1,2,1,2,2,2,2,2,2,2,3,2,1,2,1,2,1,2,2,2,2,2,2,2,3,2}, + new int[]{1,2,1,2,1,2,2,2,2,2,2,2,3,2,1,2,1,2,1,2,2,2,2,2,2,2,3,2}, + // refresh + new int[]{1,2,1,2,1,2,2,2,2,2,2,2,3,2,1,2,1,2,1,2,2,2,2,2,2,2,3,2}, + // k3 off, k2 on + new int[]{1,2,1,2,1,2,2,2,1,2,1,2,1,2,2,2}, + // k1 on + new int[]{1,2,1,2} + ); + } +} diff --git a/test/sun/security/krb5/auto/KDC.java b/test/sun/security/krb5/auto/KDC.java index 169094c779ba8a9421826a5d7db9dc232d31aea4..b03058798bd32ca43af1182052c73212b6e9f6ae 100644 --- a/test/sun/security/krb5/auto/KDC.java +++ b/test/sun/security/krb5/auto/KDC.java @@ -141,6 +141,10 @@ public class KDC { // Options private Map options = new HashMap(); + private Thread thread1, thread2, thread3; + DatagramSocket u1 = null; + ServerSocket t1 = null; + /** * Option names, to be expanded forever. */ @@ -480,8 +484,9 @@ public class KDC { Method stringToKey = EncryptionKey.class.getDeclaredMethod("stringToKey", char[].class, String.class, byte[].class, Integer.TYPE); stringToKey.setAccessible(true); Integer kvno = null; - // For service whose password ending with a number, use it as kvno - if (p.toString().indexOf('/') >= 0) { + // For service whose password ending with a number, use it as kvno. + // Kvno must be postive. + if (p.toString().indexOf('/') > 0) { char[] pass = getPassword(p, server); if (Character.isDigit(pass[pass.length-1])) { kvno = pass[pass.length-1] - '0'; @@ -940,8 +945,6 @@ public class KDC { * @throws java.io.IOException for any communication error */ protected void startServer(int port, boolean asDaemon) throws IOException { - DatagramSocket u1 = null; - ServerSocket t1 = null; if (port > 0) { u1 = new DatagramSocket(port, InetAddress.getByName("127.0.0.1")); t1 = new ServerSocket(port); @@ -966,7 +969,7 @@ public class KDC { this.port = port; // The UDP consumer - Thread thread = new Thread() { + thread1 = new Thread() { public void run() { while (true) { try { @@ -982,11 +985,11 @@ public class KDC { } } }; - thread.setDaemon(asDaemon); - thread.start(); + thread1.setDaemon(asDaemon); + thread1.start(); // The TCP consumer - thread = new Thread() { + thread2 = new Thread() { public void run() { while (true) { try { @@ -1004,11 +1007,11 @@ public class KDC { } } }; - thread.setDaemon(asDaemon); - thread.start(); + thread2.setDaemon(asDaemon); + thread2.start(); // The dispatcher - thread = new Thread() { + thread3 = new Thread() { public void run() { while (true) { try { @@ -1018,10 +1021,21 @@ public class KDC { } } }; - thread.setDaemon(true); - thread.start(); + thread3.setDaemon(true); + thread3.start(); } + public void terminate() { + try { + thread1.stop(); + thread2.stop(); + thread3.stop(); + u1.close(); + t1.close(); + } catch (Exception e) { + // OK + } + } /** * Helper class to encapsulate a job in a KDC. */ diff --git a/test/sun/security/krb5/auto/MoreKvno.java b/test/sun/security/krb5/auto/MoreKvno.java index 66740a8b79964b41d38b74e43bf82bec2672d9ad..5a2c9e56a585b0ac855f4aa922432b39ed390dea 100644 --- a/test/sun/security/krb5/auto/MoreKvno.java +++ b/test/sun/security/krb5/auto/MoreKvno.java @@ -24,15 +24,20 @@ /* * @test * @bug 6893158 + * @bug 6907425 * @summary AP_REQ check should use key version number */ +import org.ietf.jgss.GSSException; import sun.security.jgss.GSSUtil; +import sun.security.krb5.KrbException; import sun.security.krb5.PrincipalName; import sun.security.krb5.internal.ktab.KeyTab; +import sun.security.krb5.internal.Krb5; public class MoreKvno { + static PrincipalName p; public static void main(String[] args) throws Exception { @@ -41,21 +46,40 @@ public class MoreKvno { // Rewrite keytab, 3 set of keys with different kvno KeyTab ktab = KeyTab.create(OneKDC.KTAB); - PrincipalName p = new PrincipalName(OneKDC.SERVER+"@"+OneKDC.REALM, PrincipalName.KRB_NT_SRV_HST); - ktab.addEntry(p, "pass0".toCharArray(), 0); - ktab.addEntry(p, "pass2".toCharArray(), 2); + p = new PrincipalName( + OneKDC.SERVER+"@"+OneKDC.REALM, PrincipalName.KRB_NT_SRV_HST); ktab.addEntry(p, "pass1".toCharArray(), 1); + ktab.addEntry(p, "pass3".toCharArray(), 3); + ktab.addEntry(p, "pass2".toCharArray(), 2); ktab.save(); - kdc.addPrincipal(OneKDC.SERVER, "pass1".toCharArray()); - go(OneKDC.SERVER, "com.sun.security.jgss.krb5.accept"); - kdc.addPrincipal(OneKDC.SERVER, "pass2".toCharArray()); + char[] pass = "pass2".toCharArray(); + kdc.addPrincipal(OneKDC.SERVER, pass); + go(OneKDC.SERVER, "com.sun.security.jgss.krb5.accept", pass); + + pass = "pass3".toCharArray(); + kdc.addPrincipal(OneKDC.SERVER, pass); // "server" initiate also, check pass2 is used at authentication - go(OneKDC.SERVER, "server"); + go(OneKDC.SERVER, "server", pass); + + try { + pass = "pass4".toCharArray(); + kdc.addPrincipal(OneKDC.SERVER, pass); + go(OneKDC.SERVER, "com.sun.security.jgss.krb5.accept", pass); + throw new Exception("This test should fail"); + } catch (GSSException gsse) { + KrbException ke = (KrbException)gsse.getCause(); + if (ke.returnCode() != Krb5.KRB_AP_ERR_BADKEYVER) { + throw new Exception("Not expected failure code: " + + ke.returnCode()); + } + } } - static void go(String server, String entry) throws Exception { + static void go(String server, String entry, char[] pass) throws Exception { Context c, s; + + // Part 1: Test keytab c = Context.fromUserPass("dummy", "bogus".toCharArray(), false); s = Context.fromJAAS(entry); @@ -66,5 +90,17 @@ public class MoreKvno { s.dispose(); c.dispose(); + + // Part 2: Test username/password pair + c = Context.fromUserPass("dummy", "bogus".toCharArray(), false); + s = Context.fromUserPass(p.getNameString(), pass, true); + + c.startAsClient(server, GSSUtil.GSS_KRB5_MECH_OID); + s.startAsServer(GSSUtil.GSS_KRB5_MECH_OID); + + Context.handshake(c, s); + + s.dispose(); + c.dispose(); } } diff --git a/test/sun/security/krb5/auto/OneKDC.java b/test/sun/security/krb5/auto/OneKDC.java index 213869e8d24037582b996696afa2e0dd7279145f..d52ada563136d2bfaa57a05e29ad3a8e9b33a23f 100644 --- a/test/sun/security/krb5/auto/OneKDC.java +++ b/test/sun/security/krb5/auto/OneKDC.java @@ -24,8 +24,6 @@ import java.io.File; import java.io.FileOutputStream; import java.io.IOException; -import java.net.InetAddress; -import java.net.UnknownHostException; import java.security.Security; import javax.security.auth.callback.Callback; import javax.security.auth.callback.CallbackHandler; diff --git a/test/sun/security/krb5/auto/SSL.java b/test/sun/security/krb5/auto/SSL.java index d8e361a00e00cb2f11cf0db794a05c9c297aa8c6..72e37361d6f475b52819cf6aba75d0573b29653c 100644 --- a/test/sun/security/krb5/auto/SSL.java +++ b/test/sun/security/krb5/auto/SSL.java @@ -1,5 +1,5 @@ /* - * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2009-2010 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,7 @@ /* * @test - * @bug 6894643 + * @bug 6894643 6913636 * @summary Test JSSE Kerberos ciphersuite */ import java.io.*; @@ -32,12 +32,13 @@ import javax.net.ssl.*; import java.security.Principal; import java.util.Date; import sun.security.jgss.GSSUtil; +import sun.security.krb5.PrincipalName; +import sun.security.krb5.internal.ktab.KeyTab; public class SSL { private static final String KRB5_CIPHER = "TLS_KRB5_WITH_3DES_EDE_CBC_SHA"; private static final int LOOP_LIMIT = 1; - private static final char[] PASS = "secret".toCharArray(); private static int loopCount = 0; private static volatile String server; private static volatile int port; @@ -54,12 +55,39 @@ public class SSL { kdc.addPrincipal(OneKDC.USER, OneKDC.PASS); kdc.addPrincipalRandKey("krbtgt/" + OneKDC.REALM); - kdc.addPrincipal("host/" + server, PASS); KDC.saveConfig(OneKDC.KRB5_CONF, kdc); System.setProperty("java.security.krb5.conf", OneKDC.KRB5_CONF); + // Add 3 versions of keys into keytab + KeyTab ktab = KeyTab.create(OneKDC.KTAB); + PrincipalName service = new PrincipalName( + "host/" + server, PrincipalName.KRB_NT_SRV_HST); + ktab.addEntry(service, "pass1".toCharArray(), 1); + ktab.addEntry(service, "pass2".toCharArray(), 2); + ktab.addEntry(service, "pass3".toCharArray(), 3); + ktab.save(); + + // and use the middle one as the real key + kdc.addPrincipal("host/" + server, "pass2".toCharArray()); + + // JAAS config entry name ssl + System.setProperty("java.security.auth.login.config", OneKDC.JAAS_CONF); + File f = new File(OneKDC.JAAS_CONF); + FileOutputStream fos = new FileOutputStream(f); + fos.write(( + "ssl {\n" + + " com.sun.security.auth.module.Krb5LoginModule required\n" + + " principal=\"host/" + server + "\"\n" + + " useKeyTab=true\n" + + " keyTab=" + OneKDC.KTAB + "\n" + + " isInitiator=false\n" + + " storeKey=true;\n};\n" + ).getBytes()); + fos.close(); + f.deleteOnExit(); + final Context c = Context.fromUserPass(OneKDC.USER, OneKDC.PASS, false); - final Context s = Context.fromUserPass("host/" + server, PASS, true); + final Context s = Context.fromJAAS("ssl"); c.startAsClient("host/" + server, GSSUtil.GSS_KRB5_MECH_OID); s.startAsServer(GSSUtil.GSS_KRB5_MECH_OID); diff --git a/test/sun/security/krb5/auto/Test5653.java b/test/sun/security/krb5/auto/Test5653.java new file mode 100644 index 0000000000000000000000000000000000000000..cc61e8c7d7230970a86225a7aa6ec5c2e0a6e632 --- /dev/null +++ b/test/sun/security/krb5/auto/Test5653.java @@ -0,0 +1,80 @@ +/* + * Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ + +/* + * @test + * @bug 6895424 + * @summary RFC 5653 + */ + +import org.ietf.jgss.GSSContext; +import org.ietf.jgss.GSSManager; +import org.ietf.jgss.GSSName; +import org.ietf.jgss.Oid; +import sun.security.jgss.GSSUtil; + +public class Test5653 { + + public static void main(String[] args) + throws Exception { + + Oid oldOid = new Oid("1.3.6.1.5.6.2"); + new OneKDC(null).writeJAASConf(); + + System.setProperty("javax.security.auth.useSubjectCredsOnly", "false"); + GSSManager m = GSSManager.getInstance(); + boolean found = false; + + // Test 1: the getMechsForName() method accepts it. + for (Oid tmp: m.getMechsForName(oldOid)) { + if (tmp.equals(GSSUtil.GSS_KRB5_MECH_OID)) { + found = true; + break; + } + } + if (!found) { + throw new Exception("Cannot found krb5 mech for old name type"); + } + + // Test 2: the createName() method accepts it. + GSSName name = m.createName("server@host.rabbit.hole", oldOid); + + // Test 3: its getStringNameType() output is correct + if (!name.getStringNameType().equals(GSSName.NT_HOSTBASED_SERVICE)) { + throw new Exception("GSSName not correct name type"); + } + + // Test 4: everything still works. + GSSContext c1 = m.createContext( + name, + GSSUtil.GSS_KRB5_MECH_OID, + null, + GSSContext.DEFAULT_LIFETIME); + byte[] token = c1.initSecContext(new byte[0], 0, 0); + + Context s; + s = Context.fromJAAS("server"); + s.startAsServer(GSSUtil.GSS_KRB5_MECH_OID); + s.x().acceptSecContext(token, 0, token.length); + } +} diff --git a/test/sun/security/krb5/ktab/KeyString.java b/test/sun/security/krb5/ktab/KeyString.java new file mode 100644 index 0000000000000000000000000000000000000000..8a9c8898b4f977f24ea2eebb30ca7f604b00248e --- /dev/null +++ b/test/sun/security/krb5/ktab/KeyString.java @@ -0,0 +1,39 @@ +/* + * Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ +/* + * @test + * @bug 6917791 + * @summary KeyTabEntry, when the byte value smaller then 16, the string drop '0' + */ + +import sun.security.krb5.internal.ktab.KeyTabEntry; + +public class KeyString { + public static void main(String[] args) throws Exception { + KeyTabEntry e = new KeyTabEntry(null, null, null, 1, 1, new byte[8]); + // "0x" plus eight "00" + if (e.getKeyString().length() != 18) { + throw new Exception("key bytes length not correct"); + } + } +} diff --git a/test/sun/security/util/Oid/S11N.sh b/test/sun/security/util/Oid/S11N.sh index 081cd52298fc315e08e358b5c4994fc456b9c3d2..82046f360c0520a21bf312d2c389b06de96218ab 100644 --- a/test/sun/security/util/Oid/S11N.sh +++ b/test/sun/security/util/Oid/S11N.sh @@ -1,5 +1,5 @@ # -# Copyright 2004-2005 Sun Microsystems, Inc. All Rights Reserved. +# Copyright 2004-2009 Sun Microsystems, Inc. All Rights Reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -21,8 +21,8 @@ # have any questions. # # @test -# @bug 4811968 -# @summary Serialization compatibility with old versions +# @bug 4811968 6908628 +# @summary Serialization compatibility with old versions (and fix) # @author Weijun Wang # # set a few environment variables so that the shell-script can run stand-alone @@ -99,7 +99,8 @@ esac # the test code -${TESTJAVA}${FS}bin${FS}javac -d . ${TESTSRC}${FS}SerialTest.java || exit 10 +${TESTJAVA}${FS}bin${FS}javac -target 1.4 -source 1.4 \ + -d . ${TESTSRC}${FS}SerialTest.java || exit 10 OLDJAVA=" /java/re/j2se/1.6.0/latest/binaries/${PF} @@ -161,4 +162,10 @@ rm -f tmp.oid.serial rm -f tmp.oid.serial.old rm -f SerialTest.class +for oldj in ${OLDJAVA}; do + if [ ! -d ${oldj} ]; then + echo WARNING: ${oldj} is missing. Test incomplete! > /dev/stderr + fi +done + exit 0 diff --git a/test/sun/text/resources/LocaleData b/test/sun/text/resources/LocaleData index 7b0ada3c594ad6013c47511b483351565b8fe3c0..e662c356117e3744ae4b2d91c09534799b4cc7d4 100644 --- a/test/sun/text/resources/LocaleData +++ b/test/sun/text/resources/LocaleData @@ -673,8 +673,8 @@ FormatData/es_VE/NumberElements/0=, FormatData/es_VE/NumberElements/1=. FormatData/es_VE/NumberElements/2=; -# bug #4099810, 4290801 -CurrencyNames/uk_UA/UAH=\u0433\u0440\u0432. +# bug #4099810, 4290801, 6868106 +CurrencyNames/uk_UA/UAH=\u0433\u0440\u043b. FormatData/uk_UA/NumberPatterns/0=#,##0.###;-#,##0.### # FormatData/uk_UA/NumberPatterns/1=#,##0.## '\u0433\u0440\u0432.';-#,##0.## '\u0433\u0440\u0432.' # Changed; see bug 4122840 FormatData/uk_UA/NumberPatterns/2=#,##0% @@ -5526,3 +5526,575 @@ LocaleNames//IM=Isle Of Man # BL, MF (6627549) LocaleNames//BL=Saint Barth\u00e9lemy LocaleNames//MF=Saint Martin + +# bug 6609737 +FormatData/de/DateTimePatterns/0=HH:mm' Uhr 'z +TimeZoneNames/de/CET/1=Mitteleurop\u00e4ische Zeit +TimeZoneNames/de/CET/2=MEZ +TimeZoneNames/de/CET/3=Mitteleurop\u00e4ische Sommerzeit +TimeZoneNames/de/CET/4=MESZ +TimeZoneNames/de/EET/2=OEZ +TimeZoneNames/de/EET/4=OESZ +TimeZoneNames/de/WET/2=WEZ +TimeZoneNames/de/WET/4=WESZ + +# bug 6610748 +FormatData/fi/AmPmMarkers/0=ap. +FormatData/fi/AmPmMarkers/1=ip. + +# bug 6507067 +TimeZoneNames/zh_TW/Asia\/Taipei/1=\u53f0\u7063\u6a19\u6e96\u6642\u9593 +TimeZoneNames/zh_TW/Asia\/Taipei/2=TST + +# bug 6645271 +FormatData/hr_HR/DateTimePatterns/6=dd.MM.yyyy. +FormatData/hr_HR/DateTimePatterns/7=dd.MM.yy. + +# bug 6873931 +CurrencyNames/tr_TR/TRY=TL + +#bug 6450945 +CalendarData/ro/firstDayOfWeek=2 +CalendarData/ro/minimalDaysInFirstWeek=1 +FormatData/ro/DayNames/6=s\u00e2mb\u0103t\u0103 + +#bug 6645268 +LocaleNames/fi/fr=ranska +LocaleNames/fi/FR=Ranska +LocaleNames/fi_FI/fr=ranska +LocaleNames/fi_FI/FR=Ranska + +# bug 6646611, 6914413 +FormatData/be_BY/MonthNames/10=\u043b\u0456\u0441\u0442\u0430\u043f\u0430\u0434\u0430 +FormatData/be_BY/MonthAbbreviations/10=\u043b\u0456\u0441 + +# bug 6645405 +FormatData/hu_HU/NumberPatterns/1=#,##0.## \u00A4;-#,##0.## \u00A4 + +# bug 6650730 +FormatData/lt/NumberElements/1=\u00a0 +FormatData/lt/DateTimePatterns/6=yyyy-MM-dd + +#bug 6910489 +CalendarData/sl/firstDayOfWeek=2 + +# bug 6573250 +CurrencyNames/en_CA/USD=US$ + +# bug 6870908 +FormatData/et/MonthNames/0=jaanuar +FormatData/et/MonthNames/1=veebruar +FormatData/et/MonthNames/2=m\u00e4rts +FormatData/et/MonthNames/3=aprill +FormatData/et/MonthNames/4=mai +FormatData/et/MonthNames/5=juuni +FormatData/et/MonthNames/6=juuli +FormatData/et/MonthNames/7=august +FormatData/et/MonthNames/8=september +FormatData/et/MonthNames/9=oktoober +FormatData/et/MonthNames/10=november +FormatData/et/MonthNames/11=detsember +FormatData/et/MonthAbbreviations/0=jaan +FormatData/et/MonthAbbreviations/1=veebr +FormatData/et/MonthAbbreviations/2=m\u00e4rts +FormatData/et/MonthAbbreviations/3=apr +FormatData/et/MonthAbbreviations/4=mai +FormatData/et/MonthAbbreviations/5=juuni +FormatData/et/MonthAbbreviations/6=juuli +FormatData/et/MonthAbbreviations/7=aug +FormatData/et/MonthAbbreviations/8=sept +FormatData/et/MonthAbbreviations/9=okt +FormatData/et/MonthAbbreviations/10=nov +FormatData/et/MonthAbbreviations/11=dets + +# bug 6585666 +LocaleNames/es/aa=afar +LocaleNames/es/av=avar +LocaleNames/es/az=azer\u00ed +LocaleNames/es/ba=bashkir +LocaleNames/es/bh=bihari +LocaleNames/es/bn=bengal\u00ed +LocaleNames/es/cu=eslavo eclesi\u00e1stico +LocaleNames/es/dz=dzongkha +LocaleNames/es/eu=vasco +LocaleNames/es/fa=persa +LocaleNames/es/ff=fula +LocaleNames/es/fj=fidjiano +LocaleNames/es/fo=fero\u00e9s +LocaleNames/es/fy=fris\u00f3n +LocaleNames/es/gu=gujarati +LocaleNames/es/gv=ga\u00e9lico man\u00e9s +LocaleNames/es/hi=hindi +LocaleNames/es/ho=hiri motu +LocaleNames/es/ie=interlingue +LocaleNames/es/ig=igbo +LocaleNames/es/ii=sichuan yi +LocaleNames/es/ik=inupiaq +LocaleNames/es/kg=kongo +LocaleNames/es/ki=kikuyu +LocaleNames/es/kj=kuanyama +LocaleNames/es/kk=kazajo +LocaleNames/es/km=jemer +LocaleNames/es/kn=canar\u00e9s +LocaleNames/es/ks=cachemiro +LocaleNames/es/ku=kurdo +LocaleNames/es/ky=kirghiz +LocaleNames/es/lu=luba-katanga +LocaleNames/es/mr=marathi +LocaleNames/es/nb=bokmal noruego +LocaleNames/es/nd=ndebele septentrional +LocaleNames/es/nn=nynorsk noruego +LocaleNames/es/nr=ndebele meridional +LocaleNames/es/os=os\u00e9tico +LocaleNames/es/rm=retorrom\u00e1nico +LocaleNames/es/rn=kiroundi +LocaleNames/es/rw=kinyarwanda +LocaleNames/es/sd=sindhi +LocaleNames/es/se=sami septentrional +LocaleNames/es/sl=esloveno +LocaleNames/es/sn=shona +LocaleNames/es/ss=siswati +LocaleNames/es/st=sesotho +LocaleNames/es/su=sundan\u00e9s +LocaleNames/es/sw=swahili +LocaleNames/es/tg=tayiko +LocaleNames/es/ti=tigri\u00f1a +LocaleNames/es/tn=setchwana +LocaleNames/es/to=tongano +LocaleNames/es/tw=twi +LocaleNames/es/ty=tahitiano +LocaleNames/es/ug=uigur +LocaleNames/es/uk=ucraniano +LocaleNames/es/uz=uzbeko +LocaleNames/es/vo=volap\u00fck +LocaleNames/es/za=zhuang + +# bug 6716626 - language +LocaleNames/nl/aa=Afar +LocaleNames/nl/ab=Abchazisch +LocaleNames/nl/ae=Avestisch +LocaleNames/nl/af=Afrikaans +LocaleNames/nl/ak=Akan +LocaleNames/nl/am=Amhaars +LocaleNames/nl/an=Aragonees +LocaleNames/nl/ar=Arabisch +LocaleNames/nl/as=Assamees +LocaleNames/nl/av=Avarisch +LocaleNames/nl/ay=Aymara +LocaleNames/nl/az=Azerbeidzjaans +LocaleNames/nl/ba=Basjkiers +LocaleNames/nl/be=Wit-Russisch +LocaleNames/nl/bg=Bulgaars +LocaleNames/nl/bh=Bihari +LocaleNames/nl/bi=Bislama +LocaleNames/nl/bm=Bambara +LocaleNames/nl/bn=Bengalees +LocaleNames/nl/bo=Tibetaans +LocaleNames/nl/br=Bretons +LocaleNames/nl/bs=Bosnisch +LocaleNames/nl/ca=Catalaans +LocaleNames/nl/ce=Chechen +LocaleNames/nl/ch=Chamorro +LocaleNames/nl/co=Corsicaans +LocaleNames/nl/cr=Cree +LocaleNames/nl/cs=Tsjechisch +LocaleNames/nl/cu=Kerkslavisch +LocaleNames/nl/cv=Tsjoevasjisch +LocaleNames/nl/cy=Welsh +LocaleNames/nl/da=Deens +LocaleNames/nl/de=Duits +LocaleNames/nl/dv=Divehi +LocaleNames/nl/dz=Dzongkha +LocaleNames/nl/ee=Ewe +LocaleNames/nl/el=Grieks +LocaleNames/nl/en=Engels +LocaleNames/nl/eo=Esperanto +LocaleNames/nl/es=Spaans +LocaleNames/nl/et=Estlands +LocaleNames/nl/eu=Baskisch +LocaleNames/nl/fa=Perzisch +LocaleNames/nl/ff=Fulah +LocaleNames/nl/fi=Fins +LocaleNames/nl/fj=Fijisch +LocaleNames/nl/fo=Faer\u00f6ers +LocaleNames/nl/fr=Frans +LocaleNames/nl/fy=Fries +LocaleNames/nl/ga=Iers +LocaleNames/nl/gd=Schots Gaelic +LocaleNames/nl/gl=Galicisch +LocaleNames/nl/gn=Guarani +LocaleNames/nl/gu=Gujarati +LocaleNames/nl/gv=Manx +LocaleNames/nl/ha=Hausa +LocaleNames/nl/he=Hebreeuws +LocaleNames/nl/hi=Hindi +LocaleNames/nl/ho=Hiri Motu +LocaleNames/nl/hr=Kroatisch +LocaleNames/nl/ht=Ha\u00eftiaans +LocaleNames/nl/hu=Hongaars +LocaleNames/nl/hy=Armeens +LocaleNames/nl/hz=Herero +LocaleNames/nl/ia=Interlingua +LocaleNames/nl/id=Indonesisch +LocaleNames/nl/ie=Interlingue +LocaleNames/nl/ig=Igbo +LocaleNames/nl/ii=Sichuan Yi +LocaleNames/nl/ik=Inupiaq +LocaleNames/nl/io=Ido +LocaleNames/nl/is=IJslands +LocaleNames/nl/it=Italiaans +LocaleNames/nl/iu=Inuktitut +LocaleNames/nl/ja=Japans +LocaleNames/nl/jv=Javaans +LocaleNames/nl/ka=Georgisch +LocaleNames/nl/kg=Kongo +LocaleNames/nl/ki=Kikuyu +LocaleNames/nl/kj=Kuanyama +LocaleNames/nl/kk=Kazachs +LocaleNames/nl/kl=Kalaallisut +LocaleNames/nl/km=Khmer +LocaleNames/nl/kn=Kannada +LocaleNames/nl/ko=Koreaans +LocaleNames/nl/kr=Kanuri +LocaleNames/nl/ks=Kashmiri +LocaleNames/nl/ku=Koerdisch +LocaleNames/nl/kv=Komi +LocaleNames/nl/kw=Cornish +LocaleNames/nl/ky=Kirgizisch +LocaleNames/nl/la=Latijn +LocaleNames/nl/lb=Luxemburgs +LocaleNames/nl/lg=Ganda +LocaleNames/nl/li=Limburgs +LocaleNames/nl/ln=Lingala +LocaleNames/nl/lo=Lao +LocaleNames/nl/lt=Litouws +LocaleNames/nl/lu=Luba-Katanga +LocaleNames/nl/lv=Letlands +LocaleNames/nl/mg=Malagasisch +LocaleNames/nl/mh=Marshallees +LocaleNames/nl/mi=Maori +LocaleNames/nl/mk=Macedonisch +LocaleNames/nl/ml=Malayalam +LocaleNames/nl/mn=Mongools +LocaleNames/nl/mo=Moldavisch +LocaleNames/nl/mr=Marathi +LocaleNames/nl/ms=Maleis +LocaleNames/nl/mt=Maltees +LocaleNames/nl/my=Birmees +LocaleNames/nl/na=Nauru +LocaleNames/nl/nb=Noors - Bokm\u00e5l +LocaleNames/nl/nd=Noord-Ndbele +LocaleNames/nl/ne=Nepalees +LocaleNames/nl/ng=Ndonga +LocaleNames/nl/nl=Nederlands +LocaleNames/nl/nn=Noors - Nynorsk +LocaleNames/nl/no=Noors +LocaleNames/nl/nr=Zuid-Ndbele +LocaleNames/nl/nv=Navajo +LocaleNames/nl/ny=Nyanja +LocaleNames/nl/oc=Occitaans +LocaleNames/nl/oj=Ojibwa +LocaleNames/nl/om=Oromo +LocaleNames/nl/or=Oriya +LocaleNames/nl/os=Ossetisch +LocaleNames/nl/pa=Punjabi +LocaleNames/nl/pi=Pali +LocaleNames/nl/pl=Pools +LocaleNames/nl/ps=Pasjtoe +LocaleNames/nl/pt=Portugees +LocaleNames/nl/qu=Quechua +LocaleNames/nl/rm=Reto-Romaans +LocaleNames/nl/rn=Rundi +LocaleNames/nl/ro=Roemeens +LocaleNames/nl/ru=Russisch +LocaleNames/nl/rw=Kinyarwanda +LocaleNames/nl/sa=Sanskriet +LocaleNames/nl/sc=Sardinisch +LocaleNames/nl/sd=Sindhi +LocaleNames/nl/se=Noord-Samisch +LocaleNames/nl/sg=Sango +LocaleNames/nl/si=Singalees +LocaleNames/nl/sk=Slowaaks +LocaleNames/nl/sl=Sloveens +LocaleNames/nl/sm=Samoaans +LocaleNames/nl/sn=Shona +LocaleNames/nl/so=Somalisch +LocaleNames/nl/sq=Albanees +LocaleNames/nl/sr=Servisch +LocaleNames/nl/ss=Swati +LocaleNames/nl/st=Zuid-Sotho +LocaleNames/nl/su=Soendanees +LocaleNames/nl/sv=Zweeds +LocaleNames/nl/sw=Swahili +LocaleNames/nl/ta=Tamil +LocaleNames/nl/te=Teloegoe +LocaleNames/nl/tg=Tadzjieks +LocaleNames/nl/th=Thais +LocaleNames/nl/ti=Tigrinya +LocaleNames/nl/tk=Turkmeens +LocaleNames/nl/tl=Tagalog +LocaleNames/nl/tn=Tswana +LocaleNames/nl/to=Tonga +LocaleNames/nl/tr=Turks +LocaleNames/nl/ts=Tsonga +LocaleNames/nl/tt=Tataars +LocaleNames/nl/tw=Twi +LocaleNames/nl/ty=Tahitisch +LocaleNames/nl/ug=Oeigoers +LocaleNames/nl/uk=Oekra\u00efens +LocaleNames/nl/ur=Urdu +LocaleNames/nl/uz=Oezbeeks +LocaleNames/nl/ve=Venda +LocaleNames/nl/vi=Vietnamees +LocaleNames/nl/vo=Volap\u00fck +LocaleNames/nl/wa=Wallonisch +LocaleNames/nl/wo=Wolof +LocaleNames/nl/xh=Xhosa +LocaleNames/nl/yi=Jiddisch +LocaleNames/nl/yo=Yoruba +LocaleNames/nl/za=Zhuang +LocaleNames/nl/zh=Chinees +LocaleNames/nl/zu=Zulu + +# bug 6716626 - country +LocaleNames/nl/AD=Andorra +LocaleNames/nl/AE=Verenigde Arabische Emiraten +LocaleNames/nl/AF=Afghanistan +LocaleNames/nl/AG=Antigua en Barbuda +LocaleNames/nl/AI=Anguilla +LocaleNames/nl/AL=Albani\u00eb +LocaleNames/nl/AM=Armeni\u00eb +LocaleNames/nl/AN=Nederlandse Antillen +LocaleNames/nl/AO=Angola +LocaleNames/nl/AQ=Antarctica +LocaleNames/nl/AR=Argentini\u00eb +LocaleNames/nl/AS=Amerikaans Samoa +LocaleNames/nl/AT=Oostenrijk +LocaleNames/nl/AU=Australi\u00eb +LocaleNames/nl/AW=Aruba +LocaleNames/nl/AX=Alandeilanden +LocaleNames/nl/AZ=Azerbeidzjan +LocaleNames/nl/BA=Bosni\u00eb en Herzegovina +LocaleNames/nl/BB=Barbados +LocaleNames/nl/BD=Bangladesh +LocaleNames/nl/BE=Belgi\u00eb +LocaleNames/nl/BF=Burkina Faso +LocaleNames/nl/BG=Bulgarije +LocaleNames/nl/BH=Bahrein +LocaleNames/nl/BI=Burundi +LocaleNames/nl/BJ=Benin +LocaleNames/nl/BM=Bermuda +LocaleNames/nl/BN=Brunei +LocaleNames/nl/BO=Bolivia +LocaleNames/nl/BR=Brazili\u00eb +LocaleNames/nl/BS=Bahama\u2019s +LocaleNames/nl/BT=Bhutan +LocaleNames/nl/BV=Bouveteiland +LocaleNames/nl/BW=Botswana +LocaleNames/nl/BY=Wit-Rusland +LocaleNames/nl/BZ=Belize +LocaleNames/nl/CA=Canada +LocaleNames/nl/CC=Cocoseilanden +LocaleNames/nl/CD=Congo-Kinshasa +LocaleNames/nl/CF=Centraal-Afrikaanse Republiek +LocaleNames/nl/CG=Congo +LocaleNames/nl/CH=Zwitserland +LocaleNames/nl/CI=Ivoorkust +LocaleNames/nl/CK=Cookeilanden +LocaleNames/nl/CL=Chili +LocaleNames/nl/CM=Kameroen +LocaleNames/nl/CN=China +LocaleNames/nl/CO=Colombia +LocaleNames/nl/CR=Costa Rica +LocaleNames/nl/CS=Servi\u00eb en Montenegro +LocaleNames/nl/CU=Cuba +LocaleNames/nl/CV=Kaapverdi\u00eb +LocaleNames/nl/CX=Christmaseiland +LocaleNames/nl/CY=Cyprus +LocaleNames/nl/CZ=Tsjechi\u00eb +LocaleNames/nl/DE=Duitsland +LocaleNames/nl/DJ=Djibouti +LocaleNames/nl/DK=Denemarken +LocaleNames/nl/DM=Dominica +LocaleNames/nl/DO=Dominicaanse Republiek +LocaleNames/nl/DZ=Algerije +LocaleNames/nl/EC=Ecuador +LocaleNames/nl/EE=Estland +LocaleNames/nl/EG=Egypte +LocaleNames/nl/EH=Westelijke Sahara +LocaleNames/nl/ER=Eritrea +LocaleNames/nl/ES=Spanje +LocaleNames/nl/ET=Ethiopi\u00eb +LocaleNames/nl/FI=Finland +LocaleNames/nl/FJ=Fiji +LocaleNames/nl/FK=Falklandeilanden +LocaleNames/nl/FM=Micronesi\u00eb +LocaleNames/nl/FO=Faer\u00f6er +LocaleNames/nl/FR=Frankrijk +LocaleNames/nl/GA=Gabon +LocaleNames/nl/GB=Verenigd Koninkrijk +LocaleNames/nl/GD=Grenada +LocaleNames/nl/GE=Georgi\u00eb +LocaleNames/nl/GF=Frans-Guyana +LocaleNames/nl/GH=Ghana +LocaleNames/nl/GI=Gibraltar +LocaleNames/nl/GL=Groenland +LocaleNames/nl/GM=Gambia +LocaleNames/nl/GN=Guinee +LocaleNames/nl/GP=Guadeloupe +LocaleNames/nl/GQ=Equatoriaal-Guinea +LocaleNames/nl/GR=Griekenland +LocaleNames/nl/GS=Zuid-Georgi\u00eb en Zuidelijke Sandwicheilanden +LocaleNames/nl/GT=Guatemala +LocaleNames/nl/GU=Guam +LocaleNames/nl/GW=Guinee-Bissau +LocaleNames/nl/GY=Guyana +LocaleNames/nl/HK=Hongkong SAR van China +LocaleNames/nl/HM=Heard- en McDonaldeilanden +LocaleNames/nl/HN=Honduras +LocaleNames/nl/HR=Kroati\u00eb +LocaleNames/nl/HT=Ha\u00efti +LocaleNames/nl/HU=Hongarije +LocaleNames/nl/ID=Indonesi\u00eb +LocaleNames/nl/IE=Ierland +LocaleNames/nl/IL=Isra\u00ebl +LocaleNames/nl/IN=India +LocaleNames/nl/IO=Britse Gebieden in de Indische Oceaan +LocaleNames/nl/IQ=Irak +LocaleNames/nl/IR=Iran +LocaleNames/nl/IS=IJsland +LocaleNames/nl/IT=Itali\u00eb +LocaleNames/nl/JM=Jamaica +LocaleNames/nl/JO=Jordani\u00eb +LocaleNames/nl/JP=Japan +LocaleNames/nl/KE=Kenia +LocaleNames/nl/KG=Kirgizi\u00eb +LocaleNames/nl/KH=Cambodja +LocaleNames/nl/KI=Kiribati +LocaleNames/nl/KM=Comoren +LocaleNames/nl/KN=Saint Kitts en Nevis +LocaleNames/nl/KP=Noord-Korea +LocaleNames/nl/KR=Zuid-Korea +LocaleNames/nl/KW=Koeweit +LocaleNames/nl/KY=Caymaneilanden +LocaleNames/nl/KZ=Kazachstan +LocaleNames/nl/LA=Laos +LocaleNames/nl/LB=Libanon +LocaleNames/nl/LC=Saint Lucia +LocaleNames/nl/LI=Liechtenstein +LocaleNames/nl/LK=Sri Lanka +LocaleNames/nl/LR=Liberia +LocaleNames/nl/LS=Lesotho +LocaleNames/nl/LT=Litouwen +LocaleNames/nl/LU=Luxemburg +LocaleNames/nl/LV=Letland +LocaleNames/nl/LY=Libi\u00eb +LocaleNames/nl/MA=Marokko +LocaleNames/nl/MC=Monaco +LocaleNames/nl/MD=Moldavi\u00eb +LocaleNames/nl/ME=Montenegro +LocaleNames/nl/MG=Madagaskar +LocaleNames/nl/MH=Marshalleilanden +LocaleNames/nl/MK=Macedoni\u00eb +LocaleNames/nl/ML=Mali +LocaleNames/nl/MM=Myanmar +LocaleNames/nl/MN=Mongoli\u00eb +LocaleNames/nl/MO=Macao SAR van China +LocaleNames/nl/MP=Noordelijke Marianeneilanden +LocaleNames/nl/MQ=Martinique +LocaleNames/nl/MR=Mauritani\u00eb +LocaleNames/nl/MS=Montserrat +LocaleNames/nl/MT=Malta +LocaleNames/nl/MU=Mauritius +LocaleNames/nl/MV=Maldiven +LocaleNames/nl/MW=Malawi +LocaleNames/nl/MX=Mexico +LocaleNames/nl/MY=Maleisi\u00eb +LocaleNames/nl/MZ=Mozambique +LocaleNames/nl/NA=Namibi\u00eb +LocaleNames/nl/NC=Nieuw-Caledoni\u00eb +LocaleNames/nl/NE=Niger +LocaleNames/nl/NF=Norfolkeiland +LocaleNames/nl/NG=Nigeria +LocaleNames/nl/NI=Nicaragua +LocaleNames/nl/NL=Nederland +LocaleNames/nl/NO=Noorwegen +LocaleNames/nl/NP=Nepal +LocaleNames/nl/NR=Nauru +LocaleNames/nl/NU=Niue +LocaleNames/nl/NZ=Nieuw-Zeeland +LocaleNames/nl/OM=Oman +LocaleNames/nl/PA=Panama +LocaleNames/nl/PE=Peru +LocaleNames/nl/PF=Frans-Polynesi\u00eb +LocaleNames/nl/PG=Papoea-Nieuw-Guinea +LocaleNames/nl/PH=Filipijnen +LocaleNames/nl/PK=Pakistan +LocaleNames/nl/PL=Polen +LocaleNames/nl/PM=Saint Pierre en Miquelon +LocaleNames/nl/PN=Pitcairn +LocaleNames/nl/PR=Puerto Rico +LocaleNames/nl/PS=Palestijns Gebied +LocaleNames/nl/PT=Portugal +LocaleNames/nl/PW=Palau +LocaleNames/nl/PY=Paraguay +LocaleNames/nl/QA=Qatar +LocaleNames/nl/RE=R\u00e9union +LocaleNames/nl/RO=Roemeni\u00eb +LocaleNames/nl/RS=Servi\u00eb +LocaleNames/nl/RU=Rusland +LocaleNames/nl/RW=Rwanda +LocaleNames/nl/SA=Saoedi-Arabi\u00eb +LocaleNames/nl/SB=Salomonseilanden +LocaleNames/nl/SC=Seychellen +LocaleNames/nl/SD=Soedan +LocaleNames/nl/SE=Zweden +LocaleNames/nl/SG=Singapore +LocaleNames/nl/SH=Sint-Helena +LocaleNames/nl/SI=Sloveni\u00eb +LocaleNames/nl/SJ=Svalbard en Jan Mayen +LocaleNames/nl/SK=Slowakije +LocaleNames/nl/SL=Sierra Leone +LocaleNames/nl/SM=San Marino +LocaleNames/nl/SN=Senegal +LocaleNames/nl/SO=Somali\u00eb +LocaleNames/nl/SR=Suriname +LocaleNames/nl/ST=Sao Tom\u00e9 en Principe +LocaleNames/nl/SV=El Salvador +LocaleNames/nl/SY=Syri\u00eb +LocaleNames/nl/SZ=Swaziland +LocaleNames/nl/TC=Turks- en Caicoseilanden +LocaleNames/nl/TD=Tsjaad +LocaleNames/nl/TF=Franse Gebieden in de zuidelijke Indische Oceaan +LocaleNames/nl/TG=Togo +LocaleNames/nl/TH=Thailand +LocaleNames/nl/TJ=Tadzjikistan +LocaleNames/nl/TK=Tokelau +LocaleNames/nl/TL=Oost-Timor +LocaleNames/nl/TM=Turkmenistan +LocaleNames/nl/TN=Tunesi\u00eb +LocaleNames/nl/TO=Tonga +LocaleNames/nl/TR=Turkije +LocaleNames/nl/TT=Trinidad en Tobago +LocaleNames/nl/TV=Tuvalu +LocaleNames/nl/TW=Taiwan +LocaleNames/nl/TZ=Tanzania +LocaleNames/nl/UA=Oekra\u00efne +LocaleNames/nl/UG=Oeganda +LocaleNames/nl/UM=Amerikaanse kleinere afgelegen eilanden +LocaleNames/nl/US=Verenigde Staten +LocaleNames/nl/UY=Uruguay +LocaleNames/nl/UZ=Oezbekistan +LocaleNames/nl/VA=Vaticaanstad +LocaleNames/nl/VC=Saint Vincent en de Grenadines +LocaleNames/nl/VE=Venezuela +LocaleNames/nl/VG=Britse Maagdeneilanden +LocaleNames/nl/VI=Amerikaanse Maagdeneilanden +LocaleNames/nl/VN=Vietnam +LocaleNames/nl/VU=Vanuatu +LocaleNames/nl/WF=Wallis en Futuna +LocaleNames/nl/WS=Samoa +LocaleNames/nl/YE=Jemen +LocaleNames/nl/YT=Mayotte +LocaleNames/nl/ZA=Zuid-Afrika +LocaleNames/nl/ZM=Zambia diff --git a/test/sun/text/resources/LocaleDataTest.java b/test/sun/text/resources/LocaleDataTest.java index ff36327ea772de3cda941797aa361ef43f818855..308c3d6b64f4f0d27101c641b5ffba0a68aa59ac 100644 --- a/test/sun/text/resources/LocaleDataTest.java +++ b/test/sun/text/resources/LocaleDataTest.java @@ -31,7 +31,8 @@ * 5102005 5074431 6182685 6208712 6277020 6245766 6351682 6386647 6379382 * 6414459 6455680 6498742 6558863 6488119 6547501 6497154 6558856 6481177 * 6379214 6485516 6486607 4225362 4494727 6533691 6531591 6531593 6570259 - * 6509039 + * 6509039 6609737 6610748 6645271 6507067 6873931 6450945 6645268 6646611 + * 6645405 6650730 6910489 6573250 6870908 6585666 6716626 6914413 * @summary Verify locale data * */ @@ -255,6 +256,15 @@ public class LocaleDataTest index = key.length(); resTag = key.substring(oldIndex, index); + // TimeZone name may have "/" in it, for example "Asia/Taipei", so use "Asia\/Taipei in LocaleData. + if(resTag.endsWith("\\")) { + resTag = resTag.substring(0, resTag.length() - 1); + oldIndex = index; + index = key.indexOf("/", oldIndex + 1); + if (index == -1) index = key.length(); + resTag += key.substring(oldIndex, index); + } + if (index < key.length() - 1) qualifier = key.substring(index + 1); else diff --git a/test/sun/tools/common/ApplicationSetup.sh b/test/sun/tools/common/ApplicationSetup.sh index b5c0ad2314dde2111bef6d9e9dacf869a8fb0afd..9c8e9d2bbc6bee8c463ceca6942b5b66c129dab7 100644 --- a/test/sun/tools/common/ApplicationSetup.sh +++ b/test/sun/tools/common/ApplicationSetup.sh @@ -45,7 +45,11 @@ startApplication() # "java" process. if [ "$OS" = "Windows" ]; then sleep 2 - realpid=`ps -o pid,ppid,comm|grep ${pid}|grep "java"|cut -c1-6` + if [ "${isCygwin}" = "true" ] ; then + realpid=`ps -p ${pid} | tail -1 | awk '{print $4;}'` + else + realpid=`ps -o pid,ppid,comm|grep ${pid}|grep "java"|cut -c1-6` + fi pid=${realpid} fi diff --git a/test/sun/tools/common/CommonSetup.sh b/test/sun/tools/common/CommonSetup.sh index 861289c08d9de7f162ced76e5fbaa7c7df86ba2e..3876affc5ac05e908b53850dd60c48842b9c4743 100644 --- a/test/sun/tools/common/CommonSetup.sh +++ b/test/sun/tools/common/CommonSetup.sh @@ -67,6 +67,11 @@ case "$OS" in PS=";" OS="Windows" ;; + CYGWIN* ) + PS=";" + OS="Windows" + isCygwin=true + ;; * ) PS=":" ;; diff --git a/test/sun/tools/jhat/HatRun.java b/test/sun/tools/jhat/HatRun.java index cb1e41b248ec5903ce921060f6e3217f6be0b85d..6d736f83193e3c97f8aedef48e76129cfcabc994 100644 --- a/test/sun/tools/jhat/HatRun.java +++ b/test/sun/tools/jhat/HatRun.java @@ -166,8 +166,10 @@ public class HatRun { jre_home ); String cdir = System.getProperty("test.classes", "."); String os_arch = System.getProperty("os.arch"); - boolean d64 = os_arch.equals("sparcv9") || - os_arch.equals("amd64"); + String os_name = System.getProperty("os.name"); + boolean d64 = os_name.equals("SunOS") && ( + os_arch.equals("sparcv9") || + os_arch.equals("amd64")); String isa_dir = d64?(File.separator+os_arch):""; String java = jre_home + File.separator + "bin" + isa_dir diff --git a/test/sun/tools/jps/jps-help.sh b/test/sun/tools/jps/jps-help.sh index 28a478642806db6920f9444f585c0daffe01a517..0303954343a44e8873ac5134a8d681e9d3a54840 100644 --- a/test/sun/tools/jps/jps-help.sh +++ b/test/sun/tools/jps/jps-help.sh @@ -35,7 +35,7 @@ JPS="${TESTJAVA}/bin/jps" rm -f jps.out 2>/dev/null ${JPS} -? > jps.out 2>&1 -diff jps.out ${TESTSRC}/usage.out +diff -w jps.out ${TESTSRC}/usage.out if [ $? != 0 ] then echo "Output of jps -? differ from expected output. Failed." @@ -46,7 +46,7 @@ fi rm -f jps.out 2>/dev/null ${JPS} -help > jps.out 2>&1 -diff jps.out ${TESTSRC}/usage.out +diff -w jps.out ${TESTSRC}/usage.out if [ $? != 0 ] then echo "Output of jps -help differ from expected output. Failed." diff --git a/test/sun/tools/jstat/jstatHelp.sh b/test/sun/tools/jstat/jstatHelp.sh index 545970e31100398f62c95ad0d04374d095ec9ab1..3ec7906c0e3c1ad809bb870beace4a2bf07d9e0a 100644 --- a/test/sun/tools/jstat/jstatHelp.sh +++ b/test/sun/tools/jstat/jstatHelp.sh @@ -35,7 +35,7 @@ JSTAT="${TESTJAVA}/bin/jstat" rm -f jstat.out 2>/dev/null ${JSTAT} -? > jstat.out 2>&1 -diff jstat.out ${TESTSRC}/usage.out +diff -w jstat.out ${TESTSRC}/usage.out if [ $? != 0 ] then echo "Output of jstat -? differ from expected output. Failed." @@ -45,7 +45,7 @@ fi rm -f jstat.out 2>/dev/null ${JSTAT} -help > jstat.out 2>&1 -diff jstat.out ${TESTSRC}/usage.out +diff -w jstat.out ${TESTSRC}/usage.out if [ $? != 0 ] then echo "Output of jstat -help differ from expected output. Failed." diff --git a/test/sun/tools/jstat/jstatOptions1.sh b/test/sun/tools/jstat/jstatOptions1.sh index e38c413790f947153759d64e659d2659291bc2e7..ad3df13ca30f87f087c15cadb38bdd90a8f9de1f 100644 --- a/test/sun/tools/jstat/jstatOptions1.sh +++ b/test/sun/tools/jstat/jstatOptions1.sh @@ -35,4 +35,4 @@ JSTAT="${TESTJAVA}/bin/jstat" rm -f jstat.out 2>/dev/null ${JSTAT} -options > jstat.out 2>&1 -diff jstat.out ${TESTSRC}/options1.out +diff -w jstat.out ${TESTSRC}/options1.out diff --git a/test/sun/tools/jstatd/jstatdUsage1.sh b/test/sun/tools/jstatd/jstatdUsage1.sh index 22d309b62c8c50720f119853daff8d3666dfadee..074ec5ce2bac255587500feb34c478dc8bbaa93a 100644 --- a/test/sun/tools/jstatd/jstatdUsage1.sh +++ b/test/sun/tools/jstatd/jstatdUsage1.sh @@ -37,7 +37,7 @@ JSTATD_2_OUT="jstatd_$$_2.out" ${JSTATD} -? > ${JSTATD_1_OUT} 2>&1 -diff ${JSTATD_1_OUT} ${TESTSRC}/usage.out +diff -w ${JSTATD_1_OUT} ${TESTSRC}/usage.out if [ $? != 0 ] then echo "Output of jstatd -? differs from expected output. Failed." @@ -46,7 +46,7 @@ fi ${JSTATD} -help > ${JSTATD_2_OUT} 2>&1 -diff ${JSTATD_2_OUT} ${TESTSRC}/usage.out +diff -w ${JSTATD_2_OUT} ${TESTSRC}/usage.out if [ $? != 0 ] then echo "Output of jstatd -help differs from expected output. Failed." diff --git a/test/sun/tools/native2ascii/Native2AsciiTests.sh b/test/sun/tools/native2ascii/Native2AsciiTests.sh index 1fa7f6c00045a4a72ad929f90fcc1f58ad42c735..26281ba7241a4258c4558d77e6ffc230ad9848b2 100644 --- a/test/sun/tools/native2ascii/Native2AsciiTests.sh +++ b/test/sun/tools/native2ascii/Native2AsciiTests.sh @@ -32,7 +32,7 @@ if [ "${TESTSRC}" = "" ]; then TESTSRC=.; fi if [ "${TESTJAVA}" = "" ]; then TESTJAVA=$1; shift; fi case `uname -s` in - Windows*) OS=Windows;; + Windows* | CYGWIN*) OS=Windows;; SunOS|Linux) OS=Unix;; esac @@ -45,12 +45,14 @@ check() { # Strip carriage returns from output when comparing with n2a test output # on win32 systems - if [ OS = Windows ]; then - tr -d '\015' <$out >$out.1 + if [ ${OS} = Windows ]; then + sed -e 's@\\r@@g' $out >$out.1 + sed -e 's@\\r@@g' $expected >$out.expected else cp $out $out.1 + cp $expected $out.expected fi - if (set -x; diff -c $expected $out.1); then + if (set -x; diff -c $out.expected $out.1); then echo "$bug passed" else echo "$bug failed" diff --git a/test/sun/util/resources/Locale/Bug4429024.java b/test/sun/util/resources/Locale/Bug4429024.java index 6a3ffc2891fb6318da04aa4f64ee77c141581b5f..e592025d0b32aad42c2767ffe1f9195f7d5647ff 100644 --- a/test/sun/util/resources/Locale/Bug4429024.java +++ b/test/sun/util/resources/Locale/Bug4429024.java @@ -46,7 +46,7 @@ public class Bug4429024 { { "en", "englanti" }, { "es", "espanja" }, { "fi", "suomi" }, - { "fr", "franska" }, + { "fr", "ranska" }, { "he", "heprea" }, { "hi", "hindi" }, { "it", "italia" }, @@ -75,7 +75,7 @@ public class Bug4429024 { { "DK", "Tanska" }, { "ES", "Espanja" }, { "FI", "Suomi" }, - { "FR", "Franska" }, + { "FR", "Ranska" }, { "GB", "Iso-Britannia" }, { "GR", "Kreikka" }, { "IE", "Irlanti" }, diff --git a/test/tools/launcher/ChangeDataModel.sh b/test/tools/launcher/ChangeDataModel.sh index eddc38d7cfcd00576c2079033e1398e6e3d86660..1fc689f403beed1b049dddee46931f74577af138 100644 --- a/test/tools/launcher/ChangeDataModel.sh +++ b/test/tools/launcher/ChangeDataModel.sh @@ -29,6 +29,9 @@ OS=`uname -s`; +# To remove CR from output, needed for java apps in CYGWIN, harmless otherwise +SED_CR="sed -e s@\\r@@g" + case "$OS" in Windows* | CYGWIN* ) PATHSEP=";" @@ -79,10 +82,10 @@ $JAVAC GetDataModel.java # Verify data model flag for default data model is accepted -DM=`$JAVA GetDataModel` +DM=`$JAVA GetDataModel | ${SED_CR}` case "$DM" in 32 ) - DM2=`${JAVA} -d32 GetDataModel` + DM2=`${JAVA} -d32 GetDataModel | ${SED_CR}` if [ "${DM2}" != "32" ] then echo "Data model flag -d32 not accepted or had improper effect." @@ -91,7 +94,7 @@ case "$DM" in ;; 64 ) - DM2=`${JAVA} -d64 GetDataModel` + DM2=`${JAVA} -d64 GetDataModel | ${SED_CR}` if [ "${DM2}" != "64" ] then echo "Data model flag -d64 not accepted or had improper effect." @@ -227,10 +230,10 @@ then else # Negative tests for non-dual mode platforms to ensure the other data model is # rejected - DM=`$JAVA GetDataModel` + DM=`$JAVA GetDataModel | ${SED_CR}` case "$DM" in 32 ) - DM2=`${JAVA} -d64 GetDataModel` + DM2=`${JAVA} -d64 GetDataModel | ${SED_CR}` if [ "x${DM2}" != "x" ] then echo "Data model flag -d64 was accepted." @@ -239,7 +242,7 @@ else ;; 64 ) - DM2=`${JAVA} -d32 GetDataModel` + DM2=`${JAVA} -d32 GetDataModel | ${SED_CR}` if [ "x${DM2}" != "x" ] then echo "Data model flag -d32 was accepted." diff --git a/test/tools/launcher/ClassPathWildCard.sh b/test/tools/launcher/ClassPathWildCard.sh index 46a4866e4862ab1b4dc97652a82de09b816f5005..4b3b0dfb5e18dd485c29eba87345209c5c3d8756 100644 --- a/test/tools/launcher/ClassPathWildCard.sh +++ b/test/tools/launcher/ClassPathWildCard.sh @@ -145,7 +145,7 @@ CreateClassFiles D OS=`uname -s` case $OS in - Windows*|Cygwin*) + Windows*|CYGWIN*) PATHSEP=";" ExecJava "" "${PATHSEP}NOOPDIR" ExecJava "w" "${PATHSEP}NOOPDIR" diff --git a/test/tools/launcher/DefaultLocaleTest.sh b/test/tools/launcher/DefaultLocaleTest.sh index 97eddd5bf635f97c3bd4bf1549a68d06fbe63c4f..31af0aa31998f324b8809fc87ad24afc1eb15ef2 100644 --- a/test/tools/launcher/DefaultLocaleTest.sh +++ b/test/tools/launcher/DefaultLocaleTest.sh @@ -48,7 +48,7 @@ fi OS=`uname` case "$OS" in - Windows* | CYGWIN* ) + Windows* ) JAVAC="${TESTJAVA}/bin/javac -d . " JAVA="${TESTJAVA}/bin/java -classpath . " JAVAW="${TESTJAVA}/bin/javaw -classpath . " @@ -64,6 +64,22 @@ case "$OS" in echo "Test passes" exit 0 ;; + CYGWIN* ) + JAVAC="${TESTJAVA}/bin/javac -d . " + JAVA="${TESTJAVA}/bin/java -classpath . " + JAVAW="${TESTJAVA}/bin/javaw -classpath . " + + ${JAVAC} ${TESTSRC}/DefaultLocaleTest.java + ${JAVA} DefaultLocaleTest | sed -e s@\\r@@g > x.out + ${JAVAW} DefaultLocaleTest `cat x.out` + if [ $? -ne 0 ] + then + echo "Test fails" + exit 1 + fi + echo "Test passes" + exit 0 + ;; * ) echo "Non-windows environment; test vacuously succeeds." exit 0; diff --git a/test/tools/launcher/UnicodeTest.sh b/test/tools/launcher/UnicodeTest.sh index 7b4789772f0fb5b3456722b4df29843a8c2a594b..8f77f4b739dffbdbb3482913e6717a92f39fd334 100644 --- a/test/tools/launcher/UnicodeTest.sh +++ b/test/tools/launcher/UnicodeTest.sh @@ -54,7 +54,7 @@ mkdir UnicodeTest-src UnicodeTest-classes echo "creating test source files" "$JAVAC" -d . "${TESTSRC}"/UnicodeTest.java -CLASS_NAME=`"$JAVA" UnicodeTest` +CLASS_NAME=`"$JAVA" UnicodeTest | sed -e 's@\\r@@g' ` if [ "$CLASS_NAME" = "" ] then