# HG changeset patch # User kizune # Date 1386247055 -14400 # Node ID 48367e6de87270be2f302ec1b801fdaee5a488ad # Parent aaea3a69fa6c4fd23911ab8228808d194b052c92# Parent 1670108bec258634e98b2a944dd454b237e2ec9a Merge diff -r aaea3a69fa6c -r 48367e6de872 .hgtags --- a/.hgtags Tue Dec 03 14:13:15 2013 +0400 +++ b/.hgtags Thu Dec 05 16:37:35 2013 +0400 @@ -240,3 +240,4 @@ 3c040b04af05646878798216ebf939d27e6fe687 jdk8-b116 19de039a03a619b99f1a8b454e1618c9fa9dae66 jdk8-b117 4fd6a7ff8c068eceaaaf8bf12a394195203b99b3 jdk8-b118 +43a80d75d06ed22d6942f25f067587a3be3a129d jdk8-b119 diff -r aaea3a69fa6c -r 48367e6de872 make/BuildLangtools.gmk --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/make/BuildLangtools.gmk Thu Dec 05 16:37:35 2013 +0400 @@ -0,0 +1,205 @@ +# +# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# + +# This must be the first rule +default: all + +include $(SPEC) +include MakeBase.gmk +include JavaCompilation.gmk + +# The BOOT_JAVAC setup uses the bootdir compiler to compile the tools +# and the bootstrap javac, to be run by the bootdir jvm. +$(eval $(call SetupJavaCompiler,BOOT_JAVAC, \ + JAVAC := $(JAVAC), \ + SERVER_DIR := $(SJAVAC_SERVER_DIR), \ + SERVER_JVM := $(SJAVAC_SERVER_JAVA), \ + FLAGS := -XDignore.symbol.file=true -g -Xlint:all$(COMMA)-deprecation -Werror)) + +# javax.tools.JavaCompilerTool isn't really a suffix but this gets the file copied. +RESOURCE_SUFFIXES := .gif .xml .css .js javax.tools.JavaCompilerTool + +# Now setup the compilation of the properties compilation tool. You can depend +# upon $(BUILD_TOOLS) to trigger a compilation of the tools. Note that we +# add src/share/classes to the sourcepath. This is necessary since the GenStubs +# program needs to be linked and run towards the new javac sources. +$(eval $(call SetupJavaCompilation,BUILD_TOOLS, \ + SETUP := BOOT_JAVAC, \ + DISABLE_SJAVAC := true, \ + ADD_JAVAC_FLAGS := -Xprefer:source, \ + SRC := $(LANGTOOLS_TOPDIR)/make/tools $(LANGTOOLS_TOPDIR)/src/share/classes, \ + INCLUDES := compileproperties genstubs, \ + BIN := $(LANGTOOLS_OUTPUTDIR)/btclasses)) + +# The compileprops tools compiles a properties file into a resource bundle. +TOOL_COMPILEPROPS_CMD := $(JAVA) -cp $(LANGTOOLS_OUTPUTDIR)/btclasses compileproperties.CompileProperties -quiet + +# Lookup the properties that need to be compiled into resource bundles. +PROPSOURCES := $(shell $(FIND) $(LANGTOOLS_TOPDIR)/src/share/classes -name "*.properties") + +# Strip away prefix and suffix, leaving for example only: "com/sun/tools/javac/resources/javac_zh_CN" +PROPPATHS := $(patsubst $(LANGTOOLS_TOPDIR)/src/share/classes/%.properties, %, $(PROPSOURCES)) + +# Generate the list of java files to be created. +PROPJAVAS := $(patsubst %, $(LANGTOOLS_OUTPUTDIR)/gensrc/%.java, $(PROPPATHS)) + +# Generate the package dirs for the tobe generated java files. +PROPDIRS := $(dir $(PROPJAVAS)) + +# Now generate a sequence of "-compile ...javac_zh_CN.properties ...javac_zh_CN.java java.util.ListResourceBundle" +# suitable to be fed into the CompileProperties command. +PROPCMDLINE := $(subst _SPACE_, $(SPACE), $(join $(addprefix -compile_SPACE_, $(PROPSOURCES)), \ + $(addsuffix _SPACE_java.util.ListResourceBundle, $(addprefix _SPACE_$(LANGTOOLS_OUTPUTDIR)/gensrc/, $(addsuffix .java, $(PROPPATHS)))))) + +# Now setup the rule for the generation of the resource bundles. +$(LANGTOOLS_OUTPUTDIR)/gensrc/_the_props.d: $(PROPSOURCES) $(BUILD_TOOLS) + $(RM) -r $(@D)/* + $(MKDIR) -p $(@D) $(PROPDIRS) + $(PRINTF) "jdk=$(JDK_VERSION)\nfull=$(FULL_VERSION)\nrelease=$(RELEASE)\n" > $(LANGTOOLS_OUTPUTDIR)/gensrc/com/sun/tools/javah/resources/version.properties + $(PRINTF) "jdk=$(JDK_VERSION)\nfull=$(FULL_VERSION)\nrelease=$(RELEASE)\n" > $(LANGTOOLS_OUTPUTDIR)/gensrc/com/sun/tools/javap/resources/version.properties + $(PRINTF) "jdk=$(JDK_VERSION)\nfull=$(FULL_VERSION)\nrelease=$(RELEASE)\n" > $(LANGTOOLS_OUTPUTDIR)/gensrc/com/sun/tools/javac/resources/version.properties + $(PRINTF) "jdk=$(JDK_VERSION)\nfull=$(FULL_VERSION)\nrelease=$(RELEASE)\n" > $(LANGTOOLS_OUTPUTDIR)/gensrc/com/sun/tools/jdeps/resources/version.properties + $(PRINTF) "jdk=$(JDK_VERSION)\nfull=$(FULL_VERSION)\nrelease=$(RELEASE)\n" > $(LANGTOOLS_OUTPUTDIR)/gensrc/com/sun/tools/javadoc/resources/version.properties + $(ECHO) Compiling $(words $(PROPSOURCES) v1 v2 v3) properties into resource bundles + $(TOOL_COMPILEPROPS_CMD) $(PROPCMDLINE) \ + -compile $(LANGTOOLS_OUTPUTDIR)/gensrc/com/sun/tools/javah/resources/version.properties \ + $(LANGTOOLS_OUTPUTDIR)/gensrc/com/sun/tools/javah/resources/version.java \ + java.util.ListResourceBundle \ + -compile $(LANGTOOLS_OUTPUTDIR)/gensrc/com/sun/tools/javap/resources/version.properties \ + $(LANGTOOLS_OUTPUTDIR)/gensrc/com/sun/tools/javap/resources/version.java \ + java.util.ListResourceBundle \ + -compile $(LANGTOOLS_OUTPUTDIR)/gensrc/com/sun/tools/javac/resources/version.properties \ + $(LANGTOOLS_OUTPUTDIR)/gensrc/com/sun/tools/javac/resources/version.java \ + java.util.ListResourceBundle \ + -compile $(LANGTOOLS_OUTPUTDIR)/gensrc/com/sun/tools/jdeps/resources/version.properties \ + $(LANGTOOLS_OUTPUTDIR)/gensrc/com/sun/tools/jdeps/resources/version.java \ + java.util.ListResourceBundle \ + -compile $(LANGTOOLS_OUTPUTDIR)/gensrc/com/sun/tools/javadoc/resources/version.properties \ + $(LANGTOOLS_OUTPUTDIR)/gensrc/com/sun/tools/javadoc/resources/version.java \ + java.util.ListResourceBundle + $(ECHO) PROPS_ARE_CREATED = yes > $@ + +# Trigger the generation of the resource bundles. After the resource bundles have +# been compiled, then the makefile will restart and the newly created java files +# will become part of the build further along in the makefile. +-include $(LANGTOOLS_OUTPUTDIR)/gensrc/_the_props.d + +ifeq ($(PROPS_ARE_CREATED), yes) + # Setup the rules to build a dist/bootstrap/lib/javac.jar, ie a smaller intermediate javac + # that can be compiled with an old javac. The intermediate javac is then used + # to compile javac again and to build the complete new jdk. + $(eval $(call SetupJavaCompilation,BUILD_BOOTSTRAP_LANGTOOLS, \ + SETUP := BOOT_JAVAC, \ + DISABLE_SJAVAC := true, \ + SRC := $(LANGTOOLS_TOPDIR)/src/share/classes $(LANGTOOLS_OUTPUTDIR)/gensrc, \ + EXCLUDES := com/sun/tools/javac/nio, \ + COPY := $(RESOURCE_SUFFIXES), \ + BIN := $(LANGTOOLS_OUTPUTDIR)/btclasses/bootstrap)) + + $(eval $(call SetupArchive,ARCHIVE_BOOTSTRAP_JAVAC, $(BUILD_BOOTSTRAP_LANGTOOLS), \ + SRCS := $(LANGTOOLS_OUTPUTDIR)/btclasses/bootstrap, \ + JAR := $(LANGTOOLS_OUTPUTDIR)/dist/bootstrap/lib/javac.jar, \ + SUFFIXES := .class $(RESOURCE_SUFFIXES))) + + # GenStubs is used to bootstrap any dependencies from javac to the new JDK that is not + # yet built. It is currently not needed but might be again in the future. The following + # exercises the functionality to verify that it works. + TOOL_GENSTUBS_CMD = $(JAVA) \ + "-Xbootclasspath/p:$(LANGTOOLS_OUTPUTDIR)/dist/bootstrap/lib/javac.jar" \ + -classpath $(LANGTOOLS_OUTPUTDIR)/btclasses \ + genstubs.GenStubs + + # We fetch source from the JDK... + JDKS = $(JDK_TOPDIR)/src/share/classes + + # Build the list of classes to generate stubs from. java/util/function/Predicate.java isn't + # currently needed, but is used as a demo for now. + + STUBSOURCES := $(shell $(FIND) $(JDKS) -name "*.java" | $(GREP) \ + -e "$(JDKS)/java/util/function/Predicate.java") + + # Rewrite the file names into class names because the GenStubs tool require this. + STUBCLASSES := $(subst /,., $(patsubst $(JDKS)/%.java, %, $(STUBSOURCES))) + + # Now setup the build recipe for genstubs. + $(LANGTOOLS_OUTPUTDIR)/genstubs/_the_stubs.d: $(STUBSOURCES) $(BUILD_TOOLS) \ + $(LANGTOOLS_OUTPUTDIR)/dist/bootstrap/lib/javac.jar \ + $(LANGTOOLS_OUTPUTDIR)/gensrc/_the_props.d + $(MKDIR) -p $(@D) + $(MKDIR) -p $(LANGTOOLS_OUTPUTDIR)/tmpstubs + $(ECHO) $(LOG_INFO) Generating stubs from JDK sources. + ($(TOOL_GENSTUBS_CMD) -s $(LANGTOOLS_OUTPUTDIR)/tmpstubs -sourcepath $(JDKS) $(STUBCLASSES) && $(ECHO) STUBS_ARE_CREATED = yes > $@) + if $(DIFF) -x "_the*" -rq $(LANGTOOLS_OUTPUTDIR)/tmpstubs $(LANGTOOLS_OUTPUTDIR)/genstubs > /dev/null 2>&1; then \ + $(ECHO) $(LOG_INFO) No changes in the stubs!; \ + $(RM) -r $(LANGTOOLS_OUTPUTDIR)/tmpstubs; \ + else \ + $(ECHO) $(LOG_INFO) Changes in stubs detected!; \ + $(RM) -r $(@D); \ + $(MV) $(LANGTOOLS_OUTPUTDIR)/tmpstubs $(@D); \ + fi + $(ECHO) STUBS_ARE_CREATED = yes > $@ + + # Trigger a generation of the genstubs java source code and a restart + # of the makefile to make sure that the following build setup use the + # newly created java files. + -include $(LANGTOOLS_OUTPUTDIR)/genstubs/_the_stubs.d + + ifeq ($(STUBS_ARE_CREATED), yes) + # Setup a compiler configuration using the intermediate javac in dist/bootstrap/lib/javac.jar + # that generates code for the new jdk that is being built. + # The code compiled by this compiler setup, cannot necessarily be run with the bootstrap jvm. + $(eval $(call SetupJavaCompiler,GENERATE_NEWBYTECODE, \ + JVM := $(JAVA), \ + JAVAC := "-Xbootclasspath/p:$(LANGTOOLS_OUTPUTDIR)/dist/bootstrap/lib/javac.jar" \ + -cp $(LANGTOOLS_OUTPUTDIR)/dist/bootstrap/lib/javac.jar \ + com.sun.tools.javac.Main, \ + FLAGS := -XDignore.symbol.file=true -Xlint:all$(COMMA)-deprecation -Werror, \ + SERVER_DIR := $(SJAVAC_SERVER_DIR), \ + SERVER_JVM := $(SJAVAC_SERVER_JAVA))) + + $(eval $(call SetupJavaCompilation,BUILD_FULL_JAVAC, \ + SETUP := GENERATE_NEWBYTECODE, \ + SRC := $(LANGTOOLS_TOPDIR)/src/share/classes $(LANGTOOLS_OUTPUTDIR)/gensrc \ + $(LANGTOOLS_OUTPUTDIR)/genstubs, \ + EXCLUDES := java/util java/io java/nio, \ + COPY := $(RESOURCE_SUFFIXES), \ + BIN := $(LANGTOOLS_OUTPUTDIR)/classes)) + + $(eval $(call SetupArchive,ARCHIVE_FULL_JAVAC, $(BUILD_FULL_JAVAC), \ + SETUP := GENERATE_NEWBYTECODE, \ + SRCS := $(LANGTOOLS_OUTPUTDIR)/classes, \ + SUFFIXES := .class $(RESOURCE_SUFFIXES), \ + JAR := $(LANGTOOLS_OUTPUTDIR)/dist/lib/classes.jar)) + + $(eval $(call SetupZipArchive,ZIP_FULL_JAVAC_SOURCE, \ + SRC := $(LANGTOOLS_TOPDIR)/src/share/classes $(LANGTOOLS_OUTPUTDIR)/gensrc, \ + ZIP := $(LANGTOOLS_OUTPUTDIR)/dist/lib/src.zip)) + + all: $(LANGTOOLS_OUTPUTDIR)/dist/lib/classes.jar \ + $(LANGTOOLS_OUTPUTDIR)/dist/lib/src.zip \ + $(LANGTOOLS_OUTPUTDIR)/dist/bootstrap/lib/javac.jar + + endif +endif diff -r aaea3a69fa6c -r 48367e6de872 make/Makefile --- a/make/Makefile Tue Dec 03 14:13:15 2013 +0400 +++ b/make/Makefile Thu Dec 05 16:37:35 2013 +0400 @@ -1,5 +1,5 @@ # -# Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -23,199 +23,27 @@ # questions. # -# Makefile for langtools: wrapper around Ant build.xml file - -# -# On Solaris, the standard 'make' utility will not work with these makefiles. -# This little rule is only understood by Solaris make, and is harmless -# when seen by the GNU make tool. If using Solaris make, this causes the -# make command to fail. -# -SUN_MAKE_TEST:sh = @echo "ERROR: PLEASE USE GNU VERSION OF MAKE"; exit 33 - -# -# Minimal platform defs -# Need FullPath because we can't rely on gnumake abspath, until we use v3.81 -# - -SYSTEM_UNAME := $(shell uname) - -# Where is unwanted output to be delivered? -# On Windows, MKS uses the special file "NUL", cygwin uses the customary unix file. -ifeq ($(SYSTEM_UNAME), Windows_NT) -DEV_NULL = NUL +# Locate this Makefile +ifeq ($(filter /%, $(lastword $(MAKEFILE_LIST))), ) + makefile_path := $(CURDIR)/$(lastword $(MAKEFILE_LIST)) else -DEV_NULL = /dev/null -endif - -ifneq (,$(findstring CYGWIN,$(SYSTEM_UNAME))) -USING_CYGWIN = true + makefile_path := $(lastword $(MAKEFILE_LIST)) endif - -ifdef USING_CYGWIN -define FullPath -$(shell cygpath -a -s -m $1 2> $(DEV_NULL)) -endef -else -define FullPath -$(shell cd $1 2> $(DEV_NULL) && pwd) -endef -endif - -# -# Makefile args -# +repo_dir := $(patsubst %/make/Makefile, %, $(makefile_path)) -ifdef QUIET - ANT_OPTIONS += -quiet -endif - -ifdef VERBOSE - ANT_OPTIONS += -verbose -debug -endif +# What is the name of this subsystem (langtools, corba, etc)? +subsystem_name := $(notdir $(repo_dir)) -ifdef JDK_VERSION - ANT_OPTIONS += -Djdk.version=$(JDK_VERSION) -endif - -ifdef FULL_VERSION - ANT_OPTIONS += -Dfull.version='$(FULL_VERSION)' # will contain spaces -endif - -ifdef MILESTONE -ifneq ($(MILESTONE),fcs) - ANT_OPTIONS += -Dmilestone=$(MILESTONE) +# Try to locate top-level makefile +top_level_makefile := $(repo_dir)/../Makefile +ifneq ($(wildcard $(top_level_makefile)), ) + $(info Will run $(subsystem_name) target on top-level Makefile) + $(info WARNING: This is a non-recommended way of building!) + $(info ===================================================) else - ANT_OPTIONS += -Drelease=$(JDK_VERSION) -endif -endif - -ifdef BUILD_NUMBER - ANT_OPTIONS += -Dbuild.number=$(BUILD_NUMBER) -else - ifdef JDK_BUILD_NUMBER - ANT_OPTIONS += -Dbuild.number=$(JDK_BUILD_NUMBER) - endif -endif - -ifeq ($(VARIANT), DBG) - ANT_OPTIONS += -Djavac.debug=true -else - ifeq ($(VARIANT), OPT) - ANT_OPTIONS += -Djavac.debug=false - endif -endif - -ifeq ($(DEBUG_CLASSFILES), true) - ANT_OPTIONS += -Djavac.debug=true - ANT_OPTIONS += -Ddebug.classfiles=true + $(info Cannot locate top-level Makefile. Is this repo not checked out as part of a complete forest?) + $(error Build from top-level Makefile instead) endif -# Note: jdk/make/common/Defs.gmk uses LANGUAGE_VERSION (-source NN) -# and the somewhat misnamed CLASS_VERSION (-target NN) -ifdef TARGET_CLASS_VERSION - ANT_OPTIONS += -Djavac.target=$(TARGET_CLASS_VERSION) -else - ifdef JAVAC_TARGET_ARG - ANT_OPTIONS += -Djavac.target=$(JAVAC_TARGET_ARG) - endif -endif - -ifdef SOURCE_LANGUAGE_VERSION - ANT_OPTIONS += -Djavac.source=$(SOURCE_LANGUAGE_VERSION) -else - ifdef JAVAC_SOURCE_ARG - ANT_OPTIONS += -Djavac.source=$(JAVAC_SOURCE_ARG) - endif -endif - -ifdef ALT_BOOTDIR - ANT_OPTIONS += -Dboot.java.home=$(ALT_BOOTDIR) - ANT_JAVA_HOME = JAVA_HOME=$(ALT_BOOTDIR) -endif - -# To facilitate bootstrapping, much of langtools can be compiled with (just) -# a boot JDK. However, some source files need to be compiled against -# new JDK API. In a bootstrap build, an import JDK may not be available, -# so build.xml can also build against the source files in a jdk repo, -# in which case it will automatically generate stub files for the new JDK API. -ifdef JDK_TOPDIR - ANT_OPTIONS += -Dimport.jdk=$(JDK_TOPDIR) -else - ifdef ALT_JDK_TOPDIR - ANT_OPTIONS += -Dimport.jdk=$(ALT_JDK_TOPDIR) - else - ifdef ALT_JDK_IMPORT_PATH - ANT_OPTIONS += -Dimport.jdk=$(ALT_JDK_IMPORT_PATH) - endif - endif -endif - -ifdef ALT_OUTPUTDIR - OUTPUTDIR = $(ALT_OUTPUTDIR) - ANT_OPTIONS += -Dbuild.dir=$(ALT_OUTPUTDIR)/build - ANT_OPTIONS += -Ddist.dir=$(ALT_OUTPUTDIR)/dist -else - OUTPUTDIR = .. -endif -#ABS_OUTPUTDIR = $(abspath $(OUTPUTDIR)) -ABS_OUTPUTDIR = $(call FullPath,$(OUTPUTDIR)) - -ANT_TMPDIR = $(ABS_OUTPUTDIR)/build/ant-tmp -ANT_OPTS = ANT_OPTS=-Djava.io.tmpdir='$(ANT_TMPDIR)' - -ifdef FINDBUGS_HOME - ANT_OPTIONS += -Dfindbugs.home=$(FINDBUGS_HOME) -endif - -ifdef ANT_HOME - ANT = $(ANT_HOME)/bin/ant - ifneq ($(shell test -x $(ANT) && echo OK), OK) - $(error $(ANT) not found -- please update ANT_HOME) - endif -else - ANT = ant - ifneq ($(shell test -x "`which $(ANT)`" && echo OK), OK) - $(error 'ant' not found -- please set ANT_HOME or put 'ant' on your PATH) - endif -endif - -# Default target and expected 'do everything' target -all: build - -# Standard make clobber target -clobber: clean - -# All ant targets of interest -ANT_TARGETS = build clean sanity post-sanity diagnostics build-all-tools # for now - -# Create diagnostics log (careful, ant 1.8.0 -diagnostics always does an exit 1) -$(OUTPUTDIR)/build/ant-diagnostics.log: - @mkdir -p $(OUTPUTDIR)/build $(ANT_TMPDIR) - @$(RM) $@ - $(ANT_JAVA_HOME) $(ANT_OPTS) $(ANT) -diagnostics > $@ ; \ - $(ANT_JAVA_HOME) $(ANT_OPTS) $(ANT) -version >> $@ - -# Create a make target for each -$(ANT_TARGETS): $(OUTPUTDIR)/build/ant-diagnostics.log - @ mkdir -p $(OUTPUTDIR)/build $(ANT_TMPDIR) - $(ANT_JAVA_HOME) $(ANT_OPTS) $(ANT) $(ANT_OPTIONS) $@ - -#------------------------------------------------------------------- -# -# Targets for Oracle's internal JPRT build system - -CD = cd -ZIP = zip - -JPRT_ARCHIVE_BUNDLE=$(ABS_OUTPUTDIR)/$(JPRT_BUILD_FLAVOR)-bundle.zip - -jprt_build_product jprt_build_debug jprt_build_fastdebug: all - ( $(CD) $(OUTPUTDIR) && \ - $(ZIP) -q -r $(JPRT_ARCHIVE_BUNDLE) build dist ) - -#------------------------------------------------------------------- - -# Declare these phony (not filenames) -.PHONY: $(ANT_TARGETS) all clobber \ - jprt_build_product jprt_build_debug jprt_build_fastdebug +all: + @$(MAKE) -f $(top_level_makefile) $(subsystem_name) diff -r aaea3a69fa6c -r 48367e6de872 make/jprt.properties --- a/make/jprt.properties Tue Dec 03 14:13:15 2013 +0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,73 +0,0 @@ -# -# Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. Oracle designates this -# particular file as subject to the "Classpath" exception as provided -# by Oracle in the LICENSE file that accompanied this code. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# - -# Properties for jprt - -# Locked down to jdk8 -jprt.tools.default.release=jdk8 - -# The different build flavors we want, we override here so we just get these 2 -jprt.build.flavors=product,fastdebug - -# Standard list of jprt build targets for this source tree -jprt.build.targets= \ - solaris_sparcv9_5.10-{product|fastdebug}, \ - solaris_x64_5.10-{product|fastdebug}, \ - linux_i586_2.6-{product|fastdebug}, \ - linux_x64_2.6-{product|fastdebug}, \ - macosx_x64_10.7-{product|fastdebug}, \ - windows_i586_6.1-{product|fastdebug}, \ - windows_x64_6.1-{product|fastdebug} - -# Test target list (no fastdebug & limited c2 testing) -jprt.my.test.target.set= \ - solaris_sparcv9_5.10-product-c2-TESTNAME, \ - solaris_x64_5.10-product-c2-TESTNAME, \ - linux_i586_2.6-product-{c1|c2}-TESTNAME, \ - linux_x64_2.6-product-c2-TESTNAME, \ - macosx_x64_10.7-product-c2-TESTNAME, \ - windows_i586_6.1-product-c1-TESTNAME, \ - windows_x64_6.1-product-c2-TESTNAME - -# Default test targets -jprt.make.rule.test.targets= \ - ${jprt.my.test.target.set:TESTNAME=jtreg} - -# Directories to be excluded from the source bundles -jprt.bundle.exclude.src.dirs=build dist webrev - -# Test target list (no fastdebug & limited c2 testing) -jprt.my.test.target.set= \ - solaris_sparcv9_5.10-product-c2-TESTNAME, \ - solaris_x64_5.10-product-c2-TESTNAME, \ - linux_i586_2.6-product-{c1|c2}-TESTNAME, \ - linux_x64_2.6-product-c2-TESTNAME, \ - macosx_x64_10.7-product-c2-TESTNAME, \ - windows_i586_6.1-product-c1-TESTNAME, \ - windows_x64_6.1-product-c2-TESTNAME - -# Default test targets -jprt.make.rule.test.targets= \ - ${jprt.my.test.target.set:TESTNAME=jtreg} diff -r aaea3a69fa6c -r 48367e6de872 makefiles/BuildLangtools.gmk --- a/makefiles/BuildLangtools.gmk Tue Dec 03 14:13:15 2013 +0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,201 +0,0 @@ -# -# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. Oracle designates this -# particular file as subject to the "Classpath" exception as provided -# by Oracle in the LICENSE file that accompanied this code. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# - -# This must be the first rule -default: all - -include $(SPEC) -include MakeBase.gmk -include JavaCompilation.gmk - -# The BOOT_JAVAC setup uses the bootdir compiler to compile the tools -# and the bootstrap javac, to be run by the bootdir jvm. -$(eval $(call SetupJavaCompiler,BOOT_JAVAC, \ - JAVAC := $(JAVAC), \ - SERVER_DIR := $(SJAVAC_SERVER_DIR), \ - SERVER_JVM := $(SJAVAC_SERVER_JAVA), \ - FLAGS := -XDignore.symbol.file=true -g -Xlint:all$(COMMA)-deprecation -Werror)) - -# javax.tools.JavaCompilerTool isn't really a suffix but this gets the file copied. -RESOURCE_SUFFIXES := .gif .xml .css .js javax.tools.JavaCompilerTool - -# Now setup the compilation of the properties compilation tool. You can depend -# upon $(BUILD_TOOLS) to trigger a compilation of the tools. Note that we -# add src/share/classes to the sourcepath. This is necessary since the GenStubs -# program needs to be linked and run towards the new javac sources. -$(eval $(call SetupJavaCompilation,BUILD_TOOLS, \ - SETUP := BOOT_JAVAC, \ - DISABLE_SJAVAC := true, \ - ADD_JAVAC_FLAGS := -Xprefer:source, \ - SRC := $(LANGTOOLS_TOPDIR)/make/tools $(LANGTOOLS_TOPDIR)/src/share/classes, \ - INCLUDES := compileproperties genstubs, \ - BIN := $(LANGTOOLS_OUTPUTDIR)/btclasses)) - -# The compileprops tools compiles a properties file into a resource bundle. -TOOL_COMPILEPROPS_CMD := $(JAVA) -cp $(LANGTOOLS_OUTPUTDIR)/btclasses compileproperties.CompileProperties -quiet - -# Lookup the properties that need to be compiled into resource bundles. -PROPSOURCES := $(shell $(FIND) $(LANGTOOLS_TOPDIR)/src/share/classes -name "*.properties") - -# Strip away prefix and suffix, leaving for example only: "com/sun/tools/javac/resources/javac_zh_CN" -PROPPATHS := $(patsubst $(LANGTOOLS_TOPDIR)/src/share/classes/%.properties, %, $(PROPSOURCES)) - -# Generate the list of java files to be created. -PROPJAVAS := $(patsubst %, $(LANGTOOLS_OUTPUTDIR)/gensrc/%.java, $(PROPPATHS)) - -# Generate the package dirs for the tobe generated java files. -PROPDIRS := $(dir $(PROPJAVAS)) - -# Now generate a sequence of "-compile ...javac_zh_CN.properties ...javac_zh_CN.java java.util.ListResourceBundle" -# suitable to be fed into the CompileProperties command. -PROPCMDLINE := $(subst _SPACE_, $(SPACE), $(join $(addprefix -compile_SPACE_, $(PROPSOURCES)), \ - $(addsuffix _SPACE_java.util.ListResourceBundle, $(addprefix _SPACE_$(LANGTOOLS_OUTPUTDIR)/gensrc/, $(addsuffix .java, $(PROPPATHS)))))) - -# Now setup the rule for the generation of the resource bundles. -$(LANGTOOLS_OUTPUTDIR)/gensrc/_the_props.d: $(PROPSOURCES) $(BUILD_TOOLS) - $(RM) -r $(@D)/* - $(MKDIR) -p $(@D) $(PROPDIRS) - $(PRINTF) "jdk=$(JDK_VERSION)\nfull=$(FULL_VERSION)\nrelease=$(RELEASE)\n" > $(LANGTOOLS_OUTPUTDIR)/gensrc/com/sun/tools/javah/resources/version.properties - $(PRINTF) "jdk=$(JDK_VERSION)\nfull=$(FULL_VERSION)\nrelease=$(RELEASE)\n" > $(LANGTOOLS_OUTPUTDIR)/gensrc/com/sun/tools/javap/resources/version.properties - $(PRINTF) "jdk=$(JDK_VERSION)\nfull=$(FULL_VERSION)\nrelease=$(RELEASE)\n" > $(LANGTOOLS_OUTPUTDIR)/gensrc/com/sun/tools/javac/resources/version.properties - $(PRINTF) "jdk=$(JDK_VERSION)\nfull=$(FULL_VERSION)\nrelease=$(RELEASE)\n" > $(LANGTOOLS_OUTPUTDIR)/gensrc/com/sun/tools/jdeps/resources/version.properties - $(ECHO) Compiling $(words $(PROPSOURCES) v1 v2 v3) properties into resource bundles - $(TOOL_COMPILEPROPS_CMD) $(PROPCMDLINE) \ - -compile $(LANGTOOLS_OUTPUTDIR)/gensrc/com/sun/tools/javah/resources/version.properties \ - $(LANGTOOLS_OUTPUTDIR)/gensrc/com/sun/tools/javah/resources/version.java \ - java.util.ListResourceBundle \ - -compile $(LANGTOOLS_OUTPUTDIR)/gensrc/com/sun/tools/javap/resources/version.properties \ - $(LANGTOOLS_OUTPUTDIR)/gensrc/com/sun/tools/javap/resources/version.java \ - java.util.ListResourceBundle \ - -compile $(LANGTOOLS_OUTPUTDIR)/gensrc/com/sun/tools/javac/resources/version.properties \ - $(LANGTOOLS_OUTPUTDIR)/gensrc/com/sun/tools/javac/resources/version.java \ - java.util.ListResourceBundle \ - -compile $(LANGTOOLS_OUTPUTDIR)/gensrc/com/sun/tools/jdeps/resources/version.properties \ - $(LANGTOOLS_OUTPUTDIR)/gensrc/com/sun/tools/jdeps/resources/version.java \ - java.util.ListResourceBundle - $(ECHO) PROPS_ARE_CREATED = yes > $@ - -# Trigger the generation of the resource bundles. After the resource bundles have -# been compiled, then the makefile will restart and the newly created java files -# will become part of the build further along in the makefile. --include $(LANGTOOLS_OUTPUTDIR)/gensrc/_the_props.d - -ifeq ($(PROPS_ARE_CREATED), yes) - # Setup the rules to build a dist/bootstrap/lib/javac.jar, ie a smaller intermediate javac - # that can be compiled with an old javac. The intermediate javac is then used - # to compile javac again and to build the complete new jdk. - $(eval $(call SetupJavaCompilation,BUILD_BOOTSTRAP_LANGTOOLS, \ - SETUP := BOOT_JAVAC, \ - DISABLE_SJAVAC := true, \ - SRC := $(LANGTOOLS_TOPDIR)/src/share/classes $(LANGTOOLS_OUTPUTDIR)/gensrc, \ - EXCLUDES := com/sun/tools/javac/nio, \ - COPY := $(RESOURCE_SUFFIXES), \ - BIN := $(LANGTOOLS_OUTPUTDIR)/btclasses/bootstrap)) - - $(eval $(call SetupArchive,ARCHIVE_BOOTSTRAP_JAVAC, $(BUILD_BOOTSTRAP_LANGTOOLS), \ - SRCS := $(LANGTOOLS_OUTPUTDIR)/btclasses/bootstrap, \ - JAR := $(LANGTOOLS_OUTPUTDIR)/dist/bootstrap/lib/javac.jar, \ - SUFFIXES := .class $(RESOURCE_SUFFIXES))) - - # GenStubs is used to bootstrap any dependencies from javac to the new JDK that is not - # yet built. It is currently not needed but might be again in the future. The following - # exercises the functionality to verify that it works. - TOOL_GENSTUBS_CMD = $(JAVA) \ - "-Xbootclasspath/p:$(LANGTOOLS_OUTPUTDIR)/dist/bootstrap/lib/javac.jar" \ - -classpath $(LANGTOOLS_OUTPUTDIR)/btclasses \ - genstubs.GenStubs - - # We fetch source from the JDK... - JDKS = $(JDK_TOPDIR)/src/share/classes - - # Build the list of classes to generate stubs from. java/util/function/Predicate.java isn't - # currently needed, but is used as a demo for now. - - STUBSOURCES := $(shell $(FIND) $(JDKS) -name "*.java" | $(GREP) \ - -e "$(JDKS)/java/util/function/Predicate.java") - - # Rewrite the file names into class names because the GenStubs tool require this. - STUBCLASSES := $(subst /,., $(patsubst $(JDKS)/%.java, %, $(STUBSOURCES))) - - # Now setup the build recipe for genstubs. - $(LANGTOOLS_OUTPUTDIR)/genstubs/_the_stubs.d: $(STUBSOURCES) $(BUILD_TOOLS) \ - $(LANGTOOLS_OUTPUTDIR)/dist/bootstrap/lib/javac.jar \ - $(LANGTOOLS_OUTPUTDIR)/gensrc/_the_props.d - $(MKDIR) -p $(@D) - $(MKDIR) -p $(LANGTOOLS_OUTPUTDIR)/tmpstubs - $(ECHO) $(LOG_INFO) Generating stubs from JDK sources. - ($(TOOL_GENSTUBS_CMD) -s $(LANGTOOLS_OUTPUTDIR)/tmpstubs -sourcepath $(JDKS) $(STUBCLASSES) && $(ECHO) STUBS_ARE_CREATED = yes > $@) - if $(DIFF) -x "_the*" -rq $(LANGTOOLS_OUTPUTDIR)/tmpstubs $(LANGTOOLS_OUTPUTDIR)/genstubs > /dev/null 2>&1; then \ - $(ECHO) $(LOG_INFO) No changes in the stubs!; \ - $(RM) -r $(LANGTOOLS_OUTPUTDIR)/tmpstubs; \ - else \ - $(ECHO) $(LOG_INFO) Changes in stubs detected!; \ - $(RM) -r $(@D); \ - $(MV) $(LANGTOOLS_OUTPUTDIR)/tmpstubs $(@D); \ - fi - $(ECHO) STUBS_ARE_CREATED = yes > $@ - - # Trigger a generation of the genstubs java source code and a restart - # of the makefile to make sure that the following build setup use the - # newly created java files. - -include $(LANGTOOLS_OUTPUTDIR)/genstubs/_the_stubs.d - - ifeq ($(STUBS_ARE_CREATED), yes) - # Setup a compiler configuration using the intermediate javac in dist/bootstrap/lib/javac.jar - # that generates code for the new jdk that is being built. - # The code compiled by this compiler setup, cannot necessarily be run with the bootstrap jvm. - $(eval $(call SetupJavaCompiler,GENERATE_NEWBYTECODE, \ - JVM := $(JAVA), \ - JAVAC := "-Xbootclasspath/p:$(LANGTOOLS_OUTPUTDIR)/dist/bootstrap/lib/javac.jar" \ - -cp $(LANGTOOLS_OUTPUTDIR)/dist/bootstrap/lib/javac.jar \ - com.sun.tools.javac.Main, \ - FLAGS := -XDignore.symbol.file=true -Xlint:all$(COMMA)-deprecation -Werror, \ - SERVER_DIR := $(SJAVAC_SERVER_DIR), \ - SERVER_JVM := $(SJAVAC_SERVER_JAVA))) - - $(eval $(call SetupJavaCompilation,BUILD_FULL_JAVAC, \ - SETUP := GENERATE_NEWBYTECODE, \ - SRC := $(LANGTOOLS_TOPDIR)/src/share/classes $(LANGTOOLS_OUTPUTDIR)/gensrc \ - $(LANGTOOLS_OUTPUTDIR)/genstubs, \ - EXCLUDES := java/util java/io java/nio, \ - COPY := $(RESOURCE_SUFFIXES), \ - BIN := $(LANGTOOLS_OUTPUTDIR)/classes)) - - $(eval $(call SetupArchive,ARCHIVE_FULL_JAVAC, $(BUILD_FULL_JAVAC), \ - SETUP := GENERATE_NEWBYTECODE, \ - SRCS := $(LANGTOOLS_OUTPUTDIR)/classes, \ - SUFFIXES := .class $(RESOURCE_SUFFIXES), \ - JAR := $(LANGTOOLS_OUTPUTDIR)/dist/lib/classes.jar)) - - $(eval $(call SetupZipArchive,ZIP_FULL_JAVAC_SOURCE, \ - SRC := $(LANGTOOLS_TOPDIR)/src/share/classes $(LANGTOOLS_OUTPUTDIR)/gensrc, \ - ZIP := $(LANGTOOLS_OUTPUTDIR)/dist/lib/src.zip)) - - all: $(LANGTOOLS_OUTPUTDIR)/dist/lib/classes.jar \ - $(LANGTOOLS_OUTPUTDIR)/dist/lib/src.zip \ - $(LANGTOOLS_OUTPUTDIR)/dist/bootstrap/lib/javac.jar - - endif -endif diff -r aaea3a69fa6c -r 48367e6de872 makefiles/Makefile --- a/makefiles/Makefile Tue Dec 03 14:13:15 2013 +0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ -# -# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. Oracle designates this -# particular file as subject to the "Classpath" exception as provided -# by Oracle in the LICENSE file that accompanied this code. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# - -# Locate this Makefile -ifeq ($(filter /%, $(lastword $(MAKEFILE_LIST))), ) - makefile_path := $(CURDIR)/$(lastword $(MAKEFILE_LIST)) -else - makefile_path := $(lastword $(MAKEFILE_LIST)) -endif -repo_dir := $(patsubst %/makefiles/Makefile, %, $(makefile_path)) - -# What is the name of this subsystem (langtools, corba, etc)? -subsystem_name := $(notdir $(repo_dir)) - -# Try to locate top-level makefile -top_level_makefile := $(repo_dir)/../common/makefiles/Makefile -ifneq ($(wildcard $(top_level_makefile)), ) - $(info Will run $(subsystem_name) target on top-level Makefile) - $(info WARNING: This is a non-recommended way of building!) - $(info ===================================================) -else - $(info Cannot locate top-level Makefile. Is this repo not checked out as part of a complete forest?) - $(error Build from top-level Makefile instead) -endif - -all: - @$(MAKE) -f $(top_level_makefile) $(subsystem_name) diff -r aaea3a69fa6c -r 48367e6de872 src/share/classes/com/sun/tools/doclets/formats/html/ConfigurationImpl.java --- a/src/share/classes/com/sun/tools/doclets/formats/html/ConfigurationImpl.java Tue Dec 03 14:13:15 2013 +0400 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/ConfigurationImpl.java Thu Dec 05 16:37:35 2013 +0400 @@ -204,12 +204,27 @@ "com.sun.tools.doclets.formats.html.resources.standard"); } + private final String versionRBName = "com.sun.tools.javadoc.resources.version"; + private ResourceBundle versionRB; + /** * Return the build date for the doclet. */ @Override public String getDocletSpecificBuildDate() { - return BUILD_DATE; + if (versionRB == null) { + try { + versionRB = ResourceBundle.getBundle(versionRBName); + } catch (MissingResourceException e) { + return BUILD_DATE; + } + } + + try { + return versionRB.getString("release"); + } catch (MissingResourceException e) { + return BUILD_DATE; + } } /** diff -r aaea3a69fa6c -r 48367e6de872 src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java --- a/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java Tue Dec 03 14:13:15 2013 +0400 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java Thu Dec 05 16:37:35 2013 +0400 @@ -331,7 +331,7 @@ if (timestamp) { Calendar calendar = new GregorianCalendar(TimeZone.getDefault()); Date today = calendar.getTime(); - text += " ("+ ConfigurationImpl.BUILD_DATE + ") on " + today; + text += " ("+ configuration.getDocletSpecificBuildDate() + ") on " + today; } return new Comment(text); } diff -r aaea3a69fa6c -r 48367e6de872 src/share/classes/com/sun/tools/javac/code/Flags.java --- a/src/share/classes/com/sun/tools/javac/code/Flags.java Tue Dec 03 14:13:15 2013 +0400 +++ b/src/share/classes/com/sun/tools/javac/code/Flags.java Thu Dec 05 16:37:35 2013 +0400 @@ -293,7 +293,7 @@ ExtendedStandardFlags = (long)StandardFlags | DEFAULT, ModifierFlags = ((long)StandardFlags & ~INTERFACE) | DEFAULT, InterfaceMethodMask = ABSTRACT | STATIC | PUBLIC | STRICTFP | DEFAULT, - AnnotationTypeElementMask = FINAL | ABSTRACT | PUBLIC | STRICTFP, + AnnotationTypeElementMask = ABSTRACT | PUBLIC, LocalVarFlags = FINAL | PARAMETER; diff -r aaea3a69fa6c -r 48367e6de872 src/share/classes/com/sun/tools/javac/code/Type.java --- a/src/share/classes/com/sun/tools/javac/code/Type.java Tue Dec 03 14:13:15 2013 +0400 +++ b/src/share/classes/com/sun/tools/javac/code/Type.java Thu Dec 05 16:37:35 2013 +0400 @@ -970,13 +970,6 @@ public boolean allInterfaces; - public enum IntersectionKind { - EXPLICIT, - IMPLICT; - } - - public IntersectionKind intersectionKind; - public IntersectionClassType(List bounds, ClassSymbol csym, boolean allInterfaces) { super(Type.noType, List.nil(), csym); this.allInterfaces = allInterfaces; @@ -1008,9 +1001,7 @@ @Override public R accept(TypeVisitor v, P p) { - return intersectionKind == IntersectionKind.EXPLICIT ? - v.visitIntersection(this, p) : - v.visitDeclared(this, p); + return v.visitIntersection(this, p); } } diff -r aaea3a69fa6c -r 48367e6de872 src/share/classes/com/sun/tools/javac/comp/Attr.java --- a/src/share/classes/com/sun/tools/javac/comp/Attr.java Tue Dec 03 14:13:15 2013 +0400 +++ b/src/share/classes/com/sun/tools/javac/comp/Attr.java Thu Dec 05 16:37:35 2013 +0400 @@ -933,7 +933,8 @@ chk.validate(tree.typarams, localEnv); // Check that result type is well-formed. - chk.validate(tree.restype, localEnv); + if (tree.restype != null && !tree.restype.type.hasTag(VOID)) + chk.validate(tree.restype, localEnv); // Check that receiver type is well-formed. if (tree.recvparam != null) { @@ -3982,10 +3983,6 @@ return bounds.head.type; } else { Type owntype = types.makeCompoundType(TreeInfo.types(bounds)); - if (tree.hasTag(TYPEINTERSECTION)) { - ((IntersectionClassType)owntype).intersectionKind = - IntersectionClassType.IntersectionKind.EXPLICIT; - } // ... the variable's bound is a class type flagged COMPOUND // (see comment for TypeVar.bound). // In this case, generate a class tree that represents the diff -r aaea3a69fa6c -r 48367e6de872 src/share/classes/com/sun/tools/javac/comp/Check.java --- a/src/share/classes/com/sun/tools/javac/comp/Check.java Tue Dec 03 14:13:15 2013 +0400 +++ b/src/share/classes/com/sun/tools/javac/comp/Check.java Thu Dec 05 16:37:35 2013 +0400 @@ -1326,6 +1326,14 @@ tree.underlyingType.accept(this); } + @Override + public void visitTypeIdent(JCPrimitiveTypeTree that) { + if (that.type.hasTag(TypeTag.VOID)) { + log.error(that.pos(), "void.not.allowed.here"); + } + super.visitTypeIdent(that); + } + /** Default visitor method: do nothing. */ @Override diff -r aaea3a69fa6c -r 48367e6de872 src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java --- a/src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java Tue Dec 03 14:13:15 2013 +0400 +++ b/src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java Thu Dec 05 16:37:35 2013 +0400 @@ -357,9 +357,11 @@ //first determine the method symbol to be used to generate the sam instance //this is either the method reference symbol, or the bridged reference symbol - Symbol refSym = localContext.needsBridge() ? - localContext.bridgeSym : - tree.sym; + Symbol refSym = localContext.needsBridge() + ? localContext.bridgeSym + : localContext.isSignaturePolymorphic() + ? localContext.sigPolySym + : tree.sym; //build the bridge method, if needed if (localContext.needsBridge()) { @@ -1995,6 +1997,7 @@ final boolean isSuper; final Symbol bridgeSym; + final Symbol sigPolySym; ReferenceTranslationContext(JCMemberReference tree) { super(tree); @@ -2004,6 +2007,12 @@ referenceBridgeName(), null, owner.enclClass()) : null; + this.sigPolySym = isSignaturePolymorphic() + ? makePrivateSyntheticMethod(tree.sym.flags(), + tree.sym.name, + bridgedRefSig(), + tree.sym.enclClass()) + : null; if (dumpLambdaToMethodStats) { String key = bridgeSym == null ? "mref.stat" : "mref.stat.1"; @@ -2106,6 +2115,15 @@ } /** + * Signature polymorphic methods need special handling. + * e.g. MethodHandle.invoke() MethodHandle.invokeExact() + */ + final boolean isSignaturePolymorphic() { + return tree.sym.kind == MTH && + types.isSignaturePolymorphic((MethodSymbol)tree.sym); + } + + /** * Does this reference needs a bridge (i.e. var args need to be * expanded or "super" is used) */ diff -r aaea3a69fa6c -r 48367e6de872 src/share/classes/com/sun/tools/javac/comp/Lower.java --- a/src/share/classes/com/sun/tools/javac/comp/Lower.java Tue Dec 03 14:13:15 2013 +0400 +++ b/src/share/classes/com/sun/tools/javac/comp/Lower.java Thu Dec 05 16:37:35 2013 +0400 @@ -1378,11 +1378,14 @@ ref = make.Ident(sym); args = make.Idents(md.params); } else { - Symbol msym = sym; - if (sym.owner.isInterface()) { - msym = msym.clone(types.supertype(accessor.owner.type).tsym); + JCExpression site = make.Ident(md.params.head); + if (acode % 2 != 0) { + //odd access codes represent qualified super accesses - need to + //emit reference to the direct superclass, even if the refered + //member is from an indirect superclass (JLS 13.1) + site.setType(types.erasure(types.supertype(vsym.owner.enclClass().type))); } - ref = make.Select(make.Ident(md.params.head), msym); + ref = make.Select(site, sym); args = make.Idents(md.params.tail); } JCStatement stat; // The statement accessing the private symbol. diff -r aaea3a69fa6c -r 48367e6de872 src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java --- a/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java Tue Dec 03 14:13:15 2013 +0400 +++ b/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java Thu Dec 05 16:37:35 2013 +0400 @@ -1174,9 +1174,8 @@ } // counter for number of generic local variables - int nGenericVars = 0; - - if (code.varBufferSize > 0) { + if (code.varDebugInfo && code.varBufferSize > 0) { + int nGenericVars = 0; int alenIdx = writeAttr(names.LocalVariableTable); databuf.appendChar(code.getLVTSize()); for (int i=0; i 0) { - int alenIdx = writeAttr(names.LocalVariableTypeTable); - databuf.appendChar(nGenericVars); - int count = 0; + if (nGenericVars > 0) { + alenIdx = writeAttr(names.LocalVariableTypeTable); + databuf.appendChar(nGenericVars); + int count = 0; - for (int i=0; i 0) { diff -r aaea3a69fa6c -r 48367e6de872 src/share/classes/com/sun/tools/javac/jvm/Gen.java --- a/src/share/classes/com/sun/tools/javac/jvm/Gen.java Tue Dec 03 14:13:15 2013 +0400 +++ b/src/share/classes/com/sun/tools/javac/jvm/Gen.java Thu Dec 05 16:37:35 2013 +0400 @@ -2420,7 +2420,7 @@ if (isInvokeDynamic(sym)) { result = items.makeDynamicItem(sym); return; - } else if (!accessSuper) { + } else { sym = binaryQualifier(sym, tree.selected.type); } if ((sym.flags() & STATIC) != 0) { diff -r aaea3a69fa6c -r 48367e6de872 src/share/classes/com/sun/tools/javac/parser/DocCommentParser.java --- a/src/share/classes/com/sun/tools/javac/parser/DocCommentParser.java Tue Dec 03 14:13:15 2013 +0400 +++ b/src/share/classes/com/sun/tools/javac/parser/DocCommentParser.java Thu Dec 05 16:37:35 2013 +0400 @@ -280,7 +280,7 @@ try { nextChar(); if (isIdentifierStart(ch)) { - Name name = readIdentifier(); + Name name = readTagName(); TagParser tp = tagParsers.get(name); if (tp == null) { List content = blockContent(); @@ -329,7 +329,7 @@ try { nextChar(); if (isIdentifierStart(ch)) { - Name name = readIdentifier(); + Name name = readTagName(); skipWhitespace(); TagParser tp = tagParsers.get(name); @@ -905,6 +905,14 @@ return names.fromChars(buf, start, bp - start); } + protected Name readTagName() { + int start = bp; + nextChar(); + while (bp < buflen && (Character.isUnicodeIdentifierPart(ch) || ch == '.')) + nextChar(); + return names.fromChars(buf, start, bp - start); + } + protected boolean isJavaIdentifierStart(char ch) { return Character.isJavaIdentifierStart(ch); } diff -r aaea3a69fa6c -r 48367e6de872 src/share/classes/com/sun/tools/javadoc/DocEnv.java --- a/src/share/classes/com/sun/tools/javadoc/DocEnv.java Tue Dec 03 14:13:15 2013 +0400 +++ b/src/share/classes/com/sun/tools/javadoc/DocEnv.java Thu Dec 05 16:37:35 2013 +0400 @@ -39,6 +39,7 @@ import com.sun.tools.javac.code.Symbol.*; import com.sun.tools.javac.code.Type.ClassType; import com.sun.tools.javac.comp.Check; +import com.sun.tools.javac.file.JavacFileManager; import com.sun.tools.javac.tree.JCTree; import com.sun.tools.javac.tree.JCTree.*; import com.sun.tools.javac.util.Context; @@ -146,6 +147,9 @@ chk = Check.instance(context); types = Types.instance(context); fileManager = context.get(JavaFileManager.class); + if (fileManager instanceof JavacFileManager) { + ((JavacFileManager)fileManager).setSymbolFileEnabled(false); + } // Default. Should normally be reset with setLocale. this.doclocale = new DocLocale(this, "", breakiterator); diff -r aaea3a69fa6c -r 48367e6de872 src/share/classes/javax/lang/model/type/DeclaredType.java --- a/src/share/classes/javax/lang/model/type/DeclaredType.java Tue Dec 03 14:13:15 2013 +0400 +++ b/src/share/classes/javax/lang/model/type/DeclaredType.java Thu Dec 05 16:37:35 2013 +0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -49,14 +49,6 @@ * Types#directSupertypes(TypeMirror)} method. This returns the * supertypes with any type arguments substituted in. * - *

This interface is also used to represent intersection types. - * An intersection type is implicit in a program rather than being - * explictly declared. For example, the bound of the type parameter - * {@code } - * is an intersection type. It is represented by a {@code DeclaredType} - * with {@code Number} as its superclass and {@code Runnable} as its - * lone superinterface. - * * @author Joseph D. Darcy * @author Scott Seligman * @author Peter von der Ahé diff -r aaea3a69fa6c -r 48367e6de872 src/share/classes/javax/lang/model/type/IntersectionType.java --- a/src/share/classes/javax/lang/model/type/IntersectionType.java Tue Dec 03 14:13:15 2013 +0400 +++ b/src/share/classes/javax/lang/model/type/IntersectionType.java Thu Dec 05 16:37:35 2013 +0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,9 +30,15 @@ /** * Represents an intersection type. * - * As of the {@link javax.lang.model.SourceVersion#RELEASE_8 - * RELEASE_8} source version, intersection types can appear as the target type - * of a cast expression. + *

An intersection type can be either implicitly or explicitly + * declared in a program. For example, the bound of the type parameter + * {@code } is an (implicit) intersection + * type. As of {@link javax.lang.model.SourceVersion#RELEASE_8 + * RELEASE_8}, this is represented by an {@code IntersectionType} with + * {@code Number} and {@code Runnable} as its bounds. Also as of the + * {@link javax.lang.model.SourceVersion#RELEASE_8 RELEASE_8}, + * intersection types can explicitly appear as the target type of a + * cast expression. * * @since 1.8 */ diff -r aaea3a69fa6c -r 48367e6de872 src/share/classes/javax/lang/model/type/TypeVariable.java --- a/src/share/classes/javax/lang/model/type/TypeVariable.java Tue Dec 03 14:13:15 2013 +0400 +++ b/src/share/classes/javax/lang/model/type/TypeVariable.java Thu Dec 05 16:37:35 2013 +0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -62,10 +62,9 @@ *

If this type variable was declared with no explicit * upper bounds, the result is {@code java.lang.Object}. * If it was declared with multiple upper bounds, - * the result is an intersection type (modeled as a - * {@link DeclaredType}). - * Individual bounds can be found by examining the result's - * {@linkplain Types#directSupertypes(TypeMirror) supertypes}. + * the result is an {@linkplain IntersectionType intersection type}; + * individual bounds can be found by examining the result's + * {@linkplain IntersectionType#getBounds() bounds}. * * @return the upper bound of this type variable */ diff -r aaea3a69fa6c -r 48367e6de872 test/com/sun/javadoc/testCompletionFailure/TestCompletionFailure.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/com/sun/javadoc/testCompletionFailure/TestCompletionFailure.java Thu Dec 05 16:37:35 2013 +0400 @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8027977 + * @summary Test to verify javadoc executes without CompletionFailure exception. + * @author Bhavesh Patel + * @library ../lib/ + * @build JavadocTester TestCompletionFailure + * @run main TestCompletionFailure + */ + +public class TestCompletionFailure extends JavadocTester { + + private static final String BUG_ID = "8027977"; + + //Input for string search tests. + private static final String[][] NEGATED_TEST = { + {ERROR_OUTPUT, "TestCompletionFailure: error - " + + "com.sun.tools.javac.code.Symbol$CompletionFailure: class file for " + + "sun.util.locale.provider.LocaleProviderAdapter not found" + } + }; + + private static final String[] ARGS = new String[] { + "-d", BUG_ID, "-sourcepath", SRC_DIR, "pkg1" + }; + + /** + * The entry point of the test. + * @param args the array of command line arguments. + */ + public static void main(String[] args) throws Exception { + TestCompletionFailure tester = new TestCompletionFailure(); + run(tester, ARGS, NO_TEST, NEGATED_TEST); + tester.printSummary(); + } + + /** + * {@inheritDoc} + */ + public String getBugId() { + return BUG_ID; + } + + /** + * {@inheritDoc} + */ + public String getBugName() { + return getClass().getName(); + } +} diff -r aaea3a69fa6c -r 48367e6de872 test/com/sun/javadoc/testCompletionFailure/pkg1/NumberFormatTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/com/sun/javadoc/testCompletionFailure/pkg1/NumberFormatTest.java Thu Dec 05 16:37:35 2013 +0400 @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package pkg1; + +import java.text.NumberFormat; + +public abstract class NumberFormatTest extends NumberFormat { } diff -r aaea3a69fa6c -r 48367e6de872 test/tools/doclint/CustomTagTest.java --- a/test/tools/doclint/CustomTagTest.java Tue Dec 03 14:13:15 2013 +0400 +++ b/test/tools/doclint/CustomTagTest.java Thu Dec 05 16:37:35 2013 +0400 @@ -1,17 +1,18 @@ /* * @test /nodynamiccopyright/ - * @bug 8006248 + * @bug 8006248 8028318 * @summary DocLint should report unknown tags * @build DocLintTester * @run main DocLintTester CustomTagTest.java * @run main DocLintTester -XcustomTags: -ref CustomTagTest.out CustomTagTest.java - * @run main DocLintTester -XcustomTags:customTag -ref CustomTagTestWithOption.out CustomTagTest.java - * @run main DocLintTester -XcustomTags:customTag,anotherCustomTag -ref CustomTagTestWithOption.out CustomTagTest.java + * @run main DocLintTester -XcustomTags:customTag,custom.tag -ref CustomTagTestWithOption.out CustomTagTest.java + * @run main DocLintTester -XcustomTags:customTag,custom.tag,anotherCustomTag -ref CustomTagTestWithOption.out CustomTagTest.java * @author bpatel */ /** * @customTag Text for a custom tag. + * @custom.tag Text for another custom tag. * @unknownTag Text for an unknown tag. */ public class CustomTagTest { diff -r aaea3a69fa6c -r 48367e6de872 test/tools/doclint/CustomTagTest.out --- a/test/tools/doclint/CustomTagTest.out Tue Dec 03 14:13:15 2013 +0400 +++ b/test/tools/doclint/CustomTagTest.out Thu Dec 05 16:37:35 2013 +0400 @@ -1,8 +1,11 @@ CustomTagTest.java:14: error: unknown tag: customTag * @customTag Text for a custom tag. ^ -CustomTagTest.java:15: error: unknown tag: unknownTag +CustomTagTest.java:15: error: unknown tag: custom.tag + * @custom.tag Text for another custom tag. + ^ +CustomTagTest.java:16: error: unknown tag: unknownTag * @unknownTag Text for an unknown tag. ^ -2 errors +3 errors diff -r aaea3a69fa6c -r 48367e6de872 test/tools/doclint/CustomTagTestWithOption.out --- a/test/tools/doclint/CustomTagTestWithOption.out Tue Dec 03 14:13:15 2013 +0400 +++ b/test/tools/doclint/CustomTagTestWithOption.out Thu Dec 05 16:37:35 2013 +0400 @@ -1,4 +1,4 @@ -CustomTagTest.java:15: error: unknown tag: unknownTag +CustomTagTest.java:16: error: unknown tag: unknownTag * @unknownTag Text for an unknown tag. ^ 1 error diff -r aaea3a69fa6c -r 48367e6de872 test/tools/javac/T8028504/DontGenerateLVTForGNoneOpTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/T8028504/DontGenerateLVTForGNoneOpTest.java Thu Dec 05 16:37:35 2013 +0400 @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8028504 + * @summary javac generates LocalVariableTable even with -g:none + * @compile -g:none DontGenerateLVTForGNoneOpTest.java + * @run main DontGenerateLVTForGNoneOpTest + */ + +import java.io.File; +import java.lang.annotation.ElementType; +import java.lang.annotation.Target; +import java.nio.file.Paths; + +import com.sun.tools.classfile.Attribute; +import com.sun.tools.classfile.ClassFile; +import com.sun.tools.classfile.Code_attribute; +import com.sun.tools.classfile.Method; + +public class DontGenerateLVTForGNoneOpTest { + + public static void main(String[] args) throws Exception { + new DontGenerateLVTForGNoneOpTest().run(); + } + + void run() throws Exception { + checkClassFile(new File(Paths.get(System.getProperty("test.classes"), + this.getClass().getName() + ".class").toUri())); + } + + void checkClassFile(final File cfile) throws Exception { + ClassFile classFile = ClassFile.read(cfile); + for (Method method : classFile.methods) { + Code_attribute code = (Code_attribute)method.attributes.get(Attribute.Code); + if (code != null) { + if (code.attributes.get(Attribute.LocalVariableTable) != null) { + throw new AssertionError("LVT shouldn't be generated for g:none"); + } + } + } + } + + public void bar() { + try { + System.out.println(); + } catch(@TA Exception e) { + } catch(Throwable t) {} + } + + @Target(ElementType.TYPE_USE) + @interface TA {} +} diff -r aaea3a69fa6c -r 48367e6de872 test/tools/javac/annotations/AnnotationTypeElementModifiers.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/annotations/AnnotationTypeElementModifiers.java Thu Dec 05 16:37:35 2013 +0400 @@ -0,0 +1,46 @@ +/* + * @test /nodynamiccopyright/ + * @bug 8028428 + * @summary Test that only 'public' and 'abstract' elements compile + * @compile/fail/ref=AnnotationTypeElementModifiers.out -XDrawDiagnostics AnnotationTypeElementModifiers.java + */ + +public @interface AnnotationTypeElementModifiers { + // First 4 should work + public int A(); + public int AA() default 1; + + abstract int B(); + abstract int BB() default 1; + + // These shouldn't work + private int C(); + private int CC() default 1; + + protected int D(); + protected int DD() default 1; + + static int E(); + static int EE() default 1; + + final int F(); + final int FF() default 1; + + synchronized int H(); + synchronized int HH() default 1; + + volatile int I(); + volatile int II() default 1; + + transient int J(); + transient int JJ() default 1; + + native int K(); + native int KK() default 1; + + strictfp float L(); + strictfp float LL() default 0.1f; + + default int M(); + default int MM() default 1; +} diff -r aaea3a69fa6c -r 48367e6de872 test/tools/javac/annotations/AnnotationTypeElementModifiers.out --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/annotations/AnnotationTypeElementModifiers.out Thu Dec 05 16:37:35 2013 +0400 @@ -0,0 +1,21 @@ +AnnotationTypeElementModifiers.java:17:17: compiler.err.mod.not.allowed.here: private +AnnotationTypeElementModifiers.java:18:17: compiler.err.mod.not.allowed.here: private +AnnotationTypeElementModifiers.java:20:19: compiler.err.mod.not.allowed.here: protected +AnnotationTypeElementModifiers.java:21:19: compiler.err.mod.not.allowed.here: protected +AnnotationTypeElementModifiers.java:23:16: compiler.err.mod.not.allowed.here: static +AnnotationTypeElementModifiers.java:24:16: compiler.err.mod.not.allowed.here: static +AnnotationTypeElementModifiers.java:26:15: compiler.err.mod.not.allowed.here: final +AnnotationTypeElementModifiers.java:27:15: compiler.err.mod.not.allowed.here: final +AnnotationTypeElementModifiers.java:29:22: compiler.err.mod.not.allowed.here: synchronized +AnnotationTypeElementModifiers.java:30:22: compiler.err.mod.not.allowed.here: synchronized +AnnotationTypeElementModifiers.java:32:18: compiler.err.mod.not.allowed.here: volatile +AnnotationTypeElementModifiers.java:33:18: compiler.err.mod.not.allowed.here: volatile +AnnotationTypeElementModifiers.java:35:19: compiler.err.mod.not.allowed.here: transient +AnnotationTypeElementModifiers.java:36:19: compiler.err.mod.not.allowed.here: transient +AnnotationTypeElementModifiers.java:38:16: compiler.err.mod.not.allowed.here: native +AnnotationTypeElementModifiers.java:39:16: compiler.err.mod.not.allowed.here: native +AnnotationTypeElementModifiers.java:41:20: compiler.err.mod.not.allowed.here: strictfp +AnnotationTypeElementModifiers.java:42:20: compiler.err.mod.not.allowed.here: strictfp +AnnotationTypeElementModifiers.java:44:17: compiler.err.mod.not.allowed.here: default +AnnotationTypeElementModifiers.java:45:17: compiler.err.mod.not.allowed.here: default +20 errors diff -r aaea3a69fa6c -r 48367e6de872 test/tools/javac/declaration/method/MethodVoidParameter.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/declaration/method/MethodVoidParameter.java Thu Dec 05 16:37:35 2013 +0400 @@ -0,0 +1,9 @@ +/* @test /nodynamiccopyright/ + * @bug 8026374 + * @summary Cannot use void as a variable type + * @compile/fail/ref=MethodVoidParameter.out -XDrawDiagnostics MethodVoidParameter.java + */ +public class MethodVoidParameter { + void method(void v) { } + void method(void... v) { } +} diff -r aaea3a69fa6c -r 48367e6de872 test/tools/javac/declaration/method/MethodVoidParameter.out --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/declaration/method/MethodVoidParameter.out Thu Dec 05 16:37:35 2013 +0400 @@ -0,0 +1,3 @@ +MethodVoidParameter.java:7:17: compiler.err.void.not.allowed.here +MethodVoidParameter.java:8:17: compiler.err.void.not.allowed.here +2 errors diff -r aaea3a69fa6c -r 48367e6de872 test/tools/javac/expression/_super/NonDirectSuper/Base.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/expression/_super/NonDirectSuper/Base.java Thu Dec 05 16:37:35 2013 +0400 @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package base; + +public class Base extends PackagePrivate { } + +class PackagePrivate { + protected int refTobaseBase() { + return 0; + } + protected int refTotestOtherPackageTest() { + return 0; + } + protected int refTotestTarget11() { + return 0; + } + protected int refTotestCurPackagePrivateExt11() { + return 0; + } + protected int refTobaseBase; + protected int refTotestOtherPackageTest; + protected int refTotestTarget11; + protected int refTotestCurPackagePrivateExt11; +} diff -r aaea3a69fa6c -r 48367e6de872 test/tools/javac/expression/_super/NonDirectSuper/NonDirectSuper.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/expression/_super/NonDirectSuper/NonDirectSuper.java Thu Dec 05 16:37:35 2013 +0400 @@ -0,0 +1,179 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8027789 + * @summary check that the direct superclass is used as the site when calling + * a superclass' method + * @compile Base.java NonDirectSuper.java + * @compile -source 1.2 -target 1.1 Target11.java + * @run main test.NonDirectSuper + */ + +package test; + +import java.io.File; + +import com.sun.tools.classfile.Attribute; +import com.sun.tools.classfile.ClassFile; +import com.sun.tools.classfile.Code_attribute; +import com.sun.tools.classfile.ConstantPool.CPRefInfo; +import com.sun.tools.classfile.Instruction; +import com.sun.tools.classfile.Method; +import com.sun.tools.classfile.Opcode; + +public class NonDirectSuper { + public static void main(String... args) { + new NonDirectSuper().run(); + } + + void run() { + String workDir = System.getProperty("test.classes"); + File testPackage = new File(workDir, "test"); + + for (File clazz : testPackage.listFiles()) { + if ("NonDirectSuper.class".equals(clazz.getName())) continue; + verifyInvokeSpecialRefToObject(clazz); + } + } + + void verifyInvokeSpecialRefToObject(File clazz) { + try { + final ClassFile cf = ClassFile.read(clazz); + for (Method m : cf.methods) { + Code_attribute codeAttr = (Code_attribute)m.attributes.get(Attribute.Code); + for (Instruction instr : codeAttr.getInstructions()) { + if (instr.getOpcode() == Opcode.INVOKESPECIAL || + instr.getOpcode() == Opcode.INVOKEVIRTUAL) { + int pc_index = instr.getShort(1); + CPRefInfo ref = (CPRefInfo)cf.constant_pool.get(pc_index); + String className = ref.getClassName(); + String methodName = ref.getNameAndTypeInfo().getName(); + if (methodName.equals("toString")) { + if (!className.equals("java/lang/Object")) + throw new IllegalStateException("Must directly refer to j.l.Object"); + } else if (methodName.startsWith("refTo")) { + String expectedClass = methodName.substring("refTo".length()); + if (!className.replace("/", "").equals(expectedClass)) { + throw new IllegalStateException("Unexpected reference to: " + + className + ", should be " + expectedClass); + } + } + } + if (instr.getOpcode() == Opcode.GETFIELD || + instr.getOpcode() == Opcode.PUTFIELD) { + int pc_index = instr.getShort(1); + CPRefInfo ref = (CPRefInfo)cf.constant_pool.get(pc_index); + String className = ref.getClassName(); + String fieldName = ref.getNameAndTypeInfo().getName(); + if (fieldName.startsWith("refTo")) { + String expectedClass = fieldName.substring("refTo".length()); + if (!className.replace("/", "").equals(expectedClass)) { + throw new IllegalStateException("Unexpected reference to: " + + className + ", should be " + expectedClass); + } + } + } + } + } + } catch (Exception e) { + e.printStackTrace(); + throw new Error("error reading " + clazz +": " + e); + } + } +} + +class OtherPackageTest extends base.Base { + void run() { + new Runnable() { + public void run() { + OtherPackageTest.super.refTobaseBase(); + OtherPackageTest.super.refTobaseBase = OtherPackageTest.super.refTobaseBase + 1; + OtherPackageTest.super.toString(); + refTotestOtherPackageTest(); + refTotestOtherPackageTest = refTotestOtherPackageTest + 1; + OtherPackageTest.this.refTotestOtherPackageTest(); + OtherPackageTest.this.refTotestOtherPackageTest = + OtherPackageTest.this.refTotestOtherPackageTest + 1; + } + }.run(); + super.refTobaseBase(); + super.refTobaseBase = super.refTobaseBase + 1; + super.toString(); + OtherPackageTest.super.refTobaseBase(); + OtherPackageTest.super.refTobaseBase = OtherPackageTest.super.refTobaseBase + 1; + OtherPackageTest.super.toString(); + refTotestOtherPackageTest(); + refTotestOtherPackageTest = refTotestOtherPackageTest + 1; + } + + static class InnerBase { + private void refTotestOtherPackageTest$InnerBase() { } + } + static class InnerTest extends InnerBase { + void run() { + new Runnable() { + public void run() { + InnerTest.super.refTotestOtherPackageTest$InnerBase(); + } + }.run(); + super.refTotestOtherPackageTest$InnerBase(); + InnerTest.super.refTotestOtherPackageTest$InnerBase(); + } + } +} + +class CurPackagePrivateBase { + void refTotestCurPackagePrivateExt() { } + void refTotestCurPackagePrivateTest() { } + int refTotestCurPackagePrivateExt; + int refTotestCurPackagePrivateTest; +} + +class CurPackagePrivateExt extends CurPackagePrivateBase { +} + +class CurPackagePrivateTest extends CurPackagePrivateExt { + void run() { + new Runnable() { + public void run() { + CurPackagePrivateTest.super.refTotestCurPackagePrivateExt(); + CurPackagePrivateTest.super.refTotestCurPackagePrivateExt = + CurPackagePrivateTest.super.refTotestCurPackagePrivateExt + 1; + CurPackagePrivateTest.this.refTotestCurPackagePrivateTest(); + CurPackagePrivateTest.this.refTotestCurPackagePrivateTest = + CurPackagePrivateTest.this.refTotestCurPackagePrivateTest + 1; + refTotestCurPackagePrivateTest(); + refTotestCurPackagePrivateTest = refTotestCurPackagePrivateTest + 1; + } + }.run(); + super.refTotestCurPackagePrivateExt(); + super.refTotestCurPackagePrivateExt = super.refTotestCurPackagePrivateExt + 1; + CurPackagePrivateTest.super.refTotestCurPackagePrivateExt(); + CurPackagePrivateTest.super.refTotestCurPackagePrivateExt = + CurPackagePrivateTest.super.refTotestCurPackagePrivateExt + 1; + refTotestCurPackagePrivateTest(); + refTotestCurPackagePrivateTest = refTotestCurPackagePrivateTest + 1; + } +} diff -r aaea3a69fa6c -r 48367e6de872 test/tools/javac/expression/_super/NonDirectSuper/Target11.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/expression/_super/NonDirectSuper/Target11.java Thu Dec 05 16:37:35 2013 +0400 @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package test; + +class Target11 extends CurPackagePrivateExt11 { + void run() { + new Runnable() { + public void run() { + Target11.super.refTotestCurPackagePrivateBase11(); + Target11.super.refTotestCurPackagePrivateBase11 = + Target11.super.refTotestCurPackagePrivateBase11 + 1; + Target11.super.refTotestCurPackagePrivateExt11(); + Target11.super.refTotestCurPackagePrivateExt11 = + Target11.super.refTotestCurPackagePrivateExt11 + 1; + Target11.super.toString(); + refTotestCurPackagePrivateBase11(); + refTotestCurPackagePrivateBase11 = + refTotestCurPackagePrivateBase11 + 1; + refTotestTarget11(); + refTotestTarget11 = refTotestTarget11 + 1; + Target11.this.refTotestCurPackagePrivateBase11(); + Target11.this.refTotestCurPackagePrivateBase11 = + Target11.this.refTotestCurPackagePrivateBase11 + 1; + Target11.this.refTotestTarget11(); + Target11.this.refTotestTarget11 = + Target11.this.refTotestTarget11 + 1; + } + }.run(); + super.refTotestCurPackagePrivateBase11(); + super.refTotestCurPackagePrivateBase11 = + super.refTotestCurPackagePrivateBase11 + 1; + super.refTotestCurPackagePrivateExt11(); + super.refTotestCurPackagePrivateExt11 = + super.refTotestCurPackagePrivateExt11 + 1; + super.toString(); + + Target11.super.refTotestCurPackagePrivateBase11(); + Target11.super.refTotestCurPackagePrivateBase11 = + Target11.super.refTotestCurPackagePrivateBase11 + 1; + Target11.super.refTotestCurPackagePrivateExt11(); + Target11.super.refTotestCurPackagePrivateExt11 = + Target11.super.refTotestCurPackagePrivateExt11 + 1; + + refTotestCurPackagePrivateBase11(); + refTotestCurPackagePrivateBase11 = refTotestCurPackagePrivateBase11 + 1; + refTotestTarget11 = refTotestTarget11 + 1; + } +} + +class CurPackagePrivateBase11 extends base.Base { + protected void refTotestCurPackagePrivateBase11() {} + protected int refTotestCurPackagePrivateBase11; +} + +class CurPackagePrivateExt11 extends CurPackagePrivateBase11 { } diff -r aaea3a69fa6c -r 48367e6de872 test/tools/javac/lambda/methodReferenceExecution/MethodReferenceTestMethodHandle.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/lambda/methodReferenceExecution/MethodReferenceTestMethodHandle.java Thu Dec 05 16:37:35 2013 +0400 @@ -0,0 +1,105 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * @test + * @bug 8028739 + * @summary javac generates incorrect descriptor for MethodHandle::invoke + * @run testng MethodReferenceTestMethodHandle + */ + +import java.lang.invoke.*; +import java.util.*; + +import org.testng.annotations.Test; +import static org.testng.Assert.assertEquals; + +@Test +public class MethodReferenceTestMethodHandle { + + MethodHandles.Lookup lookup = MethodHandles.lookup(); + + interface ReplaceItf { + Object apply(String a, char b, char c) throws Throwable; + } + + interface FormatItf { + Object apply(String a, Object... args) throws Throwable; + } + + interface AddItf { + void apply(List st, int idx, Object v) throws Throwable; + } + + public void testVirtual() throws Throwable { + + MethodType mt = MethodType.methodType(String.class, char.class, char.class); + MethodHandle ms = lookup.findVirtual(String.class, "replace", mt); + + // --- String.replace(String, char, char) --- + + assertEquals("oome otring to oearch", ms.invoke("some string to search", 's', 'o')); + + ReplaceItf f1 = (a, b, c) -> ms.invoke(a,b,c); + assertEquals("oome otring to oearch", f1.apply("some string to search", 's', 'o')); + + ReplaceItf f2 = ms::invoke; + assertEquals("oome otring to oearch", f2.apply("some string to search", 's', 'o')); + assertEquals("oome otring to oearch", f2.apply("some string to search", new Character('s'), 'o')); + assertEquals("oome otring to oearch", ((ReplaceItf) ms::invoke).apply("some string to search", 's', 'o')); + } + + public void testStatic() throws Throwable { + MethodType fmt = MethodType.methodType(String.class, String.class, (new Object[1]).getClass()); + MethodHandle fms = lookup.findStatic(String.class, "format", fmt); + + // --- String.format(String, Object...) --- + + assertEquals("Testing One 2 3", fms.invoke("Testing %s %d %x", "One", new Integer(2), 3)); + + FormatItf ff2 = fms::invoke; + assertEquals("Testing One 2 3", ff2.apply("Testing %s %d %x", "One", new Integer(2), 3)); + assertEquals("Testing One 2 3", ((FormatItf) fms::invoke).apply("Testing %s %d %x", "One", new Integer(2), 3)); + assertEquals("Testing One 2 3 four", ff2.apply("Testing %s %d %x %s", "One", new Integer(2), 3, "four")); + } + + public void testVoid() throws Throwable { + MethodType pmt = MethodType.methodType(void.class, int.class, Object.class); + MethodHandle pms = lookup.findVirtual(List.class, "add", pmt); + List list = new ArrayList<>(); + + // --- List.add(int,String) --- + + pms.invoke(list, 0, "Hi"); + + AddItf pf2 = pms::invoke; + pf2.apply(list, 1, "there"); + AddItf pf3 = pms::invokeExact; + pf3.apply(list, 2, "you"); + assertEquals("Hi", list.get(0)); + assertEquals("there", list.get(1)); + assertEquals("you", list.get(2)); + } +} diff -r aaea3a69fa6c -r 48367e6de872 test/tools/javac/processing/model/type/IntersectionPropertiesTest.java --- a/test/tools/javac/processing/model/type/IntersectionPropertiesTest.java Tue Dec 03 14:13:15 2013 +0400 +++ b/test/tools/javac/processing/model/type/IntersectionPropertiesTest.java Thu Dec 05 16:37:35 2013 +0400 @@ -31,26 +31,27 @@ */ import com.sun.source.util.*; -import com.sun.tools.javac.api.*; -import com.sun.tools.javac.file.*; +import com.sun.tools.javac.util.Assert; import javax.annotation.processing.*; -import javax.lang.model.SourceVersion; import javax.lang.model.type.*; import javax.lang.model.util.ElementFilter; import javax.lang.model.element.*; import javax.tools.*; import java.util.*; import java.io.*; +import javax.lang.model.util.Types; public class IntersectionPropertiesTest { private int errors = 0; private static final String Intersection_name = "IntersectionTest.java"; private static final String Intersection_contents = + "import java.util.AbstractList;\n" + "import java.util.List;\n" + "import java.io.Serializable;\t" + - "public class IntersectionTest {\n" + - " void method(S s) { }\n" + + "public class IntersectionTest {\n" + + " void method(S s, One o, Two t) { }\n" + + " public static abstract class SubType extends AbstractList implements Runnable, Serializable { } \n" + "}"; private static final File classesdir = new File("intersectionproperties"); @@ -116,7 +117,8 @@ TypeParameterElement typeParameterElement = ((TypeParameterElement) typeVariable.asElement()); final List bounds = typeParameterElement.getBounds(); - final HashSet actual = new HashSet(processingEnv.getTypeUtils().directSupertypes(upperBound)); + Types types = processingEnv.getTypeUtils(); + final HashSet actual = new HashSet(types.directSupertypes(upperBound)); final HashSet expected = new HashSet(bounds); if (!expected.equals(actual)) { System.err.println("Mismatched expected and actual bounds."); @@ -128,6 +130,40 @@ System.err.println(" " + tm); errors++; } + + TypeVariable oneTypeVariable = (TypeVariable) method.getParameters().get(1).asType(); + TypeMirror oneUpperBound = oneTypeVariable.getUpperBound(); + TypeVariable twoTypeVariable = (TypeVariable) method.getParameters().get(2).asType(); + TypeMirror twoUpperBound = twoTypeVariable.getUpperBound(); + TypeElement oneUpperBoundElement = (TypeElement) types.asElement(oneUpperBound); + + Assert.checkNonNull(oneUpperBoundElement); + + Assert.check("java.util.AbstractList".equals(oneUpperBoundElement.getSuperclass().toString()), + oneUpperBoundElement.getSuperclass().toString()); + + List superInterfaces = new java.util.ArrayList<>(); + + for (TypeMirror tm : oneUpperBoundElement.getInterfaces()) { + superInterfaces.add(tm.toString()); + } + + Assert.check(java.util.Arrays.asList("java.lang.Runnable", + "java.io.Serializable").equals(superInterfaces), + superInterfaces); + + Assert.check(types.isSameType(upperBound, types.capture(upperBound))); + Assert.check(types.isSameType(types.erasure(typeVariable), types.erasure(upperBound))); + + TypeElement subTypeClass = processingEnv.getElementUtils().getTypeElement("IntersectionTest.SubType"); + + Assert.checkNonNull(subTypeClass); + + Assert.check(types.isAssignable(subTypeClass.asType(), oneUpperBound)); + Assert.check(types.isSameType(oneUpperBound, twoUpperBound)); + Assert.check(!types.isSameType(upperBound, twoUpperBound)); + Assert.check(types.isSubtype(subTypeClass.asType(), oneUpperBound)); + Assert.check(types.isSubtype(oneUpperBound, upperBound)); } }