This commit is contained in:
Phil Race 2018-03-08 10:18:28 -08:00
commit ff223cc1ee
120 changed files with 6533 additions and 6488 deletions

View File

@ -435,7 +435,7 @@ else # $(HAS_SPEC)=true
define PrepareCompareBuild define PrepareCompareBuild
$(ECHO) "Preparing for comparison rebuild" $(ECHO) "Preparing for comparison rebuild"
# Apply patch, if any # Apply patch, if any
$(if $(COMPARE_BUILD_PATCH), $(PATCH) -p1 < $(COMPARE_BUILD_PATCH)) $(if $(COMPARE_BUILD_PATCH), cd $(topdir) && $(PATCH) -p1 < $(COMPARE_BUILD_PATCH))
# Move the first build away temporarily # Move the first build away temporarily
$(RM) -r $(topdir)/build/.compare-build-temp $(RM) -r $(topdir)/build/.compare-build-temp
$(MKDIR) -p $(topdir)/build/.compare-build-temp $(MKDIR) -p $(topdir)/build/.compare-build-temp
@ -455,7 +455,7 @@ else # $(HAS_SPEC)=true
# Cleanup after a compare build # Cleanup after a compare build
define CleanupCompareBuild define CleanupCompareBuild
# If running with a COMPARE_BUILD patch, reverse-apply it # If running with a COMPARE_BUILD patch, reverse-apply it
$(if $(COMPARE_BUILD_PATCH), $(PATCH) -R -p1 < $(COMPARE_BUILD_PATCH)) $(if $(COMPARE_BUILD_PATCH), cd $(topdir) && $(PATCH) -R -p1 < $(COMPARE_BUILD_PATCH))
# Move this build away and restore the original build # Move this build away and restore the original build
$(MKDIR) -p $(topdir)/build/compare-build $(MKDIR) -p $(topdir)/build/compare-build
$(MV) $(OUTPUTDIR) $(COMPARE_BUILD_OUTPUTDIR) $(MV) $(OUTPUTDIR) $(COMPARE_BUILD_OUTPUTDIR)

View File

@ -399,10 +399,13 @@ docs-zip:
update-build-docs: update-build-docs:
+($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f UpdateBuildDocs.gmk) +($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f UpdateBuildDocs.gmk)
update-x11wrappers:
+($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f UpdateX11Wrappers.gmk)
ALL_TARGETS += docs-jdk-api-javadoc docs-jdk-api-modulegraph \ ALL_TARGETS += docs-jdk-api-javadoc docs-jdk-api-modulegraph \
docs-javase-api-javadoc docs-javase-api-modulegraph \ docs-javase-api-javadoc docs-javase-api-modulegraph \
docs-reference-api-javadoc docs-reference-api-modulegraph docs-jdk-specs \ docs-reference-api-javadoc docs-reference-api-modulegraph docs-jdk-specs \
docs-jdk-index docs-zip update-build-docs docs-jdk-index docs-zip update-build-docs update-x11wrappers
################################################################################ ################################################################################
# Cross compilation support # Cross compilation support
@ -894,6 +897,8 @@ else
generate-summary: jmods buildtools-modules generate-summary: jmods buildtools-modules
update-x11wrappers: java.base-copy buildtools-jdk
endif endif
################################################################################ ################################################################################

View File

@ -60,6 +60,18 @@ define SetTestOpt
endif endif
endef endef
# Setup _NT_SYMBOL_PATH on Windows
ifeq ($(OPENJDK_TARGET_OS), windows)
ifndef _NT_SYMBOL_PATH
# Can't use PathList here as it adds quotes around the value.
_NT_SYMBOL_PATH := \
$(subst $(SPACE),;, $(foreach p, $(sort $(dir $(wildcard \
$(addprefix $(SYMBOLS_IMAGE_DIR)/bin/, *.pdb */*.pdb)))), $(call FixPath, $p)))
export _NT_SYMBOL_PATH
$(info _NT_SYMBOL_PATH $(_NT_SYMBOL_PATH))
endif
endif
################################################################################ ################################################################################
# Hook to include the corresponding custom file, if present. # Hook to include the corresponding custom file, if present.
$(eval $(call IncludeCustomExtension, RunTests.gmk)) $(eval $(call IncludeCustomExtension, RunTests.gmk))
@ -496,6 +508,11 @@ define SetupRunJtregTestBody
$1_JTREG_BASIC_OPTIONS += -e:JIB_DATA_DIR $1_JTREG_BASIC_OPTIONS += -e:JIB_DATA_DIR
# Some tests needs to find a boot JDK using the JDK8_HOME variable. # Some tests needs to find a boot JDK using the JDK8_HOME variable.
$1_JTREG_BASIC_OPTIONS += -e:JDK8_HOME=$$(BOOT_JDK) $1_JTREG_BASIC_OPTIONS += -e:JDK8_HOME=$$(BOOT_JDK)
# If running on Windows, propagate the _NT_SYMBOL_PATH to enable
# symbol lookup in hserr files
ifeq ($$(OPENJDK_TARGET_OS), windows)
$1_JTREG_BASIC_OPTIONS += -e:_NT_SYMBOL_PATH
endif
$1_JTREG_BASIC_OPTIONS += \ $1_JTREG_BASIC_OPTIONS += \
$$(addprefix -javaoption:, $$(JTREG_JAVA_OPTIONS)) \ $$(addprefix -javaoption:, $$(JTREG_JAVA_OPTIONS)) \

View File

@ -113,6 +113,7 @@ $(eval $(call SetupVariable,JT_HOME))
# These can have default values based on the ones above # These can have default values based on the ones above
$(eval $(call SetupVariable,JDK_IMAGE_DIR,$(OUTPUTDIR)/images/jdk)) $(eval $(call SetupVariable,JDK_IMAGE_DIR,$(OUTPUTDIR)/images/jdk))
$(eval $(call SetupVariable,TEST_IMAGE_DIR,$(OUTPUTDIR)/images/test)) $(eval $(call SetupVariable,TEST_IMAGE_DIR,$(OUTPUTDIR)/images/test))
$(eval $(call SetupVariable,SYMBOLS_IMAGE_DIR,$(OUTPUTDIR)/images/symbols))
# Provide default values for tools that we need # Provide default values for tools that we need
$(eval $(call SetupVariable,MAKE,make,NO_CHECK)) $(eval $(call SetupVariable,MAKE,make,NO_CHECK))
@ -245,6 +246,7 @@ $(call CreateNewSpec, $(NEW_SPEC), \
JT_HOME := $(JT_HOME), \ JT_HOME := $(JT_HOME), \
JDK_IMAGE_DIR := $(JDK_IMAGE_DIR), \ JDK_IMAGE_DIR := $(JDK_IMAGE_DIR), \
TEST_IMAGE_DIR := $(TEST_IMAGE_DIR), \ TEST_IMAGE_DIR := $(TEST_IMAGE_DIR), \
SYMBOLS_IMAGE_DIR := $(SYMBOLS_IMAGE_DIR), \
MAKE := $(MAKE), \ MAKE := $(MAKE), \
BASH := $(BASH), \ BASH := $(BASH), \
JIB_JAR := $(JIB_JAR), \ JIB_JAR := $(JIB_JAR), \

101
make/UpdateX11Wrappers.gmk Normal file
View File

@ -0,0 +1,101 @@
#
# Copyright (c) 2012, 2018, 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.
#
################################################################################
default: all
include $(SPEC)
include MakeBase.gmk
include NativeCompilation.gmk
include ToolsJdk.gmk
################################################################################
# This file is responsible for extracting the x11 native struct offsets to
# the xawt Java library. The tool needs to be run on the os/arch that
# will host the final jvm, thus the tool cannot be used when cross compiling.
#
# Two versions of the generated offset file, sizes-32.txt and sizes-64.txt are
# committed into the source code repository. These are the ones used in
# GensrcX11Wrappers.gmk to generate the Java code during the build.
################################################################################
ifeq ($(COMPILE_TYPE), cross)
$(error It is not possible to update the x11wrappers when cross-compiling)
endif
X11WRAPPERS_OUTPUT := $(SUPPORT_OUTPUTDIR)/x11wrappers
GENSRC_X11WRAPPERS_DATADIR := $(TOPDIR)/make/data/x11wrappergen
BITS := $(OPENJDK_TARGET_CPU_BITS)
# Generate the C code for the program that will output the offset file.
$(X11WRAPPERS_OUTPUT)/src/data_generator.c: $(GENSRC_X11WRAPPERS_DATADIR)/xlibtypes.txt $(BUILD_TOOLS_JDK)
$(call LogInfo, Generating X11 wrapper data generator source code)
$(call MakeDir, $(@D))
$(call ExecuteWithLog, $@, \
$(TOOL_WRAPPERGENERATOR) gen_c_source $@ $(GENSRC_X11WRAPPERS_DATADIR)/xlibtypes.txt $(BITS))
DATA_GENERATOR_INCLUDES := \
-I$(TOPDIR)/src/hotspot/share/include \
-I$(TOPDIR)/src/hotspot/os/$(HOTSPOT_TARGET_OS_TYPE)/include \
-I$(SUPPORT_OUTPUTDIR)/modules_include/java.base \
-I$(SUPPORT_OUTPUTDIR)/modules_include/java.base/$(OPENJDK_TARGET_OS_INCLUDE_SUBDIR) \
-I$(TOPDIR)/src/java.base/share/native/libjava \
-I$(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjava \
-I$(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/awt \
-I$(TOPDIR)/src/java.desktop/share/native/common/awt/debug \
-I$(TOPDIR)/src/java.desktop/share/native/libawt/awt/image/cvutils \
#
# Compile the generated C code into an executable.
$(eval $(call SetupNativeCompilation, BUILD_DATA_GENERATOR, \
PROGRAM := data_generator, \
OUTPUT_DIR := $(X11WRAPPERS_OUTPUT)/bin, \
EXTRA_FILES := $(X11WRAPPERS_OUTPUT)/src/data_generator.c, \
CFLAGS := $(X_CFLAGS) $(DATA_GENERATOR_INCLUDES) $(CFLAGS_JDKEXE), \
LDFLAGS := $(LDFLAGS_JDKEXE), \
LIBS := $(X_LIBS) -lc, \
OBJECT_DIR := $(X11WRAPPERS_OUTPUT)/objs, \
))
# Run the executable to create the data file.
$(GENSRC_X11WRAPPERS_DATADIR)/sizes-$(BITS).txt: $(BUILD_DATA_GENERATOR_TARGET)
$(call LogInfo, Generating X11 wrapper data files)
$(call MakeDir, $(@D))
$(call ExecuteWithLog, $(X11WRAPPERS_OUTPUT)/generation, \
$(BUILD_DATA_GENERATOR_TARGET) | $(SORT) > $@)
$(ECHO) IMPORTANT: If you update the X11 wrapper data files, they most certainly
$(ECHO) need to be updated for both 32 and 64 bit platforms. You have now
$(ECHO) updated them for $(BITS) bit platforms only.
TARGETS += $(GENSRC_X11WRAPPERS_DATADIR)/sizes-$(BITS).txt
################################################################################
all: $(TARGETS)
.PHONY: all default

View File

@ -108,29 +108,19 @@ AC_DEFUN([FLAGS_SETUP_DEBUG_SYMBOLS],
[ [
# Debug symbols # Debug symbols
if test "x$TOOLCHAIN_TYPE" = xgcc; then if test "x$TOOLCHAIN_TYPE" = xgcc; then
if test "x$OPENJDK_TARGET_CPU_BITS" = "x64" && test "x$DEBUG_LEVEL" = "xfastdebug"; then CFLAGS_DEBUG_SYMBOLS="-g"
CFLAGS_DEBUG_SYMBOLS="-g1"
else
CFLAGS_DEBUG_SYMBOLS="-g"
fi
elif test "x$TOOLCHAIN_TYPE" = xclang; then elif test "x$TOOLCHAIN_TYPE" = xclang; then
CFLAGS_DEBUG_SYMBOLS="-g" CFLAGS_DEBUG_SYMBOLS="-g"
elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
CFLAGS_DEBUG_SYMBOLS="-g -xs"
# -g0 enables debug symbols without disabling inlining. # -g0 enables debug symbols without disabling inlining.
CXXFLAGS_DEBUG_SYMBOLS="-g0 -xs" CFLAGS_DEBUG_SYMBOLS="-g0 -xs"
elif test "x$TOOLCHAIN_TYPE" = xxlc; then elif test "x$TOOLCHAIN_TYPE" = xxlc; then
CFLAGS_DEBUG_SYMBOLS="-g" CFLAGS_DEBUG_SYMBOLS="-g"
elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
CFLAGS_DEBUG_SYMBOLS="-Zi" CFLAGS_DEBUG_SYMBOLS="-Zi"
fi fi
if test "x$CXXFLAGS_DEBUG_SYMBOLS" = x; then
# If we did not specify special flags for C++, use C version
CXXFLAGS_DEBUG_SYMBOLS="$CFLAGS_DEBUG_SYMBOLS"
fi
AC_SUBST(CFLAGS_DEBUG_SYMBOLS) AC_SUBST(CFLAGS_DEBUG_SYMBOLS)
AC_SUBST(CXXFLAGS_DEBUG_SYMBOLS)
# FIXME: This was never used in the old build. What to do with it? # FIXME: This was never used in the old build. What to do with it?
if test "x$TOOLCHAIN_TYPE" = xgcc; then if test "x$TOOLCHAIN_TYPE" = xgcc; then
@ -143,13 +133,7 @@ AC_DEFUN([FLAGS_SETUP_DEBUG_SYMBOLS],
# Debug symbols for JVM_CFLAGS # Debug symbols for JVM_CFLAGS
if test "x$TOOLCHAIN_TYPE" = xsolstudio; then if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
JVM_CFLAGS_SYMBOLS="$JVM_CFLAGS_SYMBOLS -xs" JVM_CFLAGS_SYMBOLS="$JVM_CFLAGS_SYMBOLS -g0 -xs"
if test "x$DEBUG_LEVEL" = xslowdebug; then
JVM_CFLAGS_SYMBOLS="$JVM_CFLAGS_SYMBOLS -g"
else
# -g0 does not disable inlining, which -g does.
JVM_CFLAGS_SYMBOLS="$JVM_CFLAGS_SYMBOLS -g0"
fi
elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
JVM_CFLAGS_SYMBOLS="$JVM_CFLAGS_SYMBOLS -Z7 -d2Zi+" JVM_CFLAGS_SYMBOLS="$JVM_CFLAGS_SYMBOLS -Z7 -d2Zi+"
else else
@ -496,7 +480,6 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_HELPER],
if test "x$DEBUG_LEVEL" != xrelease; then if test "x$DEBUG_LEVEL" != xrelease; then
DEBUG_OPTIONS_FLAGS_JDK="$CFLAGS_DEBUG_OPTIONS" DEBUG_OPTIONS_FLAGS_JDK="$CFLAGS_DEBUG_OPTIONS"
DEBUG_SYMBOLS_CFLAGS_JDK="$CFLAGS_DEBUG_SYMBOLS" DEBUG_SYMBOLS_CFLAGS_JDK="$CFLAGS_DEBUG_SYMBOLS"
DEBUG_SYMBOLS_CXXFLAGS_JDK="$CXXFLAGS_DEBUG_SYMBOLS"
fi fi
#### TOOLCHAIN DEFINES #### TOOLCHAIN DEFINES
@ -556,6 +539,12 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_HELPER],
TOOLCHAIN_CFLAGS_JDK_CXXONLY="-features=no%except -norunpath -xnolib" # CXX only TOOLCHAIN_CFLAGS_JDK_CXXONLY="-features=no%except -norunpath -xnolib" # CXX only
TOOLCHAIN_CFLAGS_JVM="-template=no%extdef -features=no%split_init \ TOOLCHAIN_CFLAGS_JVM="-template=no%extdef -features=no%split_init \
-library=stlport4 -mt -features=no%except" -library=stlport4 -mt -features=no%except"
if test "x$DEBUG_LEVEL" = xslowdebug; then
# Previously -g was used instead of -g0 for slowdebug; this is equivalent
# to setting +d.
TOOLCHAIN_CFLAGS_JVM="$TOOLCHAIN_CFLAGS_JVM +d"
fi
elif test "x$TOOLCHAIN_TYPE" = xxlc; then elif test "x$TOOLCHAIN_TYPE" = xxlc; then
TOOLCHAIN_CFLAGS_JDK="-qchars=signed -qfullpath -qsaveopt" # add on both CFLAGS TOOLCHAIN_CFLAGS_JDK="-qchars=signed -qfullpath -qsaveopt" # add on both CFLAGS
TOOLCHAIN_CFLAGS_JVM="-qtune=balanced \ TOOLCHAIN_CFLAGS_JVM="-qtune=balanced \
@ -825,16 +814,16 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_CPU_DEP],
CFLAGS_JDK_COMMON="$ALWAYS_CFLAGS_JDK $ALWAYS_DEFINES_JDK $TOOLCHAIN_CFLAGS_JDK \ CFLAGS_JDK_COMMON="$ALWAYS_CFLAGS_JDK $ALWAYS_DEFINES_JDK $TOOLCHAIN_CFLAGS_JDK \
$OS_CFLAGS $CFLAGS_OS_DEF_JDK $DEBUG_CFLAGS_JDK $DEBUG_OPTIONS_FLAGS_JDK \ $OS_CFLAGS $CFLAGS_OS_DEF_JDK $DEBUG_CFLAGS_JDK $DEBUG_OPTIONS_FLAGS_JDK \
$WARNING_CFLAGS $WARNING_CFLAGS_JDK" $WARNING_CFLAGS $WARNING_CFLAGS_JDK $DEBUG_SYMBOLS_CFLAGS_JDK"
# Use ${$2EXTRA_CFLAGS} to block EXTRA_CFLAGS to be added to build flags. # Use ${$2EXTRA_CFLAGS} to block EXTRA_CFLAGS to be added to build flags.
# (Currently we don't have any OPENJDK_BUILD_EXTRA_CFLAGS, but that might # (Currently we don't have any OPENJDK_BUILD_EXTRA_CFLAGS, but that might
# change in the future.) # change in the future.)
CFLAGS_JDK_COMMON_CONLY="$TOOLCHAIN_CFLAGS_JDK_CONLY $DEBUG_SYMBOLS_CFLAGS_JDK \ CFLAGS_JDK_COMMON_CONLY="$TOOLCHAIN_CFLAGS_JDK_CONLY \
$WARNING_CFLAGS_JDK_CONLY ${$2EXTRA_CFLAGS}" $WARNING_CFLAGS_JDK_CONLY ${$2EXTRA_CFLAGS}"
CFLAGS_JDK_COMMON_CXXONLY="$ALWAYS_DEFINES_JDK_CXXONLY $TOOLCHAIN_CFLAGS_JDK_CXXONLY \ CFLAGS_JDK_COMMON_CXXONLY="$ALWAYS_DEFINES_JDK_CXXONLY $TOOLCHAIN_CFLAGS_JDK_CXXONLY \
$DEBUG_SYMBOLS_CXXFLAGS_JDK $WARNING_CFLAGS_JDK_CXXONLY ${$2EXTRA_CXXFLAGS}" $WARNING_CFLAGS_JDK_CXXONLY ${$2EXTRA_CXXFLAGS}"
$1_CFLAGS_JVM="${$1_DEFINES_CPU_JVM} ${$1_CFLAGS_CPU} ${$1_CFLAGS_CPU_JVM} ${$1_TOOLCHAIN_CFLAGS} ${$1_WARNING_CFLAGS_JVM}" $1_CFLAGS_JVM="${$1_DEFINES_CPU_JVM} ${$1_CFLAGS_CPU} ${$1_CFLAGS_CPU_JVM} ${$1_TOOLCHAIN_CFLAGS} ${$1_WARNING_CFLAGS_JVM}"
$1_CFLAGS_JDK="${$1_DEFINES_CPU_JDK} ${$1_CFLAGS_CPU} ${$1_CFLAGS_CPU_JDK} ${$1_TOOLCHAIN_CFLAGS}" $1_CFLAGS_JDK="${$1_DEFINES_CPU_JDK} ${$1_CFLAGS_CPU} ${$1_CFLAGS_CPU_JDK} ${$1_TOOLCHAIN_CFLAGS}"

View File

@ -236,7 +236,10 @@ AC_DEFUN_ONCE([FLAGS_PRE_TOOLCHAIN],
if test "x$TOOLCHAIN_TYPE" = xxlc; then if test "x$TOOLCHAIN_TYPE" = xxlc; then
MACHINE_FLAG="-q${OPENJDK_TARGET_CPU_BITS}" MACHINE_FLAG="-q${OPENJDK_TARGET_CPU_BITS}"
elif test "x$TOOLCHAIN_TYPE" != xmicrosoft; then elif test "x$TOOLCHAIN_TYPE" != xmicrosoft; then
MACHINE_FLAG="-m${OPENJDK_TARGET_CPU_BITS}" if test "x$OPENJDK_TARGET_CPU" != xaarch64 &&
test "x$OPENJDK_TARGET_CPU" != xarm; then
MACHINE_FLAG="-m${OPENJDK_TARGET_CPU_BITS}"
fi
fi fi
# FIXME: global flags are not used yet... # FIXME: global flags are not used yet...

View File

@ -532,7 +532,6 @@ COPY_DEBUG_SYMBOLS := @COPY_DEBUG_SYMBOLS@
ZIP_EXTERNAL_DEBUG_SYMBOLS := @ZIP_EXTERNAL_DEBUG_SYMBOLS@ ZIP_EXTERNAL_DEBUG_SYMBOLS := @ZIP_EXTERNAL_DEBUG_SYMBOLS@
CFLAGS_DEBUG_SYMBOLS:=@CFLAGS_DEBUG_SYMBOLS@ CFLAGS_DEBUG_SYMBOLS:=@CFLAGS_DEBUG_SYMBOLS@
CXXFLAGS_DEBUG_SYMBOLS:=@CXXFLAGS_DEBUG_SYMBOLS@
# #
# Compress (or not) jars # Compress (or not) jars

View File

@ -150,7 +150,7 @@ NATIVE_SOURCE_EXTENSIONS := %.s %.S %.c %.cpp %.cc %.m %.mm
define replace_with_obj_extension define replace_with_obj_extension
$(strip \ $(strip \
$(foreach extension, $(NATIVE_SOURCE_EXTENSIONS), \ $(foreach extension, $(NATIVE_SOURCE_EXTENSIONS), \
$(patsubst $(extension),%$(OBJ_SUFFIX),$(filter $(extension),$1))) \ $(patsubst $(extension),%$(OBJ_SUFFIX), $(filter $(extension), $1))) \
) )
endef endef
@ -183,150 +183,167 @@ DEPENDENCY_TARGET_SED_PATTERN := \
-e 's/$$$$/ :/' \ -e 's/$$$$/ :/' \
# #
define add_native_source ################################################################################
# param 1 = BUILD_MYPACKAGE # Create the recipe needed to compile a single native source file.
# parma 2 = the source file name (..../alfa.c or .../beta.cpp) #
# param 3 = the bin dir that stores all .o (.obj) and .d files. # Parameter 1 is the name of the rule, based on the name of the library/
# param 4 = the c flags to the compiler # program being build and the name of the source code file, e.g.
# param 5 = the c compiler # BUILD_LIBFOO_fooMain.cpp.
# param 6 = the c++ flags to the compiler #
# param 7 = the c++ compiler # Remaining parameters are named arguments:
# param 8 = the flags to the assembler # FILE - The full path of the source file to compiler
# param 9 = set to disable THIS_FILE # BASE - The name of the rule for the entire binary to build ($1)
# DISABLE_THIS_FILE_DEFINE - Set to true to disable the THIS_FILE define.
#
SetupCompileNativeFile = $(NamedParamsMacroTemplate)
define SetupCompileNativeFileBody
$1_FILENAME := $$(notdir $$($1_FILE))
ifeq ($9, ) # The target file to be generated.
$1_$2_THIS_FILE = -DTHIS_FILE='"$$(<F)"' $1_OBJ := $$($$($1_BASE)_OBJECT_DIR)/$$(call replace_with_obj_extension, \
endif $$($1_FILENAME))
ifeq ($$($1_$(notdir $2)_OPTIMIZATION), ) # Only continue if this object file hasn't been processed already. This lets
$1_$(notdir $2)_OPT_CFLAGS := $$($1_OPT_CFLAGS) # the first found source file override any other with the same name.
$1_$(notdir $2)_OPT_CXXFLAGS := $$($1_OPT_CXXFLAGS) ifeq ($$(findstring $$($1_OBJ), $$($$($1_BASE)_OBJS_SO_FAR)), )
else $$($1_BASE)_OBJS_SO_FAR += $$($1_OBJ)
ifeq (NONE, $$($1_$(notdir $2)_OPTIMIZATION)) # This is the definite source file to use for $1_FILENAME.
$1_$(notdir $2)_OPT_CFLAGS := $(C_O_FLAG_NONE) $1_SRC_FILE := $$($1_FILE)
$1_$(notdir $2)_OPT_CXXFLAGS := $(CXX_O_FLAG_NONE)
else ifeq (LOW, $$($1_$(notdir $2)_OPTIMIZATION)) ifneq ($$($1_DISABLE_THIS_FILE_DEFINE), true)
$1_$(notdir $2)_OPT_CFLAGS := $(C_O_FLAG_NORM) $1_THIS_FILE = -DTHIS_FILE='"$$(<F)"'
$1_$(notdir $2)_OPT_CXXFLAGS := $(CXX_O_FLAG_NORM) endif
else ifeq (HIGH, $$($1_$(notdir $2)_OPTIMIZATION))
$1_$(notdir $2)_OPT_CFLAGS := $(C_O_FLAG_HI) ifeq ($$($1_OPTIMIZATION), )
$1_$(notdir $2)_OPT_CXXFLAGS := $(CXX_O_FLAG_HI) $1_OPT_CFLAGS := $$($$($1_BASE)_OPT_CFLAGS)
else ifeq (HIGHEST, $$($1_$(notdir $2)_OPTIMIZATION)) $1_OPT_CXXFLAGS := $$($$($1_BASE)_OPT_CXXFLAGS)
$1_$(notdir $2)_OPT_CFLAGS := $(C_O_FLAG_HIGHEST)
$1_$(notdir $2)_OPT_CXXFLAGS := $(CXX_O_FLAG_HIGHEST)
else ifeq (HIGHEST_JVM, $$($1_$(notdir $2)_OPTIMIZATION))
$1_$(notdir $2)_OPT_CFLAGS := $(C_O_FLAG_HIGHEST_JVM)
$1_$(notdir $2)_OPT_CXXFLAGS := $(CXX_O_FLAG_HIGHEST_JVM)
else ifeq (SIZE, $$($1_$(notdir $2)_OPTIMIZATION))
$1_$(notdir $2)_OPT_CFLAGS := $(C_O_FLAG_SIZE)
$1_$(notdir $2)_OPT_CXXFLAGS := $(CXX_O_FLAG_SIZE)
else else
$$(error Unknown value for OPTIMIZATION: $$($1_$(notdir $2)_OPTIMIZATION)) ifeq ($$($1_OPTIMIZATION), NONE)
$1_OPT_CFLAGS := $(C_O_FLAG_NONE)
$1_OPT_CXXFLAGS := $(CXX_O_FLAG_NONE)
else ifeq ($$($1_OPTIMIZATION), LOW)
$1_OPT_CFLAGS := $(C_O_FLAG_NORM)
$1_OPT_CXXFLAGS := $(CXX_O_FLAG_NORM)
else ifeq ($$($1_OPTIMIZATION), HIGH)
$1_OPT_CFLAGS := $(C_O_FLAG_HI)
$1_OPT_CXXFLAGS := $(CXX_O_FLAG_HI)
else ifeq ($$($1_OPTIMIZATION), HIGHEST)
$1_OPT_CFLAGS := $(C_O_FLAG_HIGHEST)
$1_OPT_CXXFLAGS := $(CXX_O_FLAG_HIGHEST)
else ifeq ($$($1_OPTIMIZATION), HIGHEST_JVM)
$1_OPT_CFLAGS := $(C_O_FLAG_HIGHEST_JVM)
$1_OPT_CXXFLAGS := $(CXX_O_FLAG_HIGHEST_JVM)
else ifeq ($$($1_OPTIMIZATION), SIZE)
$1_OPT_CFLAGS := $(C_O_FLAG_SIZE)
$1_OPT_CXXFLAGS := $(CXX_O_FLAG_SIZE)
else
$$(error Unknown value for file OPTIMIZATION: $$($1_OPTIMIZATION))
endif
endif endif
endif
ifneq ($$($1_PRECOMPILED_HEADER), ) ifneq ($$($$($1_BASE)_PRECOMPILED_HEADER), )
ifeq ($$(filter $$(notdir $2), $$($1_PRECOMPILED_HEADER_EXCLUDE)), ) ifeq ($$(filter $$($1_FILENAME), $$($$($1_BASE)_PRECOMPILED_HEADER_EXCLUDE)), )
$1_$2_USE_PCH_FLAGS := $$($1_USE_PCH_FLAGS) $1_USE_PCH_FLAGS := $$($$($1_BASE)_USE_PCH_FLAGS)
endif
endif endif
endif
ifneq ($$(filter %.c, $2), ) $1_BASE_CFLAGS := $$($$($1_BASE)_CFLAGS) $$($$($1_BASE)_EXTRA_CFLAGS) \
# Compile as a C file $$($$($1_BASE)_SYSROOT_CFLAGS)
$1_$2_FLAGS := $(CFLAGS_CCACHE) $$($1_$2_USE_PCH_FLAGS) $4 \ $1_BASE_CXXFLAGS := $$($$($1_BASE)_CXXFLAGS) $$($$($1_BASE)_EXTRA_CXXFLAGS) \
$$($1_$(notdir $2)_OPT_CFLAGS) \ $$($$($1_BASE)_SYSROOT_CFLAGS) $$($1_EXTRA_CXXFLAGS)
$$($1_$(notdir $2)_CFLAGS) $$($1_$2_THIS_FILE) -c
$1_$2_COMP := $5 ifneq ($$(filter %.c, $$($1_FILENAME)), )
$1_$2_DEP_FLAG := $(C_FLAG_DEPS) # Compile as a C file
else ifneq ($$(filter %.m, $2), ) $1_FLAGS := $(CFLAGS_CCACHE) $$($1_USE_PCH_FLAGS) $$($1_BASE_CFLAGS) \
# Compile as an Objective-C file $$($1_OPT_CFLAGS) $$($1_CFLAGS) $$($1_THIS_FILE) -c
$1_$2_FLAGS := -x objective-c $(CFLAGS_CCACHE) $$($1_$2_USE_PCH_FLAGS) $4 \ $1_COMPILER := $$($$($1_BASE)_CC)
$$($1_$(notdir $2)_OPT_CFLAGS) \ $1_DEP_FLAG := $(C_FLAG_DEPS)
$$($1_$(notdir $2)_CFLAGS) $$($1_$2_THIS_FILE) -c else ifneq ($$(filter %.m, $$($1_FILENAME)), )
$1_$2_COMP := $5 # Compile as an Objective-C file
$1_$2_DEP_FLAG := $(C_FLAG_DEPS) $1_FLAGS := -x objective-c $(CFLAGS_CCACHE) $$($1_USE_PCH_FLAGS) \
else ifneq ($$(filter %.s %.S, $2), ) $$($1_BASE_CFLAGS) $$($1_OPT_CFLAGS) $$($1_CFLAGS) $$($1_THIS_FILE) -c
# Compile as assembler file $1_COMPILER := $$($$($1_BASE)_CC)
$1_$2_FLAGS := $8 $1_DEP_FLAG := $(C_FLAG_DEPS)
$1_$2_COMP := $(AS) else ifneq ($$(filter %.s %.S, $$($1_FILENAME)), )
$1_$2_DEP_FLAG := # Compile as assembler file
else ifneq ($$(filter %.cpp, $2)$$(filter %.cc, $2)$$(filter %.mm, $2), ) $1_FLAGS := $$($$($1_BASE)_ASFLAGS)
# Compile as a C++ or Objective-C++ file $1_COMPILER := $(AS)
$1_$2_FLAGS := $(CFLAGS_CCACHE) $$($1_$2_USE_PCH_FLAGS) $6 \ $1_DEP_FLAG :=
$$($1_$(notdir $2)_OPT_CXXFLAGS) \ else ifneq ($$(filter %.cpp %.cc %.mm, $$($1_FILENAME)), )
$$($1_$(notdir $2)_CXXFLAGS) $$($1_$2_THIS_FILE) -c # Compile as a C++ or Objective-C++ file
$1_$2_COMP := $7 $1_FLAGS := $(CFLAGS_CCACHE) $$($1_USE_PCH_FLAGS) $$($1_BASE_CXXFLAGS) \
$1_$2_DEP_FLAG := $(CXX_FLAG_DEPS) $$($1_OPT_CXXFLAGS) $$($1_CXXFLAGS) $$($1_THIS_FILE) -c
else $1_COMPILER := $$($$($1_BASE)_CXX)
$$(error Internal error in NativeCompilation.gmk: no compiler for file $2) $1_DEP_FLAG := $(CXX_FLAG_DEPS)
endif else
# Generate the .o (.obj) file name and place it in the bin dir. $$(error Internal error in NativeCompilation.gmk: no compiler for file $$($1_FILENAME))
$1_$2_OBJ := $3/$$(call replace_with_obj_extension, $$(notdir $2)) endif
# Only continue if this object file hasn't been processed already. This lets the first found
# source file override any other with the same name. ifeq ($$(filter %.s %.S, $$($1_FILENAME)), )
ifeq ($$(findstring $$($1_$2_OBJ), $$($1_OBJS_SO_FAR)), )
$1_OBJS_SO_FAR += $$($1_$2_OBJ)
ifeq ($$(filter %.s %.S, $2), )
# And this is the dependency file for this obj file. # And this is the dependency file for this obj file.
$1_$2_DEP := $$(patsubst %$(OBJ_SUFFIX),%.d,$$($1_$2_OBJ)) $1_DEP := $$(patsubst %$(OBJ_SUFFIX),%.d,$$($1_OBJ))
# The dependency target file lists all dependencies as empty targets # The dependency target file lists all dependencies as empty targets to
# to avoid make error "No rule to make target" for removed files # avoid make error "No rule to make target" for removed files
$1_$2_DEP_TARGETS := $$(patsubst %$(OBJ_SUFFIX),%.d.targets,$$($1_$2_OBJ)) $1_DEP_TARGETS := $$(patsubst %$(OBJ_SUFFIX),%.d.targets,$$($1_OBJ))
# Include previously generated dependency information. (if it exists) # Include previously generated dependency information. (if it exists)
-include $$($1_$2_DEP) -include $$($1_DEP)
-include $$($1_$2_DEP_TARGETS) -include $$($1_DEP_TARGETS)
ifeq ($(TOOLCHAIN_TYPE), microsoft) ifeq ($(TOOLCHAIN_TYPE), microsoft)
# To avoid name clashes between pdbs for objects and libs/execs, put # To avoid name clashes between pdbs for objects and libs/execs, put
# object pdbs in a separate subdir. # object pdbs in a separate subdir.
$1_$2_DEBUG_OUT_FLAGS := -Fd$$(strip $$(patsubst $$($1_OBJECT_DIR)/%, \ $1_DEBUG_OUT_FLAGS := -Fd$$(strip $$(patsubst $$($$($1_BASE)_OBJECT_DIR)/%, \
$$($1_OBJECT_DIR)/pdb/%, $$(patsubst %$(OBJ_SUFFIX),%.pdb,$$($1_$2_OBJ)))) $$($$($1_BASE)_OBJECT_DIR)/pdb/%, $$(patsubst %$(OBJ_SUFFIX),%.pdb,$$($1_OBJ))))
endif endif
endif endif
ifneq ($$(strip $$($1_$(notdir $2)_CFLAGS) $$($1_$(notdir $2)_CXXFLAGS) \ ifneq ($$(strip $$($1_CFLAGS) $$($1_CXXFLAGS) $$($1_OPTIMIZATION)), )
$$($1_$(notdir $2)_OPTIMIZATION)), ) $1_VARDEPS := $$($1_CFLAGS) $$($1_CXXFLAGS) $$($1_OPT_CFLAGS) \
$1_$2_VARDEPS := $$($1_$(notdir $2)_CFLAGS) $$($1_$(notdir $2)_CXXFLAGS) \ $$($1_OPT_CXXFLAGS)
$$($1_$(notdir $2)_OPT_CFLAGS) $$($1_$(notdir $2)_OPT_CXXFLAGS) $1_VARDEPS_FILE := $$(call DependOnVariable, $1_VARDEPS, $$($1_OBJ).vardeps)
$1_$2_VARDEPS_FILE := $$(call DependOnVariable, $1_$2_VARDEPS, $$($1_$2_OBJ).vardeps)
endif endif
$$($1_$2_OBJ) : $2 $$($1_COMPILE_VARDEPS_FILE) $$($1_$2_VARDEPS_FILE) | $$($1_BUILD_INFO) $$($1_OBJ): $$($1_SRC_FILE) $$($$($1_BASE)_COMPILE_VARDEPS_FILE) \
$$(call LogInfo, Compiling $$(notdir $2) (for $$($1_BASENAME))) $$($1_VARDEPS_FILE) | $$($$($1_BASE)_BUILD_INFO)
$$(call LogInfo, Compiling $$($1_FILENAME) (for $$($$($1_BASE)_BASENAME)))
$$(call MakeDir, $$(@D) $$(@D)/pdb) $$(call MakeDir, $$(@D) $$(@D)/pdb)
ifneq ($(TOOLCHAIN_TYPE), microsoft) ifneq ($(TOOLCHAIN_TYPE), microsoft)
ifeq ($(TOOLCHAIN_TYPE)$$(filter %.s, $2), solstudio) ifeq ($(TOOLCHAIN_TYPE)$$(filter %.s, $$($1_FILENAME)), solstudio)
# The Solaris studio compiler doesn't output the full path to the object file in the # The Solaris studio compiler doesn't output the full path to the
# generated deps files. Fixing it with sed. If compiling assembly, don't try this. # object file in the generated deps files. Fixing it with sed. If
# compiling assembly, don't try this.
$$(call ExecuteWithLog, $$@, \ $$(call ExecuteWithLog, $$@, \
$$($1_$2_COMP) $$($1_$2_FLAGS) $$($1_$2_DEP_FLAG) $$($1_$2_DEP).tmp $(CC_OUT_OPTION)$$($1_$2_OBJ) $2) $$($1_COMPILER) $$($1_FLAGS) $$($1_DEP_FLAG) $$($1_DEP).tmp \
$(SED) 's|^$$(@F):|$$@:|' $$($1_$2_DEP).tmp > $$($1_$2_DEP) $(CC_OUT_OPTION)$$($1_OBJ) $$($1_SRC_FILE))
$(SED) 's|^$$(@F):|$$@:|' $$($1_DEP).tmp > $$($1_DEP)
else else
$$(call ExecuteWithLog, $$@, \ $$(call ExecuteWithLog, $$@, \
$$($1_$2_COMP) $$($1_$2_FLAGS) $$($1_$2_DEP_FLAG) $$($1_$2_DEP) $(CC_OUT_OPTION)$$($1_$2_OBJ) $2) $$($1_COMPILER) $$($1_FLAGS) $$($1_DEP_FLAG) $$($1_DEP) \
$(CC_OUT_OPTION)$$($1_OBJ) $$($1_SRC_FILE))
endif endif
# Create a dependency target file from the dependency file. # Create a dependency target file from the dependency file.
# Solution suggested by http://make.mad-scientist.net/papers/advanced-auto-dependency-generation/ # Solution suggested by http://make.mad-scientist.net/papers/advanced-auto-dependency-generation/
ifneq ($$($1_$2_DEP), ) ifneq ($$($1_DEP), )
$(SED) $(DEPENDENCY_TARGET_SED_PATTERN) $$($1_$2_DEP) > $$($1_$2_DEP_TARGETS) $(SED) $(DEPENDENCY_TARGET_SED_PATTERN) $$($1_DEP) > $$($1_DEP_TARGETS)
endif endif
else else
# The Visual Studio compiler lacks a feature for generating make dependencies, but by # The Visual Studio compiler lacks a feature for generating make
# setting -showIncludes, all included files are printed. These are filtered out and # dependencies, but by setting -showIncludes, all included files are
# parsed into make dependences. # printed. These are filtered out and parsed into make dependences.
# Keep as much as possible on one execution line for best performance on Windows. #
# No need to save exit code from compilation since pipefail is always active on # Keep as much as possible on one execution line for best performance
# Windows. # on Windows. No need to save exit code from compilation since
# pipefail is always active on Windows.
$$(call ExecuteWithLog, $$@, \ $$(call ExecuteWithLog, $$@, \
$$($1_$2_COMP) $$($1_$2_FLAGS) -showIncludes $$($1_$2_DEBUG_OUT_FLAGS) \ $$($1_COMPILER) $$($1_FLAGS) -showIncludes $$($1_DEBUG_OUT_FLAGS) \
$(CC_OUT_OPTION)$$($1_$2_OBJ) $2) \ $(CC_OUT_OPTION)$$($1_OBJ) $$($1_SRC_FILE)) \
| $(GREP) -v -e "^Note: including file:" \ | $(TR) -d '\r' | $(GREP) -v -e "^Note: including file:" \
-e "^$(notdir $2)$$$$" || test "$$$$?" = "1" ; \ -e "^$$($1_FILENAME)$$$$" || test "$$$$?" = "1" ; \
$(ECHO) $$@: \\ > $$($1_$2_DEP) ; \ $(ECHO) $$@: \\ > $$($1_DEP) ; \
$(SED) $(WINDOWS_SHOWINCLUDE_SED_PATTERN) $$($1_$2_OBJ).log \ $(SED) $(WINDOWS_SHOWINCLUDE_SED_PATTERN) $$($1_OBJ).log \
| $(SORT) -u >> $$($1_$2_DEP) ; \ | $(SORT) -u >> $$($1_DEP) ; \
$(SED) $(DEPENDENCY_TARGET_SED_PATTERN) $$($1_$2_DEP) > $$($1_$2_DEP_TARGETS) $(SED) $(DEPENDENCY_TARGET_SED_PATTERN) $$($1_DEP) > $$($1_DEP_TARGETS)
endif endif
endif endif
endef endef
@ -379,7 +396,6 @@ endef
# ZIP_EXTERNAL_DEBUG_SYMBOLS Set to false to override global setting of debug symbol # ZIP_EXTERNAL_DEBUG_SYMBOLS Set to false to override global setting of debug symbol
# zipping # zipping
# CFLAGS_DEBUG_SYMBOLS Overrides the default cflags for enabling debug symbols # CFLAGS_DEBUG_SYMBOLS Overrides the default cflags for enabling debug symbols
# CXXFLAGS_DEBUG_SYMBOLS Overrides the default cxxflags for enabling debug symbols
# STRIPFLAGS Optionally change the flags given to the strip command # STRIPFLAGS Optionally change the flags given to the strip command
# PRECOMPILED_HEADER Header file to use as precompiled header # PRECOMPILED_HEADER Header file to use as precompiled header
# PRECOMPILED_HEADER_EXCLUDE List of source files that should not use PCH # PRECOMPILED_HEADER_EXCLUDE List of source files that should not use PCH
@ -560,9 +576,8 @@ define SetupNativeCompilationBody
ifeq ($(COMPILE_WITH_DEBUG_SYMBOLS), true) ifeq ($(COMPILE_WITH_DEBUG_SYMBOLS), true)
$$(call SetIfEmpty, $1_CFLAGS_DEBUG_SYMBOLS, $(CFLAGS_DEBUG_SYMBOLS)) $$(call SetIfEmpty, $1_CFLAGS_DEBUG_SYMBOLS, $(CFLAGS_DEBUG_SYMBOLS))
$$(call SetIfEmpty, $1_CXXFLAGS_DEBUG_SYMBOLS, $(CXXFLAGS_DEBUG_SYMBOLS))
$1_EXTRA_CFLAGS += $$($1_CFLAGS_DEBUG_SYMBOLS) $1_EXTRA_CFLAGS += $$($1_CFLAGS_DEBUG_SYMBOLS)
$1_EXTRA_CXXFLAGS += $$($1_CXXFLAGS_DEBUG_SYMBOLS) $1_EXTRA_CXXFLAGS += $$($1_CFLAGS_DEBUG_SYMBOLS)
endif endif
ifneq ($$($1_REORDER), ) ifneq ($$($1_REORDER), )
@ -641,11 +656,12 @@ define SetupNativeCompilationBody
$1_GENERATED_PCH_SRC := $$($1_OBJECT_DIR)/$1_pch.cpp $1_GENERATED_PCH_SRC := $$($1_OBJECT_DIR)/$1_pch.cpp
$1_GENERATED_PCH_OBJ := $$($1_OBJECT_DIR)/$1_pch.obj $1_GENERATED_PCH_OBJ := $$($1_OBJECT_DIR)/$1_pch.obj
$$(eval $$(call add_native_source,$1,$$($1_GENERATED_PCH_SRC), \ $$(eval $$(call SetupCompileNativeFile, $1_$$(notdir $$($1_GENERATED_PCH_SRC)), \
$$($1_OBJECT_DIR),,, \ FILE := $$($1_GENERATED_PCH_SRC), \
$$($1_CXXFLAGS) $$($1_EXTRA_CXXFLAGS) $$($1_SYSROOT_CFLAGS) \ BASE := $1, \
-Fp$$($1_PCH_FILE) -Yc$$(notdir $$($1_PRECOMPILED_HEADER)), \ EXTRA_CXXFLAGS := -Fp$$($1_PCH_FILE) -Yc$$(notdir $$($1_PRECOMPILED_HEADER)), \
$$($1_CXX),,no_this_file)) DISABLE_THIS_FILE_DEFINE := true, \
))
$1_USE_PCH_FLAGS := \ $1_USE_PCH_FLAGS := \
-Fp$$($1_PCH_FILE) -Yu$$(notdir $$($1_PRECOMPILED_HEADER)) -Fp$$($1_PCH_FILE) -Yu$$(notdir $$($1_PRECOMPILED_HEADER))
@ -688,13 +704,13 @@ define SetupNativeCompilationBody
endif endif
endif endif
# Now call add_native_source for each source file we are going to compile. # Now call SetupCompileNativeFile for each source file we are going to compile.
$$(foreach p, $$($1_SRCS), \ $$(foreach file, $$($1_SRCS), \
$$(eval $$(call add_native_source,$1,$$p,$$($1_OBJECT_DIR), \ $$(eval $$(call SetupCompileNativeFile, $1_$$(notdir $$(file)),\
$$($1_CFLAGS) $$($1_EXTRA_CFLAGS) $$($1_SYSROOT_CFLAGS), \ FILE := $$(file), \
$$($1_CC), \ BASE := $1, \
$$($1_CXXFLAGS) $$($1_EXTRA_CXXFLAGS) $$($1_SYSROOT_CFLAGS), \ )) \
$$($1_CXX), $$($1_ASFLAGS)))) )
# Setup rule for printing progress info when compiling source files. # Setup rule for printing progress info when compiling source files.
# This is a rough heuristic and may not always print accurate information. # This is a rough heuristic and may not always print accurate information.

View File

@ -59,13 +59,13 @@ define SetupTestFilesCompilationBody
ifeq ($$($1_TYPE), LIBRARY) ifeq ($$($1_TYPE), LIBRARY)
$1_PREFIX = lib $1_PREFIX = lib
$1_OUTPUT_SUBDIR := lib $1_OUTPUT_SUBDIR := lib
$1_CFLAGS := $(CFLAGS_TESTLIB) $(CFLAGS_WARNINGS_ARE_ERRORS) $1_CFLAGS := $(CFLAGS_TESTLIB)
$1_LDFLAGS := $(LDFLAGS_TESTLIB) $(call SET_SHARED_LIBRARY_ORIGIN) $1_LDFLAGS := $(LDFLAGS_TESTLIB) $(call SET_SHARED_LIBRARY_ORIGIN)
$1_COMPILATION_TYPE := LIBRARY $1_COMPILATION_TYPE := LIBRARY
else ifeq ($$($1_TYPE), PROGRAM) else ifeq ($$($1_TYPE), PROGRAM)
$1_PREFIX = exe $1_PREFIX = exe
$1_OUTPUT_SUBDIR := bin $1_OUTPUT_SUBDIR := bin
$1_CFLAGS := $(CFLAGS_TESTEXE) $(CFLAGS_WARNINGS_ARE_ERRORS) $1_CFLAGS := $(CFLAGS_TESTEXE)
$1_LDFLAGS := $(LDFLAGS_TESTEXE) $1_LDFLAGS := $(LDFLAGS_TESTEXE)
$1_COMPILATION_TYPE := EXECUTABLE $1_COMPILATION_TYPE := EXECUTABLE
else else

View File

@ -743,11 +743,22 @@ var getJibProfilesProfiles = function (input, common, data) {
dependencies: [ "devkit" ], dependencies: [ "devkit" ],
environment_path: input.get("devkit", "install_path") environment_path: input.get("devkit", "install_path")
+ "/Xcode.app/Contents/Developer/usr/bin" + "/Xcode.app/Contents/Developer/usr/bin"
} };
profiles["run-test"] = concatObjects(profiles["run-test"], macosxRunTestExtra); profiles["run-test"] = concatObjects(profiles["run-test"], macosxRunTestExtra);
profiles["run-test-jprt"] = concatObjects(profiles["run-test-jprt"], macosxRunTestExtra); profiles["run-test-jprt"] = concatObjects(profiles["run-test-jprt"], macosxRunTestExtra);
profiles["run-test-prebuilt"] = concatObjects(profiles["run-test-prebuilt"], macosxRunTestExtra); profiles["run-test-prebuilt"] = concatObjects(profiles["run-test-prebuilt"], macosxRunTestExtra);
} }
// On windows we want the debug symbols available at test time
if (input.build_os == "windows") {
windowsRunTestPrebuiltExtra = {
dependencies: [ testedProfile + ".jdk_symbols" ],
environment: {
"PRODUCT_SYMBOLS_HOME": input.get(testedProfile + ".jdk_symbols", "home_path"),
}
};
profiles["run-test-prebuilt"] = concatObjects(profiles["run-test-prebuilt"],
windowsRunTestPrebuiltExtra);
}
// Generate the missing platform attributes // Generate the missing platform attributes
profiles = generatePlatformAttributes(profiles); profiles = generatePlatformAttributes(profiles);

View File

@ -1,26 +0,0 @@
!XGetWindowProperty|int
w long
property Atom
long_offset long
long_length long
delete Bool
req_type Atom
actual_type Atom out
actual_format int out
number_of_items long out
bytes_after long out
data pointer out free
!XQueryTree|int
w long
root long out
parent long out
children pointer out free
nchildren int out
!XTranslateCoordinates|int
scr_w long
dest_w long
src_x int
src_y int
dest_x int out
dest_y int out
child long out

File diff suppressed because it is too large Load Diff

View File

@ -1,9 +1,9 @@
// //
//
// This file is used for automated generation of java classes to wrap native structures. // This file is used for automated generation of java classes to wrap native structures.
// The detail on format of this file see WrapperGenerator.java // For details on format of this file, see WrapperGenerator.java
// //
// WARNING: if you modified this file, you need to regenerate sizes.64-solaris-i386 // WARNING: If you modify this file, you need to regenerate sizes-32.txt and sizes-64.txt.
// Run "make update-x11wrappers" to do this.
// //
XExtData XExtData

View File

@ -30,10 +30,10 @@ $(eval $(call IncludeCustomExtension, gensrc/Gensrc-java.desktop.gmk))
ifneq ($(OPENJDK_TARGET_OS), windows) ifneq ($(OPENJDK_TARGET_OS), windows)
include GensrcIcons.gmk include GensrcIcons.gmk
endif
ifneq ($(OPENJDK_TARGET_OS), macosx) ifneq ($(filter $(OPENJDK_TARGET_OS), linux solaris aix), )
include GensrcX11Wrappers.gmk include GensrcX11Wrappers.gmk
endif
endif endif
include GensrcSwing.gmk include GensrcSwing.gmk

View File

@ -1,5 +1,5 @@
# #
# Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
@ -23,106 +23,32 @@
# questions. # questions.
# #
# This file is responsible for extracting the x11 native struct offsets to # Generate java sources using the X11 offsets that are precalculated in files
# the xawt Java library. The tool needs to be run on the os/arch that # make/data/x11wrappergen/sizes-<address size>.txt.
# will host the final jvm, thus the tool cannot be used when cross compiling.
# To enable cross compiling, the two versions of the generated offset file, GENSRC_X11WRAPPERS_OUTPUT_TOP := $(SUPPORT_OUTPUTDIR)/gensrc/java.desktop
# sizes.32 and sizes.64 are committed into the source code repository.
# These are the ones used.
# However when not cross compiling, the offset generator tool is built and GENSRC_X11WRAPPERS_MARKER := $(GENSRC_X11WRAPPERS_OUTPUT_TOP)/_x11wrappers.marker
# run, to verify that it still generates the same sizes.32 and sizes.64.
GENSRC_X11WRAPPERS :=
# Put temporary c-code and executable to calculate offsets here.
# Also put verification offset file here as well.
GENSRC_X11WRAPPERS_TMP := $(SUPPORT_OUTPUTDIR)/gensrc/java.desktop/_x11wrappers
# Put the generated Java classes used to interface X11 from awt here. # Put the generated Java classes used to interface X11 from awt here.
GENSRC_X11WRAPPERS_DST := $(SUPPORT_OUTPUTDIR)/gensrc/java.desktop/sun/awt/X11 GENSRC_X11WRAPPERS_OUTPUTDIR := $(GENSRC_X11WRAPPERS_OUTPUT_TOP)/sun/awt/X11
# The pre-calculated offset file are stored here: # The pre-calculated offset file are stored here:
GENSRC_SIZER_DIR := $(TOPDIR)/make/data/x11wrappergen GENSRC_X11WRAPPERS_DATADIR := $(TOPDIR)/make/data/x11wrappergen
GENSRC_X11WRAPPERS_DATA := $(GENSRC_X11WRAPPERS_DATADIR)/sizes-$(OPENJDK_TARGET_CPU_BITS).txt
# Normal case is to generate only according to target bits $(info ExecuteWithLog is $(call ExecuteWithLog $(GENSRC_X11WRAPPERS_OUTPUT_TOP)/foobar, CMDLINE))
GENSRC_X11_VERSION := $(OPENJDK_TARGET_CPU_BITS)
ifeq ($(OPENJDK_TARGET_CPU_BITS), 64)
ifneq ($(OPENJDK_TARGET_OS), linux)
# On all 64-bit systems except Linux, generate both 32 and 64 bit versions
GENSRC_X11_VERSION := 32 64
endif
else
ifeq ($(OPENJDK_TARGET_OS), solaris)
# As a special case, solaris 32-bit also generates the 64-bit version
GENSRC_X11_VERSION := 32 64
endif
endif
GENSRC_X11_SIZES_USED := $(addprefix $(GENSRC_X11WRAPPERS_TMP)/sizes., $(GENSRC_X11_VERSION)) # Run the tool on the offset files to generate several Java classes used in awt.
$(GENSRC_X11WRAPPERS_MARKER): $(BUILD_TOOLS_JDK) $(GENSRC_X11WRAPPERS_DATA) \
# Copy only the sizes.* files that are actually needed. WrapperGenerator picks up any it finds from the $(GENSRC_X11WRAPPERS_DATADIR)/xlibtypes.txt
# file prefix it is given so those not needed need to be hidden. $(call MakeDir, $(GENSRC_X11WRAPPERS_OUTPUTDIR))
$(GENSRC_X11WRAPPERS_TMP)/sizes.%: $(GENSRC_SIZER_DIR)/sizes.% $(call LogInfo, Generating X11 wrapper source files)
$(call MakeDir, $(@D)) $(call ExecuteWithLog, $@, \
$(RM) '$@' $(TOOL_WRAPPERGENERATOR) gen_java $(GENSRC_X11WRAPPERS_OUTPUTDIR) \
$(SORT) $< > $@ $(GENSRC_X11WRAPPERS_DATADIR)/xlibtypes.txt $(GENSRC_X11WRAPPERS_DATA) \
$(OPENJDK_TARGET_CPU_BITS))
# Run the tool on the offset files copied from the source repository to generate several Java classes
# used in awt.
$(SUPPORT_OUTPUTDIR)/gensrc/java.desktop/_the.generated.x11: $(GENSRC_X11_SIZES_USED) $(BUILD_TOOLS_JDK)
$(call MakeDir, $(GENSRC_X11WRAPPERS_DST))
$(TOOL_WRAPPERGENERATOR) $(GENSRC_X11WRAPPERS_DST) $(GENSRC_SIZER_DIR)/xlibtypes.txt "gen" $(GENSRC_X11WRAPPERS_TMP)/sizes
$(TOUCH) $@ $(TOUCH) $@
GENSRC_X11WRAPPERS += $(SUPPORT_OUTPUTDIR)/gensrc/java.desktop/_the.generated.x11
ifneq ($(COMPILE_TYPE), cross) GENSRC_JAVA_DESKTOP += $(GENSRC_X11WRAPPERS_MARKER)
# This is not a cross compile, regenerate the offset file, so that we
# can compare it with the version in the source code repository.
# Generate the C code for the program that will output the offset file.
$(GENSRC_X11WRAPPERS_TMP)/sizer.%.c: $(GENSRC_SIZER_DIR)/xlibtypes.txt $(BUILD_TOOLS_JDK)
$(call LogInfo, Generating X11 wrapper ($*-bit version))
$(call MakeDir, $(@D))
$(TOOL_WRAPPERGENERATOR) $(@D) $(GENSRC_SIZER_DIR)/xlibtypes.txt "sizer" $*
# use -m32/-m64 only if the compiler supports it
ifeq ($(COMPILER_SUPPORTS_TARGET_BITS_FLAG), true)
MEMORY_MODEL_FLAG="$(COMPILER_TARGET_BITS_FLAG)$*"
endif
SIZER_CFLAGS := \
-I$(TOPDIR)/src/hotspot/share/include \
-I$(TOPDIR)/src/hotspot/os/$(HOTSPOT_TARGET_OS_TYPE)/include \
-I$(SUPPORT_OUTPUTDIR)/modules_include/java.base \
-I$(SUPPORT_OUTPUTDIR)/modules_include/java.base/$(OPENJDK_TARGET_OS_INCLUDE_SUBDIR) \
-I$(TOPDIR)/src/java.base/share/native/libjava \
-I$(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjava \
-I$(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/awt \
-I$(TOPDIR)/src/java.desktop/share/native/common/awt/debug \
-I$(TOPDIR)/src/java.desktop/share/native/libawt/awt/image/cvutils \
#
# Compile the C code into an executable.
$(GENSRC_X11WRAPPERS_TMP)/sizer.%.exe: $(GENSRC_X11WRAPPERS_TMP)/sizer.%.c
$(call MakeDir, $(@D))
(cd $(@D) && $(CC) $(MEMORY_MODEL_FLAG) -o $@ $< \
$(X_CFLAGS) \
$(X_LIBS) \
$(SIZER_CFLAGS) -lc)
.PRECIOUS: $(GENSRC_X11WRAPPERS_TMP)/sizer.%.exe $(GENSRC_X11WRAPPERS_TMP)/sizer.%.c
# Run the executable create the offset file and check that it is identical
# to the offset file in the source code repository.
$(GENSRC_X11WRAPPERS_TMP)/sizes.%.verification: $(GENSRC_X11WRAPPERS_TMP)/sizer.%.exe
$(call LogInfo, Verifying X11 wrapper sizes)
$(call MakeDir, $(@D))
$(GENSRC_X11WRAPPERS_TMP)/sizer.$*.exe | $(SORT) > $@.tmp
$(DIFF) $(GENSRC_X11WRAPPERS_TMP)/sizes.$*.verification.tmp $(GENSRC_X11WRAPPERS_TMP)/sizes.$*
mv $@.tmp $@
GENSRC_X11WRAPPERS += $(GENSRC_X11WRAPPERS_TMP)/sizes.$(OPENJDK_TARGET_CPU_BITS).verification
endif
GENSRC_JAVA_DESKTOP += $(GENSRC_X11WRAPPERS)

View File

@ -160,7 +160,9 @@ ifeq ($(call check-jvm-feature, dtrace), true)
> $(DTRACE_SUPPORT_DIR)/$(@F).d)) > $(DTRACE_SUPPORT_DIR)/$(@F).d))
$(call ExecuteWithLog, $@, $(DTRACE) $(DTRACE_FLAGS) -o $@ \ $(call ExecuteWithLog, $@, $(DTRACE) $(DTRACE_FLAGS) -o $@ \
-s $(DTRACE_SUPPORT_DIR)/$(@F).d) -s $(DTRACE_SUPPORT_DIR)/$(@F).d)
$(call ExecuteWithLog, $@.elfedit, $(ELFEDIT) $(call GetElfeditCommands) $@) ifeq ($(OPENJDK_TARGET_CPU_ARCH), sparc)
$(call ExecuteWithLog, $@.elfedit, $(ELFEDIT) $(call GetElfeditCommands) $@)
endif
############################################################################ ############################################################################
# Build the stand-alone dtrace libraries # Build the stand-alone dtrace libraries

View File

@ -82,7 +82,6 @@ $(eval $(call SetupNativeCompilation, BUILD_GTEST_LIBJVM, \
CFLAGS_macosx := -DGTEST_OS_MAC=1, \ CFLAGS_macosx := -DGTEST_OS_MAC=1, \
CFLAGS_aix := -qpic=large, \ CFLAGS_aix := -qpic=large, \
CFLAGS_DEBUG_SYMBOLS := $(JVM_CFLAGS_SYMBOLS), \ CFLAGS_DEBUG_SYMBOLS := $(JVM_CFLAGS_SYMBOLS), \
CXXFLAGS_DEBUG_SYMBOLS := $(JVM_CFLAGS_SYMBOLS), \
DISABLED_WARNINGS_gcc := undef, \ DISABLED_WARNINGS_gcc := undef, \
DISABLED_WARNINGS_clang := undef switch format-nonliteral \ DISABLED_WARNINGS_clang := undef switch format-nonliteral \
tautological-undefined-compare $(BUILD_LIBJVM_DISABLED_WARNINGS_clang), \ tautological-undefined-compare $(BUILD_LIBJVM_DISABLED_WARNINGS_clang), \
@ -116,7 +115,6 @@ $(eval $(call SetupNativeCompilation, BUILD_GTEST_LAUNCHER, \
CFLAGS := $(JVM_CFLAGS) -I$(GTEST_FRAMEWORK_SRC) \ CFLAGS := $(JVM_CFLAGS) -I$(GTEST_FRAMEWORK_SRC) \
-I$(GTEST_FRAMEWORK_SRC)/include, \ -I$(GTEST_FRAMEWORK_SRC)/include, \
CFLAGS_DEBUG_SYMBOLS := $(JVM_CFLAGS_SYMBOLS), \ CFLAGS_DEBUG_SYMBOLS := $(JVM_CFLAGS_SYMBOLS), \
CXXFLAGS_DEBUG_SYMBOLS := $(JVM_CFLAGS_SYMBOLS), \
LDFLAGS := $(LDFLAGS_JDKEXE), \ LDFLAGS := $(LDFLAGS_JDKEXE), \
LDFLAGS_unix := -L$(JVM_OUTPUTDIR)/gtest $(call SET_SHARED_LIBRARY_ORIGIN), \ LDFLAGS_unix := -L$(JVM_OUTPUTDIR)/gtest $(call SET_SHARED_LIBRARY_ORIGIN), \
LDFLAGS_solaris := -library=stlport4, \ LDFLAGS_solaris := -library=stlport4, \

View File

@ -221,7 +221,6 @@ $(eval $(call SetupNativeCompilation, BUILD_LIBJVM, \
EXTRA_OBJECT_FILES := $(DTRACE_EXTRA_OBJECT_FILES), \ EXTRA_OBJECT_FILES := $(DTRACE_EXTRA_OBJECT_FILES), \
CFLAGS := $(JVM_CFLAGS), \ CFLAGS := $(JVM_CFLAGS), \
CFLAGS_DEBUG_SYMBOLS := $(JVM_CFLAGS_SYMBOLS), \ CFLAGS_DEBUG_SYMBOLS := $(JVM_CFLAGS_SYMBOLS), \
CXXFLAGS_DEBUG_SYMBOLS := $(JVM_CFLAGS_SYMBOLS), \
vm_version.cpp_CXXFLAGS := $(CFLAGS_VM_VERSION), \ vm_version.cpp_CXXFLAGS := $(CFLAGS_VM_VERSION), \
arguments.cpp_CXXFLAGS := $(CFLAGS_VM_VERSION), \ arguments.cpp_CXXFLAGS := $(CFLAGS_VM_VERSION), \
DISABLED_WARNINGS_clang := tautological-compare, \ DISABLED_WARNINGS_clang := tautological-compare, \

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -1109,7 +1109,6 @@ public class WrapperGenerator {
} }
public void writeJavaWrapperClass(String outputDir) { public void writeJavaWrapperClass(String outputDir) {
// (new File(outputDir, package_path)).mkdirs();
try { try {
for (Enumeration e = symbolTable.elements() ; e.hasMoreElements() ;) { for (Enumeration e = symbolTable.elements() ; e.hasMoreElements() ;) {
BaseType tp = (BaseType) e.nextElement(); BaseType tp = (BaseType) e.nextElement();
@ -1126,7 +1125,6 @@ public class WrapperGenerator {
} }
} }
public void writeNativeSizer(String file) public void writeNativeSizer(String file)
{ {
int type; int type;
@ -1136,7 +1134,6 @@ public class WrapperGenerator {
StructType stp; StructType stp;
Enumeration eo; Enumeration eo;
try { try {
FileOutputStream fs = new FileOutputStream(file); FileOutputStream fs = new FileOutputStream(file);
@ -1158,7 +1155,6 @@ public class WrapperGenerator {
pw.println(" unsigned long status;\n"); pw.println(" unsigned long status;\n");
pw.println("} PropMwmHints;\n"); pw.println("} PropMwmHints;\n");
pw.println("\n\nint main(){"); pw.println("\n\nint main(){");
j=0; j=0;
for ( eo = symbolTable.elements() ; eo.hasMoreElements() ;) { for ( eo = symbolTable.elements() ; eo.hasMoreElements() ;) {
@ -1182,7 +1178,6 @@ public class WrapperGenerator {
pw.println("printf(\"Atom\t%d\\n\",(int)sizeof(Atom));"); pw.println("printf(\"Atom\t%d\\n\",(int)sizeof(Atom));");
pw.println("printf(\"Window\t%d\\n\",(int)sizeof(Window));"); pw.println("printf(\"Window\t%d\\n\",(int)sizeof(Window));");
for (eo = symbolTable.elements() ; eo.hasMoreElements() ;) { for (eo = symbolTable.elements() ; eo.hasMoreElements() ;) {
@ -1234,7 +1229,8 @@ public class WrapperGenerator {
symbolTable.put("Atom", new AtomicType(AtomicType.TYPE_ATOM, "", "Atom")); symbolTable.put("Atom", new AtomicType(AtomicType.TYPE_ATOM, "", "Atom"));
symbolTable.put("ulong", new AtomicType(AtomicType.TYPE_ULONG, "", "ulong")); symbolTable.put("ulong", new AtomicType(AtomicType.TYPE_ULONG, "", "ulong"));
} }
public WrapperGenerator(String outputDir, String xlibFilename) {
public WrapperGenerator(String xlibFilename) {
initTypes(); initTypes();
try { try {
BufferedReader in = new BufferedReader(new FileReader(xlibFilename)); BufferedReader in = new BufferedReader(new FileReader(xlibFilename));
@ -1303,33 +1299,19 @@ public class WrapperGenerator {
catch (Exception e) { catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
private void makeSizer(String outputDir) {
if (wide) { private void makeSizer(String sizerFileName) {
sizerFileName = "sizer.64.c"; File fp = new File(sizerFileName);
} else {
sizerFileName = "sizer.32.c";
}
File fp = new File(outputDir, sizerFileName);
writeNativeSizer(fp.getAbsolutePath()); writeNativeSizer(fp.getAbsolutePath());
} }
private boolean readSizeInfo(String sizeInfo) {
private boolean readFileSizeInfo(String filename, boolean wide) {
try { try {
File f = new File(sizeInfo+".32");
boolean res = true; boolean res = true;
FileInputStream fis = null; FileInputStream fis = new FileInputStream(filename);
if (f.exists()) { res = readSizeInfo(fis, wide);
fis = new FileInputStream(f); fis.close();
res = readSizeInfo(fis, false);
fis.close();
}
f = new File(sizeInfo+".64");
if (f.exists()) {
fis = new FileInputStream(f);
res &= readSizeInfo(fis, true);
fis.close();
}
return res; return res;
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
@ -1337,8 +1319,8 @@ public class WrapperGenerator {
} }
} }
private void startGeneration(String outputDir, String sizeInfo) { private void startGeneration(String outputDir, String filename, boolean wide) {
if (readSizeInfo(sizeInfo)) if (readFileSizeInfo(filename, wide))
{ {
writeJavaWrapperClass(outputDir); writeJavaWrapperClass(outputDir);
} }
@ -1348,21 +1330,22 @@ public class WrapperGenerator {
} }
public static void main(String[] args) { public static void main(String[] args) {
if (args.length < 4) { if (args.length < 4) {
System.out.println("Usage:\nWrapperGenerator <output_dir> <xlibtypes.txt> <action> [<platform> | <sizes info file>]"); System.out.println("Usage:\nWrapperGenerator gen_java <output_dir> <xlibtypes.txt> <sizes-*.txt> <platform>");
System.out.println("Where <action>: gen, sizer"); System.out.println(" or");
System.out.println(" <platform>: 32, 64"); System.out.println("WrapperGenerator gen_c_source <output_file> <xlibtypes.txt> <platform>");
System.out.println("Where <platform>: 32, 64");
System.exit(1); System.exit(1);
} }
WrapperGenerator xparser = new WrapperGenerator(args[0], args[1]); WrapperGenerator xparser = new WrapperGenerator(args[2]);
if (args[2].equals("sizer")) { if (args[0].equals("gen_c_source")) {
xparser.wide = args[3].equals("64"); xparser.wide = args[3].equals("64");
xparser.makeSizer(args[0]); xparser.makeSizer(args[1]);
} else if (args[2].equals("gen")) { } else if (args[0].equals("gen_java")) {
xparser.startGeneration(args[0], args[3]); boolean wide = args[4].equals("64");
xparser.startGeneration(args[1], args[3], wide);
} }
} }
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -32,7 +32,7 @@ package javax.security.auth;
* *
* <p> The target name is the name of a security configuration parameter * <p> The target name is the name of a security configuration parameter
* (see below). Currently the {@code AuthPermission} object is used to * (see below). Currently the {@code AuthPermission} object is used to
* guard access to the {@link Policy}, {@link Subject}, * guard access to the {@link Subject},
* {@link javax.security.auth.login.LoginContext}, and * {@link javax.security.auth.login.LoginContext}, and
* {@link javax.security.auth.login.Configuration} objects. * {@link javax.security.auth.login.Configuration} objects.
* *
@ -121,21 +121,6 @@ package javax.security.auth;
* {@code LoginContext}. * {@code LoginContext}.
* </pre> * </pre>
* *
* <p> {@code javax.security.auth.Policy} has been
* deprecated in favor of {@code java.security.Policy}.
* Therefore, the following target names have also been deprecated:
*
* <pre>
* getPolicy - allow the caller to retrieve the system-wide
* Subject-based access control policy.
*
* setPolicy - allow the caller to set the system-wide
* Subject-based access control policy.
*
* refreshPolicy - allow the caller to refresh the system-wide
* Subject-based access control policy.
* </pre>
*
* @implNote * @implNote
* Implementations may define additional target names, but should use naming * Implementations may define additional target names, but should use naming
* conventions such as reverse domain name notation to avoid name clashes. * conventions such as reverse domain name notation to avoid name clashes.

View File

@ -1,356 +0,0 @@
/*
* Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package javax.security.auth;
import java.security.Security;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.security.PrivilegedExceptionAction;
import java.util.Objects;
import sun.security.util.Debug;
/**
* <p> This is an abstract class for representing the system policy for
* Subject-based authorization. A subclass implementation
* of this class provides a means to specify a Subject-based
* access control {@code Policy}.
*
* <p> A {@code Policy} object can be queried for the set of
* Permissions granted to code running as a
* {@code Principal} in the following manner:
*
* <pre>
* policy = Policy.getPolicy();
* PermissionCollection perms = policy.getPermissions(subject,
* codeSource);
* </pre>
*
* The {@code Policy} object consults the local policy and returns
* and appropriate {@code Permissions} object with the
* Permissions granted to the Principals associated with the
* provided {@code subject}, and granted to the code specified
* by the provided {@code codeSource}.
*
* <p> A {@code Policy} contains the following information.
* Note that this example only represents the syntax for the default
* {@code Policy} implementation. Subclass implementations of this class
* may implement alternative syntaxes and may retrieve the
* {@code Policy} from any source such as files, databases,
* or servers.
*
* <p> Each entry in the {@code Policy} is represented as
* a <b><i>grant</i></b> entry. Each <b><i>grant</i></b> entry
* specifies a codebase, code signers, and Principals triplet,
* as well as the Permissions granted to that triplet.
*
* <pre>
* grant CodeBase ["URL"], Signedby ["signers"],
* Principal [Principal_Class] "Principal_Name" {
* Permission Permission_Class ["Target_Name"]
* [, "Permission_Actions"]
* [, signedBy "SignerName"];
* };
* </pre>
*
* The CodeBase and Signedby components of the triplet name/value pairs
* are optional. If they are not present, then any codebase will match,
* and any signer (including unsigned code) will match.
* For Example,
*
* <pre>
* grant CodeBase "foo.com", Signedby "foo",
* Principal com.sun.security.auth.UnixPrincipal "duke" {
* permission java.io.FilePermission "/home/duke", "read, write";
* };
* </pre>
*
* This <b><i>grant</i></b> entry specifies that code from "foo.com",
* signed by "foo', and running as a {@code UnixPrincipal} with the
* name, duke, has one {@code Permission}. This {@code Permission}
* permits the executing code to read and write files in the directory,
* "/home/duke".
*
* <p> To "run" as a particular {@code Principal},
* code invokes the {@code Subject.doAs(subject, ...)} method.
* After invoking that method, the code runs as all the Principals
* associated with the specified {@code Subject}.
* Note that this {@code Policy} (and the Permissions
* granted in this {@code Policy}) only become effective
* after the call to {@code Subject.doAs} has occurred.
*
* <p> Multiple Principals may be listed within one <b><i>grant</i></b> entry.
* All the Principals in the grant entry must be associated with
* the {@code Subject} provided to {@code Subject.doAs}
* for that {@code Subject} to be granted the specified Permissions.
*
* <pre>
* grant Principal com.sun.security.auth.UnixPrincipal "duke",
* Principal com.sun.security.auth.UnixNumericUserPrincipal "0" {
* permission java.io.FilePermission "/home/duke", "read, write";
* permission java.net.SocketPermission "duke.com", "connect";
* };
* </pre>
*
* This entry grants any code running as both "duke" and "0"
* permission to read and write files in duke's home directory,
* as well as permission to make socket connections to "duke.com".
*
* <p> Note that non Principal-based grant entries are not permitted
* in this {@code Policy}. Therefore, grant entries such as:
*
* <pre>
* grant CodeBase "foo.com", Signedby "foo" {
* permission java.io.FilePermission "/tmp/scratch", "read, write";
* };
* </pre>
*
* are rejected. Such permission must be listed in the
* {@code java.security.Policy}.
*
* <p> The default {@code Policy} implementation can be changed by
* setting the value of the {@code auth.policy.provider} security property to
* the fully qualified name of the desired {@code Policy} implementation class.
*
* @deprecated Replaced by java.security.Policy.
* java.security.Policy has a method:
* <pre>
* public PermissionCollection getPermissions
* (java.security.ProtectionDomain pd)
*
* </pre>
* and ProtectionDomain has a constructor:
* <pre>
* public ProtectionDomain
* (CodeSource cs,
* PermissionCollection permissions,
* ClassLoader loader,
* Principal[] principals)
* </pre>
*
* These two APIs provide callers the means to query the
* Policy for Principal-based Permission entries.
* This class is subject to removal in a future version of Java SE.
*
* @since 1.4
* @see java.security.Security security properties
*/
@Deprecated(since="1.4", forRemoval=true)
public abstract class Policy {
private static Policy policy;
private static final String AUTH_POLICY =
"sun.security.provider.AuthPolicyFile";
private final java.security.AccessControlContext acc =
java.security.AccessController.getContext();
// true if a custom (not AUTH_POLICY) system-wide policy object is set
private static boolean isCustomPolicy;
/**
* Sole constructor. (For invocation by subclass constructors, typically
* implicit.)
*/
protected Policy() { }
/**
* Returns the installed Policy object.
* This method first calls
* {@code SecurityManager.checkPermission} with the
* {@code AuthPermission("getPolicy")} permission
* to ensure the caller has permission to get the Policy object.
*
* @return the installed Policy. The return value cannot be
* {@code null}.
*
* @exception java.lang.SecurityException if the current thread does not
* have permission to get the Policy object.
*
* @see #setPolicy
*/
public static Policy getPolicy() {
java.lang.SecurityManager sm = System.getSecurityManager();
if (sm != null) sm.checkPermission(new AuthPermission("getPolicy"));
return getPolicyNoCheck();
}
/**
* Returns the installed Policy object, skipping the security check.
*
* @return the installed Policy.
*
*/
static Policy getPolicyNoCheck() {
if (policy == null) {
synchronized(Policy.class) {
if (policy == null) {
String policy_class = null;
policy_class = AccessController.doPrivileged
(new PrivilegedAction<String>() {
public String run() {
return java.security.Security.getProperty
("auth.policy.provider");
}
});
if (policy_class == null) {
policy_class = AUTH_POLICY;
}
try {
final String finalClass = policy_class;
Policy untrustedImpl = AccessController.doPrivileged(
new PrivilegedExceptionAction<Policy>() {
public Policy run() throws ClassNotFoundException,
InstantiationException,
IllegalAccessException {
Class<? extends Policy> implClass = Class.forName(
finalClass, false,
Thread.currentThread().getContextClassLoader()
).asSubclass(Policy.class);
return implClass.newInstance();
}
});
AccessController.doPrivileged(
new PrivilegedExceptionAction<Void>() {
public Void run() {
setPolicy(untrustedImpl);
isCustomPolicy = !finalClass.equals(AUTH_POLICY);
return null;
}
}, Objects.requireNonNull(untrustedImpl.acc)
);
} catch (Exception e) {
throw new SecurityException
(sun.security.util.ResourcesMgr.getString
("unable.to.instantiate.Subject.based.policy"));
}
}
}
}
return policy;
}
/**
* Sets the system-wide Policy object. This method first calls
* {@code SecurityManager.checkPermission} with the
* {@code AuthPermission("setPolicy")}
* permission to ensure the caller has permission to set the Policy.
*
* @param policy the new system Policy object.
*
* @exception java.lang.SecurityException if the current thread does not
* have permission to set the Policy.
*
* @see #getPolicy
*/
public static void setPolicy(Policy policy) {
java.lang.SecurityManager sm = System.getSecurityManager();
if (sm != null) sm.checkPermission(new AuthPermission("setPolicy"));
Policy.policy = policy;
// all non-null policy objects are assumed to be custom
isCustomPolicy = policy != null ? true : false;
}
/**
* Returns true if a custom (not AUTH_POLICY) system-wide policy object
* has been set or installed. This method is called by
* SubjectDomainCombiner to provide backwards compatibility for
* developers that provide their own javax.security.auth.Policy
* implementations.
*
* @return true if a custom (not AUTH_POLICY) system-wide policy object
* has been set; false otherwise
*/
static boolean isCustomPolicySet(Debug debug) {
if (policy != null) {
if (debug != null && isCustomPolicy) {
debug.println("Providing backwards compatibility for " +
"javax.security.auth.policy implementation: " +
policy.toString());
}
return isCustomPolicy;
}
// check if custom policy has been set using auth.policy.provider prop
String policyClass = java.security.AccessController.doPrivileged
(new java.security.PrivilegedAction<String>() {
public String run() {
return Security.getProperty("auth.policy.provider");
}
});
if (policyClass != null && !policyClass.equals(AUTH_POLICY)) {
if (debug != null) {
debug.println("Providing backwards compatibility for " +
"javax.security.auth.policy implementation: " +
policyClass);
}
return true;
}
return false;
}
/**
* Retrieve the Permissions granted to the Principals associated with
* the specified {@code CodeSource}.
*
* @param subject the {@code Subject}
* whose associated Principals,
* in conjunction with the provided
* {@code CodeSource}, determines the Permissions
* returned by this method. This parameter
* may be {@code null}.
*
* @param cs the code specified by its {@code CodeSource}
* that determines, in conjunction with the provided
* {@code Subject}, the Permissions
* returned by this method. This parameter may be
* {@code null}.
*
* @return the Collection of Permissions granted to all the
* {@code Subject} and code specified in
* the provided <i>subject</i> and <i>cs</i>
* parameters.
*/
public abstract java.security.PermissionCollection getPermissions
(Subject subject,
java.security.CodeSource cs);
/**
* Refresh and reload the Policy.
*
* <p>This method causes this object to refresh/reload its current
* Policy. This is implementation-dependent.
* For example, if the Policy object is stored in
* a file, calling {@code refresh} will cause the file to be re-read.
*
* @exception SecurityException if the caller does not have permission
* to refresh the Policy.
*/
public abstract void refresh();
}

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -26,13 +26,9 @@
package javax.security.auth; package javax.security.auth;
import java.security.AccessController; import java.security.AccessController;
import java.security.Permission;
import java.security.Permissions;
import java.security.PermissionCollection;
import java.security.Principal; import java.security.Principal;
import java.security.PrivilegedAction; import java.security.PrivilegedAction;
import java.security.ProtectionDomain; import java.security.ProtectionDomain;
import java.security.Security;
import java.util.Set; import java.util.Set;
import java.util.WeakHashMap; import java.util.WeakHashMap;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
@ -56,15 +52,6 @@ public class SubjectDomainCombiner implements java.security.DomainCombiner {
sun.security.util.Debug.getInstance("combiner", sun.security.util.Debug.getInstance("combiner",
"\t[SubjectDomainCombiner]"); "\t[SubjectDomainCombiner]");
@SuppressWarnings({"deprecation", "removal"})
// Note: check only at classloading time, not dynamically during combine()
private static final boolean useJavaxPolicy =
javax.security.auth.Policy.isCustomPolicySet(debug);
// Relevant only when useJavaxPolicy is true
private static final boolean allowCaching =
(useJavaxPolicy && cachePolicy());
/** /**
* Associate the provided {@code Subject} with this * Associate the provided {@code Subject} with this
* {@code SubjectDomainCombiner}. * {@code SubjectDomainCombiner}.
@ -196,12 +183,6 @@ public class SubjectDomainCombiner implements java.security.DomainCombiner {
return null; return null;
} }
// maintain backwards compatibility for developers who provide
// their own custom javax.security.auth.Policy implementations
if (useJavaxPolicy) {
return combineJavaxPolicy(currentDomains, assignedDomains);
}
int cLen = (currentDomains == null ? 0 : currentDomains.length); int cLen = (currentDomains == null ? 0 : currentDomains.length);
int aLen = (assignedDomains == null ? 0 : assignedDomains.length); int aLen = (assignedDomains == null ? 0 : assignedDomains.length);
@ -292,151 +273,6 @@ public class SubjectDomainCombiner implements java.security.DomainCombiner {
} }
} }
/**
* Use the javax.security.auth.Policy implementation
*/
private ProtectionDomain[] combineJavaxPolicy(
ProtectionDomain[] currentDomains,
ProtectionDomain[] assignedDomains) {
if (!allowCaching) {
java.security.AccessController.doPrivileged
(new PrivilegedAction<Void>() {
@SuppressWarnings({"deprecation", "removal"})
public Void run() {
// Call refresh only caching is disallowed
javax.security.auth.Policy.getPolicy().refresh();
return null;
}
});
}
int cLen = (currentDomains == null ? 0 : currentDomains.length);
int aLen = (assignedDomains == null ? 0 : assignedDomains.length);
// the ProtectionDomains for the new AccessControlContext
// that we will return
ProtectionDomain[] newDomains = new ProtectionDomain[cLen + aLen];
synchronized(cachedPDs) {
if (!subject.isReadOnly() &&
!subject.getPrincipals().equals(principalSet)) {
// if the Subject was mutated, clear the PD cache
Set<Principal> newSet = subject.getPrincipals();
synchronized(newSet) {
principalSet = new java.util.HashSet<Principal>(newSet);
}
principals = principalSet.toArray
(new Principal[principalSet.size()]);
cachedPDs.clear();
if (debug != null) {
debug.println("Subject mutated - clearing cache");
}
}
for (int i = 0; i < cLen; i++) {
ProtectionDomain pd = currentDomains[i];
ProtectionDomain subjectPd = cachedPDs.getValue(pd);
if (subjectPd == null) {
if (pd.staticPermissionsOnly()) {
// keep static ProtectionDomain objects static
subjectPd = pd;
} else {
// XXX
// we must first add the original permissions.
// that way when we later add the new JAAS permissions,
// any unresolved JAAS-related permissions will
// automatically get resolved.
// get the original perms
Permissions perms = new Permissions();
PermissionCollection coll = pd.getPermissions();
java.util.Enumeration<Permission> e;
if (coll != null) {
synchronized (coll) {
e = coll.elements();
while (e.hasMoreElements()) {
Permission newPerm =
e.nextElement();
perms.add(newPerm);
}
}
}
// get perms from the policy
final java.security.CodeSource finalCs = pd.getCodeSource();
final Subject finalS = subject;
PermissionCollection newPerms =
java.security.AccessController.doPrivileged
(new PrivilegedAction<PermissionCollection>() {
@SuppressWarnings({"deprecation", "removal"})
public PermissionCollection run() {
return
javax.security.auth.Policy.getPolicy().getPermissions
(finalS, finalCs);
}
});
// add the newly granted perms,
// avoiding duplicates
synchronized (newPerms) {
e = newPerms.elements();
while (e.hasMoreElements()) {
Permission newPerm = e.nextElement();
if (!perms.implies(newPerm)) {
perms.add(newPerm);
if (debug != null)
debug.println (
"Adding perm " + newPerm + "\n");
}
}
}
subjectPd = new ProtectionDomain
(finalCs, perms, pd.getClassLoader(), principals);
}
if (allowCaching)
cachedPDs.putValue(pd, subjectPd);
}
newDomains[i] = subjectPd;
}
}
if (debug != null) {
debug.println("updated current: ");
for (int i = 0; i < cLen; i++) {
debug.println("\tupdated[" + i + "] = " + newDomains[i]);
}
}
// now add on the assigned domains
if (aLen > 0) {
System.arraycopy(assignedDomains, 0, newDomains, cLen, aLen);
}
if (debug != null) {
if (newDomains == null || newDomains.length == 0) {
debug.println("returning null");
} else {
debug.println("combinedDomains: ");
for (int i = 0; i < newDomains.length; i++) {
debug.println("newDomain " + i + ": " +
newDomains[i].toString());
}
}
}
// return the new ProtectionDomains
if (newDomains == null || newDomains.length == 0) {
return null;
} else {
return newDomains;
}
}
private static ProtectionDomain[] optimize(ProtectionDomain[] domains) { private static ProtectionDomain[] optimize(ProtectionDomain[] domains) {
if (domains == null || domains.length == 0) if (domains == null || domains.length == 0)
return null; return null;
@ -476,21 +312,6 @@ public class SubjectDomainCombiner implements java.security.DomainCombiner {
return ((num == 0 || optimized.length == 0) ? null : optimized); return ((num == 0 || optimized.length == 0) ? null : optimized);
} }
private static boolean cachePolicy() {
String s = AccessController.doPrivileged
(new PrivilegedAction<String>() {
public String run() {
return Security.getProperty("cache.auth.policy");
}
});
if (s != null) {
return Boolean.parseBoolean(s);
}
// cache by default
return true;
}
private static void printInputDomains(ProtectionDomain[] currentDomains, private static void printInputDomains(ProtectionDomain[] currentDomains,
ProtectionDomain[] assignedDomains) { ProtectionDomain[] assignedDomains) {
if (currentDomains == null || currentDomains.length == 0) { if (currentDomains == null || currentDomains.length == 0) {

View File

@ -57,9 +57,6 @@ public class MimeTable implements FileNameMap {
"/etc/mailcap", "/etc/mailcap",
"/usr/etc/mailcap", "/usr/etc/mailcap",
"/usr/local/etc/mailcap", "/usr/local/etc/mailcap",
System.getProperty("hotjava.home",
"/usr/local/hotjava")
+ "/lib/mailcap",
}; };
return null; return null;
} }

View File

@ -63,8 +63,6 @@ public interface SelChImpl extends Channel {
void translateAndSetInterestOps(int ops, SelectionKeyImpl sk); void translateAndSetInterestOps(int ops, SelectionKeyImpl sk);
int validOps();
void kill() throws IOException; void kill() throws IOException;
} }

View File

@ -96,7 +96,7 @@ class SocketChannelImpl
private static final int ST_CLOSING = 3; private static final int ST_CLOSING = 3;
private static final int ST_KILLPENDING = 4; private static final int ST_KILLPENDING = 4;
private static final int ST_KILLED = 5; private static final int ST_KILLED = 5;
private int state; private volatile int state; // need stateLock to change
// IDs of native threads doing reads and writes, for signalling // IDs of native threads doing reads and writes, for signalling
private long readerThread; private long readerThread;
@ -148,12 +148,37 @@ class SocketChannelImpl
} }
} }
// @throws ClosedChannelException if channel is closed /**
* Checks that the channel is open.
*
* @throws ClosedChannelException if channel is closed (or closing)
*/
private void ensureOpen() throws ClosedChannelException { private void ensureOpen() throws ClosedChannelException {
if (!isOpen()) if (!isOpen())
throw new ClosedChannelException(); throw new ClosedChannelException();
} }
/**
* Checks that the channel is open and connected.
*
* @apiNote This method uses the "state" field to check if the channel is
* open. It should never be used in conjuncion with isOpen or ensureOpen
* as these methods check AbstractInterruptibleChannel's closed field - that
* field is set before implCloseSelectableChannel is called and so before
* the state is changed.
*
* @throws ClosedChannelException if channel is closed (or closing)
* @throws NotYetConnectedException if open and not connected
*/
private void ensureOpenAndConnected() throws ClosedChannelException {
int state = this.state;
if (state < ST_CONNECTED) {
throw new NotYetConnectedException();
} else if (state > ST_CONNECTED) {
throw new ClosedChannelException();
}
}
@Override @Override
public Socket socket() { public Socket socket() {
synchronized (stateLock) { synchronized (stateLock) {
@ -275,13 +300,14 @@ class SocketChannelImpl
if (blocking) { if (blocking) {
// set hook for Thread.interrupt // set hook for Thread.interrupt
begin(); begin();
}
synchronized (stateLock) { synchronized (stateLock) {
ensureOpen(); ensureOpenAndConnected();
if (state != ST_CONNECTED) // record thread so it can be signalled if needed
throw new NotYetConnectedException();
if (blocking)
readerThread = NativeThread.current(); readerThread = NativeThread.current();
}
} else {
ensureOpenAndConnected();
} }
} }
@ -385,15 +411,16 @@ class SocketChannelImpl
if (blocking) { if (blocking) {
// set hook for Thread.interrupt // set hook for Thread.interrupt
begin(); begin();
}
synchronized (stateLock) { synchronized (stateLock) {
ensureOpen(); ensureOpenAndConnected();
if (isOutputClosed) if (isOutputClosed)
throw new ClosedChannelException(); throw new ClosedChannelException();
if (state != ST_CONNECTED) // record thread so it can be signalled if needed
throw new NotYetConnectedException();
if (blocking)
writerThread = NativeThread.current(); writerThread = NativeThread.current();
}
} else {
ensureOpenAndConnected();
} }
} }
@ -574,38 +601,48 @@ class SocketChannelImpl
@Override @Override
public boolean isConnected() { public boolean isConnected() {
synchronized (stateLock) { return (state == ST_CONNECTED);
return (state == ST_CONNECTED);
}
} }
@Override @Override
public boolean isConnectionPending() { public boolean isConnectionPending() {
synchronized (stateLock) { return (state == ST_CONNECTIONPENDING);
return (state == ST_CONNECTIONPENDING);
}
} }
/** /**
* Marks the beginning of a connect operation that might block. * Marks the beginning of a connect operation that might block.
* * @param blocking true if configured blocking
* @param isa the remote address
* @throws ClosedChannelException if the channel is closed * @throws ClosedChannelException if the channel is closed
* @throws AlreadyConnectedException if already connected * @throws AlreadyConnectedException if already connected
* @throws ConnectionPendingException is a connection is pending * @throws ConnectionPendingException is a connection is pending
* @throws IOException if the pre-connect hook fails
*/ */
private void beginConnect(boolean blocking) throws ClosedChannelException { private void beginConnect(boolean blocking, InetSocketAddress isa)
throws IOException
{
if (blocking) { if (blocking) {
// set hook for Thread.interrupt // set hook for Thread.interrupt
begin(); begin();
} }
synchronized (stateLock) { synchronized (stateLock) {
ensureOpen(); ensureOpen();
int state = this.state;
if (state == ST_CONNECTED) if (state == ST_CONNECTED)
throw new AlreadyConnectedException(); throw new AlreadyConnectedException();
if (state == ST_CONNECTIONPENDING) if (state == ST_CONNECTIONPENDING)
throw new ConnectionPendingException(); throw new ConnectionPendingException();
if (blocking) assert state == ST_UNCONNECTED;
this.state = ST_CONNECTIONPENDING;
if (localAddress == null)
NetHooks.beforeTcpConnect(fd, isa.getAddress(), isa.getPort());
remoteAddress = isa;
if (blocking) {
// record thread so it can be signalled if needed
readerThread = NativeThread.current(); readerThread = NativeThread.current();
}
} }
} }
@ -614,11 +651,21 @@ class SocketChannelImpl
* *
* @throws AsynchronousCloseException if the channel was closed due to this * @throws AsynchronousCloseException if the channel was closed due to this
* thread being interrupted on a blocking connect operation. * thread being interrupted on a blocking connect operation.
* @throws IOException if completed and unable to obtain the local address
*/ */
private void endConnect(boolean blocking, boolean completed) private void endConnect(boolean blocking, boolean completed)
throws AsynchronousCloseException throws IOException
{ {
endRead(blocking, completed); endRead(blocking, completed);
if (completed) {
synchronized (stateLock) {
if (state == ST_CONNECTIONPENDING) {
localAddress = Net.localAddress(fd);
state = ST_CONNECTED;
}
}
}
} }
@Override @Override
@ -628,64 +675,37 @@ class SocketChannelImpl
if (sm != null) if (sm != null)
sm.checkConnect(isa.getAddress().getHostAddress(), isa.getPort()); sm.checkConnect(isa.getAddress().getHostAddress(), isa.getPort());
readLock.lock(); InetAddress ia = isa.getAddress();
if (ia.isAnyLocalAddress())
ia = InetAddress.getLocalHost();
try { try {
writeLock.lock(); readLock.lock();
try { try {
// notify before-connect hook writeLock.lock();
synchronized (stateLock) {
if (state == ST_UNCONNECTED && localAddress == null) {
NetHooks.beforeTcpConnect(fd, isa.getAddress(), isa.getPort());
}
}
InetAddress ia = isa.getAddress();
if (ia.isAnyLocalAddress())
ia = InetAddress.getLocalHost();
int n = 0;
boolean blocking = isBlocking();
try { try {
int n = 0;
boolean blocking = isBlocking();
try { try {
beginConnect(blocking); beginConnect(blocking, isa);
if (blocking) { do {
do {
n = Net.connect(fd, ia, isa.getPort());
} while (n == IOStatus.INTERRUPTED && isOpen());
} else {
n = Net.connect(fd, ia, isa.getPort()); n = Net.connect(fd, ia, isa.getPort());
} } while (n == IOStatus.INTERRUPTED && isOpen());
} finally { } finally {
endConnect(blocking, n > 0); endConnect(blocking, (n > 0));
}
} catch (IOException x) {
// connect failed, close socket
close();
throw x;
}
// connection may be established
synchronized (stateLock) {
if (!isOpen())
throw new AsynchronousCloseException();
remoteAddress = isa;
if (n > 0) {
// connected established
localAddress = Net.localAddress(fd);
state = ST_CONNECTED;
return true;
} else {
// connection pending
assert !blocking;
state = ST_CONNECTIONPENDING;
return false;
} }
assert IOStatus.check(n);
return n > 0;
} finally {
writeLock.unlock();
} }
} finally { } finally {
writeLock.unlock(); readLock.unlock();
} }
} finally { } catch (IOException ioe) {
readLock.unlock(); // connect failed, close the channel
close();
throw ioe;
} }
} }
@ -704,8 +724,10 @@ class SocketChannelImpl
ensureOpen(); ensureOpen();
if (state != ST_CONNECTIONPENDING) if (state != ST_CONNECTIONPENDING)
throw new NoConnectionPendingException(); throw new NoConnectionPendingException();
if (blocking) if (blocking) {
// record thread so it can be signalled if needed
readerThread = NativeThread.current(); readerThread = NativeThread.current();
}
} }
} }
@ -714,65 +736,62 @@ class SocketChannelImpl
* *
* @throws AsynchronousCloseException if the channel was closed due to this * @throws AsynchronousCloseException if the channel was closed due to this
* thread being interrupted on a blocking connect operation. * thread being interrupted on a blocking connect operation.
* @throws IOException if completed and unable to obtain the local address
*/ */
private void endFinishConnect(boolean blocking, boolean completed) private void endFinishConnect(boolean blocking, boolean completed)
throws AsynchronousCloseException throws IOException
{ {
endRead(blocking, completed); endRead(blocking, completed);
if (completed) {
synchronized (stateLock) {
if (state == ST_CONNECTIONPENDING) {
localAddress = Net.localAddress(fd);
state = ST_CONNECTED;
}
}
}
} }
@Override @Override
public boolean finishConnect() throws IOException { public boolean finishConnect() throws IOException {
readLock.lock();
try { try {
writeLock.lock(); readLock.lock();
try { try {
// already connected? writeLock.lock();
synchronized (stateLock) {
if (state == ST_CONNECTED)
return true;
}
int n = 0;
boolean blocking = isBlocking();
try { try {
// no-op if already connected
if (isConnected())
return true;
boolean blocking = isBlocking();
boolean connected = false;
try { try {
beginFinishConnect(blocking); beginFinishConnect(blocking);
int n = 0;
if (blocking) { if (blocking) {
do { do {
n = checkConnect(fd, true); n = checkConnect(fd, true);
} while (n == 0 || (n == IOStatus.INTERRUPTED) && isOpen()); } while ((n == 0 || n == IOStatus.INTERRUPTED) && isOpen());
} else { } else {
n = checkConnect(fd, false); n = checkConnect(fd, false);
} }
connected = (n > 0);
} finally { } finally {
endFinishConnect(blocking, n > 0); endFinishConnect(blocking, connected);
}
} catch (IOException x) {
close();
throw x;
}
// post finishConnect, connection may be established
synchronized (stateLock) {
if (!isOpen())
throw new AsynchronousCloseException();
if (n > 0) {
// connection established
localAddress = Net.localAddress(fd);
state = ST_CONNECTED;
return true;
} else {
// connection still pending
assert !blocking;
return false;
} }
assert (blocking && connected) ^ !blocking;
return connected;
} finally {
writeLock.unlock();
} }
} finally { } finally {
writeLock.unlock(); readLock.unlock();
} }
} finally { } catch (IOException ioe) {
readLock.unlock(); // connect failed, close the channel
close();
throw ioe;
} }
} }
@ -994,20 +1013,17 @@ class SocketChannelImpl
return (newOps & ~oldOps) != 0; return (newOps & ~oldOps) != 0;
} }
boolean connected = isConnected();
if (((ops & Net.POLLIN) != 0) && if (((ops & Net.POLLIN) != 0) &&
((intOps & SelectionKey.OP_READ) != 0) && ((intOps & SelectionKey.OP_READ) != 0) && connected)
(state == ST_CONNECTED))
newOps |= SelectionKey.OP_READ; newOps |= SelectionKey.OP_READ;
if (((ops & Net.POLLCONN) != 0) && if (((ops & Net.POLLCONN) != 0) &&
((intOps & SelectionKey.OP_CONNECT) != 0) && ((intOps & SelectionKey.OP_CONNECT) != 0) && isConnectionPending())
((state == ST_UNCONNECTED) || (state == ST_CONNECTIONPENDING))) {
newOps |= SelectionKey.OP_CONNECT; newOps |= SelectionKey.OP_CONNECT;
}
if (((ops & Net.POLLOUT) != 0) && if (((ops & Net.POLLOUT) != 0) &&
((intOps & SelectionKey.OP_WRITE) != 0) && ((intOps & SelectionKey.OP_WRITE) != 0) && connected)
(state == ST_CONNECTED))
newOps |= SelectionKey.OP_WRITE; newOps |= SelectionKey.OP_WRITE;
sk.nioReadyOps(newOps); sk.nioReadyOps(newOps);

View File

@ -51,13 +51,6 @@ import sun.net.www.ParseUtil;
* This class represents a default Policy implementation for the * This class represents a default Policy implementation for the
* "JavaPolicy" type. * "JavaPolicy" type.
* *
* Note:
* For backward compatibility with JAAS 1.0 it loads
* both java.auth.policy and java.policy. However, it
* is recommended that java.auth.policy not be used
* and that java.policy contain all grant entries including
* those that contain principal-based entries.
*
* <p> This object stores the policy for the entire Java runtime, * <p> This object stores the policy for the entire Java runtime,
* and is the amalgamation of multiple static policy * and is the amalgamation of multiple static policy
* configurations that resides in files. * configurations that resides in files.
@ -75,17 +68,13 @@ import sun.net.www.ParseUtil;
* are needed in order for the runtime to operate correctly. * are needed in order for the runtime to operate correctly.
* <li> * <li>
* Loop through the <code>java.security.Security</code> properties, * Loop through the <code>java.security.Security</code> properties,
* <i>policy.url.1</i>, <i>policy.url.2</i>, ..., * and <i>policy.url.1</i>, <i>policy.url.2</i>, ...,
* <i>policy.url.X</i>" and * <i>policy.url.X</i>". These properties are set
* <i>auth.policy.url.1</i>, <i>auth.policy.url.2</i>, ...,
* <i>auth.policy.url.X</i>". These properties are set
* in the Java security properties file, which is located in the file named * in the Java security properties file, which is located in the file named
* &lt;JAVA_HOME&gt;/conf/security/java.security. * &lt;JAVA_HOME&gt;/conf/security/java.security.
* Each property value specifies a <code>URL</code> pointing to a * Each property value specifies a <code>URL</code> pointing to a
* policy file to be loaded. Read in and load each policy. * policy file to be loaded. Read in and load each policy.
* *
* <i>auth.policy.url</i> is supported only for backward compatibility.
*
* If none of these could be loaded, use a builtin static policy * If none of these could be loaded, use a builtin static policy
* equivalent to the conf/security/java.policy file. * equivalent to the conf/security/java.policy file.
* *
@ -98,21 +87,7 @@ import sun.net.www.ParseUtil;
* <i>policy.allowSystemProperty</i> is set to <i>true</i>), * <i>policy.allowSystemProperty</i> is set to <i>true</i>),
* also load that policy. * also load that policy.
* *
* <li> * If the <i>java.security.policy</i> property is defined using
* The <code>java.lang.System</code> property
* <i>java.security.auth.policy</i> may also be set to a
* <code>URL</code> pointing to another policy file
* (which is the case when a user uses the -D switch at runtime).
* If this property is defined, and its use is allowed by the
* security property file (the Security property,
* <i>policy.allowSystemProperty</i> is set to <i>true</i>),
* also load that policy.
*
* <i>java.security.auth.policy</i> is supported only for backward
* compatibility.
*
* If the <i>java.security.policy</i> or
* <i>java.security.auth.policy</i> property is defined using
* "==" (rather than "="), then load the specified policy file and ignore * "==" (rather than "="), then load the specified policy file and ignore
* all other configured policies. Note, that the default.policy file is * all other configured policies. Note, that the default.policy file is
* also loaded, as specified in the first step of the algorithm above. * also loaded, as specified in the first step of the algorithm above.
@ -269,8 +244,6 @@ public class PolicyFile extends java.security.Policy {
"javax.security.auth.x500.X500Principal"; "javax.security.auth.x500.X500Principal";
private static final String POLICY = "java.security.policy"; private static final String POLICY = "java.security.policy";
private static final String POLICY_URL = "policy.url."; private static final String POLICY_URL = "policy.url.";
private static final String AUTH_POLICY = "java.security.auth.policy";
private static final String AUTH_POLICY_URL = "auth.policy.url.";
private static final int DEFAULT_CACHE_SIZE = 1; private static final int DEFAULT_CACHE_SIZE = 1;
@ -411,14 +384,6 @@ public class PolicyFile extends java.security.Policy {
/** /**
* Caller did not specify URL via Policy.getInstance. * Caller did not specify URL via Policy.getInstance.
* Read from URLs listed in the java.security properties file. * Read from URLs listed in the java.security properties file.
*
* We call initPolicyFile with POLICY, POLICY_URL and then
* call it with AUTH_POLICY and AUTH_POLICY_URL.
* So first we will process the JAVA standard policy
* and then process the JAVA AUTH Policy.
* This is for backward compatibility as well as to handle
* cases where the user has a single unified policyfile
* with both java policy entries and auth entries
*/ */
boolean loaded_one = initPolicyFile(POLICY, POLICY_URL, newInfo); boolean loaded_one = initPolicyFile(POLICY, POLICY_URL, newInfo);
@ -428,8 +393,6 @@ public class PolicyFile extends java.security.Policy {
// use static policy if all else fails // use static policy if all else fails
initStaticPolicy(newInfo); initStaticPolicy(newInfo);
} }
initPolicyFile(AUTH_POLICY, AUTH_POLICY_URL, newInfo);
} }
} }

View File

@ -150,11 +150,6 @@ public class Resources extends java.util.ListResourceBundle {
// sun.security.pkcs11.SunPKCS11 // sun.security.pkcs11.SunPKCS11
{"PKCS11.Token.providerName.Password.", {"PKCS11.Token.providerName.Password.",
"PKCS11 Token [{0}] Password: "}, "PKCS11 Token [{0}] Password: "},
/* --- DEPRECATED --- */
// javax.security.auth.Policy
{"unable.to.instantiate.Subject.based.policy",
"unable to instantiate Subject-based policy"}
}; };

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -293,8 +293,7 @@ Java_sun_nio_ch_Net_connect0(JNIEnv *env, jclass clazz, jboolean preferIPv6,
int sa_len = 0; int sa_len = 0;
int rv; int rv;
if (NET_InetAddressToSockaddr(env, iao, port, &sa, &sa_len, if (NET_InetAddressToSockaddr(env, iao, port, &sa, &sa_len, preferIPv6) != 0) {
preferIPv6) != 0) {
return IOS_THROWN; return IOS_THROWN;
} }
@ -761,11 +760,11 @@ handleSocketError(JNIEnv *env, jint errorValue)
break; break;
#endif #endif
case ECONNREFUSED: case ECONNREFUSED:
xn = JNU_JAVANETPKG "ConnectException";
break;
case ETIMEDOUT: case ETIMEDOUT:
case ENOTCONN:
xn = JNU_JAVANETPKG "ConnectException"; xn = JNU_JAVANETPKG "ConnectException";
break; break;
case EHOSTUNREACH: case EHOSTUNREACH:
xn = JNU_JAVANETPKG "NoRouteToHostException"; xn = JNU_JAVANETPKG "NoRouteToHostException";
break; break;

View File

@ -59,23 +59,29 @@ Java_sun_nio_ch_SocketChannelImpl_checkConnect(JNIEnv *env, jobject this,
poller.events = POLLOUT; poller.events = POLLOUT;
poller.revents = 0; poller.revents = 0;
result = poll(&poller, 1, block ? -1 : 0); result = poll(&poller, 1, block ? -1 : 0);
if (result < 0) { if (result < 0) {
JNU_ThrowIOExceptionWithLastError(env, "Poll failed"); if (errno == EINTR) {
return IOS_THROWN; return IOS_INTERRUPTED;
} else {
JNU_ThrowIOExceptionWithLastError(env, "poll failed");
return IOS_THROWN;
}
} }
if (!block && (result == 0)) if (!block && (result == 0))
return IOS_UNAVAILABLE; return IOS_UNAVAILABLE;
if (poller.revents) { if (result > 0) {
errno = 0; errno = 0;
result = getsockopt(fd, SOL_SOCKET, SO_ERROR, &error, &n); result = getsockopt(fd, SOL_SOCKET, SO_ERROR, &error, &n);
if (result < 0) { if (result < 0) {
handleSocketError(env, errno); return handleSocketError(env, errno);
return JNI_FALSE;
} else if (error) { } else if (error) {
handleSocketError(env, error); return handleSocketError(env, error);
return JNI_FALSE; } else if ((poller.revents & POLLHUP) != 0) {
return handleSocketError(env, ENOTCONN);
} }
// connected
return 1; return 1;
} }
return 0; return 0;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -39,14 +39,15 @@ int getAddrsFromAdapter(IP_ADAPTER_ADDRESSES *ptr, netaddr **netaddrPP);
#ifdef DEBUG #ifdef DEBUG
void printnif (netif *nif) { void printnif (netif *nif) {
#ifdef _WIN64 #ifdef _WIN64
printf ("nif:0x%I64x name:%s\n", nif,nif->name); printf ("nif:0x%I64x name:%s\n", (UINT_PTR)nif, nif->name);
#else #else
printf ("nif:0x%x name:%s\n", nif,nif->name); printf ("nif:0x%x name:%s\n", nif, nif->name);
#endif #endif
if (nif->dNameIsUnicode) { if (nif->dNameIsUnicode) {
printf ("dName:%S index:%d ", nif->displayName,nif->index); printf ("dName:%S index:%d ", (unsigned short *)nif->displayName,
nif->index);
} else { } else {
printf ("dName:%s index:%d ", nif->displayName,nif->index); printf ("dName:%s index:%d ", nif->displayName, nif->index);
} }
printf ("naddrs:%d\n", nif->naddrs); printf ("naddrs:%d\n", nif->naddrs);
} }

View File

@ -58,9 +58,7 @@ Java_sun_nio_ch_SocketChannelImpl_checkConnect(JNIEnv *env, jobject this,
jobject fdo, jboolean block) jobject fdo, jboolean block)
{ {
int optError = 0; int optError = 0;
int lastError = 0; int result;
int result = 0;
int retry = 0;
int n = sizeof(int); int n = sizeof(int);
jint fd = fdval(env, fdo); jint fd = fdval(env, fdo);
fd_set wr, ex; fd_set wr, ex;
@ -73,64 +71,33 @@ Java_sun_nio_ch_SocketChannelImpl_checkConnect(JNIEnv *env, jobject this,
result = select(fd+1, 0, &wr, &ex, block ? NULL : &t); result = select(fd+1, 0, &wr, &ex, block ? NULL : &t);
/* save last winsock error */
if (result == SOCKET_ERROR) {
lastError = WSAGetLastError();
}
if (block) { /* must configure socket back to blocking state */
u_long argp = 0;
int r = ioctlsocket(fd, FIONBIO, &argp);
if (r == SOCKET_ERROR) {
handleSocketError(env, WSAGetLastError());
}
}
if (result == 0) { /* timeout */ if (result == 0) { /* timeout */
return block ? 0 : IOS_UNAVAILABLE; return block ? 0 : IOS_UNAVAILABLE;
} else { } else {
if (result == SOCKET_ERROR) { /* select failed */ if (result == SOCKET_ERROR) { /* select failed */
handleSocketError(env, lastError); handleSocketError(env, WSAGetLastError());
return IOS_THROWN; return IOS_THROWN;
} }
} }
/* // connection established if writable and no error to check
* Socket is writable or error occurred. On some Windows editions if (FD_ISSET(fd, &wr) && !FD_ISSET(fd, &ex)) {
* the socket will appear writable when the connect fails so we return 1;
* check for error rather than writable.
*/
if (!FD_ISSET(fd, &ex)) {
return 1; /* connection established */
} }
/* result = getsockopt((SOCKET)fd,
* A getsockopt( SO_ERROR ) may indicate success on NT4 even SOL_SOCKET,
* though the connection has failed. The workaround is to allow SO_ERROR,
* winsock to be scheduled and this is done via by yielding. (char *)&optError,
* As the yield approach is problematic in heavy load situations &n);
* we attempt up to 3 times to get the failure reason. if (result == SOCKET_ERROR) {
*/ int lastError = WSAGetLastError();
for (retry=0; retry<3; retry++) { if (lastError == WSAEINPROGRESS) {
result = getsockopt((SOCKET)fd, return IOS_UNAVAILABLE;
SOL_SOCKET,
SO_ERROR,
(char *)&optError,
&n);
if (result == SOCKET_ERROR) {
int lastError = WSAGetLastError();
if (lastError == WSAEINPROGRESS) {
return IOS_UNAVAILABLE;
}
NET_ThrowNew(env, lastError, "getsockopt");
return IOS_THROWN;
} }
if (optError) { NET_ThrowNew(env, lastError, "getsockopt");
break; return IOS_THROWN;
}
Sleep(0);
} }
if (optError != NO_ERROR) { if (optError != NO_ERROR) {
handleSocketError(env, optError); handleSocketError(env, optError);
return IOS_THROWN; return IOS_THROWN;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -172,22 +172,22 @@ class WindowsPreferences extends AbstractPreferences {
/** /**
* Java wrapper for Windows registry API RegOpenKey() * Java wrapper for Windows registry API RegOpenKey()
*/ */
private static native int[] WindowsRegOpenKey(int hKey, byte[] subKey, private static native long[] WindowsRegOpenKey(long hKey, byte[] subKey,
int securityMask); int securityMask);
/** /**
* Retries RegOpenKey() MAX_ATTEMPTS times before giving up. * Retries RegOpenKey() MAX_ATTEMPTS times before giving up.
*/ */
private static int[] WindowsRegOpenKey1(int hKey, byte[] subKey, private static long[] WindowsRegOpenKey1(long hKey, byte[] subKey,
int securityMask) { int securityMask) {
int[] result = WindowsRegOpenKey(hKey, subKey, securityMask); long[] result = WindowsRegOpenKey(hKey, subKey, securityMask);
if (result[ERROR_CODE] == ERROR_SUCCESS) { if (result[ERROR_CODE] == ERROR_SUCCESS) {
return result; return result;
} else if (result[ERROR_CODE] == ERROR_FILE_NOT_FOUND) { } else if (result[ERROR_CODE] == ERROR_FILE_NOT_FOUND) {
logger().warning("Trying to recreate Windows registry node " + logger().warning("Trying to recreate Windows registry node " +
byteArrayToString(subKey) + " at root 0x" + byteArrayToString(subKey) + " at root 0x" +
Integer.toHexString(hKey) + "."); Long.toHexString(hKey) + ".");
// Try recreation // Try recreation
int handle = WindowsRegCreateKeyEx(hKey, subKey)[NATIVE_HANDLE]; long handle = WindowsRegCreateKeyEx(hKey, subKey)[NATIVE_HANDLE];
WindowsRegCloseKey(handle); WindowsRegCloseKey(handle);
return WindowsRegOpenKey(hKey, subKey, securityMask); return WindowsRegOpenKey(hKey, subKey, securityMask);
} else if (result[ERROR_CODE] != ERROR_ACCESS_DENIED) { } else if (result[ERROR_CODE] != ERROR_ACCESS_DENIED) {
@ -211,18 +211,18 @@ class WindowsPreferences extends AbstractPreferences {
/** /**
* Java wrapper for Windows registry API RegCloseKey() * Java wrapper for Windows registry API RegCloseKey()
*/ */
private static native int WindowsRegCloseKey(int hKey); private static native int WindowsRegCloseKey(long hKey);
/** /**
* Java wrapper for Windows registry API RegCreateKeyEx() * Java wrapper for Windows registry API RegCreateKeyEx()
*/ */
private static native int[] WindowsRegCreateKeyEx(int hKey, byte[] subKey); private static native long[] WindowsRegCreateKeyEx(long hKey, byte[] subKey);
/** /**
* Retries RegCreateKeyEx() MAX_ATTEMPTS times before giving up. * Retries RegCreateKeyEx() MAX_ATTEMPTS times before giving up.
*/ */
private static int[] WindowsRegCreateKeyEx1(int hKey, byte[] subKey) { private static long[] WindowsRegCreateKeyEx1(long hKey, byte[] subKey) {
int[] result = WindowsRegCreateKeyEx(hKey, subKey); long[] result = WindowsRegCreateKeyEx(hKey, subKey);
if (result[ERROR_CODE] == ERROR_SUCCESS) { if (result[ERROR_CODE] == ERROR_SUCCESS) {
return result; return result;
} else { } else {
@ -245,17 +245,17 @@ class WindowsPreferences extends AbstractPreferences {
/** /**
* Java wrapper for Windows registry API RegDeleteKey() * Java wrapper for Windows registry API RegDeleteKey()
*/ */
private static native int WindowsRegDeleteKey(int hKey, byte[] subKey); private static native int WindowsRegDeleteKey(long hKey, byte[] subKey);
/** /**
* Java wrapper for Windows registry API RegFlushKey() * Java wrapper for Windows registry API RegFlushKey()
*/ */
private static native int WindowsRegFlushKey(int hKey); private static native int WindowsRegFlushKey(long hKey);
/** /**
* Retries RegFlushKey() MAX_ATTEMPTS times before giving up. * Retries RegFlushKey() MAX_ATTEMPTS times before giving up.
*/ */
private static int WindowsRegFlushKey1(int hKey) { private static int WindowsRegFlushKey1(long hKey) {
int result = WindowsRegFlushKey(hKey); int result = WindowsRegFlushKey(hKey);
if (result == ERROR_SUCCESS) { if (result == ERROR_SUCCESS) {
return result; return result;
@ -280,17 +280,17 @@ class WindowsPreferences extends AbstractPreferences {
/** /**
* Java wrapper for Windows registry API RegQueryValueEx() * Java wrapper for Windows registry API RegQueryValueEx()
*/ */
private static native byte[] WindowsRegQueryValueEx(int hKey, private static native byte[] WindowsRegQueryValueEx(long hKey,
byte[] valueName); byte[] valueName);
/** /**
* Java wrapper for Windows registry API RegSetValueEx() * Java wrapper for Windows registry API RegSetValueEx()
*/ */
private static native int WindowsRegSetValueEx(int hKey, byte[] valueName, private static native int WindowsRegSetValueEx(long hKey, byte[] valueName,
byte[] value); byte[] value);
/** /**
* Retries RegSetValueEx() MAX_ATTEMPTS times before giving up. * Retries RegSetValueEx() MAX_ATTEMPTS times before giving up.
*/ */
private static int WindowsRegSetValueEx1(int hKey, byte[] valueName, private static int WindowsRegSetValueEx1(long hKey, byte[] valueName,
byte[] value) { byte[] value) {
int result = WindowsRegSetValueEx(hKey, valueName, value); int result = WindowsRegSetValueEx(hKey, valueName, value);
if (result == ERROR_SUCCESS) { if (result == ERROR_SUCCESS) {
@ -316,18 +316,18 @@ class WindowsPreferences extends AbstractPreferences {
/** /**
* Java wrapper for Windows registry API RegDeleteValue() * Java wrapper for Windows registry API RegDeleteValue()
*/ */
private static native int WindowsRegDeleteValue(int hKey, byte[] valueName); private static native int WindowsRegDeleteValue(long hKey, byte[] valueName);
/** /**
* Java wrapper for Windows registry API RegQueryInfoKey() * Java wrapper for Windows registry API RegQueryInfoKey()
*/ */
private static native int[] WindowsRegQueryInfoKey(int hKey); private static native long[] WindowsRegQueryInfoKey(long hKey);
/** /**
* Retries RegQueryInfoKey() MAX_ATTEMPTS times before giving up. * Retries RegQueryInfoKey() MAX_ATTEMPTS times before giving up.
*/ */
private static int[] WindowsRegQueryInfoKey1(int hKey) { private static long[] WindowsRegQueryInfoKey1(long hKey) {
int[] result = WindowsRegQueryInfoKey(hKey); long[] result = WindowsRegQueryInfoKey(hKey);
if (result[ERROR_CODE] == ERROR_SUCCESS) { if (result[ERROR_CODE] == ERROR_SUCCESS) {
return result; return result;
} else { } else {
@ -351,13 +351,13 @@ class WindowsPreferences extends AbstractPreferences {
/** /**
* Java wrapper for Windows registry API RegEnumKeyEx() * Java wrapper for Windows registry API RegEnumKeyEx()
*/ */
private static native byte[] WindowsRegEnumKeyEx(int hKey, int subKeyIndex, private static native byte[] WindowsRegEnumKeyEx(long hKey, int subKeyIndex,
int maxKeyLength); int maxKeyLength);
/** /**
* Retries RegEnumKeyEx() MAX_ATTEMPTS times before giving up. * Retries RegEnumKeyEx() MAX_ATTEMPTS times before giving up.
*/ */
private static byte[] WindowsRegEnumKeyEx1(int hKey, int subKeyIndex, private static byte[] WindowsRegEnumKeyEx1(long hKey, int subKeyIndex,
int maxKeyLength) { int maxKeyLength) {
byte[] result = WindowsRegEnumKeyEx(hKey, subKeyIndex, maxKeyLength); byte[] result = WindowsRegEnumKeyEx(hKey, subKeyIndex, maxKeyLength);
if (result != null) { if (result != null) {
@ -383,12 +383,12 @@ class WindowsPreferences extends AbstractPreferences {
/** /**
* Java wrapper for Windows registry API RegEnumValue() * Java wrapper for Windows registry API RegEnumValue()
*/ */
private static native byte[] WindowsRegEnumValue(int hKey, int valueIndex, private static native byte[] WindowsRegEnumValue(long hKey, int valueIndex,
int maxValueNameLength); int maxValueNameLength);
/** /**
* Retries RegEnumValueEx() MAX_ATTEMPTS times before giving up. * Retries RegEnumValueEx() MAX_ATTEMPTS times before giving up.
*/ */
private static byte[] WindowsRegEnumValue1(int hKey, int valueIndex, private static byte[] WindowsRegEnumValue1(long hKey, int valueIndex,
int maxValueNameLength) { int maxValueNameLength) {
byte[] result = WindowsRegEnumValue(hKey, valueIndex, byte[] result = WindowsRegEnumValue(hKey, valueIndex,
maxValueNameLength); maxValueNameLength);
@ -421,18 +421,18 @@ class WindowsPreferences extends AbstractPreferences {
*/ */
private WindowsPreferences(WindowsPreferences parent, String name) { private WindowsPreferences(WindowsPreferences parent, String name) {
super(parent, name); super(parent, name);
int parentNativeHandle = parent.openKey(KEY_CREATE_SUB_KEY, KEY_READ); long parentNativeHandle = parent.openKey(KEY_CREATE_SUB_KEY, KEY_READ);
if (parentNativeHandle == NULL_NATIVE_HANDLE) { if (parentNativeHandle == NULL_NATIVE_HANDLE) {
// if here, openKey failed and logged // if here, openKey failed and logged
isBackingStoreAvailable = false; isBackingStoreAvailable = false;
return; return;
} }
int[] result = long[] result =
WindowsRegCreateKeyEx1(parentNativeHandle, toWindowsName(name)); WindowsRegCreateKeyEx1(parentNativeHandle, toWindowsName(name));
if (result[ERROR_CODE] != ERROR_SUCCESS) { if (result[ERROR_CODE] != ERROR_SUCCESS) {
logger().warning("Could not create windows registry node " + logger().warning("Could not create windows registry node " +
byteArrayToString(windowsAbsolutePath()) + byteArrayToString(windowsAbsolutePath()) +
" at root 0x" + Integer.toHexString(rootNativeHandle()) + " at root 0x" + Long.toHexString(rootNativeHandle()) +
". Windows RegCreateKeyEx(...) returned error code " + ". Windows RegCreateKeyEx(...) returned error code " +
result[ERROR_CODE] + "."); result[ERROR_CODE] + ".");
isBackingStoreAvailable = false; isBackingStoreAvailable = false;
@ -451,14 +451,14 @@ class WindowsPreferences extends AbstractPreferences {
* @param rootNativeHandle Native handle to one of Windows top level keys. * @param rootNativeHandle Native handle to one of Windows top level keys.
* @param rootDirectory Path to root directory, as a byte-encoded string. * @param rootDirectory Path to root directory, as a byte-encoded string.
*/ */
private WindowsPreferences(int rootNativeHandle, byte[] rootDirectory) { private WindowsPreferences(long rootNativeHandle, byte[] rootDirectory) {
super(null, ""); super(null, "");
int[] result = long[] result =
WindowsRegCreateKeyEx1(rootNativeHandle, rootDirectory); WindowsRegCreateKeyEx1(rootNativeHandle, rootDirectory);
if (result[ERROR_CODE] != ERROR_SUCCESS) { if (result[ERROR_CODE] != ERROR_SUCCESS) {
logger().warning("Could not open/create prefs root node " + logger().warning("Could not open/create prefs root node " +
byteArrayToString(windowsAbsolutePath()) + byteArrayToString(windowsAbsolutePath()) +
" at root 0x" + Integer.toHexString(rootNativeHandle()) + " at root 0x" + Long.toHexString(rootNativeHandle()) +
". Windows RegCreateKeyEx(...) returned error code " + ". Windows RegCreateKeyEx(...) returned error code " +
result[ERROR_CODE] + "."); result[ERROR_CODE] + ".");
isBackingStoreAvailable = false; isBackingStoreAvailable = false;
@ -497,7 +497,7 @@ class WindowsPreferences extends AbstractPreferences {
* @see #openKey(int, byte[], int) * @see #openKey(int, byte[], int)
* @see #closeKey(int) * @see #closeKey(int)
*/ */
private int openKey(int securityMask) { private long openKey(int securityMask) {
return openKey(securityMask, securityMask); return openKey(securityMask, securityMask);
} }
@ -511,7 +511,7 @@ class WindowsPreferences extends AbstractPreferences {
* @see #openKey(int, byte[], int) * @see #openKey(int, byte[], int)
* @see #closeKey(int) * @see #closeKey(int)
*/ */
private int openKey(int mask1, int mask2) { private long openKey(int mask1, int mask2) {
return openKey(windowsAbsolutePath(), mask1, mask2); return openKey(windowsAbsolutePath(), mask1, mask2);
} }
@ -527,12 +527,12 @@ class WindowsPreferences extends AbstractPreferences {
* @see #openKey(int, byte[],int) * @see #openKey(int, byte[],int)
* @see #closeKey(int) * @see #closeKey(int)
*/ */
private int openKey(byte[] windowsAbsolutePath, int mask1, int mask2) { private long openKey(byte[] windowsAbsolutePath, int mask1, int mask2) {
/* Check if key's path is short enough be opened at once /* Check if key's path is short enough be opened at once
otherwise use a path-splitting procedure */ otherwise use a path-splitting procedure */
if (windowsAbsolutePath.length <= MAX_WINDOWS_PATH_LENGTH + 1) { if (windowsAbsolutePath.length <= MAX_WINDOWS_PATH_LENGTH + 1) {
int[] result = WindowsRegOpenKey1(rootNativeHandle(), long[] result = WindowsRegOpenKey1(rootNativeHandle(),
windowsAbsolutePath, mask1); windowsAbsolutePath, mask1);
if (result[ERROR_CODE] == ERROR_ACCESS_DENIED && mask2 != mask1) if (result[ERROR_CODE] == ERROR_ACCESS_DENIED && mask2 != mask1)
result = WindowsRegOpenKey1(rootNativeHandle(), result = WindowsRegOpenKey1(rootNativeHandle(),
windowsAbsolutePath, mask2); windowsAbsolutePath, mask2);
@ -541,7 +541,7 @@ class WindowsPreferences extends AbstractPreferences {
logger().warning("Could not open windows registry node " + logger().warning("Could not open windows registry node " +
byteArrayToString(windowsAbsolutePath()) + byteArrayToString(windowsAbsolutePath()) +
" at root 0x" + " at root 0x" +
Integer.toHexString(rootNativeHandle()) + Long.toHexString(rootNativeHandle()) +
". Windows RegOpenKey(...) returned error code " + ". Windows RegOpenKey(...) returned error code " +
result[ERROR_CODE] + "."); result[ERROR_CODE] + ".");
result[NATIVE_HANDLE] = NULL_NATIVE_HANDLE; result[NATIVE_HANDLE] = NULL_NATIVE_HANDLE;
@ -550,7 +550,7 @@ class WindowsPreferences extends AbstractPreferences {
"Could not open windows registry node " + "Could not open windows registry node " +
byteArrayToString(windowsAbsolutePath()) + byteArrayToString(windowsAbsolutePath()) +
" at root 0x" + " at root 0x" +
Integer.toHexString(rootNativeHandle()) + Long.toHexString(rootNativeHandle()) +
": Access denied"); ": Access denied");
} }
} }
@ -573,12 +573,12 @@ class WindowsPreferences extends AbstractPreferences {
* @see #openKey(byte[],int) * @see #openKey(byte[],int)
* @see #closeKey(int) * @see #closeKey(int)
*/ */
private int openKey(int nativeHandle, byte[] windowsRelativePath, private long openKey(long nativeHandle, byte[] windowsRelativePath,
int mask1, int mask2) { int mask1, int mask2) {
/* If the path is short enough open at once. Otherwise split the path */ /* If the path is short enough open at once. Otherwise split the path */
if (windowsRelativePath.length <= MAX_WINDOWS_PATH_LENGTH + 1 ) { if (windowsRelativePath.length <= MAX_WINDOWS_PATH_LENGTH + 1 ) {
int[] result = WindowsRegOpenKey1(nativeHandle, long[] result = WindowsRegOpenKey1(nativeHandle,
windowsRelativePath, mask1); windowsRelativePath, mask1);
if (result[ERROR_CODE] == ERROR_ACCESS_DENIED && mask2 != mask1) if (result[ERROR_CODE] == ERROR_ACCESS_DENIED && mask2 != mask1)
result = WindowsRegOpenKey1(nativeHandle, result = WindowsRegOpenKey1(nativeHandle,
windowsRelativePath, mask2); windowsRelativePath, mask2);
@ -586,7 +586,7 @@ class WindowsPreferences extends AbstractPreferences {
if (result[ERROR_CODE] != ERROR_SUCCESS) { if (result[ERROR_CODE] != ERROR_SUCCESS) {
logger().warning("Could not open windows registry node " + logger().warning("Could not open windows registry node " +
byteArrayToString(windowsAbsolutePath()) + byteArrayToString(windowsAbsolutePath()) +
" at root 0x" + Integer.toHexString(nativeHandle) + " at root 0x" + Long.toHexString(nativeHandle) +
". Windows RegOpenKey(...) returned error code " + ". Windows RegOpenKey(...) returned error code " +
result[ERROR_CODE] + "."); result[ERROR_CODE] + ".");
result[NATIVE_HANDLE] = NULL_NATIVE_HANDLE; result[NATIVE_HANDLE] = NULL_NATIVE_HANDLE;
@ -610,13 +610,13 @@ class WindowsPreferences extends AbstractPreferences {
separatorPosition - 1]; separatorPosition - 1];
System.arraycopy(windowsRelativePath, separatorPosition+1, System.arraycopy(windowsRelativePath, separatorPosition+1,
nextRelativePath, 0, nextRelativePath.length); nextRelativePath, 0, nextRelativePath.length);
int nextNativeHandle = openKey(nativeHandle, nextRelativeRoot, long nextNativeHandle = openKey(nativeHandle, nextRelativeRoot,
mask1, mask2); mask1, mask2);
if (nextNativeHandle == NULL_NATIVE_HANDLE) { if (nextNativeHandle == NULL_NATIVE_HANDLE) {
return NULL_NATIVE_HANDLE; return NULL_NATIVE_HANDLE;
} }
int result = openKey(nextNativeHandle, nextRelativePath, long result = openKey(nextNativeHandle, nextRelativePath,
mask1,mask2); mask1,mask2);
closeKey(nextNativeHandle); closeKey(nextNativeHandle);
return result; return result;
} }
@ -630,13 +630,13 @@ class WindowsPreferences extends AbstractPreferences {
* @see #openKey(byte[],int) * @see #openKey(byte[],int)
* @see #openKey(int, byte[],int) * @see #openKey(int, byte[],int)
*/ */
private void closeKey(int nativeHandle) { private void closeKey(long nativeHandle) {
int result = WindowsRegCloseKey(nativeHandle); int result = WindowsRegCloseKey(nativeHandle);
if (result != ERROR_SUCCESS) { if (result != ERROR_SUCCESS) {
logger().warning("Could not close windows registry node " + logger().warning("Could not close windows registry node " +
byteArrayToString(windowsAbsolutePath()) + byteArrayToString(windowsAbsolutePath()) +
" at root 0x" + " at root 0x" +
Integer.toHexString(rootNativeHandle()) + Long.toHexString(rootNativeHandle()) +
". Windows RegCloseKey(...) returned error code " + ". Windows RegCloseKey(...) returned error code " +
result + "."); result + ".");
} }
@ -649,7 +649,7 @@ class WindowsPreferences extends AbstractPreferences {
* @see #getSpi(String) * @see #getSpi(String)
*/ */
protected void putSpi(String javaName, String value) { protected void putSpi(String javaName, String value) {
int nativeHandle = openKey(KEY_SET_VALUE); long nativeHandle = openKey(KEY_SET_VALUE);
if (nativeHandle == NULL_NATIVE_HANDLE) { if (nativeHandle == NULL_NATIVE_HANDLE) {
isBackingStoreAvailable = false; isBackingStoreAvailable = false;
return; return;
@ -662,7 +662,7 @@ class WindowsPreferences extends AbstractPreferences {
" at Windows registry node " + " at Windows registry node " +
byteArrayToString(windowsAbsolutePath()) + byteArrayToString(windowsAbsolutePath()) +
" at root 0x" + " at root 0x" +
Integer.toHexString(rootNativeHandle()) + Long.toHexString(rootNativeHandle()) +
". Windows RegSetValueEx(...) returned error code " + ". Windows RegSetValueEx(...) returned error code " +
result + "."); result + ".");
isBackingStoreAvailable = false; isBackingStoreAvailable = false;
@ -677,7 +677,7 @@ class WindowsPreferences extends AbstractPreferences {
* @see #putSpi(String, String) * @see #putSpi(String, String)
*/ */
protected String getSpi(String javaName) { protected String getSpi(String javaName) {
int nativeHandle = openKey(KEY_QUERY_VALUE); long nativeHandle = openKey(KEY_QUERY_VALUE);
if (nativeHandle == NULL_NATIVE_HANDLE) { if (nativeHandle == NULL_NATIVE_HANDLE) {
return null; return null;
} }
@ -699,7 +699,7 @@ class WindowsPreferences extends AbstractPreferences {
* been deleted. * been deleted.
*/ */
protected void removeSpi(String key) { protected void removeSpi(String key) {
int nativeHandle = openKey(KEY_SET_VALUE); long nativeHandle = openKey(KEY_SET_VALUE);
if (nativeHandle == NULL_NATIVE_HANDLE) { if (nativeHandle == NULL_NATIVE_HANDLE) {
return; return;
} }
@ -709,7 +709,7 @@ class WindowsPreferences extends AbstractPreferences {
logger().warning("Could not delete windows registry value " + logger().warning("Could not delete windows registry value " +
byteArrayToString(windowsAbsolutePath()) + "\\" + byteArrayToString(windowsAbsolutePath()) + "\\" +
toWindowsName(key) + " at root 0x" + toWindowsName(key) + " at root 0x" +
Integer.toHexString(rootNativeHandle()) + Long.toHexString(rootNativeHandle()) +
". Windows RegDeleteValue(...) returned error code " + ". Windows RegDeleteValue(...) returned error code " +
result + "."); result + ".");
isBackingStoreAvailable = false; isBackingStoreAvailable = false;
@ -725,27 +725,27 @@ class WindowsPreferences extends AbstractPreferences {
*/ */
protected String[] keysSpi() throws BackingStoreException{ protected String[] keysSpi() throws BackingStoreException{
// Find out the number of values // Find out the number of values
int nativeHandle = openKey(KEY_QUERY_VALUE); long nativeHandle = openKey(KEY_QUERY_VALUE);
if (nativeHandle == NULL_NATIVE_HANDLE) { if (nativeHandle == NULL_NATIVE_HANDLE) {
throw new BackingStoreException( throw new BackingStoreException(
"Could not open windows registry node " + "Could not open windows registry node " +
byteArrayToString(windowsAbsolutePath()) + byteArrayToString(windowsAbsolutePath()) +
" at root 0x" + " at root 0x" +
Integer.toHexString(rootNativeHandle()) + "."); Long.toHexString(rootNativeHandle()) + ".");
} }
int[] result = WindowsRegQueryInfoKey1(nativeHandle); long[] result = WindowsRegQueryInfoKey1(nativeHandle);
if (result[ERROR_CODE] != ERROR_SUCCESS) { if (result[ERROR_CODE] != ERROR_SUCCESS) {
String info = "Could not query windows registry node " + String info = "Could not query windows registry node " +
byteArrayToString(windowsAbsolutePath()) + byteArrayToString(windowsAbsolutePath()) +
" at root 0x" + " at root 0x" +
Integer.toHexString(rootNativeHandle()) + Long.toHexString(rootNativeHandle()) +
". Windows RegQueryInfoKeyEx(...) returned error code " + ". Windows RegQueryInfoKeyEx(...) returned error code " +
result[ERROR_CODE] + "."; result[ERROR_CODE] + ".";
logger().warning(info); logger().warning(info);
throw new BackingStoreException(info); throw new BackingStoreException(info);
} }
int maxValueNameLength = result[MAX_VALUE_NAME_LENGTH]; int maxValueNameLength = (int)result[MAX_VALUE_NAME_LENGTH];
int valuesNumber = result[VALUES_NUMBER]; int valuesNumber = (int)result[VALUES_NUMBER];
if (valuesNumber == 0) { if (valuesNumber == 0) {
closeKey(nativeHandle); closeKey(nativeHandle);
return new String[0]; return new String[0];
@ -759,7 +759,7 @@ class WindowsPreferences extends AbstractPreferences {
String info = String info =
"Could not enumerate value #" + i + " of windows node " + "Could not enumerate value #" + i + " of windows node " +
byteArrayToString(windowsAbsolutePath()) + " at root 0x" + byteArrayToString(windowsAbsolutePath()) + " at root 0x" +
Integer.toHexString(rootNativeHandle()) + "."; Long.toHexString(rootNativeHandle()) + ".";
logger().warning(info); logger().warning(info);
throw new BackingStoreException(info); throw new BackingStoreException(info);
} }
@ -777,27 +777,27 @@ class WindowsPreferences extends AbstractPreferences {
*/ */
protected String[] childrenNamesSpi() throws BackingStoreException { protected String[] childrenNamesSpi() throws BackingStoreException {
// Open key // Open key
int nativeHandle = openKey(KEY_ENUMERATE_SUB_KEYS | KEY_QUERY_VALUE); long nativeHandle = openKey(KEY_ENUMERATE_SUB_KEYS | KEY_QUERY_VALUE);
if (nativeHandle == NULL_NATIVE_HANDLE) { if (nativeHandle == NULL_NATIVE_HANDLE) {
throw new BackingStoreException( throw new BackingStoreException(
"Could not open windows registry node " + "Could not open windows registry node " +
byteArrayToString(windowsAbsolutePath()) + byteArrayToString(windowsAbsolutePath()) +
" at root 0x" + " at root 0x" +
Integer.toHexString(rootNativeHandle()) + "."); Long.toHexString(rootNativeHandle()) + ".");
} }
// Get number of children // Get number of children
int[] result = WindowsRegQueryInfoKey1(nativeHandle); long[] result = WindowsRegQueryInfoKey1(nativeHandle);
if (result[ERROR_CODE] != ERROR_SUCCESS) { if (result[ERROR_CODE] != ERROR_SUCCESS) {
String info = "Could not query windows registry node " + String info = "Could not query windows registry node " +
byteArrayToString(windowsAbsolutePath()) + byteArrayToString(windowsAbsolutePath()) +
" at root 0x" + Integer.toHexString(rootNativeHandle()) + " at root 0x" + Long.toHexString(rootNativeHandle()) +
". Windows RegQueryInfoKeyEx(...) returned error code " + ". Windows RegQueryInfoKeyEx(...) returned error code " +
result[ERROR_CODE] + "."; result[ERROR_CODE] + ".";
logger().warning(info); logger().warning(info);
throw new BackingStoreException(info); throw new BackingStoreException(info);
} }
int maxKeyLength = result[MAX_KEY_LENGTH]; int maxKeyLength = (int)result[MAX_KEY_LENGTH];
int subKeysNumber = result[SUBKEYS_NUMBER]; int subKeysNumber = (int)result[SUBKEYS_NUMBER];
if (subKeysNumber == 0) { if (subKeysNumber == 0) {
closeKey(nativeHandle); closeKey(nativeHandle);
return new String[0]; return new String[0];
@ -812,7 +812,7 @@ class WindowsPreferences extends AbstractPreferences {
String info = String info =
"Could not enumerate key #" + i + " of windows node " + "Could not enumerate key #" + i + " of windows node " +
byteArrayToString(windowsAbsolutePath()) + " at root 0x" + byteArrayToString(windowsAbsolutePath()) + " at root 0x" +
Integer.toHexString(rootNativeHandle()) + ". "; Long.toHexString(rootNativeHandle()) + ". ";
logger().warning(info); logger().warning(info);
throw new BackingStoreException(info); throw new BackingStoreException(info);
} }
@ -839,20 +839,20 @@ class WindowsPreferences extends AbstractPreferences {
throw new BackingStoreException( throw new BackingStoreException(
"flush(): Backing store not available."); "flush(): Backing store not available.");
} }
int nativeHandle = openKey(KEY_READ); long nativeHandle = openKey(KEY_READ);
if (nativeHandle == NULL_NATIVE_HANDLE) { if (nativeHandle == NULL_NATIVE_HANDLE) {
throw new BackingStoreException( throw new BackingStoreException(
"Could not open windows registry node " + "Could not open windows registry node " +
byteArrayToString(windowsAbsolutePath()) + byteArrayToString(windowsAbsolutePath()) +
" at root 0x" + " at root 0x" +
Integer.toHexString(rootNativeHandle()) + "."); Long.toHexString(rootNativeHandle()) + ".");
} }
int result = WindowsRegFlushKey1(nativeHandle); int result = WindowsRegFlushKey1(nativeHandle);
if (result != ERROR_SUCCESS) { if (result != ERROR_SUCCESS) {
String info = "Could not flush windows registry node " + String info = "Could not flush windows registry node " +
byteArrayToString(windowsAbsolutePath()) + byteArrayToString(windowsAbsolutePath()) +
" at root 0x" + " at root 0x" +
Integer.toHexString(rootNativeHandle()) + Long.toHexString(rootNativeHandle()) +
". Windows RegFlushKey(...) returned error code " + ". Windows RegFlushKey(...) returned error code " +
result + "."; result + ".";
logger().warning(info); logger().warning(info);
@ -891,21 +891,21 @@ class WindowsPreferences extends AbstractPreferences {
* is not available. * is not available.
*/ */
public void removeNodeSpi() throws BackingStoreException { public void removeNodeSpi() throws BackingStoreException {
int parentNativeHandle = long parentNativeHandle =
((WindowsPreferences)parent()).openKey(DELETE); ((WindowsPreferences)parent()).openKey(DELETE);
if (parentNativeHandle == NULL_NATIVE_HANDLE) { if (parentNativeHandle == NULL_NATIVE_HANDLE) {
throw new BackingStoreException( throw new BackingStoreException(
"Could not open parent windows registry node of " + "Could not open parent windows registry node of " +
byteArrayToString(windowsAbsolutePath()) + byteArrayToString(windowsAbsolutePath()) +
" at root 0x" + " at root 0x" +
Integer.toHexString(rootNativeHandle()) + "."); Long.toHexString(rootNativeHandle()) + ".");
} }
int result = int result =
WindowsRegDeleteKey(parentNativeHandle, toWindowsName(name())); WindowsRegDeleteKey(parentNativeHandle, toWindowsName(name()));
if (result != ERROR_SUCCESS) { if (result != ERROR_SUCCESS) {
String info = "Could not delete windows registry node " + String info = "Could not delete windows registry node " +
byteArrayToString(windowsAbsolutePath()) + byteArrayToString(windowsAbsolutePath()) +
" at root 0x" + Integer.toHexString(rootNativeHandle()) + " at root 0x" + Long.toHexString(rootNativeHandle()) +
". Windows RegDeleteKeyEx(...) returned error code " + ". Windows RegDeleteKeyEx(...) returned error code " +
result + "."; result + ".";
logger().warning(info); logger().warning(info);
@ -1089,7 +1089,7 @@ class WindowsPreferences extends AbstractPreferences {
if ((ch < 0x0020) || (ch > 0x007f)){ if ((ch < 0x0020) || (ch > 0x007f)){
// write \udddd // write \udddd
windowsName.append("/u"); windowsName.append("/u");
String hex = Integer.toHexString(javaName.charAt(i)); String hex = Long.toHexString(javaName.charAt(i));
StringBuilder hex4 = new StringBuilder(hex); StringBuilder hex4 = new StringBuilder(hex);
hex4.reverse(); hex4.reverse();
int len = 4 - hex4.length(); int len = 4 - hex4.length();
@ -1115,7 +1115,7 @@ class WindowsPreferences extends AbstractPreferences {
/** /**
* Returns native handle for the top Windows node for this node. * Returns native handle for the top Windows node for this node.
*/ */
private int rootNativeHandle() { private long rootNativeHandle() {
return (isUserNode() return (isUserNode()
? USER_ROOT_NATIVE_HANDLE ? USER_ROOT_NATIVE_HANDLE
: SYSTEM_ROOT_NATIVE_HANDLE); : SYSTEM_ROOT_NATIVE_HANDLE);

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -37,222 +37,222 @@ extern "C" {
*/ */
DEF_STATIC_JNI_OnLoad DEF_STATIC_JNI_OnLoad
JNIEXPORT jintArray JNICALL Java_java_util_prefs_WindowsPreferences_WindowsRegOpenKey JNIEXPORT jlongArray JNICALL
(JNIEnv* env, jclass this_class, jint hKey, jbyteArray lpSubKey, jint securityMask) { Java_java_util_prefs_WindowsPreferences_WindowsRegOpenKey(JNIEnv* env,
HKEY handle; jclass this_class, jlong hKey, jbyteArray lpSubKey, jint securityMask) {
char* str; char* str = (*env)->GetByteArrayElements(env, lpSubKey, NULL);
int tmp[2]; CHECK_NULL_RETURN(str, NULL);
int errorCode=-1;
jintArray result; HKEY handle;
str = (*env)->GetByteArrayElements(env, lpSubKey, NULL); int errorCode = RegOpenKeyEx((HKEY) hKey, str, 0, securityMask, &handle);
CHECK_NULL_RETURN(str, NULL); (*env)->ReleaseByteArrayElements(env, lpSubKey, str, 0);
errorCode = RegOpenKeyEx((HKEY)hKey, str, 0, securityMask, &handle);
(*env)->ReleaseByteArrayElements(env, lpSubKey, str, 0); jlong tmp[2];
tmp[0]= (int) handle; tmp[0] = (jlong) handle;
tmp[1]= errorCode; tmp[1] = errorCode;
result = (*env)->NewIntArray(env,2); jlongArray result = (*env)->NewLongArray(env, 2);
if (result != NULL) { if (result != NULL) {
(*env)->SetIntArrayRegion(env, result, 0, 2, tmp); (*env)->SetLongArrayRegion(env, result, 0, 2, tmp);
}
return result;
} }
return result;
}
JNIEXPORT jint JNICALL Java_java_util_prefs_WindowsPreferences_WindowsRegCloseKey JNIEXPORT jint JNICALL
(JNIEnv* env, jclass this_class, jint hKey) { Java_java_util_prefs_WindowsPreferences_WindowsRegCloseKey(JNIEnv* env,
return (jint) RegCloseKey((HKEY) hKey); jclass this_class, jlong hKey) {
}; return (jint) RegCloseKey((HKEY) hKey);
};
JNIEXPORT jintArray JNICALL Java_java_util_prefs_WindowsPreferences_WindowsRegCreateKeyEx JNIEXPORT jlongArray JNICALL
(JNIEnv* env, jclass this_class, jint hKey, jbyteArray lpSubKey) { Java_java_util_prefs_WindowsPreferences_WindowsRegCreateKeyEx(JNIEnv* env,
HKEY handle; jclass this_class, jlong hKey, jbyteArray lpSubKey) {
char* str; char* str = (*env)->GetByteArrayElements(env, lpSubKey, NULL);
int tmp[3]; CHECK_NULL_RETURN(str, NULL);
DWORD lpdwDisposition;
int errorCode; HKEY handle;
jintArray result = NULL; DWORD lpdwDisposition;
str = (*env)->GetByteArrayElements(env, lpSubKey, NULL); int errorCode = RegCreateKeyEx((HKEY) hKey, str, 0, NULL,
CHECK_NULL_RETURN(str, NULL); REG_OPTION_NON_VOLATILE, KEY_READ,
errorCode = RegCreateKeyEx((HKEY)hKey, str, 0, NULL, NULL, &handle, &lpdwDisposition);
REG_OPTION_NON_VOLATILE, KEY_READ, (*env)->ReleaseByteArrayElements(env, lpSubKey, str, 0);
NULL, &handle, &lpdwDisposition);
(*env)->ReleaseByteArrayElements(env, lpSubKey, str, 0); jlong tmp[3];
tmp[0]= (int) handle; tmp[0] = (jlong) handle;
tmp[1]= errorCode; tmp[1] = errorCode;
tmp[2]= lpdwDisposition; tmp[2] = lpdwDisposition;
result = (*env)->NewIntArray(env,3); jlongArray result = (*env)->NewLongArray(env, 3);
if (result != NULL) { if (result != NULL) {
(*env)->SetIntArrayRegion(env, result, 0, 3, tmp); (*env)->SetLongArrayRegion(env, result, 0, 3, tmp);
}
return result;
} }
return result;
}
JNIEXPORT jint JNICALL Java_java_util_prefs_WindowsPreferences_WindowsRegDeleteKey JNIEXPORT jint JNICALL
(JNIEnv* env, jclass this_class, jint hKey, jbyteArray lpSubKey) { Java_java_util_prefs_WindowsPreferences_WindowsRegDeleteKey(JNIEnv* env,
char* str; jclass this_class, jlong hKey, jbyteArray lpSubKey) {
int result; char* str = (*env)->GetByteArrayElements(env, lpSubKey, NULL);
str = (*env)->GetByteArrayElements(env, lpSubKey, NULL); CHECK_NULL_RETURN(str, -1);
CHECK_NULL_RETURN(str, -1);
result = RegDeleteKey((HKEY)hKey, str);
(*env)->ReleaseByteArrayElements(env, lpSubKey, str, 0);
return result;
}; int result = RegDeleteKey((HKEY) hKey, str);
(*env)->ReleaseByteArrayElements(env, lpSubKey, str, 0);
return result;
JNIEXPORT jint JNICALL Java_java_util_prefs_WindowsPreferences_WindowsRegFlushKey };
(JNIEnv* env, jclass this_class, jint hKey) {
return RegFlushKey ((HKEY)hKey);
}
JNIEXPORT jbyteArray JNICALL Java_java_util_prefs_WindowsPreferences_WindowsRegQueryValueEx JNIEXPORT jint JNICALL
(JNIEnv* env, jclass this_class, jint hKey, jbyteArray valueName) { Java_java_util_prefs_WindowsPreferences_WindowsRegFlushKey(JNIEnv* env,
char* valueNameStr; jclass this_class, jlong hKey) {
char* buffer; return RegFlushKey((HKEY) hKey);
jbyteArray result; }
DWORD valueType;
DWORD valueSize; JNIEXPORT jbyteArray JNICALL
valueNameStr = (*env)->GetByteArrayElements(env, valueName, NULL); Java_java_util_prefs_WindowsPreferences_WindowsRegQueryValueEx(JNIEnv* env,
CHECK_NULL_RETURN(valueNameStr, NULL); jclass this_class, jlong hKey, jbyteArray valueName) {
if (RegQueryValueEx((HKEY)hKey, valueNameStr, NULL, &valueType, NULL, char* valueNameStr = (*env)->GetByteArrayElements(env, valueName, NULL);
&valueSize) != ERROR_SUCCESS) { CHECK_NULL_RETURN(valueNameStr, NULL);
DWORD valueType;
DWORD valueSize;
if (RegQueryValueEx((HKEY) hKey, valueNameStr, NULL, &valueType, NULL,
&valueSize) != ERROR_SUCCESS) {
(*env)->ReleaseByteArrayElements(env, valueName, valueNameStr, 0); (*env)->ReleaseByteArrayElements(env, valueName, valueNameStr, 0);
return NULL; return NULL;
}
buffer = (char*)malloc(valueSize);
if (buffer != NULL) {
if (RegQueryValueEx((HKEY)hKey, valueNameStr, NULL, &valueType, buffer,
&valueSize) != ERROR_SUCCESS) {
free(buffer);
(*env)->ReleaseByteArrayElements(env, valueName, valueNameStr, 0);
return NULL;
}
} else {
JNU_ThrowOutOfMemoryError(env, "native memory allocation failed");
(*env)->ReleaseByteArrayElements(env, valueName, valueNameStr, 0);
return NULL;
}
if (valueType == REG_SZ) {
result = (*env)->NewByteArray(env, valueSize);
if (result != NULL) {
(*env)->SetByteArrayRegion(env, result, 0, valueSize, buffer);
}
} else {
result = NULL;
}
free(buffer);
(*env)->ReleaseByteArrayElements(env, valueName, valueNameStr, 0);
return result;
} }
char* buffer = (char*) malloc(valueSize);
if (buffer != NULL) {
if (RegQueryValueEx((HKEY) hKey, valueNameStr, NULL, &valueType, buffer,
JNIEXPORT jint JNICALL Java_java_util_prefs_WindowsPreferences_WindowsRegSetValueEx &valueSize) != ERROR_SUCCESS) {
(JNIEnv* env, jclass this_class, jint hKey, jbyteArray valueName, jbyteArray data) {
char* valueNameStr;
char* dataStr;
int size = -1;
int nameSize = -1;
int error_code = -1;
if ((valueName == NULL)||(data == NULL)) {return -1;}
size = (*env)->GetArrayLength(env, data);
dataStr = (*env)->GetByteArrayElements(env, data, NULL);
CHECK_NULL_RETURN(dataStr, -1);
valueNameStr = (*env)->GetByteArrayElements(env, valueName, NULL);
if (valueNameStr != NULL) {
error_code = RegSetValueEx((HKEY)hKey, valueNameStr, 0,
REG_SZ, dataStr, size);
(*env)->ReleaseByteArrayElements(env, valueName, valueNameStr, 0);
}
(*env)->ReleaseByteArrayElements(env, data, dataStr, 0);
return error_code;
}
JNIEXPORT jint JNICALL Java_java_util_prefs_WindowsPreferences_WindowsRegDeleteValue
(JNIEnv* env, jclass this_class, jint hKey, jbyteArray valueName) {
char* valueNameStr;
int error_code = -1;
if (valueName == NULL) {return -1;}
valueNameStr = (*env)->GetByteArrayElements(env, valueName, NULL);
CHECK_NULL_RETURN(valueNameStr, -1);
error_code = RegDeleteValue((HKEY)hKey, valueNameStr);
(*env)->ReleaseByteArrayElements(env, valueName, valueNameStr, 0);
return error_code;
}
JNIEXPORT jintArray JNICALL Java_java_util_prefs_WindowsPreferences_WindowsRegQueryInfoKey
(JNIEnv* env, jclass this_class, jint hKey) {
jintArray result = NULL;
int tmp[5];
int valuesNumber = -1;
int maxValueNameLength = -1;
int maxSubKeyLength = -1;
int subKeysNumber = -1;
int errorCode = -1;
errorCode = RegQueryInfoKey((HKEY)hKey, NULL, NULL, NULL,
&subKeysNumber, &maxSubKeyLength, NULL,
&valuesNumber, &maxValueNameLength,
NULL, NULL, NULL);
tmp[0]= subKeysNumber;
tmp[1]= (int)errorCode;
tmp[2]= valuesNumber;
tmp[3]= maxSubKeyLength;
tmp[4]= maxValueNameLength;
result = (*env)->NewIntArray(env,5);
if (result != NULL) {
(*env)->SetIntArrayRegion(env, result, 0, 5, tmp);
}
return result;
}
JNIEXPORT jbyteArray JNICALL Java_java_util_prefs_WindowsPreferences_WindowsRegEnumKeyEx
(JNIEnv* env, jclass this_class, jint hKey , jint subKeyIndex, jint maxKeyLength) {
int size = maxKeyLength;
jbyteArray result;
char* buffer = NULL;
buffer = (char*)malloc(maxKeyLength);
if (buffer == NULL) {
JNU_ThrowOutOfMemoryError(env, "native memory allocation failed");
return NULL;
}
if (RegEnumKeyEx((HKEY) hKey, subKeyIndex, buffer, &size, NULL, NULL,
NULL, NULL) != ERROR_SUCCESS){
free(buffer);
return NULL;
}
result = (*env)->NewByteArray(env, size + 1);
if (result != NULL) {
(*env)->SetByteArrayRegion(env, result, 0, size + 1, buffer);
}
free(buffer);
return result;
}
JNIEXPORT jbyteArray JNICALL Java_java_util_prefs_WindowsPreferences_WindowsRegEnumValue
(JNIEnv* env, jclass this_class, jint hKey , jint valueIndex, jint maxValueNameLength){
int size = maxValueNameLength;
jbyteArray result;
char* buffer = NULL;
int error_code;
buffer = (char*)malloc(maxValueNameLength);
if (buffer == NULL) {
JNU_ThrowOutOfMemoryError(env, "native memory allocation failed");
return NULL;
}
error_code = RegEnumValue((HKEY) hKey, valueIndex, buffer,
&size, NULL, NULL, NULL, NULL);
if (error_code!= ERROR_SUCCESS){
free(buffer); free(buffer);
(*env)->ReleaseByteArrayElements(env, valueName, valueNameStr, 0);
return NULL; return NULL;
} }
result = (*env)->NewByteArray(env, size + 1); } else {
if (result != NULL) { JNU_ThrowOutOfMemoryError(env, "native memory allocation failed");
(*env)->SetByteArrayRegion(env, result, 0, size + 1, buffer); (*env)->ReleaseByteArrayElements(env, valueName, valueNameStr, 0);
} return NULL;
free(buffer); }
return result;
} jbyteArray result;
if (valueType == REG_SZ) {
result = (*env)->NewByteArray(env, valueSize);
if (result != NULL) {
(*env)->SetByteArrayRegion(env, result, 0, valueSize, buffer);
}
} else {
result = NULL;
}
free(buffer);
(*env)->ReleaseByteArrayElements(env, valueName, valueNameStr, 0);
return result;
}
JNIEXPORT jint JNICALL
Java_java_util_prefs_WindowsPreferences_WindowsRegSetValueEx(JNIEnv* env,
jclass this_class, jlong hKey, jbyteArray valueName, jbyteArray data) {
if ((valueName == NULL) || (data == NULL)) {
return -1;
}
int size = (*env)->GetArrayLength(env, data);
char* dataStr = (*env)->GetByteArrayElements(env, data, NULL);
CHECK_NULL_RETURN(dataStr, -1);
char* valueNameStr = (*env)->GetByteArrayElements(env, valueName, NULL);
int error_code = -1;
if (valueNameStr != NULL) {
error_code = RegSetValueEx((HKEY) hKey, valueNameStr, 0,
REG_SZ, dataStr, size);
(*env)->ReleaseByteArrayElements(env, valueName, valueNameStr, 0);
}
(*env)->ReleaseByteArrayElements(env, data, dataStr, 0);
return error_code;
}
JNIEXPORT jint JNICALL
Java_java_util_prefs_WindowsPreferences_WindowsRegDeleteValue(JNIEnv* env,
jclass this_class, jlong hKey, jbyteArray valueName) {
if (valueName == NULL) {
return -1;
}
char* valueNameStr = (*env)->GetByteArrayElements(env, valueName, NULL);
CHECK_NULL_RETURN(valueNameStr, -1);
int error_code = RegDeleteValue((HKEY) hKey, valueNameStr);
(*env)->ReleaseByteArrayElements(env, valueName, valueNameStr, 0);
return error_code;
}
JNIEXPORT jlongArray JNICALL
Java_java_util_prefs_WindowsPreferences_WindowsRegQueryInfoKey(JNIEnv* env,
jclass this_class, jlong hKey) {
int subKeysNumber;
int maxSubKeyLength;
int valuesNumber;
int maxValueNameLength;
int errorCode = RegQueryInfoKey((HKEY) hKey, NULL, NULL, NULL,
&subKeysNumber, &maxSubKeyLength, NULL,
&valuesNumber, &maxValueNameLength,
NULL, NULL, NULL);
jlong tmp[5];
tmp[0] = subKeysNumber;
tmp[1] = errorCode;
tmp[2] = valuesNumber;
tmp[3] = maxSubKeyLength;
tmp[4] = maxValueNameLength;
jintArray result = (*env)->NewLongArray(env, 5);
if (result != NULL) {
(*env)->SetLongArrayRegion(env, result, 0, 5, tmp);
}
return result;
}
JNIEXPORT jbyteArray JNICALL
Java_java_util_prefs_WindowsPreferences_WindowsRegEnumKeyEx(JNIEnv* env,
jclass this_class, jlong hKey, jint subKeyIndex, jint maxKeyLength) {
int size = maxKeyLength;
char* buffer = (char*) malloc(maxKeyLength);
if (buffer == NULL) {
JNU_ThrowOutOfMemoryError(env, "native memory allocation failed");
return NULL;
}
if (RegEnumKeyEx((HKEY) hKey, subKeyIndex, buffer, &size, NULL, NULL,
NULL, NULL) != ERROR_SUCCESS) {
free(buffer);
return NULL;
}
jbyteArray result = (*env)->NewByteArray(env, size + 1);
if (result != NULL) {
(*env)->SetByteArrayRegion(env, result, 0, size + 1, buffer);
}
free(buffer);
return result;
}
JNIEXPORT jbyteArray JNICALL
Java_java_util_prefs_WindowsPreferences_WindowsRegEnumValue(JNIEnv* env,
jclass this_class, jlong hKey, jint valueIndex, jint maxValueNameLength) {
int size = maxValueNameLength;
char* buffer = (char*) malloc(maxValueNameLength);
if (buffer == NULL) {
JNU_ThrowOutOfMemoryError(env, "native memory allocation failed");
return NULL;
}
int error_code = RegEnumValue((HKEY) hKey, valueIndex, buffer,
&size, NULL, NULL, NULL, NULL);
if (error_code != ERROR_SUCCESS) {
free(buffer);
return NULL;
}
jbyteArray result = (*env)->NewByteArray(env, size + 1);
if (result != NULL) {
(*env)->SetByteArrayRegion(env, result, 0, size + 1, buffer);
}
free(buffer);
return result;
}
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -1696,6 +1696,11 @@ public class JavacParser implements Parser {
if (lambdaClassifier.diagFragment != null) { if (lambdaClassifier.diagFragment != null) {
log.error(DiagnosticFlag.SYNTAX, pos, Errors.InvalidLambdaParameterDeclaration(lambdaClassifier.diagFragment)); log.error(DiagnosticFlag.SYNTAX, pos, Errors.InvalidLambdaParameterDeclaration(lambdaClassifier.diagFragment));
} }
for (JCVariableDecl param: params) {
if (param.vartype != null && isRestrictedLocalVarTypeName(param.vartype)) {
param.vartype = null;
}
}
} }
return lambdaExpressionOrStatementRest(params, pos); return lambdaExpressionOrStatementRest(params, pos);
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -92,7 +92,7 @@ void ThrowException(JNIEnv *env, const char *exceptionName, DWORD dwError)
* Overloaded 'operator new[]' variant, which will raise Java's * Overloaded 'operator new[]' variant, which will raise Java's
* OutOfMemoryError in the case of a failure. * OutOfMemoryError in the case of a failure.
*/ */
static void* operator new[](std::size_t size, JNIEnv *env) void* operator new[](std::size_t size, JNIEnv *env)
{ {
void* buf = ::operator new[](size, std::nothrow); void* buf = ::operator new[](size, std::nothrow);
if (buf == NULL) { if (buf == NULL) {
@ -1356,212 +1356,6 @@ JNIEXPORT void JNICALL Java_sun_security_mscapi_KeyStore_destroyKeyContainer
} }
} }
/*
* Class: sun_security_mscapi_RSACipher
* Method: findCertificateUsingAlias
* Signature: (Ljava/lang/String;Ljava/lang/String;)J
*/
JNIEXPORT jlong JNICALL Java_sun_security_mscapi_RSACipher_findCertificateUsingAlias
(JNIEnv *env, jobject obj, jstring jCertStoreName, jstring jCertAliasName)
{
const char* pszCertStoreName = NULL;
const char* pszCertAliasName = NULL;
HCERTSTORE hCertStore = NULL;
PCCERT_CONTEXT pCertContext = NULL;
char* pszNameString = NULL; // certificate's friendly name
DWORD cchNameString = 0;
__try
{
if ((pszCertStoreName = env->GetStringUTFChars(jCertStoreName, NULL))
== NULL) {
__leave;
}
if ((pszCertAliasName = env->GetStringUTFChars(jCertAliasName, NULL))
== NULL) {
__leave;
}
// Open a system certificate store.
if ((hCertStore = ::CertOpenSystemStore(NULL, pszCertStoreName)) == NULL) {
ThrowException(env, KEYSTORE_EXCEPTION, GetLastError());
__leave;
}
// Use CertEnumCertificatesInStore to get the certificates
// from the open store. pCertContext must be reset to
// NULL to retrieve the first certificate in the store.
while (pCertContext = ::CertEnumCertificatesInStore(hCertStore, pCertContext))
{
if ((cchNameString = ::CertGetNameString(pCertContext,
CERT_NAME_FRIENDLY_DISPLAY_TYPE, 0, NULL, NULL, 0)) == 1) {
continue; // not found
}
pszNameString = new (env) char[cchNameString];
if (pszNameString == NULL) {
__leave;
}
if (::CertGetNameString(pCertContext,
CERT_NAME_FRIENDLY_DISPLAY_TYPE, 0, NULL, pszNameString,
cchNameString) == 1) {
continue; // not found
}
// Compare the certificate's friendly name with supplied alias name
if (strcmp(pszCertAliasName, pszNameString) == 0) {
delete [] pszNameString;
break;
} else {
delete [] pszNameString;
}
}
}
__finally
{
if (hCertStore)
::CertCloseStore(hCertStore, 0);
if (pszCertStoreName)
env->ReleaseStringUTFChars(jCertStoreName, pszCertStoreName);
if (pszCertAliasName)
env->ReleaseStringUTFChars(jCertAliasName, pszCertAliasName);
}
return (jlong) pCertContext;
}
/*
* Class: sun_security_mscapi_RSACipher
* Method: getKeyFromCert
* Signature: (JZ)J
*/
JNIEXPORT jlong JNICALL Java_sun_security_mscapi_RSACipher_getKeyFromCert
(JNIEnv *env, jobject obj, jlong pCertContext, jboolean usePrivateKey)
{
HCRYPTPROV hCryptProv = NULL;
HCRYPTKEY hKey = NULL;
DWORD dwKeySpec;
BOOL bCallerFreeProv = FALSE;
BOOL bRes;
__try
{
if (usePrivateKey == JNI_TRUE) {
// Locate the key container for the certificate's private key
// First, probe it silently
bRes = ::CryptAcquireCertificatePrivateKey(
(PCCERT_CONTEXT) pCertContext, CRYPT_ACQUIRE_SILENT_FLAG,
NULL, &hCryptProv, &dwKeySpec, &bCallerFreeProv);
if (bRes == FALSE && GetLastError() != NTE_SILENT_CONTEXT)
{
ThrowException(env, KEYSTORE_EXCEPTION, GetLastError());
__leave;
}
if (bCallerFreeProv == TRUE) {
::CryptReleaseContext(hCryptProv, NULL);
bCallerFreeProv = FALSE;
}
// Now, do it normally (not silently)
if (::CryptAcquireCertificatePrivateKey(
(PCCERT_CONTEXT) pCertContext, 0, NULL, &hCryptProv,
&dwKeySpec, &bCallerFreeProv) == FALSE)
{
ThrowException(env, KEYSTORE_EXCEPTION, GetLastError());
__leave;
}
// Get a handle to the private key
if (::CryptGetUserKey(hCryptProv, dwKeySpec, &hKey) == FALSE) {
ThrowException(env, KEY_EXCEPTION, GetLastError());
__leave;
}
}
else // use public key
{
bCallerFreeProv = TRUE;
// Acquire a CSP context.
if (::CryptAcquireContext(&hCryptProv, "J2SE", NULL,
PROV_RSA_FULL, 0) == FALSE)
{
// If CSP context hasn't been created, create one.
//
if (::CryptAcquireContext(&hCryptProv, "J2SE", NULL,
PROV_RSA_FULL, CRYPT_NEWKEYSET) == FALSE)
{
ThrowException(env, KEYSTORE_EXCEPTION, GetLastError());
__leave;
}
}
// Import the certificate's public key into the key container
if (::CryptImportPublicKeyInfo(hCryptProv, X509_ASN_ENCODING,
&(((PCCERT_CONTEXT) pCertContext)->pCertInfo->SubjectPublicKeyInfo),
&hKey) == FALSE)
{
ThrowException(env, KEY_EXCEPTION, GetLastError());
__leave;
}
}
}
__finally
{
//--------------------------------------------------------------------
// Clean up.
if (bCallerFreeProv == TRUE && hCryptProv != NULL)
::CryptReleaseContext(hCryptProv, 0);
}
return hKey; // TODO - when finished with this key, call
// CryptDestroyKey(hKey)
}
/*
* Class: sun_security_mscapi_KeyStore
* Method: getKeyLength
* Signature: (J)I
*/
JNIEXPORT jint JNICALL Java_sun_security_mscapi_KeyStore_getKeyLength
(JNIEnv *env, jobject obj, jlong hKey)
{
DWORD dwDataLen = sizeof(DWORD);
BYTE pbData[sizeof(DWORD)];
DWORD length = 0;
__try
{
// Get key length (in bits)
//TODO - may need to use KP_BLOCKLEN instead?
if (!(::CryptGetKeyParam((HCRYPTKEY) hKey, KP_KEYLEN, (BYTE *)pbData, &dwDataLen,
0))) {
ThrowException(env, KEY_EXCEPTION, GetLastError());
__leave;
}
length = (DWORD) pbData;
}
__finally
{
// no cleanup required
}
return (jint) length;
}
/* /*
* Class: sun_security_mscapi_RSACipher * Class: sun_security_mscapi_RSACipher
* Method: encryptDecrypt * Method: encryptDecrypt
@ -1804,38 +1598,47 @@ JNIEXPORT jbyteArray JNICALL Java_sun_security_mscapi_RSAPublicKey_getModulus
* Convert an array in big-endian byte order into little-endian byte order. * Convert an array in big-endian byte order into little-endian byte order.
*/ */
int convertToLittleEndian(JNIEnv *env, jbyteArray source, jbyte* destination, int convertToLittleEndian(JNIEnv *env, jbyteArray source, jbyte* destination,
int destinationLength) { int destinationLength) {
int sourceLength = env->GetArrayLength(source); int result = -1;
jbyte* sourceBytes = NULL;
jbyte* sourceBytes = env->GetByteArrayElements(source, 0); __try {
if (sourceBytes == NULL) { int sourceLength = env->GetArrayLength(source);
return -1;
}
int copyLen = sourceLength; sourceBytes = env->GetByteArrayElements(source, 0);
if (sourceLength > destinationLength) { if (sourceBytes == NULL) {
// source might include an extra sign byte __leave;
if (sourceLength == destinationLength + 1 && sourceBytes[0] == 0) { }
copyLen--;
} else { int copyLen = sourceLength;
return -1; if (sourceLength > destinationLength) {
// source might include an extra sign byte
if (sourceLength == destinationLength + 1 && sourceBytes[0] == 0) {
copyLen--;
} else {
__leave;
}
}
// Copy bytes from the end of the source array to the beginning of the
// destination array (until the destination array is full).
// This ensures that the sign byte from the source array will be excluded.
for (int i = 0; i < copyLen; i++) {
destination[i] = sourceBytes[sourceLength - 1 - i];
}
if (copyLen < destinationLength) {
memset(destination + copyLen, 0, destinationLength - copyLen);
}
result = destinationLength;
} __finally {
// Clean up.
if (sourceBytes) {
env->ReleaseByteArrayElements(source, sourceBytes, JNI_ABORT);
} }
} }
// Copy bytes from the end of the source array to the beginning of the return result;
// destination array (until the destination array is full).
// This ensures that the sign byte from the source array will be excluded.
for (int i = 0; i < copyLen; i++) {
destination[i] = sourceBytes[sourceLength - 1 - i];
}
if (copyLen < destinationLength) {
memset(destination + copyLen, 0, destinationLength - copyLen);
}
env->ReleaseByteArrayElements(source, sourceBytes, JNI_ABORT);
return destinationLength;
} }
/* /*

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -395,7 +395,6 @@ class ServerImpl implements TimeSource {
} else { } else {
try { try {
if (key.isReadable()) { if (key.isReadable()) {
boolean closed;
SocketChannel chan = (SocketChannel)key.channel(); SocketChannel chan = (SocketChannel)key.channel();
HttpConnection conn = (HttpConnection)key.attachment(); HttpConnection conn = (HttpConnection)key.attachment();
@ -437,7 +436,6 @@ class ServerImpl implements TimeSource {
} }
public void handle (SocketChannel chan, HttpConnection conn) public void handle (SocketChannel chan, HttpConnection conn)
throws IOException
{ {
try { try {
Exchange t = new Exchange (chan, protocol, conn); Exchange t = new Exchange (chan, protocol, conn);
@ -448,6 +446,9 @@ class ServerImpl implements TimeSource {
} catch (IOException e) { } catch (IOException e) {
logger.log (Level.TRACE, "Dispatcher (5)", e); logger.log (Level.TRACE, "Dispatcher (5)", e);
closeConnection(conn); closeConnection(conn);
} catch (Throwable e) {
logger.log (Level.TRACE, "Dispatcher (6)", e);
closeConnection(conn);
} }
} }
} }

View File

@ -307,8 +307,7 @@ public class HtmlConfiguration extends BaseConfiguration {
} }
if (htmlVersion == null) { if (htmlVersion == null) {
reporter.print(WARNING, getText("doclet.HTML_version_not_specified", helpfile)); htmlVersion = HtmlVersion.HTML5;
htmlVersion = HtmlVersion.HTML4;
} }
// check if helpfile exists // check if helpfile exists
@ -658,6 +657,7 @@ public class HtmlConfiguration extends BaseConfiguration {
new Option(resources, "-html4") { new Option(resources, "-html4") {
@Override @Override
public boolean process(String opt, List<String> args) { public boolean process(String opt, List<String> args) {
reporter.print(WARNING, getText("doclet.HTML_4_specified", helpfile));
htmlVersion = HtmlVersion.HTML4; htmlVersion = HtmlVersion.HTML4;
return true; return true;
} }

View File

@ -445,9 +445,8 @@ doclet.usage.xdoclint-package.description=\
disable checks for the specified packages. disable checks for the specified packages.
# L10N: do not localize the option names -html4 and -html5 # L10N: do not localize the option names -html4 and -html5
doclet.HTML_version_not_specified=\ doclet.HTML_4_specified=\
You have not specified the version of HTML to use.\n\ You have specified the HTML version as HTML 4.01 by using the -html4 option.\n\
The default is currently HTML 4.01, but this will change to HTML5\n\ The default is currently HTML5 and the support for HTML 4.01 will be removed\n\
in a future release. To suppress this warning, please specify the\n\ in a future release. To suppress this warning, please ensure that any HTML constructs\n\
version of HTML used in your documentation comments and to be\n\ in your comments are valid in HTML5, and remove the -html4 option.
generated by this doclet, using the -html4 or -html5 options.

View File

@ -101,7 +101,7 @@ public final class Label implements Serializable {
} }
/** /**
* Retrieve the top <tt>count</tt> types on the stack without modifying it. * Retrieve the top <code>count</code> types on the stack without modifying it.
* *
* @param count number of types to return * @param count number of types to return
* @return array of Types * @return array of Types

View File

@ -2057,7 +2057,7 @@ public class MethodEmitter {
} }
/** /**
* Retrieve the top <tt>count</tt> types on the stack without modifying it. * Retrieve the top <code>count</code> types on the stack without modifying it.
* *
* @param count number of types to return * @param count number of types to return
* @return array of Types * @return array of Types

View File

@ -257,7 +257,7 @@ public class Block extends Node implements BreakableNode, Terminal, Flags<Block>
} }
/** /**
* Test if this block represents a <tt>catch</tt> block in a <tt>try</tt> statement. * Test if this block represents a <code>catch</code> block in a <code>try</code> statement.
* This is used by the Splitter as catch blocks are not be subject to splitting. * This is used by the Splitter as catch blocks are not be subject to splitting.
* *
* @return true if this block represents a catch block in a try statement. * @return true if this block represents a catch block in a try statement.

View File

@ -41,7 +41,7 @@ import java.util.Locale;
* of different formats. * of different formats.
* *
* <p>This class is neither thread-safe nor reusable. Calling the * <p>This class is neither thread-safe nor reusable. Calling the
* <tt>parse()</tt> method more than once will yield undefined results.</p> * <code>parse()</code> method more than once will yield undefined results.</p>
*/ */
public class DateParser { public class DateParser {
@ -118,7 +118,7 @@ public class DateParser {
} }
/** /**
* Construct a new <tt>DateParser</tt> instance for parsing the given string. * Construct a new <code>DateParser</code> instance for parsing the given string.
* @param string the string to be parsed * @param string the string to be parsed
*/ */
public DateParser(final String string) { public DateParser(final String string) {
@ -130,7 +130,7 @@ public class DateParser {
/** /**
* Try parsing the given string as date according to the extended ISO 8601 format * Try parsing the given string as date according to the extended ISO 8601 format
* specified in ES5 15.9.1.15. Fall back to legacy mode if that fails. * specified in ES5 15.9.1.15. Fall back to legacy mode if that fails.
* This method returns <tt>true</tt> if the string could be parsed. * This method returns <code>true</code> if the string could be parsed.
* @return true if the string could be parsed as date * @return true if the string could be parsed as date
*/ */
public boolean parse() { public boolean parse() {
@ -143,8 +143,8 @@ public class DateParser {
* *
* <pre> [('-'|'+')yy]yyyy[-MM[-dd]][Thh:mm[:ss[.sss]][Z|(+|-)hh:mm]] </pre> * <pre> [('-'|'+')yy]yyyy[-MM[-dd]][Thh:mm[:ss[.sss]][Z|(+|-)hh:mm]] </pre>
* *
* <p>If the string does not contain a time zone offset, the <tt>TIMEZONE</tt> field * <p>If the string does not contain a time zone offset, the <code>TIMEZONE</code> field
* is set to <tt>0</tt> (GMT).</p> * is set to <code>0</code> (GMT).</p>
* @return true if string represents a valid ES5 date string. * @return true if string represents a valid ES5 date string.
*/ */
public boolean parseEcmaDate() { public boolean parseEcmaDate() {
@ -221,14 +221,14 @@ public class DateParser {
/** /**
* Try parsing the date using a fuzzy algorithm that can handle a variety of formats. * Try parsing the date using a fuzzy algorithm that can handle a variety of formats.
* *
* <p>Numbers separated by <tt>':'</tt> are treated as time values, optionally followed by a * <p>Numbers separated by <code>':'</code> are treated as time values, optionally followed by a
* millisecond value separated by <tt>'.'</tt>. Other number values are treated as date values. * millisecond value separated by <code>'.'</code>. Other number values are treated as date values.
* The exact sequence of day, month, and year values to apply is determined heuristically.</p> * The exact sequence of day, month, and year values to apply is determined heuristically.</p>
* *
* <p>English month names and selected time zone names as well as AM/PM markers are recognized * <p>English month names and selected time zone names as well as AM/PM markers are recognized
* and handled properly. Additionally, numeric time zone offsets such as <tt>(+|-)hh:mm</tt> or * and handled properly. Additionally, numeric time zone offsets such as <code>(+|-)hh:mm</code> or
* <tt>(+|-)hhmm</tt> are recognized. If the string does not contain a time zone offset * <code>(+|-)hhmm</code> are recognized. If the string does not contain a time zone offset
* the <tt>TIMEZONE</tt>field is left undefined, meaning the local time zone should be applied.</p> * the <code>TIMEZONE</code>field is left undefined, meaning the local time zone should be applied.</p>
* *
* <p>English weekday names are recognized but ignored. All text in parentheses is ignored as well. * <p>English weekday names are recognized but ignored. All text in parentheses is ignored as well.
* All other text causes parsing to fail.</p> * All other text causes parsing to fail.</p>
@ -331,10 +331,10 @@ public class DateParser {
} }
/** /**
* Get the parsed date and time fields as an array of <tt>Integers</tt>. * Get the parsed date and time fields as an array of <code>Integers</code>.
* *
* <p>If parsing was successful, all fields are guaranteed to be set except for the * <p>If parsing was successful, all fields are guaranteed to be set except for the
* <tt>TIMEZONE</tt> field which may be <tt>null</tt>, meaning that local time zone * <code>TIMEZONE</code> field which may be <code>null</code>, meaning that local time zone
* offset should be applied.</p> * offset should be applied.</p>
* *
* @return the parsed date fields * @return the parsed date fields

View File

@ -592,7 +592,7 @@ public class Lexer extends Scanner {
/** /**
* Check whether the given token represents the beginning of a literal. If so scan * Check whether the given token represents the beginning of a literal. If so scan
* the literal and return <tt>true</tt>, otherwise return false. * the literal and return <code>true</code>, otherwise return false.
* *
* @param token the token. * @param token the token.
* @param startTokenType the token type. * @param startTokenType the token type.

View File

@ -32,7 +32,7 @@ import java.util.Deque;
/** /**
* This class represents a string composed of two parts which may themselves be * This class represents a string composed of two parts which may themselves be
* instances of <tt>ConsString</tt> or {@link String}. Copying of characters to * instances of <code>ConsString</code> or {@link String}. Copying of characters to
* a proper string is delayed until it becomes necessary. * a proper string is delayed until it becomes necessary.
*/ */
public final class ConsString implements CharSequence { public final class ConsString implements CharSequence {

View File

@ -60,15 +60,15 @@ package jdk.nashorn.internal.runtime.linker;
* Dangerous characters are the union of all characters forbidden * Dangerous characters are the union of all characters forbidden
* or otherwise restricted by the JVM specification, * or otherwise restricted by the JVM specification,
* plus their mates, if they are brackets * plus their mates, if they are brackets
* (<code><big><b>[</b></big></code> and <code><big><b>]</b></big></code>, * (<code><b>[</b></code> and <code><b>]</b></code>,
* <code><big><b>&lt;</b></big></code> and <code><big><b>&gt;</b></big></code>), * <code><b>&lt;</b></code> and <code><b>&gt;</b></code>),
* plus, arbitrarily, the colon character <code><big><b>:</b></big></code>. * plus, arbitrarily, the colon character <code><b>:</b></code>.
* There is no distinction between type, method, and field names. * There is no distinction between type, method, and field names.
* This makes it easier to convert between mangled names of different * This makes it easier to convert between mangled names of different
* types, since they do not need to be decoded (demangled). * types, since they do not need to be decoded (demangled).
* </p> * </p>
* <p> * <p>
* The escape character is backslash <code><big><b>\</b></big></code> * The escape character is backslash <code><b>\</b></code>
* (also known as reverse solidus). * (also known as reverse solidus).
* This character is, until now, unheard of in bytecode names, * This character is, until now, unheard of in bytecode names,
* but traditional in the proposed role. * but traditional in the proposed role.
@ -92,32 +92,32 @@ package jdk.nashorn.internal.runtime.linker;
* </p> * </p>
* <p> * <p>
* The dangerous characters are * The dangerous characters are
* <code><big><b>/</b></big></code> (forward slash, used to delimit package components), * <code><b>/</b></code> (forward slash, used to delimit package components),
* <code><big><b>.</b></big></code> (dot, also a package delimiter), * <code><b>.</b></code> (dot, also a package delimiter),
* <code><big><b>;</b></big></code> (semicolon, used in signatures), * <code><b>;</b></code> (semicolon, used in signatures),
* <code><big><b>$</b></big></code> (dollar, used in inner classes and synthetic members), * <code><b>$</b></code> (dollar, used in inner classes and synthetic members),
* <code><big><b>&lt;</b></big></code> (left angle), * <code><b>&lt;</b></code> (left angle),
* <code><big><b>&gt;</b></big></code> (right angle), * <code><b>&gt;</b></code> (right angle),
* <code><big><b>[</b></big></code> (left square bracket, used in array types), * <code><b>[</b></code> (left square bracket, used in array types),
* <code><big><b>]</b></big></code> (right square bracket, reserved in this scheme for language use), * <code><b>]</b></code> (right square bracket, reserved in this scheme for language use),
* and <code><big><b>:</b></big></code> (colon, reserved in this scheme for language use). * and <code><b>:</b></code> (colon, reserved in this scheme for language use).
* Their replacements are, respectively, * Their replacements are, respectively,
* <code><big><b>|</b></big></code> (vertical bar), * <code><b>|</b></code> (vertical bar),
* <code><big><b>,</b></big></code> (comma), * <code><b>,</b></code> (comma),
* <code><big><b>?</b></big></code> (question mark), * <code><b>?</b></code> (question mark),
* <code><big><b>%</b></big></code> (percent), * <code><b>%</b></code> (percent),
* <code><big><b>^</b></big></code> (caret), * <code><b>^</b></code> (caret),
* <code><big><b>_</b></big></code> (underscore), and * <code><b>_</b></code> (underscore), and
* <code><big><b>{</b></big></code> (left curly bracket), * <code><b>{</b></code> (left curly bracket),
* <code><big><b>}</b></big></code> (right curly bracket), * <code><b>}</b></code> (right curly bracket),
* <code><big><b>!</b></big></code> (exclamation mark). * <code><b>!</b></code> (exclamation mark).
* In addition, the replacement character for the escape character itself is * In addition, the replacement character for the escape character itself is
* <code><big><b>-</b></big></code> (hyphen), * <code><b>-</b></code> (hyphen),
* and the replacement character for the null prefix is * and the replacement character for the null prefix is
* <code><big><b>=</b></big></code> (equal sign). * <code><b>=</b></code> (equal sign).
* </p> * </p>
* <p> * <p>
* An escape character <code><big><b>\</b></big></code> * An escape character <code><b>\</b></code>
* followed by any of these replacement characters * followed by any of these replacement characters
* is an escape sequence, and there are no other escape sequences. * is an escape sequence, and there are no other escape sequences.
* An equal sign is only part of an escape sequence * An equal sign is only part of an escape sequence
@ -135,16 +135,16 @@ package jdk.nashorn.internal.runtime.linker;
* string can contain <cite>accidental escapes</cite>, apparent escape * string can contain <cite>accidental escapes</cite>, apparent escape
* sequences which must not be interpreted as manglings. * sequences which must not be interpreted as manglings.
* These are disabled by replacing their leading backslash with an * These are disabled by replacing their leading backslash with an
* escape sequence (<code><big><b>\-</b></big></code>). To mangle a string, three logical steps * escape sequence (<code><b>\-</b></code>). To mangle a string, three logical steps
* are required, though they may be carried out in one pass: * are required, though they may be carried out in one pass:
* </p> * </p>
* <ol> * <ol>
* <li>In each accidental escape, replace the backslash with an escape sequence * <li>In each accidental escape, replace the backslash with an escape sequence
* (<code><big><b>\-</b></big></code>).</li> * (<code><b>\-</b></code>).</li>
* <li>Replace each dangerous character with an escape sequence * <li>Replace each dangerous character with an escape sequence
* (<code><big><b>\|</b></big></code> for <code><big><b>/</b></big></code>, etc.).</li> * (<code><b>\|</b></code> for <code><b>/</b></code>, etc.).</li>
* <li>If the first two steps introduced any change, <em>and</em> * <li>If the first two steps introduced any change, <em>and</em>
* if the string does not already begin with a backslash, prepend a null prefix (<code><big><b>\=</b></big></code>).</li> * if the string does not already begin with a backslash, prepend a null prefix (<code><b>\=</b></code>).</li>
* </ol> * </ol>
* *
* To demangle a mangled string that begins with an escape, * To demangle a mangled string that begins with an escape,
@ -174,9 +174,9 @@ package jdk.nashorn.internal.runtime.linker;
* is a many-to-one function. * is a many-to-one function.
* A mangled string is defined as <cite>validly mangled</cite> if * A mangled string is defined as <cite>validly mangled</cite> if
* it is in fact the unique mangling of its spelling string. * it is in fact the unique mangling of its spelling string.
* Three examples of invalidly mangled strings are <code><big><b>\=foo</b></big></code>, * Three examples of invalidly mangled strings are <code><b>\=foo</b></code>,
* <code><big><b>\-bar</b></big></code>, and <code><big><b>baz\!</b></big></code>, which demangle to <code><big><b>foo</b></big></code>, <code><big><b>\bar</b></big></code>, and * <code><b>\-bar</b></code>, and <code><b>baz\!</b></code>, which demangle to <code><b>foo</b></code>, <code><b>\bar</b></code>, and
* <code><big><b>baz\!</b></big></code>, but then remangle to <code><big><b>foo</b></big></code>, <code><big><b>\bar</b></big></code>, and <code><big><b>\=baz\-!</b></big></code>. * <code><b>baz\!</b></code>, but then remangle to <code><b>foo</b></code>, <code><b>\bar</b></code>, and <code><b>\=baz\-!</b></code>.
* If a language back-end or runtime is using mangled names, * If a language back-end or runtime is using mangled names,
* it should never present an invalidly mangled bytecode * it should never present an invalidly mangled bytecode
* name to the JVM. If the runtime encounters one, * name to the JVM. If the runtime encounters one,
@ -237,10 +237,10 @@ package jdk.nashorn.internal.runtime.linker;
* </p> * </p>
* <p> * <p>
* For example, an HTML-like spelling * For example, an HTML-like spelling
* <code><big><b>&lt;pre&gt;</b></big></code> mangles to * <code><b>&lt;pre&gt;</b></code> mangles to
* <code><big><b>\^pre\_</b></big></code> and could * <code><b>\^pre\_</b></code> and could
* display more cleanly as * display more cleanly as
* <code><big><b>'&lt;pre&gt;'</b></big></code>, * <code><b>'&lt;pre&gt;'</b></code>,
* with the quotes included. * with the quotes included.
* Such string-like conventions are <em>not</em> suitable * Such string-like conventions are <em>not</em> suitable
* for mangled bytecode names, in part because * for mangled bytecode names, in part because
@ -256,11 +256,11 @@ package jdk.nashorn.internal.runtime.linker;
* which contain dangerous characters (like dots in field * which contain dangerous characters (like dots in field
* names or brackets in method names) should not be * names or brackets in method names) should not be
* simply quoted. The bytecode names * simply quoted. The bytecode names
* <code><big><b>\=phase\,1</b></big></code> and * <code><b>\=phase\,1</b></code> and
* <code><big><b>phase.1</b></big></code> are distinct, * <code><b>phase.1</b></code> are distinct,
* and in demangled displays they should be presented as * and in demangled displays they should be presented as
* <code><big><b>'phase.1'</b></big></code> and something like * <code><b>'phase.1'</b></code> and something like
* <code><big><b>'phase'.1</b></big></code>, respectively. * <code><b>'phase'.1</b></code>, respectively.
* </p> * </p>
*/ */
public final class NameCodec { public final class NameCodec {

View File

@ -34,6 +34,9 @@ JTREG_VM_TYPE ?= -agentvm
USE_JTREG_ASSERT ?= true USE_JTREG_ASSERT ?= true
LIMIT_JTREG_VM_MEMORY ?= true LIMIT_JTREG_VM_MEMORY ?= true
X:=
SPACE:=$(X) $(X)
.DEFAULT : all .DEFAULT : all
# Empty these to get rid of some default rules # Empty these to get rid of some default rules
@ -87,6 +90,11 @@ else
endif endif
endif endif
# convert list of directories to dos paths
define MixedDirs
$(foreach i,$1,$(shell $(GETMIXEDPATH) "${i}"))
endef
ifdef ALT_SLASH_JAVA ifdef ALT_SLASH_JAVA
SLASH_JAVA = $(ALT_SLASH_JAVA) SLASH_JAVA = $(ALT_SLASH_JAVA)
endif endif
@ -124,6 +132,19 @@ ifndef PRODUCT_HOME
PRODUCT_HOME := $(PRODUCT_HOME) PRODUCT_HOME := $(PRODUCT_HOME)
endif endif
# On Windows, setup the _NT_SYMBOL_PATH if possible.
ifeq ($(PLATFORM), windows)
ifndef _NT_SYMBOL_PATH
ifdef PRODUCT_SYMBOLS_HOME
_NT_SYMBOL_PATH := \
$(subst $(SPACE),;,$(strip $(call MixedDirs, $(sort $(dir $(wildcard \
$(addprefix $(PRODUCT_SYMBOLS_HOME)/bin/, *.pdb */*.pdb)))))))
export _NT_SYMBOL_PATH
endif
endif
JTREG_BASIC_OPTIONS += -e:_NT_SYMBOL_PATH='$(_NT_SYMBOL_PATH)'
endif
# Expect JPRT to set JPRT_PRODUCT_ARGS (e.g. -server etc.) # Expect JPRT to set JPRT_PRODUCT_ARGS (e.g. -server etc.)
# Should be passed into 'java' only. # Should be passed into 'java' only.
# Could include: -d64 -server -client OR any java option # Could include: -d64 -server -client OR any java option
@ -334,11 +355,6 @@ else
JTREG_EXCLUSIONS = $(PROBLEM_LISTS:%=-exclude:%) JTREG_EXCLUSIONS = $(PROBLEM_LISTS:%=-exclude:%)
endif endif
# convert list of directories to dos paths
define MixedDirs
$(foreach i,$1,$(shell $(GETMIXEDPATH) "${i}"))
endef
# ------------------------------------------------------------------ # ------------------------------------------------------------------
# When called from JPRT the TESTDIRS variable is set to the jtreg tests to run # When called from JPRT the TESTDIRS variable is set to the jtreg tests to run

View File

@ -29,6 +29,7 @@ tier1 = \
:jdk_lang \ :jdk_lang \
:jdk_util \ :jdk_util \
:jdk_svc_sanity \ :jdk_svc_sanity \
:build_sanity \
sun/nio/cs/ISO8859x.java \ sun/nio/cs/ISO8859x.java \
java/nio/Buffer \ java/nio/Buffer \
com/sun/crypto/provider/Cipher \ com/sun/crypto/provider/Cipher \
@ -61,6 +62,10 @@ tier3 = \
# Other test definitions; generally smaller granularity than tiers # Other test definitions; generally smaller granularity than tiers
# #
# Build source checking
build_sanity = \
sanity/releaseFile
# java.lang package and VM runtime support # java.lang package and VM runtime support
jdk_lang = \ jdk_lang = \
java/lang \ java/lang \

View File

@ -0,0 +1,107 @@
/*
* Copyright (c) 2018, 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 8169358
* @summary HttpServer does not close client connection when RejectedExecutionException occurs.
*/
import com.sun.net.httpserver.HttpServer;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.MalformedURLException;
import java.net.SocketException;
import java.net.SocketTimeoutException;
import java.net.URL;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
import java.util.concurrent.RejectedExecutionException;
import java.util.logging.ConsoleHandler;
import java.util.logging.Handler;
import java.util.logging.Level;
import java.util.logging.Logger;
public class TaskRejectedTest {
private static final int BACKLOG = 0;
private static final String REQUEST_PATH = "/";
private static final int TIMEOUT = 10000; // 10 sec
private static void runClient(InetSocketAddress listenAddr)
throws MalformedURLException, IOException {
URL url = new URL("http", listenAddr.getHostString(),
listenAddr.getPort(), REQUEST_PATH);
HttpURLConnection con = (HttpURLConnection)url.openConnection();
con.setConnectTimeout(TIMEOUT);
con.setReadTimeout(TIMEOUT);
try {
con.connect();
con.getResponseCode();
} catch (SocketTimeoutException e) {
throw new RuntimeException("Connection was not closed by peer.", e);
} catch (SocketException e) {
// Expected (connection reset)
} finally {
con.disconnect();
}
}
public static void main(String[] args) throws Exception {
Logger logger = Logger.getLogger(
HttpServer.class.getPackage().getName());
Handler consoleHandler = new ConsoleHandler();
consoleHandler.setLevel(Level.FINEST);
logger.setLevel(Level.FINEST);
logger.addHandler(consoleHandler);
Executor executor = Executors.newSingleThreadExecutor(r -> {
throw new RejectedExecutionException("test");
});
InetSocketAddress addr = new InetSocketAddress(
InetAddress.getLoopbackAddress(), 0);
HttpServer httpServer = HttpServer.create(addr, BACKLOG);
httpServer.setExecutor(executor);
httpServer.createContext(REQUEST_PATH, exc -> {
exc.sendResponseHeaders(200, 0);
exc.close();
});
try {
httpServer.start();
runClient(httpServer.getAddress());
} finally {
httpServer.stop(0);
}
}
}

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -708,9 +708,9 @@ public class AsyncCloseAndInterrupt {
test(connectedSocketChannelFactory); test(connectedSocketChannelFactory);
if (TestUtil.onWindows()) { if (TestUtil.onWindows() || TestUtil.onSolaris()) {
log.println("WARNING Cannot reliably test connect/finishConnect" log.println("WARNING Cannot reliably test connect/finishConnect"
+ " operations on Windows"); + " operations on this platform");
} else { } else {
// Only the following tests need refuser's connection backlog // Only the following tests need refuser's connection backlog
// to be saturated // to be saturated

View File

@ -0,0 +1,143 @@
/*
* Copyright (c) 2018, 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 8198928
* @run main CloseDuringConnect
* @summary Attempt to cause a deadlock by closing a SocketChannel in one thread
* where another thread is closing the channel after a connect fail
*/
import java.io.IOException;
import java.io.UncheckedIOException;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
import java.nio.channels.SocketChannel;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.ScheduledExecutorService;
import java.util.stream.IntStream;
import static java.util.concurrent.TimeUnit.MILLISECONDS;
public class CloseDuringConnect {
// number of test iterations, needs to be 5-10 at least
static final int ITERATIONS = 50;
// maximum delay before closing SocketChannel, in milliseconds
static final int MAX_DELAY_BEFORE_CLOSE = 20;
/**
* Returns the socket address of an endpoint that refuses connections. The
* endpoint is an InetSocketAddress where the address is the loopback address
* and the port is a system port (1-1023 range).
*/
static SocketAddress refusingEndpoint() {
InetAddress lb = InetAddress.getLoopbackAddress();
int port = 1;
while (port < 1024) {
SocketAddress sa = new InetSocketAddress(lb, port);
try {
SocketChannel.open(sa).close();
} catch (IOException ioe) {
return sa;
}
port++;
}
throw new RuntimeException("Unable to find system port that is refusing connections");
}
/**
* Invoked by a task in the thread pool to connect to a remote address.
* The connection should never be established.
*/
static Void connect(SocketChannel sc, SocketAddress remote) {
try {
if (!sc.connect(remote)) {
while (!sc.finishConnect()) {
Thread.yield();
}
}
throw new RuntimeException("Connected, should not happen");
} catch (IOException expected) { }
if (sc.isConnected())
throw new RuntimeException("isConnected return true, should not happen");
return null;
}
/**
* Invoked by a task in the thread pool to close a socket channel.
*/
static Void close(SocketChannel sc) {
try {
sc.close();
} catch (IOException e) {
throw new UncheckedIOException("close failed", e);
}
return null;
}
/**
* Test for deadlock by submitting a task to connect to the given address
* while another task closes the socket channel.
* @param pool the thread pool to submit or schedule tasks
* @param remote the remote address, does not accept connections
* @param blocking socket channel blocking mode
* @param delay the delay, in millis, before closing the channel
*/
static void test(ScheduledExecutorService pool,
SocketAddress remote,
boolean blocking,
long delay) {
try {
SocketChannel sc = SocketChannel.open();
sc.configureBlocking(blocking);
Future<Void> r1 = pool.submit(() -> connect(sc, remote));
Future<Void> r2 = pool.schedule(() -> close(sc), delay, MILLISECONDS);
r1.get();
r2.get();
} catch (Throwable t) {
throw new RuntimeException("Test failed", t);
}
}
public static void main(String[] args) throws Exception {
SocketAddress refusing = refusingEndpoint();
ScheduledExecutorService pool = Executors.newScheduledThreadPool(2);
try {
IntStream.range(0, ITERATIONS).forEach(i -> {
System.out.format("Iteration %d ...%n", (i + 1));
// Execute the test for varying delays up to MAX_DELAY_BEFORE_CLOSE,
// for socket channels configured both blocking and non-blocking
IntStream.range(0, MAX_DELAY_BEFORE_CLOSE).forEach(delay -> {
test(pool, refusing, /*blocking mode*/true, delay);
test(pool, refusing, /*blocking mode*/false, delay);
});
});
} finally {
pool.shutdown();
}
}
}

View File

@ -1,6 +1,6 @@
/* /*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -24,9 +24,9 @@
/* /*
* @test * @test
* @bug 8192837 * @bug 8193660
* @summary Test to verify release file does not contain closed repo info if it's open bundle * @summary Check SOURCE line in "release" file for closedjdk
* @run main NegativeSOURCETest * @run main CheckSource
*/ */
import java.io.BufferedReader; import java.io.BufferedReader;
@ -35,14 +35,14 @@ import java.io.FileReader;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
public class NegativeSOURCETest { public class CheckSource {
NegativeSOURCETest(String dataFile) { CheckSource(String dataFile, boolean isOpenJDK) {
// Read data files // Read data files
readFile(dataFile); readFile(dataFile, isOpenJDK);
} }
private void readFile(String fileName) { private void readFile(String fileName, boolean isOpenJDK) {
String fishForSOURCE = null; String fishForSOURCE = null;
File file = new File(fileName); File file = new File(fileName);
@ -80,10 +80,26 @@ public class NegativeSOURCETest {
if (fishForSOURCE == null) { if (fishForSOURCE == null) {
throw new RuntimeException("SOURCE line was not found!"); throw new RuntimeException("SOURCE line was not found!");
} else { } else {
// OK it was found, did it have closed/open in it? // OK it was found, did it have correct sources?
if (fishForSOURCE.contains("closed") || fishForSOURCE.contains("open")) { System.out.println("The source string found: " + fishForSOURCE);
System.out.println("The offending string: " + fishForSOURCE);
throw new RuntimeException("The test failed, closed/open found!"); // First it MUST have .: regardless of closed or openJDK
if (!fishForSOURCE.contains(".:")) {
throw new RuntimeException("The test failed, .: not found!");
}
// take out the .: source path
fishForSOURCE = fishForSOURCE.replace(".:", "");
// if its closedJDK it MUST have open:
if (!isOpenJDK && !fishForSOURCE.contains("open:")) {
throw new RuntimeException("The test failed, open: not found!");
}
// take out the open: source path
fishForSOURCE = fishForSOURCE.replace("open:", "");
// if any other source exists, that's an error
if (fishForSOURCE.contains(":")) {
throw new RuntimeException("The test failed, additional sources found!");
} }
} }
@ -98,9 +114,7 @@ public class NegativeSOURCETest {
System.out.println("JDK Path : " + jdkPath); System.out.println("JDK Path : " + jdkPath);
System.out.println("Runtime Name : " + runtime); System.out.println("Runtime Name : " + runtime);
if (runtime.contains("OpenJDK")) new CheckSource(jdkPath + "/release",
new NegativeSOURCETest(jdkPath + "/release"); runtime.contains("OpenJDK"));
else
System.out.println("Test skipped: not an OpenJDK build.");
} }
} }

View File

@ -42,6 +42,7 @@
import java.io.InputStream; import java.io.InputStream;
import java.io.OutputStream; import java.io.OutputStream;
import java.security.MessageDigest;
import java.security.Security; import java.security.Security;
import javax.net.ssl.SSLSocket; import javax.net.ssl.SSLSocket;
@ -49,6 +50,7 @@ public class HandshakeHashCloneExhaustion extends SSLSocketTemplate {
private static String[] protocol; private static String[] protocol;
private static String[] ciphersuite; private static String[] ciphersuite;
private static String[] mds = { "SHA", "MD5", "SHA-256" };
/* /*
* ================== * ==================
@ -57,6 +59,14 @@ public class HandshakeHashCloneExhaustion extends SSLSocketTemplate {
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
// Add in a non-cloneable MD5/SHA1/SHA-256 implementation // Add in a non-cloneable MD5/SHA1/SHA-256 implementation
Security.insertProviderAt(new MyProvider(), 1); Security.insertProviderAt(new MyProvider(), 1);
// make sure our provider is functioning
for (String s : mds) {
MessageDigest md = MessageDigest.getInstance(s);
String p = md.getProvider().getName();
if (!p.equals("MyProvider")) {
throw new RuntimeException("Unexpected provider: " + p);
}
}
if (args.length != 2) { if (args.length != 2) {
throw new Exception( throw new Exception(

View File

@ -28,8 +28,8 @@ public final class MyProvider extends Provider {
public MyProvider() { public MyProvider() {
super("MyProvider", "1.0", super("MyProvider", "1.0",
"Test Provider: SHA1/MD5/SHA256 exhaustion testing"); "Test Provider: SHA1/MD5/SHA256 exhaustion testing");
put("MessageDigest.SHA", "DigestBase.SHADigest"); put("MessageDigest.SHA", "DigestBase$SHA");
put("MessageDigest.MD5", "DigestBase.MD5Digest"); put("MessageDigest.MD5", "DigestBase$MD5");
put("MessageDigest.SHA-256", "DigestBase.SHA256Digest"); put("MessageDigest.SHA-256", "DigestBase$SHA256");
} }
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -23,7 +23,7 @@
/* /*
* @test * @test
* @bug 4638136 7198273 8025633 8081854 * @bug 4638136 7198273 8025633 8081854 8182765
* @summary Add ability to skip over nav bar for accessibility * @summary Add ability to skip over nav bar for accessibility
* @author dkramer * @author dkramer
* @library ../lib * @library ../lib
@ -46,21 +46,37 @@ public class AccessSkipNav extends JavadocTester {
"p1", "p2"); "p1", "p2");
checkExit(Exit.OK); checkExit(Exit.OK);
// Testing only for the presence of the <a href> and <a name> // Testing only for the presence of the <a href> and <a id>
checkOutput("p1/C1.html", true, checkOutput("p1/C1.html", true,
// Top navbar <a href> // Top navbar <a href>
"<a href=\"#skip.navbar.top\" title=\"Skip navigation links\">Skip navigation links</a>", "<a href=\"#skip.navbar.top\" title=\"Skip navigation links\">Skip navigation links</a>",
// Top navbar <a name> // Top navbar <a name>
"<a name=\"skip.navbar.top\">\n" "<a id=\"skip.navbar.top\">\n"
+ "<!-- -->\n" + "<!-- -->\n"
+ "</a>", + "</a>",
// Bottom navbar <a href> // Bottom navbar <a href>
"<a href=\"#skip.navbar.bottom\" title=\"Skip navigation links\">Skip navigation links</a>", "<a href=\"#skip.navbar.bottom\" title=\"Skip navigation links\">Skip navigation links</a>",
// Bottom navbar <a name> // Bottom navbar <a name>
"<a id=\"skip.navbar.bottom\">\n"
+ "<!-- -->\n"
+ "</a>");
}
@Test
void test_html4() {
javadoc("-d", "out-html4",
"-html4",
"-sourcepath", testSrc,
"p1", "p2");
checkExit(Exit.OK);
// Testing only for the presence of <a name>
checkOutput("p1/C1.html", true,
"<a name=\"skip.navbar.top\">\n"
+ "<!-- -->\n"
+ "</a>",
"<a name=\"skip.navbar.bottom\">\n" "<a name=\"skip.navbar.bottom\">\n"
+ "<!-- -->\n" + "<!-- -->\n"
+ "</a>"); + "</a>");
} }
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -23,7 +23,7 @@
/* /*
* @test * @test
* @bug 4637604 4775148 8183037 * @bug 4637604 4775148 8183037 8182765
* @summary Test the tables for summary attribute * @summary Test the tables for summary attribute
* @author dkramer * @author dkramer
* @library ../lib * @library ../lib
@ -47,15 +47,29 @@ public class AccessSummary extends JavadocTester {
void testAccessSummary() { void testAccessSummary() {
javadoc("-d", "out", "-sourcepath", testSrc, "p1", "p2"); javadoc("-d", "out", "-sourcepath", testSrc, "p1", "p2");
checkExit(Exit.OK); checkExit(Exit.OK);
checkOutput("overview-summary.html", true, checkSummary(false);
}
@Test
void testAccessSummary_html4() {
javadoc("-d", "out-html4",
"-html4",
"-sourcepath", testSrc,
"p1", "p2");
checkExit(Exit.OK);
checkSummary(true);
}
void checkSummary(boolean found) {
checkOutput("overview-summary.html", found,
"summary=\"Package Summary table, listing packages, and an explanation\""); "summary=\"Package Summary table, listing packages, and an explanation\"");
// Test that the summary attribute appears // Test that the summary attribute appears or not
checkOutput("p1/C1.html", true, checkOutput("p1/C1.html", found,
"summary=\"Constructor Summary table, listing constructors, and an explanation\""); "summary=\"Constructor Summary table, listing constructors, and an explanation\"");
// Test that the summary attribute appears // Test that the summary attribute appears or not
checkOutput("constant-values.html", true, checkOutput("constant-values.html", found,
"summary=\"Constant Field Values table, listing constant fields, and values\""); "summary=\"Constant Field Values table, listing constant fields, and values\"");
} }
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -23,7 +23,7 @@
/* /*
* @test * @test
* @bug 4034096 4764726 6235799 * @bug 4034096 4764726 6235799 8182765
* @summary Add support for HTML keywords via META tag for * @summary Add support for HTML keywords via META tag for
* class and member names to improve API search * class and member names to improve API search
* @author dkramer * @author dkramer
@ -58,23 +58,7 @@ public class MetaTag extends JavadocTester {
checkExit(Exit.OK); checkExit(Exit.OK);
checkOutput("p1/C1.html", true, checkMeta("dc.created", true);
"<meta name=\"keywords\" content=\"p1.C1 class\">",
"<meta name=\"keywords\" content=\"field1\">",
"<meta name=\"keywords\" content=\"field2\">",
"<meta name=\"keywords\" content=\"method1()\">",
"<meta name=\"keywords\" content=\"method2()\">");
checkOutput("p1/package-summary.html", true,
"<meta name=\"keywords\" content=\"p1 package\">");
checkOutput("overview-summary.html", true,
"<meta name=\"keywords\" content=\"Overview, Sample Packages\">");
// NOTE: Hopefully, this regression test is not run at midnight. If the output
// was generated yesterday and this test is run today, the test will fail.
checkOutput("overview-summary.html", true,
"<meta name=\"date\" content=\"" + date() + "\">");
} }
@Test @Test
@ -87,24 +71,55 @@ public class MetaTag extends JavadocTester {
checkExit(Exit.OK); checkExit(Exit.OK);
// No keywords when -keywords is not used. // No keywords when -keywords is not used.
checkOutput("p1/C1.html", false, checkMeta("dc.created", false);
"<META NAME=\"keywords\" CONTENT=\"p1.C1 class\">", }
"<META NAME=\"keywords\" CONTENT=\"field1\">",
"<META NAME=\"keywords\" CONTENT=\"field2\">",
"<META NAME=\"keywords\" CONTENT=\"method1()\">",
"<META NAME=\"keywords\" CONTENT=\"method2()\">");
checkOutput("p1/package-summary.html", false, @Test
"<META NAME=\"keywords\" CONTENT=\"p1 package\">"); void testStandard_html4() {
javadoc("-d", "out-1-html4",
"-html4",
"-sourcepath", testSrc,
"-keywords",
"-doctitle", "Sample Packages",
"p1", "p2");
checkOutput("overview-summary.html", false, checkExit(Exit.OK);
"<META NAME=\"keywords\" CONTENT=\"Overview Summary, Sample Packages\">");
checkMeta("date", true);
}
@Test
void testNoTimestamp_html4() {
javadoc("-d", "out-2-html4",
"-html4",
"-sourcepath", testSrc,
"-notimestamp",
"-doctitle", "Sample Packages",
"p1", "p2");
checkExit(Exit.OK);
// No keywords when -keywords is not used.
checkMeta("date", false);
}
void checkMeta(String metaNameDate, boolean found) {
checkOutput("p1/C1.html", found,
"<meta name=\"keywords\" content=\"p1.C1 class\">",
"<meta name=\"keywords\" content=\"field1\">",
"<meta name=\"keywords\" content=\"field2\">",
"<meta name=\"keywords\" content=\"method1()\">",
"<meta name=\"keywords\" content=\"method2()\">");
checkOutput("p1/package-summary.html", found,
"<meta name=\"keywords\" content=\"p1 package\">");
checkOutput("overview-summary.html", found,
"<meta name=\"keywords\" content=\"Overview, Sample Packages\">");
// The date metatag should not show up when -notimestamp is used.
// NOTE: Hopefully, this regression test is not run at midnight. If the output // NOTE: Hopefully, this regression test is not run at midnight. If the output
// was generated yesterday and this test is run today, the test will fail. // was generated yesterday and this test is run today, the test will fail.
checkOutput("overview-summary.html", false, checkOutput("overview-summary.html", found,
"<META NAME=\"date\" CONTENT=\"" + date() + "\">"); "<meta name=\"" + metaNameDate + "\" content=\"" + date() + "\">");
} }
private static final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); private static final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -23,7 +23,7 @@
/* /*
* @test * @test
* @bug 4275630 4749453 4625400 4753048 4415270 8074521 * @bug 4275630 4749453 4625400 4753048 4415270 8074521 8182765
* @summary Generated HTML is invalid with frames. * @summary Generated HTML is invalid with frames.
* Displays unnecessary horizontal scroll bars. * Displays unnecessary horizontal scroll bars.
* Missing whitespace in DOCTYPE declaration * Missing whitespace in DOCTYPE declaration
@ -53,26 +53,42 @@ public class ValidHtml extends JavadocTester {
"-sourcepath", testSrc, "-sourcepath", testSrc,
"p1", "p2"); "p1", "p2");
checkExit(Exit.OK); checkExit(Exit.OK);
// Test the proper DOCTYPE element are present:
checkOutput("index.html", true, LOOSE);
checkOutput("overview-summary.html", true, LOOSE);
checkOutput("p1/package-summary.html", true, LOOSE);
checkOutput("p1/C.html", true, LOOSE);
checkOutput("overview-frame.html", true, LOOSE);
checkOutput("allclasses-frame.html", true, LOOSE);
checkOutput("p1/package-frame.html", true, LOOSE);
// Test for IFRAME element: // Test for IFRAME element:
checkOutput("index.html", true, checkOutput("index.html", true,
"<iframe"); "<iframe");
// Test the table elements are in the correct order: // Test the table elements are in the correct order:
checkOutput("p1/package-use.html", true, checkOutput("p1/package-use.html", true,
"</td>\n" "</td>\n"
+ "</tr>"); + "</tr>");
String HTML5 = "<!DOCTYPE HTML>";
checkValidHTML(HTML5);
} }
private static final String LOOSE = @Test
"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">"; void test_html4() {
// Test for all cases except the split index page
javadoc("-d", "out-html4",
"-html4",
"-doctitle", "Document Title",
"-windowtitle", "Window Title",
"-use",
"-overview", testSrc("overview.html"),
"-sourcepath", testSrc,
"p1", "p2");
checkExit(Exit.OK);
String HTML4 = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">";
checkValidHTML(HTML4);
}
void checkValidHTML(String doctype) {
// Test the proper DOCTYPE element are present:
checkOutput("index.html", true, doctype);
checkOutput("overview-summary.html", true, doctype);
checkOutput("p1/package-summary.html", true, doctype);
checkOutput("p1/C.html", true, doctype);
checkOutput("overview-frame.html", true, doctype);
checkOutput("allclasses-frame.html", true, doctype);
checkOutput("p1/package-frame.html", true, doctype);
}
} }

View File

@ -23,7 +23,7 @@
/* /*
* @test * @test
* @bug 8025633 8025524 8081854 8187521 * @bug 8025633 8025524 8081854 8187521 8182765
* @summary Test for valid name attribute in HTML anchors. * @summary Test for valid name attribute in HTML anchors.
* @author Bhavesh Patel * @author Bhavesh Patel
* @library /tools/lib ../lib * @library /tools/lib ../lib
@ -33,7 +33,6 @@
*/ */
import java.io.IOException; import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.file.Path; import java.nio.file.Path;
import java.nio.file.Paths; import java.nio.file.Paths;
@ -54,6 +53,7 @@ public class TestAnchorNames extends JavadocTester {
@Test @Test
void testHtml4(Path ignore) { void testHtml4(Path ignore) {
javadoc("-d", "out-html4", javadoc("-d", "out-html4",
"-html4",
"-sourcepath", testSrc, "-sourcepath", testSrc,
"-source", "8", //so that '_' can be used as an identifier "-source", "8", //so that '_' can be used as an identifier
"-use", "-use",
@ -175,7 +175,6 @@ public class TestAnchorNames extends JavadocTester {
"-sourcepath", testSrc, "-sourcepath", testSrc,
"-source", "8", //so that '_' can be used as an identifier "-source", "8", //so that '_' can be used as an identifier
"-use", "-use",
"-html5",
"pkg1"); "pkg1");
checkExit(Exit.OK); checkExit(Exit.OK);

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2009, 2016, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -23,7 +23,7 @@
/* /*
* @test * @test
* @bug 8025633 8081854 * @bug 8025633 8081854 8182765
* @summary Make sure that annotations types with optional elements have * @summary Make sure that annotations types with optional elements have
* element headers * element headers
* @author Mahmood Ali * @author Mahmood Ali
@ -47,6 +47,18 @@ public class TestAnnotationOptional extends JavadocTester {
"pkg"); "pkg");
checkExit(Exit.OK); checkExit(Exit.OK);
checkOutput("pkg/AnnotationOptional.html", true,
"<a id=\"annotation.type.element.detail\">");
}
@Test
void test_html4() {
javadoc("-d", "out-html4",
"-html4",
"-sourcepath", testSrc,
"pkg");
checkExit(Exit.OK);
checkOutput("pkg/AnnotationOptional.html", true, checkOutput("pkg/AnnotationOptional.html", true,
"<a name=\"annotation.type.element.detail\">"); "<a name=\"annotation.type.element.detail\">");
} }

View File

@ -23,7 +23,7 @@
/* /*
* @test * @test
* @bug 4973609 8015249 8025633 8026567 6469561 8071982 8162363 * @bug 4973609 8015249 8025633 8026567 6469561 8071982 8162363 8182765
* @summary Make sure that annotation types with 0 members does not have * @summary Make sure that annotation types with 0 members does not have
* extra HR tags. * extra HR tags.
* @author jamieh * @author jamieh
@ -72,11 +72,11 @@ public class TestAnnotationTypes extends JavadocTester {
checkOutput("pkg/AnnotationType.html", true, checkOutput("pkg/AnnotationType.html", true,
"<!-- ============ ANNOTATION TYPE MEMBER DETAIL =========== -->", "<!-- ============ ANNOTATION TYPE MEMBER DETAIL =========== -->",
"<ul class=\"blockList\">", "<ul class=\"blockList\">",
"<li class=\"blockList\"><a name=\"annotation.type.element.detail\">", "<li class=\"blockList\"><a id=\"annotation.type.element.detail\">",
"<!-- -->", "<!-- -->",
"</a>", "</a>",
"<h3>Element Detail</h3>", "<h3>Element Detail</h3>",
"<a name=\"value--\">", "<a id=\"value()\">",
"<!-- -->", "<!-- -->",
"</a>", "</a>",
"<ul class=\"blockListLast\">", "<ul class=\"blockListLast\">",
@ -89,7 +89,10 @@ public class TestAnnotationTypes extends JavadocTester {
+ "<P>\n\n" + "<P>\n\n"
+ "<P>" + "<P>"
+ "<!-- ========= END OF CLASS DATA ========= -->" + "<HR>"); + "<!-- ========= END OF CLASS DATA ========= -->" + "<HR>");
}
@Test
void testLinkSource() {
javadoc("-d", "out-2", javadoc("-d", "out-2",
"-linksource", "-linksource",
"-sourcepath", testSrc, "-sourcepath", testSrc,
@ -112,4 +115,16 @@ public class TestAnnotationTypes extends JavadocTester {
"public @interface <a href=\"../src-html/pkg/AnnotationTypeField.html#line.31" "public @interface <a href=\"../src-html/pkg/AnnotationTypeField.html#line.31"
+ "\">AnnotationTypeField</a></pre>"); + "\">AnnotationTypeField</a></pre>");
} }
@Test
void test_html4() {
javadoc("-d", "out-html4",
"-html4",
"-sourcepath", testSrc,
"pkg");
checkExit(Exit.OK);
checkOutput("pkg/AnnotationType.html", true,
"<li class=\"blockList\"><a name=\"annotation.type.element.detail\">",
"<a name=\"value--\">");
}
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -23,7 +23,7 @@
/* /*
* @test * @test
* @bug 4652655 4857717 8025633 8026567 8071982 8164407 * @bug 4652655 4857717 8025633 8026567 8071982 8164407 8182765
* @summary This test verifies that class cross references work properly. * @summary This test verifies that class cross references work properly.
* @author jamieh * @author jamieh
* @library ../lib * @library ../lib
@ -35,6 +35,8 @@
public class TestClassCrossReferences extends JavadocTester { public class TestClassCrossReferences extends JavadocTester {
static final String uri = "http://docs.oracle.com/javase/8/docs/api/";
public static void main(String... args) throws Exception { public static void main(String... args) throws Exception {
TestClassCrossReferences tester = new TestClassCrossReferences(); TestClassCrossReferences tester = new TestClassCrossReferences();
tester.runTests(); tester.runTests();
@ -42,8 +44,6 @@ public class TestClassCrossReferences extends JavadocTester {
@Test @Test
void test() { void test() {
final String uri = "http://docs.oracle.com/javase/8/docs/api/";
javadoc("-d", "out", javadoc("-d", "out",
"-Xdoclint:none", "-Xdoclint:none",
"-sourcepath", testSrc, "-sourcepath", testSrc,
@ -58,7 +58,7 @@ public class TestClassCrossReferences extends JavadocTester {
+ "title=\"class or interface in javax.swing.text\" class=\"externalLink\"><code>Link to AttributeContext innerclass</code></a>", + "title=\"class or interface in javax.swing.text\" class=\"externalLink\"><code>Link to AttributeContext innerclass</code></a>",
"<a href=\"" + uri + "java/math/BigDecimal.html?is-external=true\" " "<a href=\"" + uri + "java/math/BigDecimal.html?is-external=true\" "
+ "title=\"class or interface in java.math\" class=\"externalLink\"><code>Link to external class BigDecimal</code></a>", + "title=\"class or interface in java.math\" class=\"externalLink\"><code>Link to external class BigDecimal</code></a>",
"<a href=\"" + uri + "java/math/BigInteger.html?is-external=true#gcd-java.math.BigInteger-\" " "<a href=\"" + uri + "java/math/BigInteger.html?is-external=true#gcd(java.math.BigInteger)\" "
+ "title=\"class or interface in java.math\" class=\"externalLink\"><code>Link to external member gcd</code></a>", + "title=\"class or interface in java.math\" class=\"externalLink\"><code>Link to external member gcd</code></a>",
"<a href=\"" + uri + "javax/tools/SimpleJavaFileObject.html?is-external=true#URI\" " "<a href=\"" + uri + "javax/tools/SimpleJavaFileObject.html?is-external=true#URI\" "
+ "title=\"class or interface in javax.tools\" class=\"externalLink\"><code>Link to external member URI</code></a>", + "title=\"class or interface in javax.tools\" class=\"externalLink\"><code>Link to external member URI</code></a>",
@ -68,4 +68,18 @@ public class TestClassCrossReferences extends JavadocTester {
+ "</dl>"); + "</dl>");
} }
@Test
void test_html4() {
javadoc("-d", "out-html4",
"-html4",
"-Xdoclint:none",
"-sourcepath", testSrc,
"-linkoffline", uri, testSrc,
testSrc("C.java"));
checkExit(Exit.OK);
checkOutput("C.html", true,
"<a href=\"" + uri + "java/math/BigInteger.html?is-external=true#gcd-java.math.BigInteger-\" "
+ "title=\"class or interface in java.math\" class=\"externalLink\"><code>Link to external member gcd</code></a>");
}
} }

View File

@ -23,7 +23,7 @@
/* /*
* @test * @test
* @bug 8163800 8175200 8186332 * @bug 8163800 8175200 8186332 8182765
* @summary The fix for JDK-8072052 shows up other minor incorrect use of styles * @summary The fix for JDK-8072052 shows up other minor incorrect use of styles
* @library ../lib * @library ../lib
* @modules jdk.javadoc/jdk.javadoc.internal.tool * @modules jdk.javadoc/jdk.javadoc.internal.tool
@ -51,11 +51,11 @@ public class TestClassLinks extends JavadocTester {
checkOutput("p/C1.html", true, checkOutput("p/C1.html", true,
"<code><a href=\"C2.html\" title=\"class in p\">C2</a></code>", "<code><a href=\"C2.html\" title=\"class in p\">C2</a></code>",
"<code><span class=\"memberNameLink\"><a href=\"#C1--\">C1</a></span>()</code>"); "<code><span class=\"memberNameLink\"><a href=\"#%3Cinit%3E()\">C1</a></span>()</code>");
checkOutput("p/C2.html", true, checkOutput("p/C2.html", true,
"<code><a href=\"C3.html\" title=\"class in p\">C3</a></code>", "<code><a href=\"C3.html\" title=\"class in p\">C3</a></code>",
"<code><span class=\"memberNameLink\"><a href=\"#C2--\">C2</a></span>()</code>"); "<code><span class=\"memberNameLink\"><a href=\"#%3Cinit%3E()\">C2</a></span>()</code>");
checkOutput("p/C3.html", true, checkOutput("p/C3.html", true,
"<code><a href=\"I1.html\" title=\"interface in p\">I1</a></code>, " "<code><a href=\"I1.html\" title=\"interface in p\">I1</a></code>, "
@ -63,7 +63,7 @@ public class TestClassLinks extends JavadocTester {
+ "<code><a href=\"I2.html\" title=\"interface in p\">I2</a></code>, " + "<code><a href=\"I2.html\" title=\"interface in p\">I2</a></code>, "
+ "<code><a href=\"IT1.html\" title=\"interface in p\">IT1</a>&lt;T&gt;</code>, " + "<code><a href=\"IT1.html\" title=\"interface in p\">IT1</a>&lt;T&gt;</code>, "
+ "<code><a href=\"IT2.html\" title=\"interface in p\">IT2</a>&lt;java.lang.String&gt;</code>", + "<code><a href=\"IT2.html\" title=\"interface in p\">IT2</a>&lt;java.lang.String&gt;</code>",
"<code><span class=\"memberNameLink\"><a href=\"#C3--\">C3</a></span>()</code>"); "<code><span class=\"memberNameLink\"><a href=\"#%3Cinit%3E()\">C3</a></span>()</code>");
checkOutput("p/I1.html", true, checkOutput("p/I1.html", true,
"<code><a href=\"C3.html\" title=\"class in p\">C3</a></code>", "<code><a href=\"C3.html\" title=\"class in p\">C3</a></code>",
@ -82,7 +82,26 @@ public class TestClassLinks extends JavadocTester {
checkOutput("p/IT2.html", true, checkOutput("p/IT2.html", true,
"code><a href=\"C3.html\" title=\"class in p\">C3</a></code>"); "code><a href=\"C3.html\" title=\"class in p\">C3</a></code>");
} }
@Test
void test_html4() {
javadoc("-d", "out-html4",
"-html4",
"-Xdoclint:none",
"-sourcepath", testSrc,
"-package",
"p");
checkExit(Exit.OK);
checkOutput("p/C1.html", true,
"<code><span class=\"memberNameLink\"><a href=\"#C1--\">C1</a></span>()</code>");
checkOutput("p/C2.html", true,
"<code><span class=\"memberNameLink\"><a href=\"#C2--\">C2</a></span>()</code>");
checkOutput("p/C3.html", true,
"<code><span class=\"memberNameLink\"><a href=\"#C3--\">C3</a></span>()</code>");
}
} }

View File

@ -23,7 +23,7 @@
/* /*
* @test * @test
* @bug 8025524 8031625 8081854 8175200 8186332 * @bug 8025524 8031625 8081854 8175200 8186332 8182765
* @summary Test for constructor name which should be a non-qualified name. * @summary Test for constructor name which should be a non-qualified name.
* @author Bhavesh Patel * @author Bhavesh Patel
* @library ../lib * @library ../lib
@ -46,6 +46,57 @@ public class TestConstructors extends JavadocTester {
"pkg1"); "pkg1");
checkExit(Exit.OK); checkExit(Exit.OK);
checkOutput("pkg1/Outer.html", true,
"<dt><span class=\"seeLabel\">See Also:</span></dt>\n"
+ "<dd><a href=\"Outer.Inner.html#%3Cinit%3E()\"><code>Inner()</code></a>, \n"
+ "<a href=\"Outer.Inner.html#%3Cinit%3E(int)\"><code>Inner(int)</code></a>, \n"
+ "<a href=\"Outer.Inner.NestedInner.html#%3Cinit%3E()\"><code>NestedInner()</code></a>, \n"
+ "<a href=\"Outer.Inner.NestedInner.html#%3Cinit%3E(int)\"><code>NestedInner(int)</code></a>, \n"
+ "<a href=\"#%3Cinit%3E()\"><code>Outer()</code></a>, \n"
+ "<a href=\"#%3Cinit%3E(int)\"><code>Outer(int)</code></a></dd>",
"Link: <a href=\"Outer.Inner.html#%3Cinit%3E()\"><code>Inner()</code></a>, "
+ "<a href=\"#%3Cinit%3E(int)\"><code>Outer(int)</code></a>, "
+ "<a href=\"Outer.Inner.NestedInner.html#%3Cinit%3E(int)\"><code>NestedInner(int)</code></a>",
"<a href=\"#%3Cinit%3E()\">Outer</a></span>()",
"<a id=\"&lt;init&gt;(int)\">",
"<a href=\"#%3Cinit%3E(int)\">Outer</a></span>&#8203;(int&nbsp;i)",
"<a id=\"&lt;init&gt;(int)\">");
checkOutput("pkg1/Outer.Inner.html", true,
"<a href=\"#%3Cinit%3E()\">Inner</a></span>()",
"<a id=\"&lt;init&gt;()\">",
"<a href=\"#%3Cinit%3E(int)\">Inner</a></span>&#8203;(int&nbsp;i)",
"<a id=\"&lt;init&gt;(int)\">");
checkOutput("pkg1/Outer.Inner.NestedInner.html", true,
"<a href=\"#%3Cinit%3E()\">NestedInner</a></span>()",
"<a id=\"&lt;init&gt;()\">",
"<a href=\"#%3Cinit%3E(int)\">NestedInner</a></span>&#8203;(int&nbsp;i)",
"<a id=\"&lt;init&gt;(int)\">");
checkOutput("pkg1/Outer.Inner.html", false,
"Outer.Inner()",
"Outer.Inner(int)");
checkOutput("pkg1/Outer.Inner.NestedInner.html", false,
"Outer.Inner.NestedInner()",
"Outer.Inner.NestedInner(int)");
checkOutput("pkg1/Outer.html", false,
"<a href=\"Outer.Inner.html#Outer.Inner()\"><code>Outer.Inner()</code></a>",
"<a href=\"Outer.Inner.html#Outer.Inner(int)\"><code>Outer.Inner(int)</code></a>",
"<a href=\"Outer.Inner.NestedInner.html#Outer.Inner.NestedInner()\"><code>Outer.Inner.NestedInner()</code></a>",
"<a href=\"Outer.Inner.NestedInner.html#Outer.Inner.NestedInner(int)\"><code>Outer.Inner.NestedInner(int)</code></a>");
}
@Test
void test_html4() {
javadoc("-d", "out-html4",
"-html4",
"-sourcepath", testSrc,
"pkg1");
checkExit(Exit.OK);
checkOutput("pkg1/Outer.html", true, checkOutput("pkg1/Outer.html", true,
"<dt><span class=\"seeLabel\">See Also:</span></dt>\n" "<dt><span class=\"seeLabel\">See Also:</span></dt>\n"
+ "<dd><a href=\"Outer.Inner.html#Inner--\"><code>Inner()</code></a>, \n" + "<dd><a href=\"Outer.Inner.html#Inner--\"><code>Inner()</code></a>, \n"

View File

@ -24,7 +24,7 @@
/* /*
* @test * @test
* @bug 4927552 8026567 8071982 8162674 8175200 8175218 8183511 8186332 * @bug 4927552 8026567 8071982 8162674 8175200 8175218 8183511 8186332
* 8169819 8074407 8191030 * 8169819 8074407 8191030 8182765
* @summary test generated docs for deprecated items * @summary test generated docs for deprecated items
* @author jamieh * @author jamieh
* @library ../lib * @library ../lib
@ -209,6 +209,97 @@ public class TestDeprecatedDocs extends JavadocTester {
+ "<li><a href=\"#enum.constant\">Enum Constants</a></li>\n" + "<li><a href=\"#enum.constant\">Enum Constants</a></li>\n"
+ "<li><a href=\"#annotation.type.member\">Annotation Type Elements</a></li>\n" + "<li><a href=\"#annotation.type.member\">Annotation Type Elements</a></li>\n"
+ "</ul>", + "</ul>",
"<a id=\"forRemoval\">",
"<table class=\"deprecatedSummary\">\n"
+ "<caption><span>For Removal</span><span class=\"tabEnd\">&nbsp;</span></caption>\n"
+ "<tr>\n"
+ "<th class=\"colFirst\" scope=\"col\">Element</th>\n"
+ "<th class=\"colLast\" scope=\"col\">Description</th>\n"
+ "</tr>",
"<table class=\"deprecatedSummary\">\n"
+ "<caption><span>Enums</span><span class=\"tabEnd\">&nbsp;</span></caption>\n"
+ "<tr>\n"
+ "<th class=\"colFirst\" scope=\"col\">Enum</th>\n"
+ "<th class=\"colLast\" scope=\"col\">Description</th>\n"
+ "</tr>\n"
+ "<tbody>\n"
+ "<tr class=\"altColor\">\n"
+ "<th class=\"colDeprecatedItemName\" scope=\"row\"><a href=\"pkg/TestEnum.html\" title=\"enum in pkg\">pkg.TestEnum</a></th>\n"
+ "<td class=\"colLast\">\n"
+ "<div class=\"deprecationComment\">enum_test1 passes.</div>\n"
+ "</td>\n"
+ "</tr>\n"
+ "</tbody>\n"
+ "</table>",
"<table class=\"deprecatedSummary\">\n"
+ "<caption><span>Exceptions</span><span class=\"tabEnd\">&nbsp;</span></caption>\n"
+ "<tr>\n"
+ "<th class=\"colFirst\" scope=\"col\">Exceptions</th>\n"
+ "<th class=\"colLast\" scope=\"col\">Description</th>\n"
+ "</tr>\n"
+ "<tbody>\n"
+ "<tr class=\"altColor\">\n"
+ "<th class=\"colDeprecatedItemName\" scope=\"row\"><a href=\"pkg/TestException.html\" title=\"class in pkg\">pkg.TestException</a></th>\n"
+ "<td class=\"colLast\">\n"
+ "<div class=\"deprecationComment\">exception_test1 passes.</div>\n"
+ "</td>\n"
+ "</tr>\n"
+ "</tbody>\n"
+ "</table>",
"<table class=\"deprecatedSummary\">\n"
+ "<caption><span>Fields</span><span class=\"tabEnd\">&nbsp;</span></caption>\n"
+ "<tr>\n"
+ "<th class=\"colFirst\" scope=\"col\">Field</th>\n"
+ "<th class=\"colLast\" scope=\"col\">Description</th>\n"
+ "</tr>\n"
+ "<tbody>\n"
+ "<tr class=\"altColor\">\n"
+ "<th class=\"colDeprecatedItemName\" scope=\"row\"><a href=\"pkg/DeprecatedClassByAnnotation.html#field\">pkg.DeprecatedClassByAnnotation.field</a></th>\n"
+ "<td class=\"colLast\"></td>\n"
+ "</tr>\n"
+ "<tr class=\"rowColor\">\n"
+ "<th class=\"colDeprecatedItemName\" scope=\"row\"><a href=\"pkg/TestAnnotationType.html#field\">pkg.TestAnnotationType.field</a></th>\n"
+ "<td class=\"colLast\">\n"
+ "<div class=\"deprecationComment\">annotation_test4 passes.</div>\n"
+ "</td>\n"
+ "</tr>\n"
+ "<tr class=\"altColor\">\n"
+ "<th class=\"colDeprecatedItemName\" scope=\"row\"><a href=\"pkg/TestClass.html#field\">pkg.TestClass.field</a></th>\n"
+ "<td class=\"colLast\">\n"
+ "<div class=\"deprecationComment\">class_test2 passes. This is the second sentence of deprecated description for a field.</div>\n"
+ "</td>\n"
+ "</tr>\n"
+ "<tr class=\"rowColor\">\n"
+ "<th class=\"colDeprecatedItemName\" scope=\"row\"><a href=\"pkg/TestError.html#field\">pkg.TestError.field</a></th>\n"
+ "<td class=\"colLast\">\n"
+ "<div class=\"deprecationComment\">error_test2 passes.</div>\n"
+ "</td>\n"
+ "</tr>\n"
+ "<tr class=\"altColor\">\n"
+ "<th class=\"colDeprecatedItemName\" scope=\"row\"><a href=\"pkg/TestException.html#field\">pkg.TestException.field</a></th>\n"
+ "<td class=\"colLast\">\n"
+ "<div class=\"deprecationComment\">exception_test2 passes.</div>\n"
+ "</td>\n"
+ "</tr>\n"
+ "<tr class=\"rowColor\">\n"
+ "<th class=\"colDeprecatedItemName\" scope=\"row\"><a href=\"pkg/TestInterface.html#field\">pkg.TestInterface.field</a></th>\n"
+ "<td class=\"colLast\">\n"
+ "<div class=\"deprecationComment\">interface_test2 passes.</div>\n"
+ "</td>\n"
+ "</tr>\n"
+ "</tbody>\n"
+ "</table>");
}
@Test
void test_html4() {
javadoc("-d", "out-html4",
"-html4",
"-sourcepath", testSrc,
"pkg");
checkExit(Exit.OK);
checkOutput("deprecated-list.html", true,
"<a name=\"forRemoval\">", "<a name=\"forRemoval\">",
"<table class=\"deprecatedSummary\" summary=\"For Removal table, listing for removal, and an explanation\">\n" "<table class=\"deprecatedSummary\" summary=\"For Removal table, listing for removal, and an explanation\">\n"
+ "<caption><span>For Removal</span><span class=\"tabEnd\">&nbsp;</span></caption>\n" + "<caption><span>For Removal</span><span class=\"tabEnd\">&nbsp;</span></caption>\n"

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -23,7 +23,7 @@
/* /*
* @test * @test
* @bug 4857717 8025633 8026567 8164407 * @bug 4857717 8025633 8026567 8164407 8182765
* @summary Test to make sure that externally overriden and implemented methods * @summary Test to make sure that externally overriden and implemented methods
* are documented properly. The method should still include "implements" or * are documented properly. The method should still include "implements" or
* "overrides" documentation even though the method is external. * "overrides" documentation even though the method is external.
@ -33,9 +33,10 @@
* @build JavadocTester TestExternalOverridenMethod * @build JavadocTester TestExternalOverridenMethod
* @run main TestExternalOverridenMethod * @run main TestExternalOverridenMethod
*/ */
public class TestExternalOverridenMethod extends JavadocTester { public class TestExternalOverridenMethod extends JavadocTester {
static final String uri = "http://java.sun.com/j2se/1.4.1/docs/api";
public static void main(String... args) throws Exception { public static void main(String... args) throws Exception {
TestExternalOverridenMethod tester = new TestExternalOverridenMethod(); TestExternalOverridenMethod tester = new TestExternalOverridenMethod();
tester.runTests(); tester.runTests();
@ -43,13 +44,35 @@ public class TestExternalOverridenMethod extends JavadocTester {
@Test @Test
void test() { void test() {
String uri = "http://java.sun.com/j2se/1.4.1/docs/api";
javadoc("-d", "out", javadoc("-d", "out",
"-sourcepath", testSrc, "-sourcepath", testSrc,
"-linkoffline", uri, testSrc, "-linkoffline", uri, testSrc,
"pkg"); "pkg");
checkExit(Exit.OK); checkExit(Exit.OK);
checkOutput("pkg/XReader.html", true,
"<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n"
+ "<dd><code><a href=\"" + uri + "/java/io/FilterReader.html?is-external=true#read()\" "
+ "title=\"class or interface in java.io\" class=\"externalLink\">read</a></code>&nbsp;in class&nbsp;<code>"
+ "<a href=\"" + uri + "/java/io/FilterReader.html?is-external=true\" "
+ "title=\"class or interface in java.io\" class=\"externalLink\">FilterReader</a></code></dd>",
"<dt><span class=\"overrideSpecifyLabel\">Specified by:</span></dt>\n"
+ "<dd><code><a href=\"" + uri + "/java/io/DataInput.html?is-external=true#readInt()\" "
+ "title=\"class or interface in java.io\" class=\"externalLink\">readInt</a></code>&nbsp;in interface&nbsp;<code>"
+ "<a href=\"" + uri + "/java/io/DataInput.html?is-external=true\" "
+ "title=\"class or interface in java.io\" class=\"externalLink\">DataInput</a></code></dd>"
);
}
@Test
void test_html4() {
javadoc("-d", "out-html4",
"-html4",
"-sourcepath", testSrc,
"-linkoffline", uri, testSrc,
"pkg");
checkExit(Exit.OK);
checkOutput("pkg/XReader.html", true, checkOutput("pkg/XReader.html", true,
"<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n" "<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n"
+ "<dd><code><a href=\"" + uri + "/java/io/FilterReader.html?is-external=true#read--\" " + "<dd><code><a href=\"" + uri + "/java/io/FilterReader.html?is-external=true#read--\" "

View File

@ -23,7 +23,7 @@
/* /*
* @test * @test
* @bug 8073100 * @bug 8073100 8182765
* @summary ensure the hidden tag works as intended * @summary ensure the hidden tag works as intended
* @library ../lib * @library ../lib
* @modules jdk.javadoc/jdk.javadoc.internal.tool * @modules jdk.javadoc/jdk.javadoc.internal.tool
@ -38,7 +38,6 @@ public class TestHiddenTag extends JavadocTester {
tester.runTests(); tester.runTests();
} }
/** /**
* Perform tests on &#64;hidden tags * Perform tests on &#64;hidden tags
*/ */
@ -51,20 +50,20 @@ public class TestHiddenTag extends JavadocTester {
checkExit(Exit.OK); checkExit(Exit.OK);
checkOutput("pkg1/A.html", true, checkOutput("pkg1/A.html", true,
"<a name=\"visibleField\">", "<a id=\"visibleField\">",
"<a name=\"visibleMethod--\">", "<a id=\"visibleMethod()\">",
"<dt>Direct Known Subclasses:</dt>\n" + "<dt>Direct Known Subclasses:</dt>\n" +
"<dd><code><a href=\"A.VisibleInner.html\" title=\"class in pkg1\">" + "<dd><code><a href=\"A.VisibleInner.html\" title=\"class in pkg1\">" +
"A.VisibleInner</a></code>, <code><a href=\"A.VisibleInnerExtendsInvisibleInner.html\" " + "A.VisibleInner</a></code>, <code><a href=\"A.VisibleInnerExtendsInvisibleInner.html\" " +
"title=\"class in pkg1\">A.VisibleInnerExtendsInvisibleInner</a></code></dd>"); "title=\"class in pkg1\">A.VisibleInnerExtendsInvisibleInner</a></code></dd>");
checkOutput("pkg1/A.html", false, checkOutput("pkg1/A.html", false,
"<a name=\"inVisibleField\">", "<a id=\"inVisibleField\">",
"<a name=\"inVisibleMethod--\">"); "<a id=\"inVisibleMethod()\">");
checkOutput("pkg1/A.VisibleInner.html", true, checkOutput("pkg1/A.VisibleInner.html", true,
"<code><a href=\"A.html#visibleField\">visibleField</a></code>", "<code><a href=\"A.html#visibleField\">visibleField</a></code>",
"<code><a href=\"A.html#visibleMethod--\">visibleMethod</a></code>", "<code><a href=\"A.html#visibleMethod()\">visibleMethod</a></code>",
"<h3>Nested classes/interfaces inherited from class&nbsp;pkg1." + "<h3>Nested classes/interfaces inherited from class&nbsp;pkg1." +
"<a href=\"A.html\" title=\"class in pkg1\">A</a></h3>\n" + "<a href=\"A.html\" title=\"class in pkg1\">A</a></h3>\n" +
"<code><a href=\"A.VisibleInner.html\" title=\"class in pkg1\">" + "<code><a href=\"A.VisibleInner.html\" title=\"class in pkg1\">" +
@ -73,16 +72,16 @@ public class TestHiddenTag extends JavadocTester {
"</ul>"); "</ul>");
checkOutput("pkg1/A.VisibleInner.html", false, checkOutput("pkg1/A.VisibleInner.html", false,
"../pkg1/A.VisibleInner.html#VisibleInner--", "../pkg1/A.VisibleInner.html#VisibleInner()",
"<a name=\"inVisibleField\">", "<a id=\"inVisibleField\">",
"<a name=\"inVisibleMethod--\">"); "<a id=\"inVisibleMethod()\">");
checkOutput("pkg1/A.VisibleInnerExtendsInvisibleInner.html", true, checkOutput("pkg1/A.VisibleInnerExtendsInvisibleInner.html", true,
"<pre>public static class <span class=\"typeNameLabel\">" + "<pre>public static class <span class=\"typeNameLabel\">" +
"A.VisibleInnerExtendsInvisibleInner</span>\n" + "A.VisibleInnerExtendsInvisibleInner</span>\n" +
"extends <a href=\"A.html\" title=\"class in pkg1\">A</a></pre>", "extends <a href=\"A.html\" title=\"class in pkg1\">A</a></pre>",
"<code><a href=\"A.html#visibleField\">visibleField</a></code></li>", "<code><a href=\"A.html#visibleField\">visibleField</a></code></li>",
"<code><a href=\"A.html#visibleMethod--\">visibleMethod</a></code>"); "<code><a href=\"A.html#visibleMethod()\">visibleMethod</a></code>");
checkOutput("pkg1/A.VisibleInnerExtendsInvisibleInner.html", false, checkOutput("pkg1/A.VisibleInnerExtendsInvisibleInner.html", false,
"invisibleField", "invisibleField",
@ -98,6 +97,33 @@ public class TestHiddenTag extends JavadocTester {
checkFiles(false, checkFiles(false,
"pkg1/A.InvisibleInner.html", "pkg1/A.InvisibleInner.html",
"pkg1/A.InvisibleInnerExtendsVisibleInner.html"); "pkg1/A.InvisibleInnerExtendsVisibleInner.html");
}
@Test
public void test1_html4() {
javadoc("-d", "out1-html4",
"-html4",
"-sourcepath", testSrc,
"-package",
"pkg1");
checkExit(Exit.OK);
checkOutput("pkg1/A.html", true,
"<a name=\"visibleField\">",
"<a name=\"visibleMethod--\">");
checkOutput("pkg1/A.VisibleInner.html", true,
"<code><a href=\"A.html#visibleMethod--\">visibleMethod</a></code>");
checkOutput("pkg1/A.VisibleInnerExtendsInvisibleInner.html", true,
"<code><a href=\"A.html#visibleMethod--\">visibleMethod</a></code>");
checkOutput("pkg1/A.html", false,
"<a name=\"inVisibleMethod--\">");
checkOutput("pkg1/A.VisibleInner.html", false,
"../pkg1/A.VisibleInner.html#VisibleInner--",
"<a name=\"inVisibleField\">",
"<a name=\"inVisibleMethod--\">");
} }
} }

View File

@ -23,7 +23,7 @@
/* /*
* @test * @test
* @bug 4663254 8016328 8025633 8026567 8081854 * @bug 4663254 8016328 8025633 8026567 8081854 8182765
* @summary Verify that spaces do not appear in hrefs and anchors. * @summary Verify that spaces do not appear in hrefs and anchors.
* @author jamieh * @author jamieh
* @library ../lib * @library ../lib
@ -48,6 +48,49 @@ public class TestHref extends JavadocTester {
"pkg"); "pkg");
checkExit(Exit.OK); checkExit(Exit.OK);
checkOutput("pkg/C1.html", true,
//External link.
"href=\"http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html?is-external=true#wait(long,int)\"",
//Member summary table link.
"href=\"#method(int,int,java.util.ArrayList)\"",
//Anchor test.
"<a id=\"method(int,int,java.util.ArrayList)\">\n"
+ "<!-- -->\n"
+ "</a>",
//Backward compatibility anchor test."pkg/C1.html",
"<a id=\"method(int,int,java.util.ArrayList)\">\n"
+ "<!-- -->\n"
+ "</a>");
checkOutput("pkg/C2.html", true,
//{@link} test.
"Link: <a href=\"C1.html#method(int,int,java.util.ArrayList)\">",
//@see test.
"See Also:</span></dt>\n"
+ "<dd><a href=\"C1.html#method(int,int,java.util.ArrayList)\">"
);
checkOutput("pkg/C4.html", true,
//Header does not link to the page itself.
"Class C4&lt;E extends C4&lt;E&gt;&gt;</h2>",
//Signature does not link to the page itself.
"public abstract class <span class=\"typeNameLabel\">C4&lt;E extends C4&lt;E&gt;&gt;</span>"
);
checkOutput(Output.OUT, false,
"<a> tag is malformed");
}
@Test
void test_html4() {
javadoc("-Xdoclint:none",
"-d", "out-html4",
"-html4",
"-sourcepath", testSrc,
"-linkoffline", "http://java.sun.com/j2se/1.4/docs/api/", testSrc,
"pkg");
checkExit(Exit.OK);
checkOutput("pkg/C1.html", true, checkOutput("pkg/C1.html", true,
//External link. //External link.
"href=\"http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html?is-external=true#wait-long-int-\"", "href=\"http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html?is-external=true#wait-long-int-\"",
@ -69,15 +112,5 @@ public class TestHref extends JavadocTester {
"See Also:</span></dt>\n" "See Also:</span></dt>\n"
+ "<dd><a href=\"C1.html#method-int-int-java.util.ArrayList-\">" + "<dd><a href=\"C1.html#method-int-int-java.util.ArrayList-\">"
); );
checkOutput("pkg/C4.html", true,
//Header does not link to the page itself.
"Class C4&lt;E extends C4&lt;E&gt;&gt;</h2>",
//Signature does not link to the page itself.
"public abstract class <span class=\"typeNameLabel\">C4&lt;E extends C4&lt;E&gt;&gt;</span>"
);
checkOutput(Output.OUT, false,
"<a> tag is malformed");
} }
} }

View File

@ -23,7 +23,7 @@
/* /*
* @test * @test
* @bug 6786690 6820360 8025633 8026567 8175200 8183511 8186332 8074407 * @bug 6786690 6820360 8025633 8026567 8175200 8183511 8186332 8074407 8182765
* @summary This test verifies the nesting of definition list tags. * @summary This test verifies the nesting of definition list tags.
* @author Bhavesh Patel * @author Bhavesh Patel
* @library ../lib * @library ../lib
@ -57,6 +57,17 @@ public class TestHtmlDefinitionListTag extends JavadocTester {
checkCommentDeprecated(true); checkCommentDeprecated(true);
} }
@Test
void test_Comment_Deprecated_html4() {
javadoc("-Xdoclint:none",
"-d", "out-1-html4",
"-html4",
"-sourcepath", testSrc,
"pkg1");
checkExit(Exit.OK);
checkCommentDeprecated_html4(true);
}
@Test @Test
void test_NoComment_Deprecated() { void test_NoComment_Deprecated() {
// tester.run(ARGS2, TEST_ALL, NEGATED_TEST_NO_C5); // tester.run(ARGS2, TEST_ALL, NEGATED_TEST_NO_C5);
@ -72,6 +83,18 @@ public class TestHtmlDefinitionListTag extends JavadocTester {
checkCommentDeprecated(false); // ?? checkCommentDeprecated(false); // ??
} }
@Test
void test_NoComment_Deprecated_html4() {
javadoc("-Xdoclint:none",
"-d", "out-2-html4",
"-html4",
"-nocomment",
"-sourcepath", testSrc,
"pkg1");
checkExit(Exit.OK);
checkCommentDeprecated_html4(false);
}
@Test @Test
void test_Comment_NoDeprecated() { void test_Comment_NoDeprecated() {
// tester.run(ARGS3, TEST_ALL, NEGATED_TEST_NO_C5); // tester.run(ARGS3, TEST_ALL, NEGATED_TEST_NO_C5);
@ -87,6 +110,19 @@ public class TestHtmlDefinitionListTag extends JavadocTester {
checkNoCommentNoDeprecated(false); checkNoCommentNoDeprecated(false);
} }
@Test
void test_Comment_NoDeprecated_html4() {
javadoc("-Xdoclint:none",
"-d", "out-3-html4",
"-html4",
"-nodeprecated",
"-sourcepath", testSrc,
"pkg1");
checkExit(Exit.OK);
checkNoDeprecated_html4();
checkNoCommentNoDeprecated_html4(false);
}
@Test @Test
void testNoCommentNoDeprecated() { void testNoCommentNoDeprecated() {
// tester.run(ARGS4, TEST_ALL, NEGATED_TEST_NO_C5); // tester.run(ARGS4, TEST_ALL, NEGATED_TEST_NO_C5);
@ -103,6 +139,19 @@ public class TestHtmlDefinitionListTag extends JavadocTester {
checkCommentDeprecated(false); checkCommentDeprecated(false);
} }
@Test
void testNoCommentNoDeprecated_html4() {
javadoc("-Xdoclint:none",
"-d", "out-4-html4",
"-html4",
"-nocomment",
"-nodeprecated",
"-sourcepath", testSrc,
"pkg1");
checkNoCommentNoDeprecated_html4(true);
checkCommentDeprecated_html4(false);
}
void checkCommon(boolean checkC5) { void checkCommon(boolean checkC5) {
// Test common to all runs of javadoc. The class signature should print // Test common to all runs of javadoc. The class signature should print
// properly enclosed definition list tags and the Annotation Type // properly enclosed definition list tags and the Annotation Type
@ -166,7 +215,7 @@ public class TestHtmlDefinitionListTag extends JavadocTester {
+ "<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n" + "<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n"
+ "<dd>1.4</dd>\n" + "<dd>1.4</dd>\n"
+ "<dt><span class=\"seeLabel\">See Also:</span></dt>\n" + "<dt><span class=\"seeLabel\">See Also:</span></dt>\n"
+ "<dd><a href=\"#setUndecorated-boolean-\">" + "<dd><a href=\"#setUndecorated(boolean)\">"
+ "<code>setUndecorated(boolean)</code></a></dd>\n" + "<code>setUndecorated(boolean)</code></a></dd>\n"
+ "</dl>", + "</dl>",
"<dl>\n" "<dl>\n"
@ -193,7 +242,7 @@ public class TestHtmlDefinitionListTag extends JavadocTester {
+ "<dd>1.4</dd>\n" + "<dd>1.4</dd>\n"
+ "<dt><span class=\"seeLabel\">See Also:</span></dt>\n" + "<dt><span class=\"seeLabel\">See Also:</span></dt>\n"
+ "<dd>" + "<dd>"
+ "<a href=\"#readObject--\"><code>readObject()" + "<a href=\"#readObject()\"><code>readObject()"
+ "</code></a></dd>\n" + "</code></a></dd>\n"
+ "</dl>", + "</dl>",
"<dl>\n" "<dl>\n"
@ -201,7 +250,7 @@ public class TestHtmlDefinitionListTag extends JavadocTester {
+ "<dd><code>java.io.IOException</code></dd>\n" + "<dd><code>java.io.IOException</code></dd>\n"
+ "<dt><span class=\"seeLabel\">See Also:" + "<dt><span class=\"seeLabel\">See Also:"
+ "</span></dt>\n" + "</span></dt>\n"
+ "<dd><a href=\"#setUndecorated-boolean-\">" + "<dd><a href=\"#setUndecorated(boolean)\">"
+ "<code>setUndecorated(boolean)</code></a></dd>\n" + "<code>setUndecorated(boolean)</code></a></dd>\n"
+ "</dl>"); + "</dl>");
@ -215,6 +264,85 @@ public class TestHtmlDefinitionListTag extends JavadocTester {
+ "<dd>1.4</dd>\n" + "<dd>1.4</dd>\n"
+ "</dl>"); + "</dl>");
checkOutput("serialized-form.html", expectFound,
"<dl>\n"
+ "<dt><span class=\"throwsLabel\">Throws:</span>"
+ "</dt>\n"
+ "<dd><code>"
+ "java.io.IOException</code></dd>\n"
+ "<dt><span class=\"seeLabel\">See Also:</span>"
+ "</dt>\n"
+ "<dd><a href=\"pkg1/C1.html#setUndecorated(boolean)\">"
+ "<code>C1.setUndecorated(boolean)</code></a></dd>\n"
+ "</dl>",
"<span class=\"deprecatedLabel\">Deprecated.</span>\n"
+ "<div class=\"deprecationComment\">As of JDK version 1.5, replaced by\n"
+ " <a href=\"pkg1/C1.html#setUndecorated(boolean)\">"
+ "<code>setUndecorated(boolean)</code></a>.</div>\n"
+ "</div>\n"
+ "<div class=\"block\">This field indicates whether the C1 is "
+ "undecorated.</div>\n"
+ "&nbsp;\n"
+ "<dl>\n"
+ "<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n"
+ "<dd>1.4</dd>\n"
+ "<dt><span class=\"seeLabel\">See Also:</span>"
+ "</dt>\n"
+ "<dd><a href=\"pkg1/C1.html#setUndecorated(boolean)\">"
+ "<code>C1.setUndecorated(boolean)</code></a></dd>\n"
+ "</dl>",
"<span class=\"deprecatedLabel\">Deprecated.</span>\n"
+ "<div class=\"deprecationComment\">As of JDK version 1.5, replaced by\n"
+ " <a href=\"pkg1/C1.html#setUndecorated(boolean)\">"
+ "<code>setUndecorated(boolean)</code></a>.</div>\n"
+ "</div>\n"
+ "<div class=\"block\">Reads the object stream.</div>\n"
+ "<dl>\n"
+ "<dt><span class=\"throwsLabel\">Throws:"
+ "</span></dt>\n"
+ "<dd><code>java.io.IOException</code></dd>\n"
+ "</dl>",
"<span class=\"deprecatedLabel\">Deprecated.</span>"
+ "</div>\n"
+ "<div class=\"block\">The name for this class.</div>");
}
void checkCommentDeprecated_html4(boolean expectFound) {
// Test for normal run of javadoc in which various ClassDocs and
// serialized form should have properly nested definition list tags
// enclosing comments, tags and deprecated information.
checkOutput("pkg1/C1.html", expectFound,
"<dl>\n"
+ "<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n"
+ "<dd>1.4</dd>\n"
+ "<dt><span class=\"seeLabel\">See Also:</span></dt>\n"
+ "<dd><a href=\"#setUndecorated-boolean-\">"
+ "<code>setUndecorated(boolean)</code></a></dd>\n"
+ "</dl>",
"<dl>\n"
+ "<dt><span class=\"paramLabel\">Parameters:</span></dt>\n"
+ "<dd><code>undecorated"
+ "</code> - <code>true</code> if no decorations are\n"
+ " to be enabled;\n"
+ " <code>false</code> "
+ "if decorations are to be enabled.</dd>\n"
+ "<dt><span class=\"simpleTagLabel\">Since:"
+ "</span></dt>\n"
+ "<dd>1.4</dd>\n"
+ "<dt><span class=\"seeLabel\">See Also:</span></dt>\n"
+ "<dd>"
+ "<a href=\"#readObject--\"><code>readObject()"
+ "</code></a></dd>\n"
+ "</dl>",
"<dl>\n"
+ "<dt><span class=\"throwsLabel\">Throws:</span></dt>\n"
+ "<dd><code>java.io.IOException</code></dd>\n"
+ "<dt><span class=\"seeLabel\">See Also:"
+ "</span></dt>\n"
+ "<dd><a href=\"#setUndecorated-boolean-\">"
+ "<code>setUndecorated(boolean)</code></a></dd>\n"
+ "</dl>");
checkOutput("serialized-form.html", expectFound, checkOutput("serialized-form.html", expectFound,
"<dl>\n" "<dl>\n"
+ "<dt><span class=\"throwsLabel\">Throws:</span>" + "<dt><span class=\"throwsLabel\">Throws:</span>"
@ -252,10 +380,7 @@ public class TestHtmlDefinitionListTag extends JavadocTester {
+ "<dt><span class=\"throwsLabel\">Throws:" + "<dt><span class=\"throwsLabel\">Throws:"
+ "</span></dt>\n" + "</span></dt>\n"
+ "<dd><code>java.io.IOException</code></dd>\n" + "<dd><code>java.io.IOException</code></dd>\n"
+ "</dl>", + "</dl>");
"<span class=\"deprecatedLabel\">Deprecated.</span>"
+ "</div>\n"
+ "<div class=\"block\">The name for this class.</div>");
} }
void checkNoDeprecated() { void checkNoDeprecated() {
@ -299,6 +424,81 @@ public class TestHtmlDefinitionListTag extends JavadocTester {
+ "<dd><code>" + "<dd><code>"
+ "HeadlessException</code></dd>\n" + "HeadlessException</code></dd>\n"
+ "</dl>", + "</dl>",
"<dl>\n"
+ "<dt><span class=\"paramLabel\">Parameters:"
+ "</span></dt>\n"
+ "<dd><code>undecorated</code> - <code>true</code>"
+ " if no decorations are\n"
+ " to be enabled;\n"
+ " <code>false</code> if decorations are to be enabled."
+ "</dd>\n"
+ "<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n"
+ "<dd>1.4</dd>\n"
+ "<dt><span class=\"seeLabel\">See Also:</span></dt>\n"
+ "<dd><a href=\"#readObject()\">"
+ "<code>readObject()</code></a></dd>\n"
+ "</dl>",
"<dl>\n"
+ "<dt><span class=\"throwsLabel\">Throws:</span>"
+ "</dt>\n"
+ "<dd><code>java.io.IOException</code></dd>\n"
+ "<dt>"
+ "<span class=\"seeLabel\">See Also:</span></dt>\n"
+ "<dd><a href=\"#setUndecorated(boolean)\">"
+ "<code>setUndecorated(boolean)</code></a></dd>\n"
+ "</dl>");
checkOutput("serialized-form.html", true,
"<dl>\n"
+ "<dt><span class=\"throwsLabel\">Throws:</span>"
+ "</dt>\n"
+ "<dd><code>"
+ "java.io.IOException</code></dd>\n"
+ "<dt><span class=\"seeLabel\">See Also:</span>"
+ "</dt>\n"
+ "<dd><a href=\"pkg1/C1.html#setUndecorated(boolean)\">"
+ "<code>C1.setUndecorated(boolean)</code></a></dd>\n"
+ "</dl>",
"<span class=\"deprecatedLabel\">Deprecated.</span>\n"
+ "<div class=\"deprecationComment\">As of JDK version 1.5, replaced by\n"
+ " <a href=\"pkg1/C1.html#setUndecorated(boolean)\">"
+ "<code>setUndecorated(boolean)</code></a>.</div>\n"
+ "</div>\n"
+ "<div class=\"block\">This field indicates whether the C1 is "
+ "undecorated.</div>\n"
+ "&nbsp;\n"
+ "<dl>\n"
+ "<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n"
+ "<dd>1.4</dd>\n"
+ "<dt><span class=\"seeLabel\">See Also:</span>"
+ "</dt>\n"
+ "<dd><a href=\"pkg1/C1.html#setUndecorated(boolean)\">"
+ "<code>C1.setUndecorated(boolean)</code></a></dd>\n"
+ "</dl>",
"<span class=\"deprecatedLabel\">Deprecated.</span>\n"
+ "<div class=\"deprecationComment\">As of JDK version 1.5, replaced by\n"
+ " <a href=\"pkg1/C1.html#setUndecorated(boolean)\">"
+ "<code>setUndecorated(boolean)</code></a>.</div>\n"
+ "</div>\n"
+ "<div class=\"block\">Reads the object stream.</div>\n"
+ "<dl>\n"
+ "<dt><span class=\"throwsLabel\">Throws:"
+ "</span></dt>\n"
+ "<dd><code>java.io.IOException</code></dd>\n"
+ "</dl>",
"<span class=\"deprecatedLabel\">Deprecated.</span>"
+ "</div>\n"
+ "<div class=\"block\">"
+ "The name for this class.</div>");
}
void checkNoDeprecated_html4() {
// Test with -nodeprecated option. The ClassDocs should have properly nested
// definition list tags enclosing comments and tags. The ClassDocs should not
// display definition list for deprecated information. The serialized form
// should display properly nested definition list tags for comments, tags
// and deprecated information.
checkOutput("pkg1/C1.html", true,
"<dl>\n" "<dl>\n"
+ "<dt><span class=\"paramLabel\">Parameters:" + "<dt><span class=\"paramLabel\">Parameters:"
+ "</span></dt>\n" + "</span></dt>\n"
@ -360,11 +560,7 @@ public class TestHtmlDefinitionListTag extends JavadocTester {
+ "<dt><span class=\"throwsLabel\">Throws:" + "<dt><span class=\"throwsLabel\">Throws:"
+ "</span></dt>\n" + "</span></dt>\n"
+ "<dd><code>java.io.IOException</code></dd>\n" + "<dd><code>java.io.IOException</code></dd>\n"
+ "</dl>", + "</dl>");
"<span class=\"deprecatedLabel\">Deprecated.</span>"
+ "</div>\n"
+ "<div class=\"block\">"
+ "The name for this class.</div>");
} }
void checkNoCommentNoDeprecated(boolean expectFound) { void checkNoCommentNoDeprecated(boolean expectFound) {
@ -386,6 +582,30 @@ public class TestHtmlDefinitionListTag extends JavadocTester {
"APPLICATION_EXCLUDE</pre>\n" + "APPLICATION_EXCLUDE</pre>\n" +
"</li>"); "</li>");
checkOutput("serialized-form.html", expectFound,
"<pre>boolean " +
"undecorated</pre>\n" +
"<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">" +
"Deprecated.</span>\n"
+ "<div class=\"deprecationComment\">As of JDK version 1.5, replaced by\n"
+ " <a href=\"pkg1/C1.html#setUndecorated(boolean)\"><code>"
+ "setUndecorated(boolean)</code></a>.</div>\n"
+ "</div>\n"
+
"</li>",
"<span class=\"deprecatedLabel\">"
+ "Deprecated.</span>\n"
+ "<div class=\"deprecationComment\">As of JDK version"
+ " 1.5, replaced by\n"
+ " <a href=\"pkg1/C1.html#setUndecorated(boolean)\">"
+ "<code>setUndecorated(boolean)</code></a>.</div>\n"
+ "</div>\n"
+ "</li>");
}
void checkNoCommentNoDeprecated_html4(boolean expectFound) {
// Test with -nocomment and -nodeprecated options. The ClassDocs whould
// not display definition lists for any member details.
checkOutput("serialized-form.html", expectFound, checkOutput("serialized-form.html", expectFound,
"<pre>boolean " + "<pre>boolean " +
"undecorated</pre>\n" + "undecorated</pre>\n" +

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -23,7 +23,7 @@
/* /*
* @test * @test
* @bug 8008164 8169819 8183037 * @bug 8008164 8169819 8183037 8182765
* @summary Test styles on HTML tables generated by javadoc. * @summary Test styles on HTML tables generated by javadoc.
* @author Bhavesh Patel * @author Bhavesh Patel
* @library ../lib * @library ../lib
@ -45,6 +45,43 @@ public class TestHtmlTableStyles extends JavadocTester {
"-sourcepath", testSrc, "-sourcepath", testSrc,
"-use", "-use",
"pkg1", "pkg2"); "pkg1", "pkg2");
checkExit(Exit.ERROR);
checkOutput(Output.OUT, true,
"attribute not supported in HTML5: summary",
"attribute border for table only accepts \"\" or \"1\", use CSS instead: BORDER",
"attribute not supported in HTML5: cellpadding",
"attribute not supported in HTML5: cellspacing",
"attribute not supported in HTML5: align");
checkOutput("pkg1/TestTable.html", true,
"<table summary=\"Summary\" border cellpadding=3 cellspacing=1>",
"<table class=\"memberSummary\">",
"<table class=\"memberSummary\">",
"<table class=\"memberSummary\">");
checkOutput("pkg1/package-summary.html", true,
"<table class=\"typeSummary\">");
checkOutput("pkg1/class-use/TestTable.html", true,
"<table class=\"useSummary\">");
checkOutput("overview-summary.html", true,
"<table class=\"overviewSummary\">");
checkOutput("deprecated-list.html", true,
"<table class=\"deprecatedSummary\">");
checkOutput("constant-values.html", true,
"<table class=\"constantsSummary\">");
}
@Test
void test_html4() {
javadoc("-d", "out-html4",
"-html4",
"-sourcepath", testSrc,
"-use",
"pkg1", "pkg2");
checkExit(Exit.OK); checkExit(Exit.OK);
checkOutput("pkg1/TestTable.html", true, checkOutput("pkg1/TestTable.html", true,

View File

@ -23,7 +23,7 @@
/* /*
* @test * @test
* @bug 6786688 8008164 8162363 8169819 8183037 * @bug 6786688 8008164 8162363 8169819 8183037 8182765
* @summary HTML tables should have table summary, caption and table headers. * @summary HTML tables should have table summary, caption and table headers.
* @author Bhavesh Patel * @author Bhavesh Patel
* @library ../lib * @library ../lib
@ -53,11 +53,95 @@ public class TestHtmlTableTags extends JavadocTester {
"pkg1", "pkg2"); "pkg1", "pkg2");
checkExit(Exit.OK); checkExit(Exit.OK);
checkHtmlTableSummaries(); checkHtmlTableTag();
checkHtmlTableCaptions(); checkHtmlTableCaptions();
checkHtmlTableHeaders(); checkHtmlTableHeaders();
} }
@Test
void test_html4() {
javadoc("-d", "out-html4",
"-html4",
"-sourcepath", testSrc,
"-use",
"pkg1", "pkg2");
checkExit(Exit.OK);
checkHtmlTableSummaries();
}
/*
* Tests for validating table tag for HTML tables
*/
void checkHtmlTableTag() {
//Package summary
checkOutput("pkg1/package-summary.html", true,
"<table class=\"typeSummary\">",
"<table class=\"typeSummary\">");
checkOutput("pkg2/package-summary.html", true,
"<table class=\"typeSummary\">",
"<table class=\"typeSummary\">");
// Class documentation
checkOutput("pkg1/C1.html", true,
"<table class=\"memberSummary\">",
"<table class=\"memberSummary\">");
checkOutput("pkg2/C2.html", true,
"<table class=\"memberSummary\">",
"<table class=\"memberSummary\">");
checkOutput("pkg2/C2.ModalExclusionType.html", true,
"<table class=\"memberSummary\">");
checkOutput("pkg2/C3.html", true,
"<table class=\"memberSummary\">");
checkOutput("pkg2/C4.html", true,
"<table class=\"memberSummary\">");
// Class use documentation
checkOutput("pkg1/class-use/I1.html", true,
"<table class=\"useSummary\">");
checkOutput("pkg1/class-use/C1.html", true,
"<table class=\"useSummary\">",
"<table class=\"useSummary\">");
checkOutput("pkg2/class-use/C2.html", true,
"<table class=\"useSummary\">",
"<table class=\"useSummary\">");
checkOutput("pkg2/class-use/C2.ModalExclusionType.html", true,
"<table class=\"useSummary\">");
checkOutput("pkg2/class-use/C2.ModalExclusionType.html", true,
"<table class=\"useSummary\">");
// Package use documentation
checkOutput("pkg1/package-use.html", true,
"<table class=\"useSummary\">",
"<table class=\"useSummary\">");
checkOutput("pkg2/package-use.html", true,
"<table class=\"useSummary\">",
"<table class=\"useSummary\">");
// Deprecated
checkOutput("deprecated-list.html", true,
"<table class=\"deprecatedSummary\">",
"<table class=\"deprecatedSummary\">");
// Constant values
checkOutput("constant-values.html", true,
"<table class=\"constantsSummary\">");
// Overview Summary
checkOutput("overview-summary.html", true,
"<table class=\"overviewSummary\">");
}
/* /*
* Tests for validating summary for HTML tables * Tests for validating summary for HTML tables
*/ */

View File

@ -23,7 +23,7 @@
/* /*
* @test * @test
* @bug 6786682 4649116 * @bug 6786682 4649116 8182765
* @summary This test verifies the use of lang attribute by <HTML>. * @summary This test verifies the use of lang attribute by <HTML>.
* @author Bhavesh Patel * @author Bhavesh Patel
* @library ../lib * @library ../lib
@ -105,6 +105,104 @@ public class TestHtmlTag extends JavadocTester {
"pkg3"); "pkg3");
checkExit(Exit.OK); checkExit(Exit.OK);
checkOutput("pkg3/package-summary.html", true,
"<div class=\"contentContainer\">\n"
+ "<section role=\"region\"><a id=\"package.description\">\n"
+ "<!-- -->\n"
+ "</a>\n"
+ "<div class=\"block\"><p>This is the first line. Note the newlines before the &lt;p&gt; is relevant.</div>\n"
+ "</section>");
checkOutput("pkg3/A.DatatypeFactory.html", true,
"<div class=\"block\"><p>\n"
+ " Factory that creates new <code>javax.xml.datatype</code>\n"
+ " <code>Object</code>s that map XML to/from Java <code>Object</code>s.</p>\n"
+ "\n"
+ " <p>\n"
+ " A new instance of the <code>DatatypeFactory</code> is created through the\n"
+ " <a href=\"#newInstance()\"><code>newInstance()</code></a> method that uses the following implementation\n"
+ " resolution mechanisms to determine an implementation:</p>\n"
+ " <ol>\n"
+ " <li>\n"
+ " If the system property specified by <a href=\"#DATATYPEFACTORY_PROPERTY\"><code>DATATYPEFACTORY_PROPERTY</code></a>,\n"
+ " \"<code>javax.xml.datatype.DatatypeFactory</code>\", exists, a class with\n"
+ " the name of the property value is instantiated. Any Exception thrown\n"
+ " during the instantiation process is wrapped as a\n"
+ " <code>IllegalStateException</code>.\n"
+ " </li>\n"
+ " <li>\n"
+ " If the file ${JAVA_HOME}/lib/jaxp.properties exists, it is loaded in a\n"
+ " <code>Properties</code> <code>Object</code>. The\n"
+ " <code>Properties</code> <code>Object </code> is then queried for the\n"
+ " property as documented in the prior step and processed as documented in\n"
+ " the prior step.\n"
+ " </li>\n"
+ " <li>\n"
+ " Uses the service-provider loading facilities, defined by the\n"
+ " <code>ServiceLoader</code> class, to attempt to locate and load an\n"
+ " implementation of the service using the default loading mechanism:\n"
+ " the service-provider loading facility will use the current thread's context class loader\n"
+ " to attempt to load the service. If the context class loader is null, the system class loader will be used.\n"
+ " <br>\n"
+ " In case of <code>service configuration error</code> a\n"
+ " <code>DatatypeConfigurationException</code> will be thrown.\n"
+ " </li>\n"
+ " <li>\n"
+ " The final mechanism is to attempt to instantiate the <code>Class</code>\n"
+ " specified by <a href=\"#DATATYPEFACTORY_IMPLEMENTATION_CLASS\"><code>DATATYPEFACTORY_IMPLEMENTATION_CLASS</code></a>. Any Exception\n"
+ " thrown during the instantiation process is wrapped as a\n"
+ " <code>IllegalStateException</code>.\n"
+ " </li>\n"
+ " </ol></div>");
checkOutput("pkg3/A.ActivationDesc.html", true,
"<pre>public class <span class=\"typeNameLabel\">A.ActivationDesc</span>\n"
+ "extends java.lang.Object\n"
+ "implements java.io.Serializable</pre>\n"
+ "<div class=\"block\">An activation descriptor contains the information necessary to activate\n"
+ " an object: <ul>\n"
+ " <li> the object's group identifier,\n"
+ " <li> the object's fully-qualified class name,\n"
+ " <li> the object's code location (the location of the class), a codebase\n"
+ " URL path,\n"
+ " <li> the object's restart \"mode\", and,\n"
+ " <li> a \"marshalled\" object that can contain object specific\n"
+ " initialization data. </ul>\n"
+ "\n"
+ " <p>\n"
+ " A descriptor registered with the activation system can be used to\n"
+ " recreate/activate the object specified by the descriptor. The\n"
+ " <code>MarshalledObject</code> in the object's descriptor is passed as the\n"
+ " second argument to the remote object's constructor for object to use\n"
+ " during reinitialization/activation.</div>");
checkOutput("pkg3/A.ActivationGroupID.html", true,
"<pre>public class <span class=\"typeNameLabel\">A.ActivationGroupID</span>\n"
+ "extends java.lang.Object\n"
+ "implements java.io.Serializable</pre>\n"
+ "<div class=\"block\">The identifier for a registered activation group serves several purposes:\n"
+ " <ul>\n"
+ " <li>identifies the group uniquely within the activation system, and\n"
+ " <li>contains a reference to the group's activation system so that the\n"
+ " group can contact its activation system when necessary.</ul><p>\n"
+ "\n"
+ " The <code>ActivationGroupID</code> is returned from the call to\n"
+ " <code>ActivationSystem.registerGroup</code> and is used to identify the\n"
+ " group within the activation system. This group id is passed as one of the\n"
+ " arguments to the activation group's special constructor when an\n"
+ " activation group is created/recreated.</div>\n"
+ "<dl>");
}
@Test
void test_other_html4() {
javadoc("-locale", "en_US",
"-d", "out-other-html4",
"-html4",
"-sourcepath", testSrc,
"pkg3");
checkExit(Exit.OK);
checkOutput("pkg3/package-summary.html", true, checkOutput("pkg3/package-summary.html", true,
"<div class=\"contentContainer\"><a name=\"package.description\">\n" "<div class=\"contentContainer\"><a name=\"package.description\">\n"
+ "<!-- -->\n" + "<!-- -->\n"
@ -154,43 +252,5 @@ public class TestHtmlTag extends JavadocTester {
+ " <code>IllegalStateException</code>.\n" + " <code>IllegalStateException</code>.\n"
+ " </li>\n" + " </li>\n"
+ " </ol></div>"); + " </ol></div>");
checkOutput("pkg3/A.ActivationDesc.html", true,
"<pre>public class <span class=\"typeNameLabel\">A.ActivationDesc</span>\n"
+ "extends java.lang.Object\n"
+ "implements java.io.Serializable</pre>\n"
+ "<div class=\"block\">An activation descriptor contains the information necessary to activate\n"
+ " an object: <ul>\n"
+ " <li> the object's group identifier,\n"
+ " <li> the object's fully-qualified class name,\n"
+ " <li> the object's code location (the location of the class), a codebase\n"
+ " URL path,\n"
+ " <li> the object's restart \"mode\", and,\n"
+ " <li> a \"marshalled\" object that can contain object specific\n"
+ " initialization data. </ul>\n"
+ "\n"
+ " <p>\n"
+ " A descriptor registered with the activation system can be used to\n"
+ " recreate/activate the object specified by the descriptor. The\n"
+ " <code>MarshalledObject</code> in the object's descriptor is passed as the\n"
+ " second argument to the remote object's constructor for object to use\n"
+ " during reinitialization/activation.</div>");
checkOutput("pkg3/A.ActivationGroupID.html", true,
"<pre>public class <span class=\"typeNameLabel\">A.ActivationGroupID</span>\n"
+ "extends java.lang.Object\n"
+ "implements java.io.Serializable</pre>\n"
+ "<div class=\"block\">The identifier for a registered activation group serves several purposes:\n"
+ " <ul>\n"
+ " <li>identifies the group uniquely within the activation system, and\n"
+ " <li>contains a reference to the group's activation system so that the\n"
+ " group can contact its activation system when necessary.</ul><p>\n"
+ "\n"
+ " The <code>ActivationGroupID</code> is returned from the call to\n"
+ " <code>ActivationSystem.registerGroup</code> and is used to identify the\n"
+ " group within the activation system. This group id is passed as one of the\n"
+ " arguments to the activation group's special constructor when an\n"
+ " activation group is created/recreated.</div>\n"
+ "<dl>");
} }
} }

View File

@ -23,7 +23,7 @@
/* /*
* @test * @test
* @bug 8072945 8081854 8141492 8148985 8150188 4649116 8173707 8151743 8169819 8183037 * @bug 8072945 8081854 8141492 8148985 8150188 4649116 8173707 8151743 8169819 8183037 8182765
* @summary Test the version of HTML generated by the javadoc tool. * @summary Test the version of HTML generated by the javadoc tool.
* @author bpatel * @author bpatel
* @library ../lib * @library ../lib
@ -41,7 +41,9 @@ public class TestHtmlVersion extends JavadocTester {
@Test @Test
void test1() { void test1() {
javadoc("-d", "out-1", "-private", "-linksource", "-html5", javadoc("-d", "out-1",
"-private",
"-linksource",
"-sourcepath", testSrc, "-sourcepath", testSrc,
"-use", "-use",
"pkg", "pkg1", "pkg2", "pkg3"); "pkg", "pkg1", "pkg2", "pkg3");
@ -53,7 +55,10 @@ public class TestHtmlVersion extends JavadocTester {
@Test @Test
void test2() { void test2() {
javadoc("-d", "out-2", "-private", "-linksource", "-html4", javadoc("-d", "out-2",
"-html4",
"-private",
"-linksource",
"-sourcepath", testSrc, "-sourcepath", testSrc,
"-use", "-use",
"pkg", "pkg1", "pkg2", "pkg3"); "pkg", "pkg1", "pkg2", "pkg3");
@ -65,7 +70,10 @@ public class TestHtmlVersion extends JavadocTester {
@Test @Test
void test3() { void test3() {
javadoc("-d", "out-3", "-private", "-linksource", javadoc("-d", "out-3",
"-html4",
"-private",
"-linksource",
"-sourcepath", testSrc, "-sourcepath", testSrc,
"-use", "-use",
"pkg", "pkg1", "pkg2", "pkg3"); "pkg", "pkg1", "pkg2", "pkg3");
@ -77,7 +85,9 @@ public class TestHtmlVersion extends JavadocTester {
@Test @Test
void test4() { void test4() {
javadoc("-d", "out-4", "-private", "-linksource", "-html5", javadoc("-d", "out-4",
"-private",
"-linksource",
"-sourcepath", testSrc, "-sourcepath", testSrc,
"-use", "-use",
"pkg3"); "pkg3");

View File

@ -23,7 +23,7 @@
/* /*
* @test * @test
* @bug 8194955 * @bug 8194955 8182765
* @summary Warn when default HTML version is used. * @summary Warn when default HTML version is used.
* @library ../lib * @library ../lib
* @modules jdk.javadoc/jdk.javadoc.internal.tool * @modules jdk.javadoc/jdk.javadoc.internal.tool
@ -47,8 +47,11 @@ public class TestHtmlWarning extends JavadocTester {
} }
private static final Path testFile = Paths.get("C.java"); private static final Path testFile = Paths.get("C.java");
private static final String warning = private static final String warning
"javadoc: warning - You have not specified the version of HTML to use."; = "javadoc: warning - You have specified the HTML version as HTML 4.01 by using the -html4 option.\n"
+ "The default is currently HTML5 and the support for HTML 4.01 will be removed\n"
+ "in a future release. To suppress this warning, please ensure that any HTML constructs\n"
+ "in your comments are valid in HTML5, and remove the -html4 option.";
@Test @Test
void testHtml4() { void testHtml4() {
@ -57,7 +60,7 @@ public class TestHtmlWarning extends JavadocTester {
testFile.toString()); testFile.toString());
checkExit(Exit.OK); checkExit(Exit.OK);
checkOutput(Output.OUT, false, warning); checkOutput(Output.OUT, true, warning);
} }
@Test @Test
@ -76,6 +79,6 @@ public class TestHtmlWarning extends JavadocTester {
testFile.toString()); testFile.toString());
checkExit(Exit.OK); checkExit(Exit.OK);
checkOutput(Output.OUT, true, warning); checkOutput(Output.OUT, false, warning);
} }
} }

View File

@ -24,7 +24,7 @@
/* /*
* @test * @test
* @bug 4682448 4947464 5029946 8025633 8026567 8035473 8139101 8175200 * @bug 4682448 4947464 5029946 8025633 8026567 8035473 8139101 8175200
8186332 8186703 8186332 8186703 8182765
* @summary Verify that the public modifier does not show up in the * @summary Verify that the public modifier does not show up in the
* documentation for public methods, as recommended by the JLS. * documentation for public methods, as recommended by the JLS.
* If A implements I and B extends A, B should be in the list of * If A implements I and B extends A, B should be in the list of
@ -99,14 +99,14 @@ public class TestInterface extends JavadocTester {
+ "</ul>", + "</ul>",
//Make sure "Specified By" has substituted type parameters. //Make sure "Specified By" has substituted type parameters.
"<dt><span class=\"overrideSpecifyLabel\">Specified by:</span></dt>\n" "<dt><span class=\"overrideSpecifyLabel\">Specified by:</span></dt>\n"
+ "<dd><code><a href=\"Interface.html#method--\">method</a>" + "<dd><code><a href=\"Interface.html#method()\">method</a>"
+ "</code>&nbsp;in interface&nbsp;<code>" + "</code>&nbsp;in interface&nbsp;<code>"
+ "<a href=\"Interface.html\" title=\"interface in pkg\">" + "<a href=\"Interface.html\" title=\"interface in pkg\">"
+ "Interface</a>&lt;<a href=\"Child.html\" title=\"type parameter in Child\">" + "Interface</a>&lt;<a href=\"Child.html\" title=\"type parameter in Child\">"
+ "CE</a>&gt;</code></dd>", + "CE</a>&gt;</code></dd>",
//Make sure "Overrides" has substituted type parameters. //Make sure "Overrides" has substituted type parameters.
"<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n" "<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n"
+ "<dd><code><a href=\"Parent.html#method--\">method</a>" + "<dd><code><a href=\"Parent.html#method()\">method</a>"
+ "</code>&nbsp;in class&nbsp;<code><a href=\"Parent.html\" " + "</code>&nbsp;in class&nbsp;<code><a href=\"Parent.html\" "
+ "title=\"class in pkg\">Parent</a>&lt;<a href=\"Child.html\" " + "title=\"class in pkg\">Parent</a>&lt;<a href=\"Child.html\" "
+ "title=\"type parameter in Child\">CE</a>&gt;</code></dd>"); + "title=\"type parameter in Child\">CE</a>&gt;</code></dd>");
@ -120,7 +120,7 @@ public class TestInterface extends JavadocTester {
+ "</dl>"); + "</dl>");
checkOutput("pkg/Interface.html", false, checkOutput("pkg/Interface.html", false,
"public int&nbsp;method()", "public int&nbsp;method--",
"public static final&nbsp;int field"); "public static final&nbsp;int field");
checkOutput("pkg/ClassWithStaticMembers.html", false, checkOutput("pkg/ClassWithStaticMembers.html", false,
@ -133,6 +133,52 @@ public class TestInterface extends JavadocTester {
+ "<pre>public static&nbsp;int f</pre>\n" + "<pre>public static&nbsp;int f</pre>\n"
+ "<div class=\"block\">A hider field</div>", + "<div class=\"block\">A hider field</div>",
"<td class=\"colFirst\"><code>static void</code></td>\n"
+ "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">"
+ "<a href=\"#m()\">m</a></span>()</code></th>\n"
+ "<td class=\"colLast\">\n"
+ "<div class=\"block\">A hider method</div>\n"
+ "</td>\n",
"<h4>staticMethod</h4>\n"
+ "<pre>public static&nbsp;void&nbsp;staticMethod()</pre>\n"
+ "<div class=\"block\"><span class=\"descfrmTypeLabel\">"
+ "Description copied from interface:&nbsp;<code>"
+ "<a href=\"InterfaceWithStaticMembers.html#staticMethod()\">"
+ "InterfaceWithStaticMembers</a></code></span></div>\n"
+ "<div class=\"block\">A static method</div>\n");
checkOutput("pkg/ClassWithStaticMembers.InnerClass.html", true,
"<pre>public static class <span class=\"typeNameLabel\">"
+ "ClassWithStaticMembers.InnerClass</span>\n"
+ "extends java.lang.Object</pre>\n"
+ "<div class=\"block\">A hider inner class</div>");
}
@Test
void test_html4() {
javadoc("-d", "out-html4",
"-html4",
"-sourcepath", testSrc,
"pkg");
checkExit(Exit.OK);
checkOutput("pkg/Child.html", true,
//Make sure "Specified By" has substituted type parameters.
"<dt><span class=\"overrideSpecifyLabel\">Specified by:</span></dt>\n"
+ "<dd><code><a href=\"Interface.html#method--\">method</a>"
+ "</code>&nbsp;in interface&nbsp;<code>"
+ "<a href=\"Interface.html\" title=\"interface in pkg\">"
+ "Interface</a>&lt;<a href=\"Child.html\" title=\"type parameter in Child\">"
+ "CE</a>&gt;</code></dd>",
//Make sure "Overrides" has substituted type parameters.
"<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n"
+ "<dd><code><a href=\"Parent.html#method--\">method</a>"
+ "</code>&nbsp;in class&nbsp;<code><a href=\"Parent.html\" "
+ "title=\"class in pkg\">Parent</a>&lt;<a href=\"Child.html\" "
+ "title=\"type parameter in Child\">CE</a>&gt;</code></dd>");
checkOutput("pkg/ClassWithStaticMembers.html", true,
"<td class=\"colFirst\"><code>static void</code></td>\n" "<td class=\"colFirst\"><code>static void</code></td>\n"
+ "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">" + "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">"
+ "<a href=\"#m--\">m</a></span>()</code></th>\n" + "<a href=\"#m--\">m</a></span>()</code></th>\n"
@ -148,11 +194,8 @@ public class TestInterface extends JavadocTester {
+ "InterfaceWithStaticMembers</a></code></span></div>\n" + "InterfaceWithStaticMembers</a></code></span></div>\n"
+ "<div class=\"block\">A static method</div>\n"); + "<div class=\"block\">A static method</div>\n");
checkOutput("pkg/ClassWithStaticMembers.InnerClass.html", true, checkOutput("pkg/Interface.html", false,
"<pre>public static class <span class=\"typeNameLabel\">" "public int&nbsp;method()");
+ "ClassWithStaticMembers.InnerClass</span>\n"
+ "extends java.lang.Object</pre>\n"
+ "<div class=\"block\">A hider inner class</div>");
} }
@Test @Test
@ -162,6 +205,23 @@ public class TestInterface extends JavadocTester {
"pkg1"); "pkg1");
checkExit(Exit.OK); checkExit(Exit.OK);
checkOutput("pkg1/Child.html", true,
// Ensure the correct Overrides in the inheritance hierarchy is reported
"<span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n" +
"<dd><code><a href=\"GrandParent.html#method1()\">method1</a></code>" +
"&nbsp;in class&nbsp;" +
"<code><a href=\"GrandParent.html\" title=\"class in pkg1\">GrandParent</a>" +
"&lt;<a href=\"Child.html\" title=\"type parameter in Child\">CE</a>&gt;</code>");
}
@Test
void test1_html4() {
javadoc("-d", "out-1-html4",
"-html4",
"-sourcepath", testSrc,
"pkg1");
checkExit(Exit.OK);
checkOutput("pkg1/Child.html", true, checkOutput("pkg1/Child.html", true,
// Ensure the correct Overrides in the inheritance hierarchy is reported // Ensure the correct Overrides in the inheritance hierarchy is reported
"<span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n" + "<span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n" +

View File

@ -24,7 +24,7 @@
/* /*
* @test * @test
* @bug 7112427 8012295 8025633 8026567 8061305 8081854 8150130 8162363 * @bug 7112427 8012295 8025633 8026567 8061305 8081854 8150130 8162363
* 8167967 8172528 8175200 8178830 8182257 8186332 * 8167967 8172528 8175200 8178830 8182257 8186332 8182765
* @summary Test of the JavaFX doclet features. * @summary Test of the JavaFX doclet features.
* @author jvalenta * @author jvalenta
* @library ../lib * @library ../lib
@ -51,9 +51,8 @@ public class TestJavaFX extends JavadocTester {
checkOutput("pkg1/C.html", true, checkOutput("pkg1/C.html", true,
"<dt><span class=\"seeLabel\">See Also:</span></dt>\n" "<dt><span class=\"seeLabel\">See Also:</span></dt>\n"
+ "<dd><a href=\"#getRate--\"><code>getRate()</code></a>, \n" + "<dd><a href=\"#getRate()\"><code>getRate()</code></a>, \n"
+ "<a href=\"#setRate-double-\">" + "<a href=\"#setRate(double)\"><code>setRate(double)</code></a></dd>",
+ "<code>setRate(double)</code></a></dd>",
"<pre>public final&nbsp;void&nbsp;setRate&#8203;(double&nbsp;value)</pre>\n" "<pre>public final&nbsp;void&nbsp;setRate&#8203;(double&nbsp;value)</pre>\n"
+ "<div class=\"block\">Sets the value of the property rate.</div>\n" + "<div class=\"block\">Sets the value of the property rate.</div>\n"
+ "<dl>\n" + "<dl>\n"
@ -77,7 +76,7 @@ public class TestJavaFX extends JavadocTester {
"<p>Gets the value of the property <code>Property</code>", "<p>Gets the value of the property <code>Property</code>",
"<span class=\"simpleTagLabel\">Property description:</span>", "<span class=\"simpleTagLabel\">Property description:</span>",
"<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">" "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">"
+ "<a href=\"#setTestMethodProperty--\">" + "<a href=\"#setTestMethodProperty()\">"
+ "setTestMethodProperty</a></span>()</code></th>", + "setTestMethodProperty</a></span>()</code></th>",
"<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">" "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">"
+ "<a href=\"#pausedProperty\">paused</a></span></code></th>\n" + "<a href=\"#pausedProperty\">paused</a></span></code></th>\n"
@ -135,7 +134,7 @@ public class TestJavaFX extends JavadocTester {
+ "<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n" + "<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n"
+ "<dd>JavaFX 8.0</dd>", + "<dd>JavaFX 8.0</dd>",
"<h3>Property Summary</h3>\n" "<h3>Property Summary</h3>\n"
+ "<table class=\"memberSummary\" summary=\"Property Summary table, listing properties, and an explanation\">\n" + "<table class=\"memberSummary\">\n"
+ "<caption><span>Properties</span><span class=\"tabEnd\">&nbsp;</span></caption>", + "<caption><span>Properties</span><span class=\"tabEnd\">&nbsp;</span></caption>",
"<tr class=\"altColor\">\n" "<tr class=\"altColor\">\n"
+ "<td class=\"colFirst\"><code><a href=\"C.BooleanProperty.html\" title=\"class in pkg1\">C.BooleanProperty</a></code></td>\n", + "<td class=\"colFirst\"><code><a href=\"C.BooleanProperty.html\" title=\"class in pkg1\">C.BooleanProperty</a></code></td>\n",
@ -168,6 +167,30 @@ public class TestJavaFX extends JavadocTester {
checkOutput("pkg1/D.html", false, "shouldNotAppear"); checkOutput("pkg1/D.html", false, "shouldNotAppear");
} }
@Test
void test1_html4() {
javadoc("-d", "out1-html4",
"-html4",
"-sourcepath", testSrc,
"-javafx",
"-package",
"pkg1");
checkExit(Exit.OK);
checkOutput("pkg1/C.html", true,
"<dt><span class=\"seeLabel\">See Also:</span></dt>\n"
+ "<dd><a href=\"#getRate--\"><code>getRate()</code></a>, \n"
+ "<a href=\"#setRate-double-\">"
+ "<code>setRate(double)</code></a></dd>",
"<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">"
+ "<a href=\"#setTestMethodProperty--\">"
+ "setTestMethodProperty</a></span>()</code></th>",
"<h3>Property Summary</h3>\n"
+ "<table class=\"memberSummary\" summary=\"Property Summary table, listing properties, and an explanation\">\n"
+ "<caption><span>Properties</span><span class=\"tabEnd\">&nbsp;</span></caption>");
}
/* /*
* Test with -javafx option enabled, to ensure property getters and setters * Test with -javafx option enabled, to ensure property getters and setters
* are treated correctly. * are treated correctly.
@ -180,6 +203,61 @@ public class TestJavaFX extends JavadocTester {
"-package", "-package",
"pkg2"); "pkg2");
checkExit(Exit.OK); checkExit(Exit.OK);
checkOutput("pkg2/Test.html", true,
"<h3>Property Detail</h3>\n"
+ "<a id=\"betaProperty\">\n"
+ "<!-- -->\n"
+ "</a>\n"
+ "<ul class=\"blockList\">\n"
+ "<li class=\"blockList\">\n"
+ "<h4>beta</h4>\n"
+ "<pre>public&nbsp;java.lang.Object betaProperty</pre>\n"
+ "</li>\n"
+ "</ul>\n"
+ "<a id=\"gammaProperty\">\n"
+ "<!-- -->\n"
+ "</a>\n"
+ "<ul class=\"blockList\">\n"
+ "<li class=\"blockList\">\n"
+ "<h4>gamma</h4>\n"
+ "<pre>public final&nbsp;java.util.List&lt;java.lang.String&gt; gammaProperty</pre>\n"
+ "</li>\n"
+ "</ul>\n"
+ "<a id=\"deltaProperty\">\n"
+ "<!-- -->\n"
+ "</a>\n"
+ "<ul class=\"blockListLast\">\n"
+ "<li class=\"blockList\">\n"
+ "<h4>delta</h4>\n"
+ "<pre>public final&nbsp;java.util.List&lt;"
+ "java.util.Set&lt;? super java.lang.Object&gt;&gt; deltaProperty</pre>\n"
+ "</li>\n"
+ "</ul>\n"
+ "</li>\n"
+ "</ul>",
"<h3>Property Summary</h3>\n"
+ "<table class=\"memberSummary\">\n"
+ "<caption><span>Properties</span><span class=\"tabEnd\">&nbsp;</span></caption>");
checkOutput("pkg2/Test.html", false,
"<h3>Property Summary</h3>\n"
+ "<table class=\"memberSummary\" summary=\"Property Summary table, listing properties, and an explanation\">\n"
+ "<caption><span id=\"t0\" class=\"activeTableTab\"><span>All Methods</span><span class=\"tabEnd\">&nbsp;</span>"
+ "</span><span id=\"t2\" class=\"tableTab\"><span><a href=\"javascript:show(2);\">Instance Methods</a>"
+ "</span><span class=\"tabEnd\">&nbsp;</span></span><span id=\"t4\" class=\"tableTab\"><span>"
+ "<a href=\"javascript:show(8);\">Concrete Methods</a></span><span class=\"tabEnd\">&nbsp;</span></span>"
+ "</caption>");
}
@Test
void test2_html4() {
javadoc("-d", "out2a-html4",
"-html4",
"-sourcepath", testSrc,
"-javafx",
"-package",
"pkg2");
checkExit(Exit.OK);
checkOutput("pkg2/Test.html", true, checkOutput("pkg2/Test.html", true,
"<h3>Property Detail</h3>\n" "<h3>Property Detail</h3>\n"
+ "<a name=\"betaProperty\">\n" + "<a name=\"betaProperty\">\n"
@ -215,15 +293,6 @@ public class TestJavaFX extends JavadocTester {
"<h3>Property Summary</h3>\n" "<h3>Property Summary</h3>\n"
+ "<table class=\"memberSummary\" summary=\"Property Summary table, listing properties, and an explanation\">\n" + "<table class=\"memberSummary\" summary=\"Property Summary table, listing properties, and an explanation\">\n"
+ "<caption><span>Properties</span><span class=\"tabEnd\">&nbsp;</span></caption>"); + "<caption><span>Properties</span><span class=\"tabEnd\">&nbsp;</span></caption>");
checkOutput("pkg2/Test.html", false,
"<h3>Property Summary</h3>\n"
+ "<table class=\"memberSummary\" summary=\"Property Summary table, listing properties, and an explanation\">\n"
+ "<caption><span id=\"t0\" class=\"activeTableTab\"><span>All Methods</span><span class=\"tabEnd\">&nbsp;</span>"
+ "</span><span id=\"t2\" class=\"tableTab\"><span><a href=\"javascript:show(2);\">Instance Methods</a>"
+ "</span><span class=\"tabEnd\">&nbsp;</span></span><span id=\"t4\" class=\"tableTab\"><span>"
+ "<a href=\"javascript:show(8);\">Concrete Methods</a></span><span class=\"tabEnd\">&nbsp;</span></span>"
+ "</caption>");
} }
/* /*
@ -238,6 +307,47 @@ public class TestJavaFX extends JavadocTester {
"pkg2"); "pkg2");
checkExit(Exit.OK); checkExit(Exit.OK);
checkOutput("pkg2/Test.html", false, "<h3>Property Summary</h3>"); checkOutput("pkg2/Test.html", false, "<h3>Property Summary</h3>");
checkOutput("pkg2/Test.html", true,
"<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>\n"
+ "<th class=\"colSecond\" scope=\"col\">Method</th>\n"
+ "<th class=\"colLast\" scope=\"col\">Description</th>\n"
+ "</tr>\n"
+ "<tr id=\"i0\" class=\"altColor\">\n"
+ "<td class=\"colFirst\"><code>&lt;T&gt;&nbsp;java.lang.Object</code></td>\n"
+ "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">"
+ "<a href=\"#alphaProperty(java.util.List)\">alphaProperty</a>"
+ "</span>&#8203;(java.util.List&lt;T&gt;&nbsp;foo)</code></th>\n"
+ "<td class=\"colLast\">&nbsp;</td>\n"
+ "</tr>\n"
+ "<tr id=\"i1\" class=\"rowColor\">\n"
+ "<td class=\"colFirst\"><code>java.lang.Object</code></td>\n"
+ "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">"
+ "<a href=\"#betaProperty()\">betaProperty</a></span>()</code></th>\n"
+ "<td class=\"colLast\">&nbsp;</td>\n"
+ "</tr>\n"
+ "<tr id=\"i2\" class=\"altColor\">\n"
+ "<td class=\"colFirst\"><code>java.util.List&lt;java.util.Set&lt;? super java.lang.Object&gt;&gt;"
+ "</code></td>\n"
+ "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">"
+ "<a href=\"#deltaProperty()\">deltaProperty</a></span>()</code></th>\n"
+ "<td class=\"colLast\">&nbsp;</td>\n"
+ "</tr>\n"
+ "<tr id=\"i3\" class=\"rowColor\">\n"
+ "<td class=\"colFirst\"><code>java.util.List&lt;java.lang.String&gt;</code></td>\n"
+ "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">"
+ "<a href=\"#gammaProperty()\">gammaProperty</a></span>()</code></th>\n"
+ "<td class=\"colLast\">&nbsp;</td>"
);
}
@Test
void test3_html4() {
javadoc("-d", "out2b-html4",
"-html4",
"-sourcepath", testSrc,
"-package",
"pkg2");
checkExit(Exit.OK);
checkOutput("pkg2/Test.html", true, checkOutput("pkg2/Test.html", true,
"<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>\n" "<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>\n"
+ "<th class=\"colSecond\" scope=\"col\">Method</th>\n" + "<th class=\"colSecond\" scope=\"col\">Method</th>\n"

View File

@ -23,7 +23,7 @@
/* /*
* @test * @test
* @bug 4720957 5020118 8026567 8038976 8184969 8164407 * @bug 4720957 5020118 8026567 8038976 8184969 8164407 8182765
* @summary Test to make sure that -link and -linkoffline link to * @summary Test to make sure that -link and -linkoffline link to
* right files, and URLs with and without trailing slash are accepted. * right files, and URLs with and without trailing slash are accepted.
* @author jamieh * @author jamieh
@ -66,7 +66,9 @@ public class TestLinkOption extends JavadocTester {
"-linkoffline", url, testSrc + "/jdk", "-linkoffline", url, testSrc + "/jdk",
"-package", "-package",
"pkg", "mylib.lang"); "pkg", "mylib.lang");
checkExit(Exit.OK); checkExit(Exit.ERROR);
checkOutput(Output.OUT, true,
"tag not supported in the generated HTML version: tt");
checkOutput("pkg/C.html", true, checkOutput("pkg/C.html", true,
"<a href=\"" + url + "java/lang/String.html?is-external=true\" " "<a href=\"" + url + "java/lang/String.html?is-external=true\" "
@ -82,11 +84,11 @@ public class TestLinkOption extends JavadocTester {
checkOutput("pkg/B.html", true, checkOutput("pkg/B.html", true,
"<div class=\"block\">A method with html tag the method " "<div class=\"block\">A method with html tag the method "
+ "<a href=\"" + url + "java/lang/ClassLoader.html?is-external=true#getSystemClassLoader--\"" + "<a href=\"" + url + "java/lang/ClassLoader.html?is-external=true#getSystemClassLoader()\""
+ " title=\"class or interface in java.lang\" class=\"externalLink\"><code><tt>getSystemClassLoader()</tt>" + " title=\"class or interface in java.lang\" class=\"externalLink\"><code><tt>getSystemClassLoader()</tt>"
+ "</code></a> as the parent class loader.</div>", + "</code></a> as the parent class loader.</div>",
"<div class=\"block\">is equivalent to invoking <code>" "<div class=\"block\">is equivalent to invoking <code>"
+ "<a href=\"#createTempFile-java.lang.String-java.lang.String-java.io.File-\">" + "<a href=\"#createTempFile(java.lang.String,java.lang.String,java.io.File)\">"
+ "<code>createTempFile(prefix,&nbsp;suffix,&nbsp;null)</code></a></code>.</div>", + "<code>createTempFile(prefix,&nbsp;suffix,&nbsp;null)</code></a></code>.</div>",
"<a href=\"" + url + "java/lang/String.html?is-external=true\" " "<a href=\"" + url + "java/lang/String.html?is-external=true\" "
+ "title=\"class or interface in java.lang\" class=\"externalLink\">Link-Plain to String Class</a>", + "title=\"class or interface in java.lang\" class=\"externalLink\">Link-Plain to String Class</a>",
@ -109,6 +111,25 @@ public class TestLinkOption extends JavadocTester {
+ "title=\"class or interface in java.lang\" class=\"externalLink\">Object</a></pre>" + "title=\"class or interface in java.lang\" class=\"externalLink\">Object</a></pre>"
); );
String out1_html4 = "out1-html4";
javadoc("-d", out1_html4,
"-html4",
"-classpath", mylib,
"-sourcepath", testSrc,
"-linkoffline", url, testSrc + "/jdk",
"-package",
"pkg", "mylib.lang");
checkExit(Exit.OK);
checkOutput("pkg/B.html", true,
"<div class=\"block\">A method with html tag the method "
+ "<a href=\"" + url + "java/lang/ClassLoader.html?is-external=true#getSystemClassLoader--\""
+ " title=\"class or interface in java.lang\" class=\"externalLink\"><code><tt>getSystemClassLoader()</tt>"
+ "</code></a> as the parent class loader.</div>",
"<div class=\"block\">is equivalent to invoking <code>"
+ "<a href=\"#createTempFile-java.lang.String-java.lang.String-java.io.File-\">"
+ "<code>createTempFile(prefix,&nbsp;suffix,&nbsp;null)</code></a></code>.</div>");
// Generate the documentation using -linkoffline and a relative path as the first parameter. // Generate the documentation using -linkoffline and a relative path as the first parameter.
// We will try linking to the docs generated in test 1 with a relative path. // We will try linking to the docs generated in test 1 with a relative path.
String out2 = "out2"; String out2 = "out2";

View File

@ -23,7 +23,7 @@
/* /*
* @test * @test
* @bug 4732864 6280605 7064544 8014636 8016328 8025633 8071982 * @bug 4732864 6280605 7064544 8014636 8016328 8025633 8071982 8182765
* @summary Make sure that you can link from one member to another using * @summary Make sure that you can link from one member to another using
* non-qualified name, furthermore, ensure the right one is linked. * non-qualified name, furthermore, ensure the right one is linked.
* @author jamieh * @author jamieh
@ -52,9 +52,9 @@ public class TestLinkTaglet extends JavadocTester {
"Qualified Link: <a href=\"C.InnerC.html\" title=\"class in pkg\"><code>C.InnerC</code></a>.<br/>\n" "Qualified Link: <a href=\"C.InnerC.html\" title=\"class in pkg\"><code>C.InnerC</code></a>.<br/>\n"
+ " Unqualified Link1: <a href=\"C.InnerC.html\" title=\"class in pkg\"><code>C.InnerC</code></a>.<br/>\n" + " Unqualified Link1: <a href=\"C.InnerC.html\" title=\"class in pkg\"><code>C.InnerC</code></a>.<br/>\n"
+ " Unqualified Link2: <a href=\"C.InnerC.html\" title=\"class in pkg\"><code>C.InnerC</code></a>.<br/>\n" + " Unqualified Link2: <a href=\"C.InnerC.html\" title=\"class in pkg\"><code>C.InnerC</code></a>.<br/>\n"
+ " Qualified Link: <a href=\"#method-pkg.C.InnerC-pkg.C.InnerC2-\"><code>method(pkg.C.InnerC, pkg.C.InnerC2)</code></a>.<br/>\n" + " Qualified Link: <a href=\"#method(pkg.C.InnerC,pkg.C.InnerC2)\"><code>method(pkg.C.InnerC, pkg.C.InnerC2)</code></a>.<br/>\n"
+ " Unqualified Link: <a href=\"#method-pkg.C.InnerC-pkg.C.InnerC2-\"><code>method(C.InnerC, C.InnerC2)</code></a>.<br/>\n" + " Unqualified Link: <a href=\"#method(pkg.C.InnerC,pkg.C.InnerC2)\"><code>method(C.InnerC, C.InnerC2)</code></a>.<br/>\n"
+ " Unqualified Link: <a href=\"#method-pkg.C.InnerC-pkg.C.InnerC2-\"><code>method(InnerC, InnerC2)</code></a>.<br/>\n" + " Unqualified Link: <a href=\"#method(pkg.C.InnerC,pkg.C.InnerC2)\"><code>method(InnerC, InnerC2)</code></a>.<br/>\n"
+ " Package Link: <a href=\"package-summary.html\"><code>pkg</code></a>.<br/>"); + " Package Link: <a href=\"package-summary.html\"><code>pkg</code></a>.<br/>");
checkOutput("pkg/C.InnerC.html", true, checkOutput("pkg/C.InnerC.html", true,
@ -73,4 +73,23 @@ public class TestLinkTaglet extends JavadocTester {
checkFiles(false, "checkPkg/A.html"); checkFiles(false, "checkPkg/A.html");
} }
@Test
void test_html4() {
javadoc("-Xdoclint:none",
"-d", "out-html4",
"-html4",
"-sourcepath", testSrc,
"pkg", testSrc("checkPkg/B.java"));
checkExit(Exit.OK);
checkOutput("pkg/C.html", true,
"Qualified Link: <a href=\"C.InnerC.html\" title=\"class in pkg\"><code>C.InnerC</code></a>.<br/>\n"
+ " Unqualified Link1: <a href=\"C.InnerC.html\" title=\"class in pkg\"><code>C.InnerC</code></a>.<br/>\n"
+ " Unqualified Link2: <a href=\"C.InnerC.html\" title=\"class in pkg\"><code>C.InnerC</code></a>.<br/>\n"
+ " Qualified Link: <a href=\"#method-pkg.C.InnerC-pkg.C.InnerC2-\"><code>method(pkg.C.InnerC, pkg.C.InnerC2)</code></a>.<br/>\n"
+ " Unqualified Link: <a href=\"#method-pkg.C.InnerC-pkg.C.InnerC2-\"><code>method(C.InnerC, C.InnerC2)</code></a>.<br/>\n"
+ " Unqualified Link: <a href=\"#method-pkg.C.InnerC-pkg.C.InnerC2-\"><code>method(InnerC, InnerC2)</code></a>.<br/>\n"
+ " Package Link: <a href=\"package-summary.html\"><code>pkg</code></a>.<br/>");
}
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -23,7 +23,7 @@
/* /*
* @test * @test
* @bug 4521661 8081854 * @bug 4521661 8081854 8182765
* @summary Test to make sure that there is a link with a proper anchor * @summary Test to make sure that there is a link with a proper anchor
* from a serializable class to serialized-form.html. * from a serializable class to serialized-form.html.
* @author jamieh * @author jamieh
@ -48,8 +48,20 @@ public class TestLinkToSerialForm extends JavadocTester {
checkExit(Exit.OK); checkExit(Exit.OK);
checkOutput("serialized-form.html", true, checkOutput("serialized-form.html", true,
"<a name=\"pkg.C\">"); "<a id=\"pkg.C\">");
checkOutput("pkg/C.html", true, checkOutput("pkg/C.html", true,
"<a href=\"../serialized-form.html#pkg.C\">"); "<a href=\"../serialized-form.html#pkg.C\">");
} }
@Test
void test_html4() {
javadoc("-d", "out-html4",
"-html4",
"-sourcepath", testSrc,
"pkg");
checkExit(Exit.OK);
checkOutput("serialized-form.html", true,
"<a name=\"pkg.C\">");
}
} }

View File

@ -24,7 +24,7 @@
/* /*
* @test * @test
* @bug 4638588 4635809 6256068 6270645 8025633 8026567 8162363 8175200 * @bug 4638588 4635809 6256068 6270645 8025633 8026567 8162363 8175200
* 8192850 * 8192850 8182765
* @summary Test to make sure that members are inherited properly in the Javadoc. * @summary Test to make sure that members are inherited properly in the Javadoc.
* Verify that inheritance labels are correct. * Verify that inheritance labels are correct.
* @author jamieh * @author jamieh
@ -52,13 +52,13 @@ public class TestMemberInheritance extends JavadocTester {
// Public field should be inherited // Public field should be inherited
"<a href=\"BaseClass.html#pubField\">", "<a href=\"BaseClass.html#pubField\">",
// Public method should be inherited // Public method should be inherited
"<a href=\"BaseClass.html#pubMethod--\">", "<a href=\"BaseClass.html#pubMethod()\">",
// Public inner class should be inherited. // Public inner class should be inherited.
"<a href=\"BaseClass.pubInnerClass.html\" title=\"class in pkg\">", "<a href=\"BaseClass.pubInnerClass.html\" title=\"class in pkg\">",
// Protected field should be inherited // Protected field should be inherited
"<a href=\"BaseClass.html#proField\">", "<a href=\"BaseClass.html#proField\">",
// Protected method should be inherited // Protected method should be inherited
"<a href=\"BaseClass.html#proMethod--\">", "<a href=\"BaseClass.html#proMethod()\">",
// Protected inner class should be inherited. // Protected inner class should be inherited.
"<a href=\"BaseClass.proInnerClass.html\" title=\"class in pkg\">", "<a href=\"BaseClass.proInnerClass.html\" title=\"class in pkg\">",
// New labels as of 1.5.0 // New labels as of 1.5.0
@ -67,6 +67,57 @@ public class TestMemberInheritance extends JavadocTester {
"Nested classes/interfaces inherited from interface&nbsp;pkg." "Nested classes/interfaces inherited from interface&nbsp;pkg."
+ "<a href=\"BaseInterface.html\" title=\"interface in pkg\">BaseInterface</a>"); + "<a href=\"BaseInterface.html\" title=\"interface in pkg\">BaseInterface</a>");
checkOutput("pkg/BaseClass.html", true,
// Test overriding/implementing methods with generic parameters.
"<dl>\n"
+ "<dt><span class=\"overrideSpecifyLabel\">Specified by:</span></dt>\n"
+ "<dd><code><a href=\"BaseInterface.html#getAnnotation(java.lang.Class)\">"
+ "getAnnotation</a></code>&nbsp;in interface&nbsp;<code>"
+ "<a href=\"BaseInterface.html\" title=\"interface in pkg\">"
+ "BaseInterface</a></code></dd>\n"
+ "</dl>");
checkOutput("diamond/Z.html", true,
// Test diamond inheritance member summary (6256068)
"<code><a href=\"A.html#aMethod()\">aMethod</a></code>");
checkOutput("inheritDist/C.html", true,
// Test that doc is inherited from closed parent (6270645)
"<div class=\"block\">m1-B</div>");
checkOutput("pkg/SubClass.html", false,
"<a href=\"BaseClass.html#staticMethod()\">staticMethod</a></code>");
checkOutput("pkg1/Implementer.html", true,
// ensure the method makes it
"<td class=\"colFirst\"><code>static java.time.Period</code></td>\n"
+ "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">"
+ "<a href=\"#between(java.time.LocalDate,java.time.LocalDate)\">"
+ "between</a></span>&#8203;(java.time.LocalDate&nbsp;startDateInclusive,\n"
+ " java.time.LocalDate&nbsp;endDateExclusive)</code></th>");
checkOutput("pkg1/Implementer.html", false,
"<h3>Methods inherited from interface&nbsp;pkg1.<a href=\"Interface.html\""
+ " title=\"interface in pkg1\">Interface</a></h3>\n"
+ "<code><a href=\"Interface.html#between(java.time.chrono.ChronoLocalDate"
+ ",java.time.chrono.ChronoLocalDate)\">between</a></code>"
);
}
@Test
void test_html4() {
javadoc("-d", "out-html4",
"-html4",
"-sourcepath", testSrc,
"pkg", "diamond", "inheritDist", "pkg1");
checkExit(Exit.OK);
checkOutput("pkg/SubClass.html", true,
// Public method should be inherited
"<a href=\"BaseClass.html#pubMethod--\">",
// Protected method should be inherited
"<a href=\"BaseClass.html#proMethod--\">");
checkOutput("pkg/BaseClass.html", true, checkOutput("pkg/BaseClass.html", true,
// Test overriding/implementing methods with generic parameters. // Test overriding/implementing methods with generic parameters.
"<dl>\n" "<dl>\n"
@ -81,10 +132,6 @@ public class TestMemberInheritance extends JavadocTester {
// Test diamond inheritance member summary (6256068) // Test diamond inheritance member summary (6256068)
"<code><a href=\"A.html#aMethod--\">aMethod</a></code>"); "<code><a href=\"A.html#aMethod--\">aMethod</a></code>");
checkOutput("inheritDist/C.html", true,
// Test that doc is inherited from closed parent (6270645)
"<div class=\"block\">m1-B</div>");
checkOutput("pkg/SubClass.html", false, checkOutput("pkg/SubClass.html", false,
"<a href=\"BaseClass.html#staticMethod--\">staticMethod</a></code>"); "<a href=\"BaseClass.html#staticMethod--\">staticMethod</a></code>");

View File

@ -23,7 +23,7 @@
/* /*
* @test * @test
* @bug 4951228 6290760 8025633 8026567 8081854 8162363 8175200 8177417 8186332 * @bug 4951228 6290760 8025633 8026567 8081854 8162363 8175200 8177417 8186332 8182765
* @summary Test the case where the overriden method returns a different * @summary Test the case where the overriden method returns a different
* type than the method in the child class. Make sure the * type than the method in the child class. Make sure the
* documentation is inherited but the return type isn't. * documentation is inherited but the return type isn't.
@ -43,7 +43,43 @@ public class TestMemberSummary extends JavadocTester {
@Test @Test
void test() { void test() {
javadoc("-d", "out", "-private", javadoc("-d", "out",
"-private",
"-sourcepath", testSrc,
"pkg","pkg2");
checkExit(Exit.OK);
checkOutput("pkg/PublicChild.html", true,
// Check return type in member summary.
"<code><a href=\"PublicChild.html\" title=\"class in pkg\">PublicChild</a></code></td>\n"
+ "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\"><a href=\"#returnTypeTest()\">"
+ "returnTypeTest</a></span>()</code>",
// Check return type in member detail.
"<pre>public&nbsp;<a href=\"PublicChild.html\" title=\"class in pkg\">"
+ "PublicChild</a>&nbsp;returnTypeTest()</pre>",
"<th class=\"colConstructorName\" scope=\"row\"><code><span class=\"memberNameLink\">"
+ "<a href=\"#%3Cinit%3E()\">PublicChild</a></span>()</code></th>");
checkOutput("pkg/PrivateParent.html", true,
"<td class=\"colFirst\"><code>private </code></td>\n"
+ "<th class=\"colConstructorName\" scope=\"row\"><code><span class=\"memberNameLink\">"
+ "<a href=\"#%3Cinit%3E(int)\">PrivateParent</a></span>&#8203;(int&nbsp;i)</code>"
+ "</th>");
// Legacy anchor dimensions (6290760)
checkOutput("pkg2/A.html", true,
"<a id=\"f(java.lang.Object[])\">\n"
+ "<!-- -->\n"
+ "</a><a id=\"f(T[])\">\n"
+ "<!-- -->\n"
+ "</a>");
}
@Test
void test_html4() {
javadoc("-d", "out-html4",
"-html4",
"-private",
"-sourcepath", testSrc, "-sourcepath", testSrc,
"pkg","pkg2"); "pkg","pkg2");
checkExit(Exit.OK); checkExit(Exit.OK);
@ -53,9 +89,6 @@ public class TestMemberSummary extends JavadocTester {
"<code><a href=\"PublicChild.html\" title=\"class in pkg\">PublicChild</a></code></td>\n" "<code><a href=\"PublicChild.html\" title=\"class in pkg\">PublicChild</a></code></td>\n"
+ "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\"><a href=\"#returnTypeTest--\">" + "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\"><a href=\"#returnTypeTest--\">"
+ "returnTypeTest</a></span>()</code>", + "returnTypeTest</a></span>()</code>",
// Check return type in member detail.
"<pre>public&nbsp;<a href=\"PublicChild.html\" title=\"class in pkg\">"
+ "PublicChild</a>&nbsp;returnTypeTest()</pre>",
"<th class=\"colConstructorName\" scope=\"row\"><code><span class=\"memberNameLink\">" "<th class=\"colConstructorName\" scope=\"row\"><code><span class=\"memberNameLink\">"
+ "<a href=\"#PublicChild--\">PublicChild</a></span>()</code></th>"); + "<a href=\"#PublicChild--\">PublicChild</a></span>()</code></th>");

View File

@ -23,7 +23,7 @@
/* /*
* @test * @test
* @bug 8178339 * @bug 8178339 8182765
* @summary Tests indirect exports and opens in the module summary page * @summary Tests indirect exports and opens in the module summary page
* @modules jdk.javadoc/jdk.javadoc.internal.api * @modules jdk.javadoc/jdk.javadoc.internal.api
* jdk.javadoc/jdk.javadoc.internal.tool * jdk.javadoc/jdk.javadoc.internal.tool
@ -72,6 +72,16 @@ public class TestIndirectExportsOpens extends JavadocTester {
checkExit(Exit.OK); checkExit(Exit.OK);
verifyIndirectExports(false); verifyIndirectExports(false);
verifyIndirectOpens(false); verifyIndirectOpens(false);
javadoc("-d", base.resolve("out-api-html4").toString(),
"-html4",
"-quiet",
"--module-source-path", base.toString(),
"--expand-requires", "transitive",
"--module", "a");
checkExit(Exit.OK);
verifyIndirectExports_html4(false);
verifyIndirectOpens_html4(false);
} }
@Test @Test
@ -98,6 +108,16 @@ public class TestIndirectExportsOpens extends JavadocTester {
checkExit(Exit.OK); checkExit(Exit.OK);
verifyIndirectExports(true); verifyIndirectExports(true);
verifyIndirectOpens(true); verifyIndirectOpens(true);
javadoc("-d", base.resolve("out-api-html4").toString(),
"-html4",
"-quiet",
"--module-source-path", base.toString(),
"--expand-requires", "transitive",
"--module", "a");
checkExit(Exit.OK);
verifyIndirectExports_html4(true);
verifyIndirectOpens_html4(true);
} }
@Test @Test
@ -125,6 +145,17 @@ public class TestIndirectExportsOpens extends JavadocTester {
checkExit(Exit.OK); checkExit(Exit.OK);
verifyIndirectExports(false); verifyIndirectExports(false);
verifyIndirectOpens(false); verifyIndirectOpens(false);
javadoc("-d", base.resolve("out-api-html4").toString(),
"-html4",
"-quiet",
"--module-source-path", base.toString(),
"--expand-requires", "transitive",
"--module", "a");
checkExit(Exit.OK);
verifyIndirectExports_html4(false);
verifyIndirectOpens_html4(false);
} }
@Test @Test
@ -157,13 +188,13 @@ public class TestIndirectExportsOpens extends JavadocTester {
// could be listed in the indirects section, so just // could be listed in the indirects section, so just
// check for minimal expected strings. // check for minimal expected strings.
checkOutput("a/module-summary.html", true, checkOutput("a/module-summary.html", true,
"Indirect Exports table", "Indirect Exports",
"<th class=\"colFirst\" scope=\"row\"><a href=\"../m/module-summary.html\">m</a></th>\n" "<th class=\"colFirst\" scope=\"row\"><a href=\"../m/module-summary.html\">m</a></th>\n"
+ "<td class=\"colLast\"><a href=\"../m/exportsto/package-summary.html\">exportsto</a></td>\n" + "<td class=\"colLast\"><a href=\"../m/exportsto/package-summary.html\">exportsto</a></td>\n"
+ "</tr>\n"); + "</tr>\n");
checkOutput("a/module-summary.html", true, checkOutput("a/module-summary.html", true,
"Indirect Opens table", "Indirect Opens",
"<th class=\"colFirst\" scope=\"row\"><a href=\"../m/module-summary.html\">m</a></th>\n" "<th class=\"colFirst\" scope=\"row\"><a href=\"../m/module-summary.html\">m</a></th>\n"
+ "<td class=\"colLast\">opensto</td>\n" + "<td class=\"colLast\">opensto</td>\n"
+ "</tr>\n"); + "</tr>\n");
@ -188,7 +219,7 @@ public class TestIndirectExportsOpens extends JavadocTester {
} }
checkOutput("a/module-summary.html", present, checkOutput("a/module-summary.html", present,
"<table class=\"packagesSummary\" summary=\"" + typeString + " table, listing modules, and packages\">\n" "<table class=\"packagesSummary\">\n"
+ "<caption><span>" + typeString + "</span><span class=\"tabEnd\">&nbsp;</span></caption>\n" + "<caption><span>" + typeString + "</span><span class=\"tabEnd\">&nbsp;</span></caption>\n"
+ "<tr>\n" + "<tr>\n"
+ "<th class=\"colFirst\" scope=\"col\">From</th>\n" + "<th class=\"colFirst\" scope=\"col\">From</th>\n"
@ -203,5 +234,37 @@ public class TestIndirectExportsOpens extends JavadocTester {
+ "</table>\n"); + "</table>\n");
} }
} void verifyIndirectExports_html4(boolean present) {
verifyIndirects_html4(present, false);
}
void verifyIndirectOpens_html4(boolean present) {
verifyIndirects_html4(present, true);
}
void verifyIndirects_html4(boolean present, boolean opens) {
String typeString = opens ? "Indirect Opens" : "Indirect Exports";
// Avoid false positives, just check for primary string absence.
if (!present) {
checkOutput("a/module-summary.html", false, typeString);
return;
}
checkOutput("a/module-summary.html", present,
"<table class=\"packagesSummary\" summary=\"" + typeString + " table, listing modules, and packages\">\n"
+ "<caption><span>" + typeString + "</span><span class=\"tabEnd\">&nbsp;</span></caption>\n"
+ "<tr>\n"
+ "<th class=\"colFirst\" scope=\"col\">From</th>\n"
+ "<th class=\"colLast\" scope=\"col\">Packages</th>\n"
+ "</tr>\n"
+ "<tbody>\n"
+ "<tr class=\"altColor\">\n"
+ "<th class=\"colFirst\" scope=\"row\"><a href=\"../m/module-summary.html\">m</a></th>\n"
+ "<td class=\"colLast\"><a href=\"../m/pm/package-summary.html\">pm</a></td>\n"
+ "</tr>\n"
+ "</tbody>\n"
+ "</table>\n");
}
}

View File

@ -23,7 +23,7 @@
/* /*
* @test * @test
* @bug 8178067 8192007 * @bug 8178067 8192007 8182765
* @summary tests the module's services, such as provides and uses * @summary tests the module's services, such as provides and uses
* @modules jdk.javadoc/jdk.javadoc.internal.api * @modules jdk.javadoc/jdk.javadoc.internal.api
* jdk.javadoc/jdk.javadoc.internal.tool * jdk.javadoc/jdk.javadoc.internal.tool
@ -117,7 +117,8 @@ public class TestModuleServices extends JavadocTester {
mb.write(src); mb.write(src);
javadoc("-d", base.resolve("out").toString(), javadoc("-d", base.resolve("out").toString(),
"-quiet", "-noindex", "-quiet",
"-noindex",
"--module-source-path", src.toString(), "--module-source-path", src.toString(),
"--module", "moduleService,moduleServiceProvider,moduleServiceUser,moduleServiceUserNoDescription", "--module", "moduleService,moduleServiceProvider,moduleServiceUser,moduleServiceUserNoDescription",
"pkgService", "moduleServiceProvider/pkgServiceProvider", "moduleServiceUser/pkgServiceUser", "pkgService", "moduleServiceProvider/pkgServiceProvider", "moduleServiceUser/pkgServiceUser",
@ -193,6 +194,33 @@ public class TestModuleServices extends JavadocTester {
checkOutput("m/module-summary.html", true, checkOutput("m/module-summary.html", true,
"<h3>Services</h3>"); "<h3>Services</h3>");
checkOutput("m/module-summary.html", true,
"<table class=\"usesSummary\">\n" +
"<caption><span>Uses</span><span class=\"tabEnd\">&nbsp;</span></caption>\n" +
"<tr>\n" +
"<th class=\"colFirst\" scope=\"col\">Type</th>\n" +
"<th class=\"colLast\" scope=\"col\">Description</th>\n" +
"</tr>\n" +
"<tbody>\n" +
"<tr class=\"altColor\">\n" +
"<th class=\"colFirst\" scope=\"row\"><a href=\"p1/A.html\" title=\"class in p1\">A</a></th>\n" +
"<td class=\"colLast\">&nbsp;</td>\n" +
"</tr>\n" +
"<tr class=\"rowColor\">\n" +
"<th class=\"colFirst\" scope=\"row\"><a href=\"p1/B.html\" title=\"class in p1\">B</a></th>\n" +
"<td class=\"colLast\">&nbsp;</td>\n" +
"</tr>\n" +
"</tbody>\n" +
"</table>\n");
javadoc("-d", base.toString() + "/out-html4",
"-html4",
"-quiet",
"--show-module-contents", "all",
"--module-source-path", base.toString(),
"--module", "m");
checkExit(Exit.OK);
checkOutput("m/module-summary.html", true, checkOutput("m/module-summary.html", true,
"<table class=\"usesSummary\" summary=\"Uses table, listing types, and an explanation\">\n" + "<table class=\"usesSummary\" summary=\"Uses table, listing types, and an explanation\">\n" +
"<caption><span>Uses</span><span class=\"tabEnd\">&nbsp;</span></caption>\n" + "<caption><span>Uses</span><span class=\"tabEnd\">&nbsp;</span></caption>\n" +
@ -233,6 +261,28 @@ public class TestModuleServices extends JavadocTester {
checkOutput("m/module-summary.html", true, checkOutput("m/module-summary.html", true,
"<h3>Services</h3>"); "<h3>Services</h3>");
checkOutput("m/module-summary.html", true,
"<table class=\"usesSummary\">\n" +
"<caption><span>Uses</span><span class=\"tabEnd\">&nbsp;</span></caption>\n" +
"<tr>\n" +
"<th class=\"colFirst\" scope=\"col\">Type</th>\n" +
"<th class=\"colLast\" scope=\"col\">Description</th>\n" +
"</tr>\n" +
"<tbody>\n" +
"<tr class=\"altColor\">\n" +
"<th class=\"colFirst\" scope=\"row\"><a href=\"p1/A.html\" title=\"class in p1\">A</a></th>\n" +
"<td class=\"colLast\">&nbsp;</td>\n" +
"</tr>\n" +
"</tbody>\n" +
"</table>\n");
javadoc("-d", base.toString() + "/out-html4",
"-html4",
"-quiet",
"--module-source-path", base.toString(),
"--module", "m");
checkExit(Exit.OK);
checkOutput("m/module-summary.html", true, checkOutput("m/module-summary.html", true,
"<table class=\"usesSummary\" summary=\"Uses table, listing types, and an explanation\">\n" + "<table class=\"usesSummary\" summary=\"Uses table, listing types, and an explanation\">\n" +
"<caption><span>Uses</span><span class=\"tabEnd\">&nbsp;</span></caption>\n" + "<caption><span>Uses</span><span class=\"tabEnd\">&nbsp;</span></caption>\n" +
@ -299,6 +349,33 @@ public class TestModuleServices extends JavadocTester {
checkOutput("m/module-summary.html", true, checkOutput("m/module-summary.html", true,
"<h3>Services</h3>"); "<h3>Services</h3>");
checkOutput("m/module-summary.html", true,
"<table class=\"providesSummary\">\n" +
"<caption><span>Provides</span><span class=\"tabEnd\">&nbsp;</span></caption>\n" +
"<tr>\n" +
"<th class=\"colFirst\" scope=\"col\">Type</th>\n" +
"<th class=\"colLast\" scope=\"col\">Description</th>\n" +
"</tr>\n" +
"<tbody>\n" +
"<tr class=\"altColor\">\n" +
"<th class=\"colFirst\" scope=\"row\"><a href=\"p1/A.html\" title=\"interface in p1\">A</a></th>\n" +
"<td class=\"colLast\">&nbsp;<br>(<span class=\"implementationLabel\">Implementation(s):</span>&nbsp;<a href=\"p1/B.html\" title=\"class in p1\">B</a>)</td>\n" +
"</tr>\n" +
"<tr class=\"rowColor\">\n" +
"<th class=\"colFirst\" scope=\"row\"><a href=\"p2/A.html\" title=\"interface in p2\">A</a></th>\n" +
"<td class=\"colLast\">&nbsp;<br>(<span class=\"implementationLabel\">Implementation(s):</span>&nbsp;<a href=\"p2/B.html\" title=\"class in p2\">B</a>)</td>\n" +
"</tr>\n" +
"</tbody>\n");
javadoc("-d", base.toString() + "/out-html4",
"-html4",
"-quiet",
"--show-module-contents", "all",
"--module-source-path", base.toString(),
"--module", "m");
checkExit(Exit.OK);
checkOutput("m/module-summary.html", true, checkOutput("m/module-summary.html", true,
"<table class=\"providesSummary\" summary=\"Provides table, listing types, and an explanation\">\n" + "<table class=\"providesSummary\" summary=\"Provides table, listing types, and an explanation\">\n" +
"<caption><span>Provides</span><span class=\"tabEnd\">&nbsp;</span></caption>\n" + "<caption><span>Provides</span><span class=\"tabEnd\">&nbsp;</span></caption>\n" +
@ -342,6 +419,30 @@ public class TestModuleServices extends JavadocTester {
checkOutput("m/module-summary.html", true, checkOutput("m/module-summary.html", true,
"<h3>Services</h3>"); "<h3>Services</h3>");
checkOutput("m/module-summary.html", true,
"<table class=\"providesSummary\">\n" +
"<caption><span>Provides</span><span class=\"tabEnd\">&nbsp;</span></caption>\n" +
"<tr>\n" +
"<th class=\"colFirst\" scope=\"col\">Type</th>\n" +
"<th class=\"colLast\" scope=\"col\">Description</th>\n" +
"</tr>\n" +
"<tbody>\n" +
"<tr class=\"altColor\">\n" +
"<th class=\"colFirst\" scope=\"row\"><a href=\"p1/A.html\" title=\"interface in p1\">A</a></th>\n" +
"<td class=\"colLast\">\n" +
"<div class=\"block\">abc</div>\n</td>\n" +
"</tr>\n" +
"</tbody>\n" +
"</table>\n");
javadoc("-d", base.toString() + "/out-html4",
"-html4",
"-quiet",
"--module-source-path", base.toString(),
"--module", "m");
checkExit(Exit.OK);
checkOutput("m/module-summary.html", true, checkOutput("m/module-summary.html", true,
"<table class=\"providesSummary\" summary=\"Provides table, listing types, and an explanation\">\n" + "<table class=\"providesSummary\" summary=\"Provides table, listing types, and an explanation\">\n" +
"<caption><span>Provides</span><span class=\"tabEnd\">&nbsp;</span></caption>\n" + "<caption><span>Provides</span><span class=\"tabEnd\">&nbsp;</span></caption>\n" +
@ -384,6 +485,44 @@ public class TestModuleServices extends JavadocTester {
checkOutput("m/module-summary.html", true, checkOutput("m/module-summary.html", true,
"<h3>Services</h3>"); "<h3>Services</h3>");
checkOutput("m/module-summary.html", true,
"<table class=\"providesSummary\">\n" +
"<caption><span>Provides</span><span class=\"tabEnd\">&nbsp;</span></caption>\n" +
"<tr>\n" +
"<th class=\"colFirst\" scope=\"col\">Type</th>\n" +
"<th class=\"colLast\" scope=\"col\">Description</th>\n" +
"</tr>\n" +
"<tbody>\n" +
"<tr class=\"altColor\">\n" +
"<th class=\"colFirst\" scope=\"row\"><a href=\"p1/A.html\" title=\"interface in p1\">A</a></th>\n" +
"<td class=\"colLast\">\n" +
"<div class=\"block\">abc</div>\n</td>\n" +
"</tr>\n" +
"</tbody>\n" +
"</table>",
"<table class=\"usesSummary\">\n" +
"<caption><span>Uses</span><span class=\"tabEnd\">&nbsp;</span></caption>\n" +
"<tr>\n" +
"<th class=\"colFirst\" scope=\"col\">Type</th>\n" +
"<th class=\"colLast\" scope=\"col\">Description</th>\n" +
"</tr>\n" +
"<tbody>\n" +
"<tr class=\"altColor\">\n" +
"<th class=\"colFirst\" scope=\"row\"><a href=\"p2/B.html\" title=\"class in p2\">B</a></th>\n" +
"<td class=\"colLast\">\n" +
"<div class=\"block\">def</div>\n</td>\n" +
"</tr>\n" +
"</tbody>\n" +
"</table>\n");
javadoc("-d", base.toString() + "/out-html4",
"-html4",
"-quiet",
"--module-source-path", base.toString(),
"--module", "m");
checkExit(Exit.OK);
checkOutput("m/module-summary.html", true, checkOutput("m/module-summary.html", true,
"<table class=\"providesSummary\" summary=\"Provides table, listing types, and an explanation\">\n" + "<table class=\"providesSummary\" summary=\"Provides table, listing types, and an explanation\">\n" +
"<caption><span>Provides</span><span class=\"tabEnd\">&nbsp;</span></caption>\n" + "<caption><span>Provides</span><span class=\"tabEnd\">&nbsp;</span></caption>\n" +

View File

@ -26,7 +26,7 @@
* @bug 8154119 8154262 8156077 8157987 8154261 8154817 8135291 8155995 8162363 * @bug 8154119 8154262 8156077 8157987 8154261 8154817 8135291 8155995 8162363
* 8168766 8168688 8162674 8160196 8175799 8174974 8176778 8177562 8175218 * 8168766 8168688 8162674 8160196 8175799 8174974 8176778 8177562 8175218
* 8175823 8166306 8178043 8181622 8183511 8169819 8074407 8183037 8191464 * 8175823 8166306 8178043 8181622 8183511 8169819 8074407 8183037 8191464
8164407 8192007 8164407 8192007 8182765
* @summary Test modules support in javadoc. * @summary Test modules support in javadoc.
* @author bpatel * @author bpatel
* @library ../lib * @library ../lib
@ -46,7 +46,10 @@ public class TestModules extends JavadocTester {
*/ */
@Test @Test
void testHtml4() { void testHtml4() {
javadoc("-d", "out", "-use", "-Xdoclint:none", javadoc("-d", "out",
"-html4",
"-use",
"-Xdoclint:none",
"-overview", testSrc("overview.html"), "-overview", testSrc("overview.html"),
"--module-source-path", testSrc, "--module-source-path", testSrc,
"--module", "moduleA,moduleB", "--module", "moduleA,moduleB",
@ -68,7 +71,9 @@ public class TestModules extends JavadocTester {
*/ */
@Test @Test
void testHtml5() { void testHtml5() {
javadoc("-d", "out-html5", "-html5", "-use", "-Xdoclint:none", javadoc("-d", "out-html5",
"-use",
"-Xdoclint:none",
"-overview", testSrc("overview.html"), "-overview", testSrc("overview.html"),
"--module-source-path", testSrc, "--module-source-path", testSrc,
"--module", "moduleA,moduleB", "--module", "moduleA,moduleB",
@ -90,7 +95,11 @@ public class TestModules extends JavadocTester {
*/ */
@Test @Test
void testHtml4NoComment() { void testHtml4NoComment() {
javadoc("-d", "out-nocomment", "-nocomment", "-use", "-Xdoclint:none", javadoc("-d", "out-nocomment",
"-html4",
"-nocomment",
"-use",
"-Xdoclint:none",
"-overview", testSrc("overview.html"), "-overview", testSrc("overview.html"),
"--module-source-path", testSrc, "--module-source-path", testSrc,
"--module", "moduleA,moduleB", "--module", "moduleA,moduleB",
@ -108,7 +117,10 @@ public class TestModules extends JavadocTester {
*/ */
@Test @Test
void testHtml5NoComment() { void testHtml5NoComment() {
javadoc("-d", "out-html5-nocomment", "-nocomment", "-html5", "-use", "-Xdoclint:none", javadoc("-d", "out-html5-nocomment",
"-nocomment",
"-use",
"-Xdoclint:none",
"-overview", testSrc("overview.html"), "-overview", testSrc("overview.html"),
"--module-source-path", testSrc, "--module-source-path", testSrc,
"--module", "moduleA,moduleB", "--module", "moduleA,moduleB",
@ -126,7 +138,9 @@ public class TestModules extends JavadocTester {
*/ */
@Test @Test
void testHtml4UnnamedModule() { void testHtml4UnnamedModule() {
javadoc("-d", "out-nomodule", "-use", javadoc("-d", "out-nomodule",
"-html4",
"-use",
"-overview", testSrc("overview.html"), "-overview", testSrc("overview.html"),
"-sourcepath", testSrc, "-sourcepath", testSrc,
"testpkgnomodule", "testpkgnomodule1"); "testpkgnomodule", "testpkgnomodule1");
@ -143,7 +157,8 @@ public class TestModules extends JavadocTester {
*/ */
@Test @Test
void testHtml5UnnamedModule() { void testHtml5UnnamedModule() {
javadoc("-d", "out-html5-nomodule", "-html5", "-use", javadoc("-d", "out-html5-nomodule",
"-use",
"-overview", testSrc("overview.html"), "-overview", testSrc("overview.html"),
"-sourcepath", testSrc, "-sourcepath", testSrc,
"testpkgnomodule", "testpkgnomodule1"); "testpkgnomodule", "testpkgnomodule1");
@ -159,7 +174,10 @@ public class TestModules extends JavadocTester {
*/ */
@Test @Test
void testJDTagsInModules() { void testJDTagsInModules() {
javadoc("-d", "out-mdltags", "-author", "-version", "-Xdoclint:none", javadoc("-d", "out-mdltags",
"-author",
"-version",
"-Xdoclint:none",
"-tag", "regular:a:Regular Tag:", "-tag", "regular:a:Regular Tag:",
"-tag", "moduletag:s:Module Tag:", "-tag", "moduletag:s:Module Tag:",
"--module-source-path", testSrc, "--module-source-path", testSrc,
@ -169,12 +187,33 @@ public class TestModules extends JavadocTester {
checkModuleTags(); checkModuleTags();
} }
/**
* Test generated module pages with javadoc tags.
*/
@Test
void testJDTagsInModules_html4() {
javadoc("-d", "out-mdltags-html4",
"-html4",
"-author",
"-version",
"-Xdoclint:none",
"-tag", "regular:a:Regular Tag:",
"-tag", "moduletag:s:Module Tag:",
"--module-source-path", testSrc,
"--module", "moduletags,moduleB",
"testpkgmdltags", "testpkgmdlB");
checkExit(Exit.OK);
checkModuleTags_html4();
}
/** /**
* Test generated module summary page. * Test generated module summary page.
*/ */
@Test @Test
void testModuleSummary() { void testModuleSummary() {
javadoc("-d", "out-moduleSummary", "-use", "-Xdoclint:none", javadoc("-d", "out-moduleSummary",
"-use",
"-Xdoclint:none",
"--module-source-path", testSrc, "--module-source-path", testSrc,
"--module", "moduleA,moduleB", "--module", "moduleA,moduleB",
"testpkgmdlA", "testpkgmdlB", "moduleB/testpkg2mdlB"); "testpkgmdlA", "testpkgmdlB", "moduleB/testpkg2mdlB");
@ -183,12 +222,30 @@ public class TestModules extends JavadocTester {
checkNegatedModuleSummary(); checkNegatedModuleSummary();
} }
/**
* Test generated module summary page.
*/
@Test
void testModuleSummary_html4() {
javadoc("-d", "out-moduleSummary-html4",
"-html4",
"-use",
"-Xdoclint:none",
"--module-source-path", testSrc,
"--module", "moduleA,moduleB",
"testpkgmdlA", "testpkgmdlB", "moduleB/testpkg2mdlB");
checkExit(Exit.OK);
checkModuleSummary_html4();
checkNegatedModuleSummary_html4();
}
/** /**
* Test generated module summary page of an aggregating module. * Test generated module summary page of an aggregating module.
*/ */
@Test @Test
void testAggregatorModuleSummary() { void testAggregatorModuleSummary() {
javadoc("-d", "out-aggregatorModuleSummary", "-use", javadoc("-d", "out-aggregatorModuleSummary",
"-use",
"--module-source-path", testSrc, "--module-source-path", testSrc,
"--expand-requires", "transitive", "--expand-requires", "transitive",
"--module", "moduleT"); "--module", "moduleT");
@ -201,7 +258,8 @@ public class TestModules extends JavadocTester {
*/ */
@Test @Test
void testModuleFilesAndLinks() { void testModuleFilesAndLinks() {
javadoc("-d", "out-modulelinks", "-Xdoclint:none", javadoc("-d", "out-modulelinks",
"-Xdoclint:none",
"--module-source-path", testSrc, "--module-source-path", testSrc,
"--module", "moduleA,moduleB", "--module", "moduleA,moduleB",
"testpkgmdlA", "testpkgmdlB"); "testpkgmdlA", "testpkgmdlB");
@ -215,7 +273,8 @@ public class TestModules extends JavadocTester {
*/ */
@Test @Test
void testModuleDeprecation() { void testModuleDeprecation() {
javadoc("-d", "out-moduledepr", "-Xdoclint:none", javadoc("-d", "out-moduledepr",
"-Xdoclint:none",
"-tag", "regular:a:Regular Tag:", "-tag", "regular:a:Regular Tag:",
"-tag", "moduletag:s:Module Tag:", "-tag", "moduletag:s:Module Tag:",
"--module-source-path", testSrc, "--module-source-path", testSrc,
@ -230,7 +289,8 @@ public class TestModules extends JavadocTester {
*/ */
@Test @Test
void testModuleAnnotation() { void testModuleAnnotation() {
javadoc("-d", "out-moduleanno", "-Xdoclint:none", javadoc("-d", "out-moduleanno",
"-Xdoclint:none",
"--module-source-path", testSrc, "--module-source-path", testSrc,
"--module", "moduleA,moduleB", "--module", "moduleA,moduleB",
"testpkgmdlA", "testpkgmdlB"); "testpkgmdlA", "testpkgmdlB");
@ -238,12 +298,32 @@ public class TestModules extends JavadocTester {
checkModuleAnnotation(); checkModuleAnnotation();
} }
/**
* Test annotations on modules.
*/
@Test
void testModuleAnnotation_html4() {
javadoc("-d", "out-moduleanno-html4",
"-html4",
"-Xdoclint:none",
"--module-source-path", testSrc,
"--module", "moduleA,moduleB",
"testpkgmdlA", "testpkgmdlB");
checkExit(Exit.OK);
checkModuleAnnotation_html4();
}
/** /**
* Test module summary pages in "api" mode. * Test module summary pages in "api" mode.
*/ */
@Test @Test
void testApiMode() { void testApiMode() {
javadoc("-d", "out-api", "-use", "--show-module-contents=api", "-author", "-version", "-Xdoclint:none", javadoc("-d", "out-api",
"-use",
"--show-module-contents=api",
"-author",
"-version",
"-Xdoclint:none",
"-tag", "regular:a:Regular Tag:", "-tag", "regular:a:Regular Tag:",
"-tag", "moduletag:s:Module Tag:", "-tag", "moduletag:s:Module Tag:",
"--module-source-path", testSrc, "--module-source-path", testSrc,
@ -262,7 +342,12 @@ public class TestModules extends JavadocTester {
*/ */
@Test @Test
void testAllMode() { void testAllMode() {
javadoc("-d", "out-all", "-use", "--show-module-contents=all", "-author", "-version", "-Xdoclint:none", javadoc("-d", "out-all",
"-use",
"--show-module-contents=all",
"-author",
"-version",
"-Xdoclint:none",
"-tag", "regular:a:Regular Tag:", "-tag", "regular:a:Regular Tag:",
"-tag", "moduletag:s:Module Tag:", "-tag", "moduletag:s:Module Tag:",
"--module-source-path", testSrc, "--module-source-path", testSrc,
@ -276,12 +361,36 @@ public class TestModules extends JavadocTester {
checkAllModulesLink(true); checkAllModulesLink(true);
} }
/**
* Test module summary pages in "all" mode.
*/
@Test
void testAllModeHtml4() {
javadoc("-d", "out-all-html4",
"-html4",
"-use",
"--show-module-contents=all",
"-author",
"-version",
"-Xdoclint:none",
"-tag", "regular:a:Regular Tag:",
"-tag", "moduletag:s:Module Tag:",
"--module-source-path", testSrc,
"--module", "moduleA,moduleB,moduleC,moduletags",
"testpkgmdlA", "moduleA/concealedpkgmdlA", "testpkgmdlB", "testpkg2mdlB", "testpkgmdlC", "testpkgmdltags");
checkExit(Exit.OK);
checkModuleModeCommon_html4();
checkModuleModeApi_html4(false);
}
/** /**
* Test generated module summary page of a module with no exported package. * Test generated module summary page of a module with no exported package.
*/ */
@Test @Test
void testModuleSummaryNoExportedPkgAll() { void testModuleSummaryNoExportedPkgAll() {
javadoc("-d", "out-ModuleSummaryNoExportedPkgAll", "-use", "--show-module-contents=all", javadoc("-d", "out-ModuleSummaryNoExportedPkgAll",
"-use",
"--show-module-contents=all",
"-sourcepath", testSrc + "/moduleNoExport", "-sourcepath", testSrc + "/moduleNoExport",
"--module", "moduleNoExport", "--module", "moduleNoExport",
"testpkgmdlNoExport"); "testpkgmdlNoExport");
@ -289,12 +398,29 @@ public class TestModules extends JavadocTester {
checkModuleSummaryNoExported(true); checkModuleSummaryNoExported(true);
} }
/**
* Test generated module summary page of a module with no exported package.
*/
@Test
void testModuleSummaryNoExportedPkgAll_html4() {
javadoc("-d", "out-ModuleSummaryNoExportedPkgAll-html4",
"-html4",
"-use",
"--show-module-contents=all",
"-sourcepath", testSrc + "/moduleNoExport",
"--module", "moduleNoExport",
"testpkgmdlNoExport");
checkExit(Exit.OK);
checkModuleSummaryNoExported_html4(true);
}
/** /**
* Test generated module summary page of a module with no exported package. * Test generated module summary page of a module with no exported package.
*/ */
@Test @Test
void testModuleSummaryNoExportedPkgApi() { void testModuleSummaryNoExportedPkgApi() {
javadoc("-d", "out-ModuleSummaryNoExportedPkgApi", "-use", javadoc("-d", "out-ModuleSummaryNoExportedPkgApi",
"-use",
"-sourcepath", testSrc + "/moduleNoExport", "-sourcepath", testSrc + "/moduleNoExport",
"--module", "moduleNoExport", "--module", "moduleNoExport",
"testpkgmdlNoExport"); "testpkgmdlNoExport");
@ -302,6 +428,21 @@ public class TestModules extends JavadocTester {
checkModuleSummaryNoExported(false); checkModuleSummaryNoExported(false);
} }
/**
* Test generated module summary page of a module with no exported package.
*/
@Test
void testModuleSummaryNoExportedPkgApi_html4() {
javadoc("-d", "out-ModuleSummaryNoExportedPkgApi-html4",
"-html4",
"-use",
"-sourcepath", testSrc + "/moduleNoExport",
"--module", "moduleNoExport",
"testpkgmdlNoExport");
checkExit(Exit.OK);
checkModuleSummaryNoExported_html4(false);
}
/** /**
* Test generated module pages for javadoc run for a single module having a single package. * Test generated module pages for javadoc run for a single module having a single package.
*/ */
@ -320,7 +461,9 @@ public class TestModules extends JavadocTester {
*/ */
@Test @Test
void testSingleModuleMultiplePkg() { void testSingleModuleMultiplePkg() {
javadoc("-d", "out-singlemodmultiplepkg", "--show-module-contents=all", "-Xdoclint:none", javadoc("-d", "out-singlemodmultiplepkg",
"--show-module-contents=all",
"-Xdoclint:none",
"--module-source-path", testSrc, "--module-source-path", testSrc,
"--module", "moduleB", "--module", "moduleB",
"testpkg2mdlB", "testpkgmdlB"); "testpkg2mdlB", "testpkgmdlB");
@ -333,7 +476,9 @@ public class TestModules extends JavadocTester {
*/ */
@Test @Test
void testGroupOption() { void testGroupOption() {
javadoc("-d", "out-group", "--show-module-contents=all", "-Xdoclint:none", javadoc("-d", "out-group",
"--show-module-contents=all",
"-Xdoclint:none",
"-tag", "regular:a:Regular Tag:", "-tag", "regular:a:Regular Tag:",
"-tag", "moduletag:s:Module Tag:", "-tag", "moduletag:s:Module Tag:",
"--module-source-path", testSrc, "--module-source-path", testSrc,
@ -347,6 +492,28 @@ public class TestModules extends JavadocTester {
checkGroupOption(); checkGroupOption();
} }
/**
* Test -group option for modules. The overview-summary.html page should group the modules accordingly.
*/
@Test
void testGroupOption_html4() {
javadoc("-d", "out-group-html4",
"-html4",
"--show-module-contents=all",
"-Xdoclint:none",
"-tag", "regular:a:Regular Tag:",
"-tag", "moduletag:s:Module Tag:",
"--module-source-path", testSrc,
"-group", "Module Group A", "moduleA*",
"-group", "Module Group B & C", "moduleB*:moduleC*",
"-group", "Java SE Modules", "java*",
"--module", "moduleA,moduleB,moduleC,moduletags",
"moduleA/concealedpkgmdlA", "testpkgmdlA", "testpkg2mdlB", "testpkgmdlB", "testpkgmdlC",
"testpkgmdltags");
checkExit(Exit.OK);
checkGroupOption_html4();
}
/** /**
* Test -group option for modules and the ordering of module groups. * Test -group option for modules and the ordering of module groups.
* The overview-summary.html page should group the modules accordingly and display the group tabs in * The overview-summary.html page should group the modules accordingly and display the group tabs in
@ -354,7 +521,9 @@ public class TestModules extends JavadocTester {
*/ */
@Test @Test
void testGroupOptionOrdering() { void testGroupOptionOrdering() {
javadoc("-d", "out-groupOrder", "--show-module-contents=all", "-Xdoclint:none", javadoc("-d", "out-groupOrder",
"--show-module-contents=all",
"-Xdoclint:none",
"-tag", "regular:a:Regular Tag:", "-tag", "regular:a:Regular Tag:",
"-tag", "moduletag:s:Module Tag:", "-tag", "moduletag:s:Module Tag:",
"--module-source-path", testSrc, "--module-source-path", testSrc,
@ -374,7 +543,9 @@ public class TestModules extends JavadocTester {
*/ */
@Test @Test
void testUnnamedModuleGroupOption() { void testUnnamedModuleGroupOption() {
javadoc("-d", "out-groupnomodule", "-use", "-Xdoclint:none", javadoc("-d", "out-groupnomodule",
"-use",
"-Xdoclint:none",
"-overview", testSrc("overview.html"), "-overview", testSrc("overview.html"),
"-sourcepath", testSrc, "-sourcepath", testSrc,
"-group", "Package Group 0", "testpkgnomodule", "-group", "Package Group 0", "testpkgnomodule",
@ -384,6 +555,24 @@ public class TestModules extends JavadocTester {
checkUnnamedModuleGroupOption(); checkUnnamedModuleGroupOption();
} }
/**
* Test -group option for unnamed modules. The overview-summary.html page should group the packages accordingly.
*/
@Test
void testUnnamedModuleGroupOption_html4() {
javadoc("-d", "out-groupnomodule-html4",
"-html4",
"-use",
"-Xdoclint:none",
"-overview", testSrc("overview.html"),
"-sourcepath", testSrc,
"-group", "Package Group 0", "testpkgnomodule",
"-group", "Package Group 1", "testpkgnomodule1",
"testpkgnomodule", "testpkgnomodule1");
checkExit(Exit.OK);
checkUnnamedModuleGroupOption_html4();
}
/** /**
* Test -group option for unnamed modules and the ordering of package groups. * Test -group option for unnamed modules and the ordering of package groups.
* The overview-summary.html page should group the packages accordingly and display the group tabs in * The overview-summary.html page should group the packages accordingly and display the group tabs in
@ -391,7 +580,9 @@ public class TestModules extends JavadocTester {
*/ */
@Test @Test
void testGroupOptionPackageOrdering() { void testGroupOptionPackageOrdering() {
javadoc("-d", "out-groupPkgOrder", "-use", "-Xdoclint:none", javadoc("-d", "out-groupPkgOrder",
"-use",
"-Xdoclint:none",
"-overview", testSrc("overview.html"), "-overview", testSrc("overview.html"),
"-sourcepath", testSrc, "-sourcepath", testSrc,
"-group", "Z Group", "testpkgnomodule", "-group", "Z Group", "testpkgnomodule",
@ -406,7 +597,9 @@ public class TestModules extends JavadocTester {
*/ */
@Test @Test
void testGroupOptionSingleModule() { void testGroupOptionSingleModule() {
javadoc("-d", "out-groupsinglemodule", "-use", "-Xdoclint:none", javadoc("-d", "out-groupsinglemodule",
"-use",
"-Xdoclint:none",
"--module-source-path", testSrc, "--module-source-path", testSrc,
"-group", "Module Group B", "moduleB*", "-group", "Module Group B", "moduleB*",
"--module", "moduleB", "--module", "moduleB",
@ -415,12 +608,31 @@ public class TestModules extends JavadocTester {
checkGroupOptionSingleModule(); checkGroupOptionSingleModule();
} }
/**
* Test -group option for a single module.
*/
@Test
void testGroupOptionSingleModule_html4() {
javadoc("-d", "out-groupsinglemodule-html4",
"-html4",
"-use",
"-Xdoclint:none",
"--module-source-path", testSrc,
"-group", "Module Group B", "moduleB*",
"--module", "moduleB",
"testpkg2mdlB", "testpkgmdlB");
checkExit(Exit.OK);
checkGroupOptionSingleModule_html4();
}
/** /**
* Test -group option for a single module. * Test -group option for a single module.
*/ */
@Test @Test
void testModuleName() { void testModuleName() {
javadoc("-d", "out-modulename", "-use", "-Xdoclint:none", javadoc("-d", "out-modulename",
"-use",
"-Xdoclint:none",
"--module-source-path", testSrc, "--module-source-path", testSrc,
"--module", "moduleB,test.moduleFullName", "--module", "moduleB,test.moduleFullName",
"testpkg2mdlB", "testpkgmdlB", "testpkgmdlfullname"); "testpkg2mdlB", "testpkgmdlB", "testpkgmdlfullname");
@ -434,7 +646,10 @@ public class TestModules extends JavadocTester {
@Test @Test
void testLinkOffline() { void testLinkOffline() {
String url = "https://docs.oracle.com/javase/9/docs/api/"; String url = "https://docs.oracle.com/javase/9/docs/api/";
javadoc("-d", "out-linkoffline", "-use", "--show-module-contents=all", "-Xdoclint:none", javadoc("-d", "out-linkoffline",
"-use",
"--show-module-contents=all",
"-Xdoclint:none",
"--module-source-path", testSrc, "--module-source-path", testSrc,
"--module", "moduleA,moduleB", "--module", "moduleA,moduleB",
"-linkoffline", url, testSrc + "/jdk", "-linkoffline", url, testSrc + "/jdk",
@ -589,7 +804,7 @@ public class TestModules extends JavadocTester {
"Type Link: <a href=\"testpkgmdltags/TestClassInModuleTags.html\" title=\"class in " "Type Link: <a href=\"testpkgmdltags/TestClassInModuleTags.html\" title=\"class in "
+ "testpkgmdltags\"><code>TestClassInModuleTags</code></a>.", + "testpkgmdltags\"><code>TestClassInModuleTags</code></a>.",
"Member Link: <a href=\"testpkgmdltags/TestClassInModuleTags.html#" "Member Link: <a href=\"testpkgmdltags/TestClassInModuleTags.html#"
+ "testMethod-java.lang.String-\"><code>testMethod(String)</code></a>.", + "testMethod(java.lang.String)\"><code>testMethod(String)</code></a>.",
"Package Link: <a href=\"testpkgmdltags/package-summary.html\"><code>testpkgmdltags</code></a>.", "Package Link: <a href=\"testpkgmdltags/package-summary.html\"><code>testpkgmdltags</code></a>.",
"<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n" "<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n"
+ "<dd>JDK 9</dd>", + "<dd>JDK 9</dd>",
@ -610,6 +825,12 @@ public class TestModules extends JavadocTester {
+ "<dd>Just a simple module tag.</dd>"); + "<dd>Just a simple module tag.</dd>");
} }
void checkModuleTags_html4() {
checkOutput("moduletags/module-summary.html", true,
"Member Link: <a href=\"testpkgmdltags/TestClassInModuleTags.html#"
+ "testMethod-java.lang.String-\"><code>testMethod(String)</code></a>.");
}
void checkOverviewSummaryModules() { void checkOverviewSummaryModules() {
checkOutput("overview-summary.html", true, checkOutput("overview-summary.html", true,
"<table class=\"overviewSummary\" summary=\"Module Summary table, listing modules, and an explanation\">\n" "<table class=\"overviewSummary\" summary=\"Module Summary table, listing modules, and an explanation\">\n"
@ -724,7 +945,7 @@ public class TestModules extends JavadocTester {
+ "Packages</a>&nbsp;|&nbsp;Services</li>\n" + "Packages</a>&nbsp;|&nbsp;Services</li>\n"
+ "</ul>", + "</ul>",
"<!-- ============ MODULES SUMMARY =========== -->\n" "<!-- ============ MODULES SUMMARY =========== -->\n"
+ "<a name=\"modules.summary\">\n" + "<a id=\"modules.summary\">\n"
+ "<!-- -->\n" + "<!-- -->\n"
+ "</a>", + "</a>",
"<tr class=\"altColor\" id=\"i0\">\n" "<tr class=\"altColor\" id=\"i0\">\n"
@ -732,7 +953,7 @@ public class TestModules extends JavadocTester {
+ "<td class=\"colLast\">&nbsp;</td>\n" + "<td class=\"colLast\">&nbsp;</td>\n"
+ "</tr>", + "</tr>",
"<!-- ============ PACKAGES SUMMARY =========== -->\n" "<!-- ============ PACKAGES SUMMARY =========== -->\n"
+ "<a name=\"packages.summary\">\n" + "<a id=\"packages.summary\">\n"
+ "<!-- -->\n" + "<!-- -->\n"
+ "</a>", + "</a>",
"<tr class=\"altColor\">\n" "<tr class=\"altColor\">\n"
@ -747,7 +968,7 @@ public class TestModules extends JavadocTester {
+ "<a href=\"#packages.summary\">Packages</a>&nbsp;|&nbsp;<a href=\"#services.summary\">" + "<a href=\"#packages.summary\">Packages</a>&nbsp;|&nbsp;<a href=\"#services.summary\">"
+ "Services</a></li>", + "Services</a></li>",
"<!-- ============ PACKAGES SUMMARY =========== -->\n" "<!-- ============ PACKAGES SUMMARY =========== -->\n"
+ "<a name=\"packages.summary\">\n" + "<a id=\"packages.summary\">\n"
+ "<!-- -->\n" + "<!-- -->\n"
+ "</a>", + "</a>",
"<tr class=\"altColor\" id=\"i0\">\n" "<tr class=\"altColor\" id=\"i0\">\n"
@ -755,11 +976,11 @@ public class TestModules extends JavadocTester {
+ "<td class=\"colLast\">&nbsp;</td>\n" + "<td class=\"colLast\">&nbsp;</td>\n"
+ "</tr>", + "</tr>",
"<!-- ============ PACKAGES SUMMARY =========== -->\n" "<!-- ============ PACKAGES SUMMARY =========== -->\n"
+ "<a name=\"packages.summary\">\n" + "<a id=\"packages.summary\">\n"
+ "<!-- -->\n" + "<!-- -->\n"
+ "</a>", + "</a>",
"<!-- ============ SERVICES SUMMARY =========== -->\n" "<!-- ============ SERVICES SUMMARY =========== -->\n"
+ "<a name=\"services.summary\">\n" + "<a id=\"services.summary\">\n"
+ "<!-- -->\n" + "<!-- -->\n"
+ "</a>", + "</a>",
"<tr class=\"altColor\">\n" "<tr class=\"altColor\">\n"
@ -784,6 +1005,31 @@ public class TestModules extends JavadocTester {
+ "</tr>"); + "</tr>");
} }
void checkModuleSummary_html4() {
checkOutput("moduleA/module-summary.html", true,
"<!-- ============ MODULES SUMMARY =========== -->\n"
+ "<a name=\"modules.summary\">\n"
+ "<!-- -->\n"
+ "</a>",
"<!-- ============ PACKAGES SUMMARY =========== -->\n"
+ "<a name=\"packages.summary\">\n"
+ "<!-- -->\n"
+ "</a>");
checkOutput("moduleB/module-summary.html", true,
"<!-- ============ PACKAGES SUMMARY =========== -->\n"
+ "<a name=\"packages.summary\">\n"
+ "<!-- -->\n"
+ "</a>",
"<!-- ============ PACKAGES SUMMARY =========== -->\n"
+ "<a name=\"packages.summary\">\n"
+ "<!-- -->\n"
+ "</a>",
"<!-- ============ SERVICES SUMMARY =========== -->\n"
+ "<a name=\"services.summary\">\n"
+ "<!-- -->\n"
+ "</a>");
}
void checkAggregatorModuleSummary() { void checkAggregatorModuleSummary() {
checkOutput("moduleT/module-summary.html", true, checkOutput("moduleT/module-summary.html", true,
"<div class=\"header\">\n" "<div class=\"header\">\n"
@ -812,6 +1058,14 @@ public class TestModules extends JavadocTester {
} }
void checkNegatedModuleSummary() { void checkNegatedModuleSummary() {
checkOutput("moduleA/module-summary.html", false,
"<!-- ============ SERVICES SUMMARY =========== -->\n"
+ "<a id=\"services.summary\">\n"
+ "<!-- -->\n"
+ "</a>");
}
void checkNegatedModuleSummary_html4() {
checkOutput("moduleA/module-summary.html", false, checkOutput("moduleA/module-summary.html", false,
"<!-- ============ SERVICES SUMMARY =========== -->\n" "<!-- ============ SERVICES SUMMARY =========== -->\n"
+ "<a name=\"services.summary\">\n" + "<a name=\"services.summary\">\n"
@ -922,7 +1176,7 @@ public class TestModules extends JavadocTester {
+ "<td class=\"colLast\">\n" + "<td class=\"colLast\">\n"
+ "<div class=\"block\">This is a test description for the moduletags module.<br>\n" + "<div class=\"block\">This is a test description for the moduletags module.<br>\n"
+ " Type Link: <a href=\"moduletags/testpkgmdltags/TestClassInModuleTags.html\" title=\"class in testpkgmdltags\"><code>TestClassInModuleTags</code></a>.<br>\n" + " Type Link: <a href=\"moduletags/testpkgmdltags/TestClassInModuleTags.html\" title=\"class in testpkgmdltags\"><code>TestClassInModuleTags</code></a>.<br>\n"
+ " Member Link: <a href=\"moduletags/testpkgmdltags/TestClassInModuleTags.html#testMethod-java.lang.String-\"><code>testMethod(String)</code></a>.<br>\n" + " Member Link: <a href=\"moduletags/testpkgmdltags/TestClassInModuleTags.html#testMethod(java.lang.String)\"><code>testMethod(String)</code></a>.<br>\n"
+ " Package Link: <a href=\"moduletags/testpkgmdltags/package-summary.html\"><code>testpkgmdltags</code></a>.<br></div>\n" + " Package Link: <a href=\"moduletags/testpkgmdltags/package-summary.html\"><code>testpkgmdltags</code></a>.<br></div>\n"
+ "</td>"); + "</td>");
checkOutput("moduleA/module-summary.html", true, checkOutput("moduleA/module-summary.html", true,
@ -937,14 +1191,14 @@ public class TestModules extends JavadocTester {
checkOutput("moduletags/module-summary.html", true, checkOutput("moduletags/module-summary.html", true,
"<li><a href=\"#module.description\">Description</a>&nbsp;|&nbsp;<a href=\"#modules.summary\">Modules" "<li><a href=\"#module.description\">Description</a>&nbsp;|&nbsp;<a href=\"#modules.summary\">Modules"
+ "</a>&nbsp;|&nbsp;<a href=\"#packages.summary\">Packages</a>&nbsp;|&nbsp;Services</li>", + "</a>&nbsp;|&nbsp;<a href=\"#packages.summary\">Packages</a>&nbsp;|&nbsp;Services</li>",
"<table class=\"requiresSummary\" summary=\"Indirect Requires table, listing modules, and an explanation\">\n" "<table class=\"requiresSummary\">\n"
+ "<caption><span>Indirect Requires</span><span class=\"tabEnd\">&nbsp;</span></caption>", + "<caption><span>Indirect Requires</span><span class=\"tabEnd\">&nbsp;</span></caption>",
"<td class=\"colFirst\">transitive</td>\n" "<td class=\"colFirst\">transitive</td>\n"
+ "<th class=\"colSecond\" scope=\"row\"><a href=\"../moduleB/module-summary.html\">moduleB</a></th>\n" + "<th class=\"colSecond\" scope=\"row\"><a href=\"../moduleB/module-summary.html\">moduleB</a></th>\n"
+ "<td class=\"colLast\">\n" + "<td class=\"colLast\">\n"
+ "<div class=\"block\">This is a test description for the moduleB module.</div>\n" + "<div class=\"block\">This is a test description for the moduleB module.</div>\n"
+ "</td>", + "</td>",
"<table class=\"packagesSummary\" summary=\"Indirect Exports table, listing modules, and packages\">\n" "<table class=\"packagesSummary\">\n"
+ "<caption><span>Indirect Exports</span><span class=\"tabEnd\">&nbsp;</span></caption>", + "<caption><span>Indirect Exports</span><span class=\"tabEnd\">&nbsp;</span></caption>",
"<td class=\"colFirst\">transitive static</td>\n" "<td class=\"colFirst\">transitive static</td>\n"
+ "<th class=\"colSecond\" scope=\"row\"><a href=\"../moduleA/module-summary.html\">moduleA</a></th>\n" + "<th class=\"colSecond\" scope=\"row\"><a href=\"../moduleA/module-summary.html\">moduleA</a></th>\n"
@ -952,6 +1206,42 @@ public class TestModules extends JavadocTester {
+ "<div class=\"block\">This is a test description for the moduleA module with a Search " + "<div class=\"block\">This is a test description for the moduleA module with a Search "
+ "phrase <a id=\"searchphrase\" class=\"searchTagResult\">search phrase</a>.</div>\n" + "phrase <a id=\"searchphrase\" class=\"searchTagResult\">search phrase</a>.</div>\n"
+ "</td>", + "</td>",
"<table class=\"requiresSummary\">\n"
+ "<caption><span>Requires</span><span class=\"tabEnd\">&nbsp;</span></caption>\n"
+ "<tr>\n"
+ "<th class=\"colFirst\" scope=\"col\">Modifier</th>\n"
+ "<th class=\"colSecond\" scope=\"col\">Module</th>\n"
+ "<th class=\"colLast\" scope=\"col\">Description</th>",
"<table class=\"requiresSummary\">\n"
+ "<caption><span>Indirect Requires</span><span class=\"tabEnd\">&nbsp;</span></caption>\n"
+ "<tr>\n"
+ "<th class=\"colFirst\" scope=\"col\">Modifier</th>\n"
+ "<th class=\"colSecond\" scope=\"col\">Module</th>\n"
+ "<th class=\"colLast\" scope=\"col\">Description</th>",
"<table class=\"packagesSummary\">\n"
+ "<caption><span>Indirect Opens</span><span class=\"tabEnd\">&nbsp;</span></caption>\n"
+ "<tr>\n"
+ "<th class=\"colFirst\" scope=\"col\">From</th>\n"
+ "<th class=\"colLast\" scope=\"col\">Packages</th>\n"
+ "</tr>\n",
"<th class=\"colFirst\" scope=\"row\"><a href=\"../moduleB/module-summary.html\">moduleB</a></th>\n"
+ "<td class=\"colLast\"><a href=\"../moduleB/testpkgmdlB/package-summary.html\">testpkgmdlB</a></td>\n");
}
void checkModuleModeCommon_html4() {
checkOutput("overview-summary.html", true,
"<th class=\"colFirst\" scope=\"row\"><a href=\"moduletags/module-summary.html\">moduletags</a></th>\n"
+ "<td class=\"colLast\">\n"
+ "<div class=\"block\">This is a test description for the moduletags module.<br>\n"
+ " Type Link: <a href=\"moduletags/testpkgmdltags/TestClassInModuleTags.html\" title=\"class in testpkgmdltags\"><code>TestClassInModuleTags</code></a>.<br>\n"
+ " Member Link: <a href=\"moduletags/testpkgmdltags/TestClassInModuleTags.html#testMethod-java.lang.String-\"><code>testMethod(String)</code></a>.<br>\n"
+ " Package Link: <a href=\"moduletags/testpkgmdltags/package-summary.html\"><code>testpkgmdltags</code></a>.<br></div>\n"
+ "</td>");
checkOutput("moduletags/module-summary.html", true,
"<table class=\"requiresSummary\" summary=\"Indirect Requires table, listing modules, and an explanation\">\n"
+ "<caption><span>Indirect Requires</span><span class=\"tabEnd\">&nbsp;</span></caption>",
"<table class=\"packagesSummary\" summary=\"Indirect Exports table, listing modules, and packages\">\n"
+ "<caption><span>Indirect Exports</span><span class=\"tabEnd\">&nbsp;</span></caption>",
"<table class=\"requiresSummary\" summary=\"Requires table, listing modules, and an explanation\">\n" "<table class=\"requiresSummary\" summary=\"Requires table, listing modules, and an explanation\">\n"
+ "<caption><span>Requires</span><span class=\"tabEnd\">&nbsp;</span></caption>\n" + "<caption><span>Requires</span><span class=\"tabEnd\">&nbsp;</span></caption>\n"
+ "<tr>\n" + "<tr>\n"
@ -969,9 +1259,7 @@ public class TestModules extends JavadocTester {
+ "<tr>\n" + "<tr>\n"
+ "<th class=\"colFirst\" scope=\"col\">From</th>\n" + "<th class=\"colFirst\" scope=\"col\">From</th>\n"
+ "<th class=\"colLast\" scope=\"col\">Packages</th>\n" + "<th class=\"colLast\" scope=\"col\">Packages</th>\n"
+ "</tr>\n", + "</tr>\n");
"<th class=\"colFirst\" scope=\"row\"><a href=\"../moduleB/module-summary.html\">moduleB</a></th>\n"
+ "<td class=\"colLast\"><a href=\"../moduleB/testpkgmdlB/package-summary.html\">testpkgmdlB</a></td>\n");
} }
void checkModuleModeApi(boolean found) { void checkModuleModeApi(boolean found) {
@ -983,7 +1271,7 @@ public class TestModules extends JavadocTester {
+ "<a href=\"#packages.summary\">Packages</a>&nbsp;|&nbsp;<a href=\"#services.summary\">Services</a></li>", + "<a href=\"#packages.summary\">Packages</a>&nbsp;|&nbsp;<a href=\"#services.summary\">Services</a></li>",
"<th class=\"colFirst\" scope=\"row\"><a href=\"testpkgmdlB/package-summary.html\">testpkgmdlB</a></th>\n" "<th class=\"colFirst\" scope=\"row\"><a href=\"testpkgmdlB/package-summary.html\">testpkgmdlB</a></th>\n"
+ "<td class=\"colLast\">&nbsp;</td>", + "<td class=\"colLast\">&nbsp;</td>",
"<table class=\"packagesSummary\" summary=\"Packages table, listing packages, and an explanation\">\n" "<table class=\"packagesSummary\">\n"
+ "<caption><span>Opens</span><span class=\"tabEnd\">&nbsp;</span></caption>\n" + "<caption><span>Opens</span><span class=\"tabEnd\">&nbsp;</span></caption>\n"
+ "<tr>\n" + "<tr>\n"
+ "<th class=\"colFirst\" scope=\"col\">Package</th>\n" + "<th class=\"colFirst\" scope=\"col\">Package</th>\n"
@ -1001,6 +1289,23 @@ public class TestModules extends JavadocTester {
+ "<td class=\"colLast\">&nbsp;</td>"); + "<td class=\"colLast\">&nbsp;</td>");
} }
void checkModuleModeApi_html4(boolean found) {
checkOutput("moduleB/module-summary.html", found,
"<table class=\"packagesSummary\" summary=\"Packages table, listing packages, and an explanation\">\n"
+ "<caption><span>Opens</span><span class=\"tabEnd\">&nbsp;</span></caption>\n"
+ "<tr>\n"
+ "<th class=\"colFirst\" scope=\"col\">Package</th>\n"
+ "<th class=\"colLast\" scope=\"col\">Description</th>\n"
+ "</tr>\n"
+ "<tbody>\n"
+ "<tr class=\"altColor\" id=\"i0\">\n"
+ "<th class=\"colFirst\" scope=\"row\"><a href=\"testpkgmdlB/package-summary.html\">testpkgmdlB</a></th>\n"
+ "<td class=\"colLast\">&nbsp;</td>\n"
+ "</tr>\n"
+ "</tbody>\n"
+ "</table>");
}
void checkModuleModeAll(boolean found) { void checkModuleModeAll(boolean found) {
checkOutput("moduleA/module-summary.html", found, checkOutput("moduleA/module-summary.html", found,
"<td class=\"colFirst\"> </td>\n" "<td class=\"colFirst\"> </td>\n"
@ -1084,13 +1389,20 @@ public class TestModules extends JavadocTester {
void checkModuleAnnotation() { void checkModuleAnnotation() {
checkOutput("moduleB/module-summary.html", true, checkOutput("moduleB/module-summary.html", true,
"<p><a href=\"testpkgmdlB/AnnotationType.html\" title=\"annotation in testpkgmdlB\">@AnnotationType</a>(<a href=\"testpkgmdlB/AnnotationType.html#optional--\">optional</a>=\"Module Annotation\",\n" "<p><a href=\"testpkgmdlB/AnnotationType.html\" title=\"annotation in testpkgmdlB\">@AnnotationType</a>(<a href=\"testpkgmdlB/AnnotationType.html#optional()\">optional</a>=\"Module Annotation\",\n"
+ " <a href=\"testpkgmdlB/AnnotationType.html#required--\">required</a>=2016)\n" + " <a href=\"testpkgmdlB/AnnotationType.html#required()\">required</a>=2016)\n"
+ "</p>"); + "</p>");
checkOutput("moduleB/module-summary.html", false, checkOutput("moduleB/module-summary.html", false,
"@AnnotationTypeUndocumented"); "@AnnotationTypeUndocumented");
} }
void checkModuleAnnotation_html4() {
checkOutput("moduleB/module-summary.html", true,
"<p><a href=\"testpkgmdlB/AnnotationType.html\" title=\"annotation in testpkgmdlB\">@AnnotationType</a>(<a href=\"testpkgmdlB/AnnotationType.html#optional--\">optional</a>=\"Module Annotation\",\n"
+ " <a href=\"testpkgmdlB/AnnotationType.html#required--\">required</a>=2016)\n"
+ "</p>");
}
void checkOverviewFrame(boolean found) { void checkOverviewFrame(boolean found) {
checkOutput("index.html", !found, checkOutput("index.html", !found,
"<iframe src=\"overview-frame.html\" name=\"packageListFrame\" title=\"All Packages\"></iframe>"); "<iframe src=\"overview-frame.html\" name=\"packageListFrame\" title=\"All Packages\"></iframe>");
@ -1101,13 +1413,43 @@ public class TestModules extends JavadocTester {
void checkModuleSummaryNoExported(boolean found) { void checkModuleSummaryNoExported(boolean found) {
checkOutput("moduleNoExport/module-summary.html", found, checkOutput("moduleNoExport/module-summary.html", found,
"<!-- ============ PACKAGES SUMMARY =========== -->\n" "<!-- ============ PACKAGES SUMMARY =========== -->\n"
+ "<a name=\"packages.summary\">\n" + "<a id=\"packages.summary\">\n"
+ "<!-- -->\n" + "<!-- -->\n"
+ "</a>", + "</a>",
"<caption><span>Concealed</span><span class=\"tabEnd\">&nbsp;</span></caption>"); "<caption><span>Concealed</span><span class=\"tabEnd\">&nbsp;</span></caption>");
} }
void checkModuleSummaryNoExported_html4(boolean found) {
checkOutput("moduleNoExport/module-summary.html", found,
"<!-- ============ PACKAGES SUMMARY =========== -->\n"
+ "<a name=\"packages.summary\">\n"
+ "<!-- -->\n"
+ "</a>");
}
void checkGroupOption() { void checkGroupOption() {
checkOutput("overview-summary.html", true,
"<div class=\"contentContainer\">\n"
+ "<table class=\"overviewSummary\">\n"
+ "<caption><span id=\"t0\" class=\"activeTableTab\"><span>All Modules</span><span class=\"tabEnd\">&nbsp;"
+ "</span></span><span id=\"t1\" class=\"tableTab\"><span><a href=\"javascript:showGroups(1);\">"
+ "Module Group A</a></span><span class=\"tabEnd\">&nbsp;</span></span><span id=\"t2\" class=\"tableTab\">"
+ "<span><a href=\"javascript:showGroups(2);\">Module Group B &amp; C</a></span><span class=\"tabEnd\">"
+ "&nbsp;</span></span><span id=\"t4\" class=\"tableTab\"><span><a href=\"javascript:showGroups(4);\">"
+ "Other Modules</a></span><span class=\"tabEnd\">&nbsp;</span></span></caption>",
"var groups = {\"i0\":1,\"i1\":2,\"i2\":2,\"i3\":4};\n"
+ "var tabs = {65535:[\"t0\",\"All Modules\"],1:[\"t1\",\"Module Group A\"],2:[\"t2\",\"Module Group B & C\"],4:[\"t4\",\"Other Modules\"]};\n"
+ "var altColor = \"altColor\";\n"
+ "var rowColor = \"rowColor\";\n"
+ "var tableTab = \"tableTab\";\n"
+ "var activeTableTab = \"activeTableTab\";");
checkOutput("overview-summary.html", false,
"<table class=\"overviewSummary\">\n"
+ "<caption><span>Modules</span><span class=\"tabEnd\">&nbsp;</span></caption>",
"Java SE Modules");
}
void checkGroupOption_html4() {
checkOutput("overview-summary.html", true, checkOutput("overview-summary.html", true,
"<div class=\"contentContainer\">\n" "<div class=\"contentContainer\">\n"
+ "<table class=\"overviewSummary\" summary=\"Module Summary table, listing modules, and an explanation\">\n" + "<table class=\"overviewSummary\" summary=\"Module Summary table, listing modules, and an explanation\">\n"
@ -1159,7 +1501,7 @@ public class TestModules extends JavadocTester {
+ "<div class=\"block\">The overview summary page header.</div>\n" + "<div class=\"block\">The overview summary page header.</div>\n"
+ "</div>\n" + "</div>\n"
+ "<div class=\"contentContainer\">\n" + "<div class=\"contentContainer\">\n"
+ "<table class=\"overviewSummary\" summary=\"Package Summary table, listing packages, and an explanation\">\n" + "<table class=\"overviewSummary\">\n"
+ "<caption><span id=\"t0\" class=\"activeTableTab\"><span>All Packages</span><span class=\"tabEnd\">&nbsp;" + "<caption><span id=\"t0\" class=\"activeTableTab\"><span>All Packages</span><span class=\"tabEnd\">&nbsp;"
+ "</span></span><span id=\"t1\" class=\"tableTab\"><span><a href=\"javascript:showGroups(1);\">" + "</span></span><span id=\"t1\" class=\"tableTab\"><span><a href=\"javascript:showGroups(1);\">"
+ "Package Group 0</a></span><span class=\"tabEnd\">&nbsp;</span></span><span id=\"t2\" " + "Package Group 0</a></span><span class=\"tabEnd\">&nbsp;</span></span><span id=\"t2\" "
@ -1173,6 +1515,20 @@ public class TestModules extends JavadocTester {
+ "var activeTableTab = \"activeTableTab\";"); + "var activeTableTab = \"activeTableTab\";");
} }
void checkUnnamedModuleGroupOption_html4() {
checkOutput("overview-summary.html", true,
"<div class=\"contentContainer\">\n"
+ "<div class=\"block\">The overview summary page header.</div>\n"
+ "</div>\n"
+ "<div class=\"contentContainer\">\n"
+ "<table class=\"overviewSummary\" summary=\"Package Summary table, listing packages, and an explanation\">\n"
+ "<caption><span id=\"t0\" class=\"activeTableTab\"><span>All Packages</span><span class=\"tabEnd\">&nbsp;"
+ "</span></span><span id=\"t1\" class=\"tableTab\"><span><a href=\"javascript:showGroups(1);\">"
+ "Package Group 0</a></span><span class=\"tabEnd\">&nbsp;</span></span><span id=\"t2\" "
+ "class=\"tableTab\"><span><a href=\"javascript:showGroups(2);\">Package Group 1</a></span>"
+ "<span class=\"tabEnd\">&nbsp;</span></span></caption>");
}
void checkGroupOptionPackageOrdering() { void checkGroupOptionPackageOrdering() {
checkOutput("overview-summary.html", true, checkOutput("overview-summary.html", true,
"<caption><span id=\"t0\" class=\"activeTableTab\"><span>All Packages</span><span " "<caption><span id=\"t0\" class=\"activeTableTab\"><span>All Packages</span><span "
@ -1184,6 +1540,16 @@ public class TestModules extends JavadocTester {
} }
void checkGroupOptionSingleModule() { void checkGroupOptionSingleModule() {
checkOutput("overview-summary.html", true,
"<div class=\"contentContainer\">\n"
+ "<table class=\"overviewSummary\">\n"
+ "<caption><span>Module Group B</span><span class=\"tabEnd\">&nbsp;</span></caption>");
checkOutput("overview-summary.html", false,
"<table class=\"overviewSummary\">\n"
+ "<caption><span>Modules</span><span class=\"tabEnd\">&nbsp;</span></caption>");
}
void checkGroupOptionSingleModule_html4() {
checkOutput("overview-summary.html", true, checkOutput("overview-summary.html", true,
"<div class=\"contentContainer\">\n" "<div class=\"contentContainer\">\n"
+ "<table class=\"overviewSummary\" summary=\"Module Summary table, listing modules, and an explanation\">\n" + "<table class=\"overviewSummary\" summary=\"Module Summary table, listing modules, and an explanation\">\n"

View File

@ -23,7 +23,7 @@
/* /*
* @test * @test
* @bug 4131628 4664607 7025314 8023700 7198273 8025633 8026567 8081854 8150188 8151743 8196027 * @bug 4131628 4664607 7025314 8023700 7198273 8025633 8026567 8081854 8150188 8151743 8196027 8182765
* @summary Make sure the Next/Prev Class links iterate through all types. * @summary Make sure the Next/Prev Class links iterate through all types.
* Make sure the navagation is 2 columns, not 3. * Make sure the navagation is 2 columns, not 3.
* @author jamieh * @author jamieh
@ -42,7 +42,8 @@ public class TestNavigation extends JavadocTester {
@Test @Test
void test() { void test() {
javadoc("-d", "out", "-overview", testSrc("overview.html"), javadoc("-d", "out",
"-overview", testSrc("overview.html"),
"-sourcepath", testSrc, "-sourcepath", testSrc,
"pkg"); "pkg");
checkExit(Exit.OK); checkExit(Exit.OK);
@ -62,11 +63,54 @@ public class TestNavigation extends JavadocTester {
checkOutput("pkg/I.html", true, checkOutput("pkg/I.html", true,
// Test for 4664607 // Test for 4664607
"<div class=\"skipNav\"><a href=\"#skip.navbar.top\" title=\"Skip navigation links\">Skip navigation links</a></div>\n" "<div class=\"skipNav\"><a href=\"#skip.navbar.top\" title=\"Skip navigation links\">Skip navigation links</a></div>\n"
+ "<a name=\"navbar.top.firstrow\">\n" + "<a id=\"navbar.top.firstrow\">\n"
+ "<!-- -->\n" + "<!-- -->\n"
+ "</a>", + "</a>",
"<li><a href=\"../overview-summary.html\">Overview</a></li>"); "<li><a href=\"../overview-summary.html\">Overview</a></li>");
// Remaining tests check for additional padding to offset the fixed navigation bar.
checkOutput("pkg/A.html", true,
"<!-- ========= END OF TOP NAVBAR ========= -->\n"
+ "</div>\n"
+ "<div class=\"navPadding\">&nbsp;</div>\n"
+ "<script type=\"text/javascript\"><!--\n"
+ "$('.navPadding').css('padding-top', $('.fixedNav').css(\"height\"));\n"
+ "//-->\n"
+ "</script>\n"
+ "</nav>\n"
+ "</header>\n"
+ "<!-- ======== START OF CLASS DATA ======== -->");
checkOutput("pkg/package-summary.html", true,
"<!-- ========= END OF TOP NAVBAR ========= -->\n"
+ "</div>\n"
+ "<div class=\"navPadding\">&nbsp;</div>\n"
+ "<script type=\"text/javascript\"><!--\n"
+ "$('.navPadding').css('padding-top', $('.fixedNav').css(\"height\"));\n"
+ "//-->\n"
+ "</script>\n"
+ "</nav>\n"
+ "</header>\n"
+ "<main role=\"main\">\n"
+ "<div class=\"header\">");
}
@Test
void test_html4() {
javadoc("-d", "out-html4",
"-html4",
"-overview", testSrc("overview.html"),
"-sourcepath", testSrc,
"pkg");
checkExit(Exit.OK);
checkOutput("pkg/I.html", true,
// Test for 4664607
"<div class=\"skipNav\"><a href=\"#skip.navbar.top\" title=\"Skip navigation links\">Skip navigation links</a></div>\n"
+ "<a name=\"navbar.top.firstrow\">\n"
+ "<!-- -->\n"
+ "</a>");
// Remaining tests check for additional padding to offset the fixed navigation bar. // Remaining tests check for additional padding to offset the fixed navigation bar.
checkOutput("pkg/A.html", true, checkOutput("pkg/A.html", true,
"<!-- ========= END OF TOP NAVBAR ========= -->\n" "<!-- ========= END OF TOP NAVBAR ========= -->\n"
@ -92,7 +136,8 @@ public class TestNavigation extends JavadocTester {
// Test for checking additional padding to offset the fixed navigation bar in HTML5. // Test for checking additional padding to offset the fixed navigation bar in HTML5.
@Test @Test
void test1() { void test1() {
javadoc("-d", "out-1", "-html5", javadoc("-d", "out-1",
"-html5",
"-sourcepath", testSrc, "-sourcepath", testSrc,
"pkg"); "pkg");
checkExit(Exit.OK); checkExit(Exit.OK);
@ -123,7 +168,8 @@ public class TestNavigation extends JavadocTester {
// Test to make sure that no extra padding for nav bar gets generated if -nonavbar is specified for HTML4. // Test to make sure that no extra padding for nav bar gets generated if -nonavbar is specified for HTML4.
@Test @Test
void test2() { void test2() {
javadoc("-d", "out-2", "-nonavbar", javadoc("-d", "out-2",
"-nonavbar",
"-sourcepath", testSrc, "-sourcepath", testSrc,
"pkg"); "pkg");
checkExit(Exit.OK); checkExit(Exit.OK);
@ -152,7 +198,9 @@ public class TestNavigation extends JavadocTester {
// Test to make sure that no extra padding for nav bar gets generated if -nonavbar is specified for HTML5. // Test to make sure that no extra padding for nav bar gets generated if -nonavbar is specified for HTML5.
@Test @Test
void test3() { void test3() {
javadoc("-d", "out-3", "-html5", "-nonavbar", javadoc("-d", "out-3",
"-html5",
"-nonavbar",
"-sourcepath", testSrc, "-sourcepath", testSrc,
"pkg"); "pkg");
checkExit(Exit.OK); checkExit(Exit.OK);

View File

@ -23,7 +23,7 @@
/* /*
* @test * @test
* @bug 6758050 8025633 * @bug 6758050 8025633 8182765
* @summary Test HTML output for nested generic types. * @summary Test HTML output for nested generic types.
* @author bpatel * @author bpatel
* @library ../lib * @library ../lib
@ -46,6 +46,20 @@ public class TestNestedGenerics extends JavadocTester {
"pkg"); "pkg");
checkExit(Exit.OK); checkExit(Exit.OK);
checkOutput("pkg/NestedGenerics.html", true,
"<div class=\"block\">Contains <a " +
"href=\"#foo(java.util.Map)\"><code>foo" +
"(java.util.Map&lt;A, java.util.Map&lt;A, A&gt;&gt;)</code></a></div>");
}
@Test
void test_html4() {
javadoc("-d", "out-html4",
"-html4",
"-sourcepath", testSrc,
"pkg");
checkExit(Exit.OK);
checkOutput("pkg/NestedGenerics.html", true, checkOutput("pkg/NestedGenerics.html", true,
"<div class=\"block\">Contains <a " + "<div class=\"block\">Contains <a " +
"href=\"#foo-java.util.Map-\"><code>foo" + "href=\"#foo-java.util.Map-\"><code>foo" +

View File

@ -24,7 +24,7 @@
/* /*
* @test * @test
* @bug 4789689 4905985 4927164 4827184 4993906 5004549 7025314 7010344 8025633 8026567 8162363 * @bug 4789689 4905985 4927164 4827184 4993906 5004549 7025314 7010344 8025633 8026567 8162363
* 8175200 8186332 * 8175200 8186332 8182765
* @summary Run Javadoc on a set of source files that demonstrate new * @summary Run Javadoc on a set of source files that demonstrate new
* language features. Check the output to ensure that the new * language features. Check the output to ensure that the new
* language features are properly documented. * language features are properly documented.
@ -46,8 +46,8 @@ public class TestNewLanguageFeatures extends JavadocTester {
void test() { void test() {
javadoc("-Xdoclint:none", javadoc("-Xdoclint:none",
"-d", "out", "-d", "out",
"-use", "-sourcepath", "-use",
testSrc, "-sourcepath", testSrc,
"pkg", "pkg1", "pkg2"); "pkg", "pkg1", "pkg2");
checkExit(Exit.OK); checkExit(Exit.OK);
@ -57,6 +57,21 @@ public class TestNewLanguageFeatures extends JavadocTester {
checkAnnotationTypeUsage(); checkAnnotationTypeUsage();
} }
@Test
void test_html4() {
javadoc("-Xdoclint:none",
"-d", "out-html4",
"-html4",
"-use",
"-sourcepath", testSrc,
"pkg", "pkg1", "pkg2");
checkExit(Exit.OK);
checkTypeParameters_html4();
checkVarArgs_html4();
checkAnnotationTypeUsage_html4();
}
//================================= //=================================
// ENUM TESTING // ENUM TESTING
//================================= //=================================
@ -136,7 +151,7 @@ public class TestNewLanguageFeatures extends JavadocTester {
"<td class=\"colFirst\"><code><a href=\"TypeParameters.html\" " "<td class=\"colFirst\"><code><a href=\"TypeParameters.html\" "
+ "title=\"type parameter in TypeParameters\">E</a>[]</code></td>\n" + "title=\"type parameter in TypeParameters\">E</a>[]</code></td>\n"
+ "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">" + "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">"
+ "<a href=\"#methodThatReturnsTypeParameterA-E:A-\">" + "<a href=\"#methodThatReturnsTypeParameterA(E%5B%5D)\">"
+ "methodThatReturnsTypeParameterA</a></span>&#8203;(<a href=\"TypeParameters.html\" " + "methodThatReturnsTypeParameterA</a></span>&#8203;(<a href=\"TypeParameters.html\" "
+ "title=\"type parameter in TypeParameters\">E</a>[]&nbsp;e)</code>", + "title=\"type parameter in TypeParameters\">E</a>[]&nbsp;e)</code>",
"<pre>public&nbsp;<a href=\"TypeParameters.html\" " "<pre>public&nbsp;<a href=\"TypeParameters.html\" "
@ -146,7 +161,7 @@ public class TestNewLanguageFeatures extends JavadocTester {
"<td class=\"colFirst\"><code>&lt;T extends java.lang.Object &amp; java.lang.Comparable&lt;? super T&gt;&gt;" "<td class=\"colFirst\"><code>&lt;T extends java.lang.Object &amp; java.lang.Comparable&lt;? super T&gt;&gt;"
+ "<br>T</code></td>\n" + "<br>T</code></td>\n"
+ "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">" + "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">"
+ "<a href=\"#methodtThatReturnsTypeParametersB-java.util.Collection-\">" + "<a href=\"#methodtThatReturnsTypeParametersB(java.util.Collection)\">"
+ "methodtThatReturnsTypeParametersB</a></span>&#8203;(java.util.Collection&lt;? extends T&gt;&nbsp;coll)</code>", + "methodtThatReturnsTypeParametersB</a></span>&#8203;(java.util.Collection&lt;? extends T&gt;&nbsp;coll)</code>",
"<div class=\"block\">Returns TypeParameters</div>\n", "<div class=\"block\">Returns TypeParameters</div>\n",
// Method takes a TypeVariable // Method takes a TypeVariable
@ -154,7 +169,7 @@ public class TestNewLanguageFeatures extends JavadocTester {
+ "<a href=\"TypeParameters.html\" title=\"type parameter in TypeParameters\">E</a>" + "<a href=\"TypeParameters.html\" title=\"type parameter in TypeParameters\">E</a>"
+ "</code></td>\n" + "</code></td>\n"
+ "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">" + "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">"
+ "<a href=\"#orElseThrow-java.util.function.Supplier-\">" + "<a href=\"#orElseThrow(java.util.function.Supplier)\">"
+ "orElseThrow</a></span>&#8203;(java.util.function.Supplier&lt;? extends X&gt;&nbsp;exceptionSupplier)</code>" + "orElseThrow</a></span>&#8203;(java.util.function.Supplier&lt;? extends X&gt;&nbsp;exceptionSupplier)</code>"
); );
@ -231,7 +246,7 @@ public class TestNewLanguageFeatures extends JavadocTester {
+ "pkg2\">Foo</a></span><span class=\"tabEnd\">&nbsp;</span></caption>", + "pkg2\">Foo</a></span><span class=\"tabEnd\">&nbsp;</span></caption>",
"<th class=\"colSecond\" scope=\"row\"><span class=\"typeNameLabel\">ClassUseTest1." "<th class=\"colSecond\" scope=\"row\"><span class=\"typeNameLabel\">ClassUseTest1."
+ "</span><code><span class=\"memberNameLink\"><a href=\"../" + "</span><code><span class=\"memberNameLink\"><a href=\"../"
+ "ClassUseTest1.html#method-T-\">method</a></span>" + "ClassUseTest1.html#method(T)\">method</a></span>"
+ "&#8203;(T&nbsp;t)</code></th>", + "&#8203;(T&nbsp;t)</code></th>",
"<caption><span>Fields in <a href=\"../" "<caption><span>Fields in <a href=\"../"
+ "package-summary.html\">pkg2</a> with type parameters of " + "package-summary.html\">pkg2</a> with type parameters of "
@ -272,7 +287,7 @@ public class TestNewLanguageFeatures extends JavadocTester {
+ "</span></caption>", + "</span></caption>",
"<th class=\"colSecond\" scope=\"row\"><span class=\"typeNameLabel\">" "<th class=\"colSecond\" scope=\"row\"><span class=\"typeNameLabel\">"
+ "ClassUseTest1.</span><code><span class=\"memberNameLink\"><a href=\"../" + "ClassUseTest1.</span><code><span class=\"memberNameLink\"><a href=\"../"
+ "ClassUseTest1.html#method-T-\">method</a></span>" + "ClassUseTest1.html#method(T)\">method</a></span>"
+ "&#8203;(T&nbsp;t)</code></th>" + "&#8203;(T&nbsp;t)</code></th>"
); );
@ -295,7 +310,7 @@ public class TestNewLanguageFeatures extends JavadocTester {
+ "&nbsp;</span></caption>", + "&nbsp;</span></caption>",
"<th class=\"colSecond\" scope=\"row\"><span class=\"typeNameLabel\">ClassUseTest2." "<th class=\"colSecond\" scope=\"row\"><span class=\"typeNameLabel\">ClassUseTest2."
+ "</span><code><span class=\"memberNameLink\"><a href=\"../" + "</span><code><span class=\"memberNameLink\"><a href=\"../"
+ "ClassUseTest2.html#method-T-\">method</a></span>" + "ClassUseTest2.html#method(T)\">method</a></span>"
+ "&#8203;(T&nbsp;t)</code></th>", + "&#8203;(T&nbsp;t)</code></th>",
"<caption><span>Fields in <a href=\"../" "<caption><span>Fields in <a href=\"../"
+ "package-summary.html\">pkg2</a> declared as <a href=\"../" + "package-summary.html\">pkg2</a> declared as <a href=\"../"
@ -336,7 +351,7 @@ public class TestNewLanguageFeatures extends JavadocTester {
+ "</span></caption>", + "</span></caption>",
"<th class=\"colSecond\" scope=\"row\"><span class=\"typeNameLabel\">ClassUseTest2." "<th class=\"colSecond\" scope=\"row\"><span class=\"typeNameLabel\">ClassUseTest2."
+ "</span><code><span class=\"memberNameLink\"><a href=\"../" + "</span><code><span class=\"memberNameLink\"><a href=\"../"
+ "ClassUseTest2.html#method-T-\">method</a></span>" + "ClassUseTest2.html#method(T)\">method</a></span>"
+ "&#8203;(T&nbsp;t)</code></th>", + "&#8203;(T&nbsp;t)</code></th>",
"<caption><span>Methods in <a href=\"../" "<caption><span>Methods in <a href=\"../"
+ "package-summary.html\">pkg2</a> that return types with " + "package-summary.html\">pkg2</a> that return types with "
@ -371,7 +386,7 @@ public class TestNewLanguageFeatures extends JavadocTester {
+ "&nbsp;</span></caption>", + "&nbsp;</span></caption>",
"<th class=\"colSecond\" scope=\"row\"><span class=\"typeNameLabel\">ClassUseTest3" "<th class=\"colSecond\" scope=\"row\"><span class=\"typeNameLabel\">ClassUseTest3"
+ ".</span><code><span class=\"memberNameLink\"><a href=\"../ClassUseTest3." + ".</span><code><span class=\"memberNameLink\"><a href=\"../ClassUseTest3."
+ "html#method-T-\">method</a></span>&#8203;(T&nbsp;t)</code></th>", + "html#method(T)\">method</a></span>&#8203;(T&nbsp;t)</code></th>",
"<td class=\"colFirst\"><code>&lt;T extends <a href=\"../" "<td class=\"colFirst\"><code>&lt;T extends <a href=\"../"
+ "ParamTest2.html\" title=\"class in pkg2\">" + "ParamTest2.html\" title=\"class in pkg2\">"
+ "ParamTest2</a>&lt;java.util.List&lt;? extends <a href=\".." + "ParamTest2</a>&lt;java.util.List&lt;? extends <a href=\".."
@ -400,7 +415,7 @@ public class TestNewLanguageFeatures extends JavadocTester {
+ "pkg2\">Foo4</a></span><span class=\"tabEnd\">&nbsp;</span></caption>", + "pkg2\">Foo4</a></span><span class=\"tabEnd\">&nbsp;</span></caption>",
"<th class=\"colSecond\" scope=\"row\"><span class=\"typeNameLabel\">ClassUseTest3." "<th class=\"colSecond\" scope=\"row\"><span class=\"typeNameLabel\">ClassUseTest3."
+ "</span><code><span class=\"memberNameLink\"><a href=\"../ClassUseTest3." + "</span><code><span class=\"memberNameLink\"><a href=\"../ClassUseTest3."
+ "html#method-T-\">method</a></span>&#8203;(T&nbsp;t)</code>" + "html#method(T)\">method</a></span>&#8203;(T&nbsp;t)</code>"
+ "</th>", + "</th>",
"<caption><span>Methods in <a href=\"../" "<caption><span>Methods in <a href=\"../"
+ "package-summary.html\">pkg2</a> that return types with " + "package-summary.html\">pkg2</a> that return types with "
@ -434,7 +449,7 @@ public class TestNewLanguageFeatures extends JavadocTester {
+ "<td class=\"colFirst\"><code>void</code></td>\n" + "<td class=\"colFirst\"><code>void</code></td>\n"
+ "<th class=\"colSecond\" scope=\"row\"><span class=\"typeNameLabel\">ClassUseTest3." + "<th class=\"colSecond\" scope=\"row\"><span class=\"typeNameLabel\">ClassUseTest3."
+ "</span><code><span class=\"memberNameLink\"><a href=\"../ClassUseTest3." + "</span><code><span class=\"memberNameLink\"><a href=\"../ClassUseTest3."
+ "html#method-java.util.Set-\">method</a></span>&#8203;(java." + "html#method(java.util.Set)\">method</a></span>&#8203;(java."
+ "util.Set&lt;<a href=\"../Foo4.html\" title=\"" + "util.Set&lt;<a href=\"../Foo4.html\" title=\""
+ "class in pkg2\">Foo4</a>&gt;&nbsp;p)</code></th>", + "class in pkg2\">Foo4</a>&gt;&nbsp;p)</code></th>",
"<caption><span>Constructor parameters in <a href=\"../" "<caption><span>Constructor parameters in <a href=\"../"
@ -444,6 +459,129 @@ public class TestNewLanguageFeatures extends JavadocTester {
+ "</span></caption>" + "</span></caption>"
); );
//=================================
// TYPE PARAMETER IN INDEX
//=================================
checkOutput("index-all.html", true,
"<span class=\"memberNameLink\"><a href=\"pkg2/Foo.html#method(java.util.Vector)\">"
+ "method(Vector&lt;Object&gt;)</a></span>"
);
// TODO: duplicate of previous case; left in delibarately for now to simplify comparison testing
//=================================
// TYPE PARAMETER IN INDEX
//=================================
checkOutput("index-all.html", true,
"<span class=\"memberNameLink\"><a href=\"pkg2/Foo.html#method(java.util.Vector)\">"
+ "method(Vector&lt;Object&gt;)</a></span>"
);
// No type parameters in class frame.
checkOutput("allclasses-frame.html", false,
"<a href=\"../pkg/TypeParameters.html\" title=\"class in pkg\">"
+ "TypeParameters</a>&lt;<a href=\"../pkg/TypeParameters.html\" "
+ "title=\"type parameter in TypeParameters\">E</a>&gt;"
);
}
//=================================
// TYPE PARAMETER TESTING
//=================================
void checkTypeParameters_html4() {
checkOutput("pkg/TypeParameters.html", true,
// Make sure the header is correct.
"<td class=\"colFirst\"><code><a href=\"TypeParameters.html\" "
+ "title=\"type parameter in TypeParameters\">E</a>[]</code></td>\n"
+ "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">"
+ "<a href=\"#methodThatReturnsTypeParameterA-E:A-\">"
+ "methodThatReturnsTypeParameterA</a></span>&#8203;(<a href=\"TypeParameters.html\" "
+ "title=\"type parameter in TypeParameters\">E</a>[]&nbsp;e)</code>",
"<td class=\"colFirst\"><code>&lt;T extends java.lang.Object &amp; java.lang.Comparable&lt;? super T&gt;&gt;"
+ "<br>T</code></td>\n"
+ "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">"
+ "<a href=\"#methodtThatReturnsTypeParametersB-java.util.Collection-\">"
+ "methodtThatReturnsTypeParametersB</a></span>&#8203;(java.util.Collection&lt;? extends T&gt;&nbsp;coll)</code>",
"<div class=\"block\">Returns TypeParameters</div>\n",
// Method takes a TypeVariable
"<td class=\"colFirst\"><code>&lt;X extends java.lang.Throwable&gt;<br>"
+ "<a href=\"TypeParameters.html\" title=\"type parameter in TypeParameters\">E</a>"
+ "</code></td>\n"
+ "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">"
+ "<a href=\"#orElseThrow-java.util.function.Supplier-\">"
+ "orElseThrow</a></span>&#8203;(java.util.function.Supplier&lt;? extends X&gt;&nbsp;exceptionSupplier)</code>"
);
//==============================================================
// Test Class-Use Documentation for Type Parameters.
//==============================================================
// ClassUseTest1: <T extends Foo & Foo2>
checkOutput("pkg2/class-use/Foo.html", true,
"<th class=\"colSecond\" scope=\"row\"><span class=\"typeNameLabel\">ClassUseTest1."
+ "</span><code><span class=\"memberNameLink\"><a href=\"../"
+ "ClassUseTest1.html#method-T-\">method</a></span>"
+ "&#8203;(T&nbsp;t)</code></th>"
);
checkOutput("pkg2/class-use/Foo2.html", true,
"<th class=\"colSecond\" scope=\"row\"><span class=\"typeNameLabel\">"
+ "ClassUseTest1.</span><code><span class=\"memberNameLink\"><a href=\"../"
+ "ClassUseTest1.html#method-T-\">method</a></span>"
+ "&#8203;(T&nbsp;t)</code></th>"
);
// ClassUseTest2: <T extends ParamTest<Foo3>>
checkOutput("pkg2/class-use/ParamTest.html", true,
"<th class=\"colSecond\" scope=\"row\"><span class=\"typeNameLabel\">ClassUseTest2."
+ "</span><code><span class=\"memberNameLink\"><a href=\"../"
+ "ClassUseTest2.html#method-T-\">method</a></span>"
+ "&#8203;(T&nbsp;t)</code></th>"
);
checkOutput("pkg2/class-use/Foo3.html", true,
"<th class=\"colSecond\" scope=\"row\"><span class=\"typeNameLabel\">ClassUseTest2."
+ "</span><code><span class=\"memberNameLink\"><a href=\"../"
+ "ClassUseTest2.html#method-T-\">method</a></span>"
+ "&#8203;(T&nbsp;t)</code></th>"
);
// ClassUseTest3: <T extends ParamTest2<List<? extends Foo4>>>
checkOutput("pkg2/class-use/ParamTest2.html", true,
"<th class=\"colSecond\" scope=\"row\"><span class=\"typeNameLabel\">ClassUseTest3"
+ ".</span><code><span class=\"memberNameLink\"><a href=\"../ClassUseTest3."
+ "html#method-T-\">method</a></span>&#8203;(T&nbsp;t)</code></th>"
);
checkOutput("pkg2/class-use/Foo4.html", true,
"<th class=\"colSecond\" scope=\"row\"><span class=\"typeNameLabel\">ClassUseTest3."
+ "</span><code><span class=\"memberNameLink\"><a href=\"../ClassUseTest3."
+ "html#method-T-\">method</a></span>&#8203;(T&nbsp;t)</code>"
+ "</th>"
);
// Type parameters in constructor and method args
checkOutput("pkg2/class-use/Foo4.html", true,
"<caption><span>Method parameters in <a href=\"../"
+ "package-summary.html\">pkg2</a> with type arguments of "
+ "type <a href=\"../Foo4.html\" title=\"class in "
+ "pkg2\">Foo4</a></span><span class=\"tabEnd\">&nbsp;"
+ "</span></caption>\n"
+ "<tr>\n"
+ "<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>\n"
+ "<th class=\"colSecond\" scope=\"col\">Method</th>\n"
+ "<th class=\"colLast\" scope=\"col\">Description</th>\n"
+ "</tr>\n"
+ "<tbody>\n"
+ "<tr class=\"altColor\">\n"
+ "<td class=\"colFirst\"><code>void</code></td>\n"
+ "<th class=\"colSecond\" scope=\"row\"><span class=\"typeNameLabel\">ClassUseTest3."
+ "</span><code><span class=\"memberNameLink\"><a href=\"../ClassUseTest3."
+ "html#method-java.util.Set-\">method</a></span>&#8203;(java."
+ "util.Set&lt;<a href=\"../Foo4.html\" title=\""
+ "class in pkg2\">Foo4</a>&gt;&nbsp;p)</code></th>"
);
//================================= //=================================
// TYPE PARAMETER IN INDEX // TYPE PARAMETER IN INDEX
//================================= //=================================
@ -461,19 +599,24 @@ public class TestNewLanguageFeatures extends JavadocTester {
+ "method(Vector&lt;Object&gt;)</a></span>" + "method(Vector&lt;Object&gt;)</a></span>"
); );
// No type parameters in class frame.
checkOutput("allclasses-frame.html", false,
"<a href=\"../pkg/TypeParameters.html\" title=\"class in pkg\">"
+ "TypeParameters</a>&lt;<a href=\"../pkg/TypeParameters.html\" "
+ "title=\"type parameter in TypeParameters\">E</a>&gt;"
);
} }
//================================= //=================================
// VAR ARG TESTING // VAR ARG TESTING
//================================= //=================================
void checkVarArgs() { void checkVarArgs() {
checkOutput("pkg/VarArgs.html", true,
"(int...&nbsp;i)",
"(int[][]...&nbsp;i)",
"(int[]...)",
"<a href=\"TypeParameters.html\" title=\"class in pkg\">"
+ "TypeParameters</a>...&nbsp;t");
}
//=================================
// VAR ARG TESTING
//=================================
void checkVarArgs_html4() {
checkOutput("pkg/VarArgs.html", true, checkOutput("pkg/VarArgs.html", true,
"(int...&nbsp;i)", "(int...&nbsp;i)",
"(int[][]...&nbsp;i)", "(int[][]...&nbsp;i)",
@ -520,16 +663,16 @@ public class TestNewLanguageFeatures extends JavadocTester {
void checkAnnotationTypeUsage() { void checkAnnotationTypeUsage() {
checkOutput("pkg/package-summary.html", true, checkOutput("pkg/package-summary.html", true,
// PACKAGE // PACKAGE
"<a href=\"AnnotationType.html\" title=\"annotation in pkg\">@AnnotationType</a>(<a href=\"AnnotationType.html#optional--\">optional</a>=\"Package Annotation\",\n" "<a href=\"AnnotationType.html\" title=\"annotation in pkg\">@AnnotationType</a>(<a href=\"AnnotationType.html#optional()\">optional</a>=\"Package Annotation\",\n"
+ " <a href=\"AnnotationType.html#required--\">required</a>=1994)"); + " <a href=\"AnnotationType.html#required()\">required</a>=1994)");
checkOutput("pkg/AnnotationTypeUsage.html", true, checkOutput("pkg/AnnotationTypeUsage.html", true,
// CLASS // CLASS
"<pre><a href=\"AnnotationType.html\" " "<pre><a href=\"AnnotationType.html\" "
+ "title=\"annotation in pkg\">@AnnotationType</a>(" + "title=\"annotation in pkg\">@AnnotationType</a>("
+ "<a href=\"AnnotationType.html#optional--\">optional</a>" + "<a href=\"AnnotationType.html#optional()\">optional</a>"
+ "=\"Class Annotation\",\n" + "=\"Class Annotation\",\n"
+ " <a href=\"AnnotationType.html#required--\">" + " <a href=\"AnnotationType.html#required()\">"
+ "required</a>=1994)\n" + "required</a>=1994)\n"
+ "public class <span class=\"typeNameLabel\">" + "public class <span class=\"typeNameLabel\">"
+ "AnnotationTypeUsage</span>\n" + "AnnotationTypeUsage</span>\n"
@ -537,41 +680,41 @@ public class TestNewLanguageFeatures extends JavadocTester {
// FIELD // FIELD
"<pre><a href=\"AnnotationType.html\" " "<pre><a href=\"AnnotationType.html\" "
+ "title=\"annotation in pkg\">@AnnotationType</a>(" + "title=\"annotation in pkg\">@AnnotationType</a>("
+ "<a href=\"AnnotationType.html#optional--\">optional</a>" + "<a href=\"AnnotationType.html#optional()\">optional</a>"
+ "=\"Field Annotation\",\n" + "=\"Field Annotation\",\n"
+ " <a href=\"AnnotationType.html#required--\">" + " <a href=\"AnnotationType.html#required()\">"
+ "required</a>=1994)\n" + "required</a>=1994)\n"
+ "public&nbsp;int field</pre>", + "public&nbsp;int field</pre>",
// CONSTRUCTOR // CONSTRUCTOR
"<pre><a href=\"AnnotationType.html\" " "<pre><a href=\"AnnotationType.html\" "
+ "title=\"annotation in pkg\">@AnnotationType</a>(" + "title=\"annotation in pkg\">@AnnotationType</a>("
+ "<a href=\"AnnotationType.html#optional--\">optional</a>" + "<a href=\"AnnotationType.html#optional()\">optional</a>"
+ "=\"Constructor Annotation\",\n" + "=\"Constructor Annotation\",\n"
+ " <a href=\"AnnotationType.html#required--\">" + " <a href=\"AnnotationType.html#required()\">"
+ "required</a>=1994)\n" + "required</a>=1994)\n"
+ "public&nbsp;AnnotationTypeUsage()</pre>", + "public&nbsp;AnnotationTypeUsage()</pre>",
// METHOD // METHOD
"<pre><a href=\"AnnotationType.html\" " "<pre><a href=\"AnnotationType.html\" "
+ "title=\"annotation in pkg\">@AnnotationType</a>(" + "title=\"annotation in pkg\">@AnnotationType</a>("
+ "<a href=\"AnnotationType.html#optional--\">optional</a>" + "<a href=\"AnnotationType.html#optional()\">optional</a>"
+ "=\"Method Annotation\",\n" + "=\"Method Annotation\",\n"
+ " <a href=\"AnnotationType.html#required--\">" + " <a href=\"AnnotationType.html#required()\">"
+ "required</a>=1994)\n" + "required</a>=1994)\n"
+ "public&nbsp;void&nbsp;method()</pre>", + "public&nbsp;void&nbsp;method()</pre>",
// METHOD PARAMS // METHOD PARAMS
"<pre>public&nbsp;void&nbsp;methodWithParams&#8203;(" "<pre>public&nbsp;void&nbsp;methodWithParams&#8203;("
+ "<a href=\"AnnotationType.html\" title=\"annotation in pkg\">" + "<a href=\"AnnotationType.html\" title=\"annotation in pkg\">"
+ "@AnnotationType</a>(<a href=\"AnnotationType.html#optional--\">" + "@AnnotationType</a>(<a href=\"AnnotationType.html#optional()\">"
+ "optional</a>=\"Parameter Annotation\",<a " + "optional</a>=\"Parameter Annotation\",<a "
+ "href=\"AnnotationType.html#required--\">required</a>=1994)\n" + "href=\"AnnotationType.html#required()\">required</a>=1994)\n"
+ " int&nbsp;documented,\n" + " int&nbsp;documented,\n"
+ " int&nbsp;undocmented)</pre>", + " int&nbsp;undocmented)</pre>",
// CONSTRUCTOR PARAMS // CONSTRUCTOR PARAMS
"<pre>public&nbsp;AnnotationTypeUsage&#8203;(<a " "<pre>public&nbsp;AnnotationTypeUsage&#8203;(<a "
+ "href=\"AnnotationType.html\" title=\"annotation in pkg\">" + "href=\"AnnotationType.html\" title=\"annotation in pkg\">"
+ "@AnnotationType</a>(<a href=\"AnnotationType.html#optional--\">" + "@AnnotationType</a>(<a href=\"AnnotationType.html#optional()\">"
+ "optional</a>=\"Constructor Param Annotation\",<a " + "optional</a>=\"Constructor Param Annotation\",<a "
+ "href=\"AnnotationType.html#required--\">required</a>=1994)\n" + "href=\"AnnotationType.html#required()\">required</a>=1994)\n"
+ " int&nbsp;documented,\n" + " int&nbsp;documented,\n"
+ " int&nbsp;undocmented)</pre>"); + " int&nbsp;undocmented)</pre>");
@ -643,6 +786,101 @@ public class TestNewLanguageFeatures extends JavadocTester {
checkOutput(Output.OUT, false, checkOutput(Output.OUT, false,
"Internal error: package sets don't match: [] with: null"); "Internal error: package sets don't match: [] with: null");
//=================================
// ANNOTATION TYPE USAGE TESTING (All Different Types).
//=================================
checkOutput("pkg1/B.html", true,
// Integer
"<a href=\"A.html#d()\">d</a>=3.14,",
// Double
"<a href=\"A.html#d()\">d</a>=3.14,",
// Boolean
"<a href=\"A.html#b()\">b</a>=true,",
// String
"<a href=\"A.html#s()\">s</a>=\"sigh\",",
// Class
"<a href=\"A.html#c()\">c</a>=<a href=\"../pkg2/Foo.html\" title=\"class in pkg2\">Foo.class</a>,",
// Bounded Class
"<a href=\"A.html#w()\">w</a>=<a href=\"../pkg/TypeParameterSubClass.html\" title=\"class in pkg\">TypeParameterSubClass.class</a>,",
// Enum
"<a href=\"A.html#e()\">e</a>=<a href=\"../pkg/Coin.html#Penny\">Penny</a>,",
// Annotation Type
"<a href=\"A.html#a()\">a</a>=<a href=\"../pkg/AnnotationType.html\" title=\"annotation in pkg\">@AnnotationType</a>(<a href=\"../pkg/AnnotationType.html#optional()\">optional</a>=\"foo\",<a href=\"../pkg/AnnotationType.html#required()\">required</a>=1994),",
// String Array
"<a href=\"A.html#sa()\">sa</a>={\"up\",\"down\"},",
// Primitive
"<a href=\"A.html#primitiveClassTest()\">primitiveClassTest</a>=boolean.class,");
// XXX: Add array test case after this if fixed:
//5020899: Incorrect internal representation of class-valued annotation elements
// Make sure that annotations are surrounded by <pre> and </pre>
checkOutput("pkg1/B.html", true,
"<pre><a href=\"A.html\" title=\"annotation in pkg1\">@A</a>",
"public interface <span class=\"typeNameLabel\">B</span></pre>");
}
//=================================
// ANNOTATION TYPE USAGE TESTING
//=================================
void checkAnnotationTypeUsage_html4() {
checkOutput("pkg/package-summary.html", true,
// PACKAGE
"<a href=\"AnnotationType.html\" title=\"annotation in pkg\">@AnnotationType</a>(<a href=\"AnnotationType.html#optional--\">optional</a>=\"Package Annotation\",\n"
+ " <a href=\"AnnotationType.html#required--\">required</a>=1994)");
checkOutput("pkg/AnnotationTypeUsage.html", true,
// CLASS
"<pre><a href=\"AnnotationType.html\" "
+ "title=\"annotation in pkg\">@AnnotationType</a>("
+ "<a href=\"AnnotationType.html#optional--\">optional</a>"
+ "=\"Class Annotation\",\n"
+ " <a href=\"AnnotationType.html#required--\">"
+ "required</a>=1994)\n"
+ "public class <span class=\"typeNameLabel\">"
+ "AnnotationTypeUsage</span>\n"
+ "extends java.lang.Object</pre>",
// FIELD
"<pre><a href=\"AnnotationType.html\" "
+ "title=\"annotation in pkg\">@AnnotationType</a>("
+ "<a href=\"AnnotationType.html#optional--\">optional</a>"
+ "=\"Field Annotation\",\n"
+ " <a href=\"AnnotationType.html#required--\">"
+ "required</a>=1994)\n"
+ "public&nbsp;int field</pre>",
// CONSTRUCTOR
"<pre><a href=\"AnnotationType.html\" "
+ "title=\"annotation in pkg\">@AnnotationType</a>("
+ "<a href=\"AnnotationType.html#optional--\">optional</a>"
+ "=\"Constructor Annotation\",\n"
+ " <a href=\"AnnotationType.html#required--\">"
+ "required</a>=1994)\n"
+ "public&nbsp;AnnotationTypeUsage()</pre>",
// METHOD
"<pre><a href=\"AnnotationType.html\" "
+ "title=\"annotation in pkg\">@AnnotationType</a>("
+ "<a href=\"AnnotationType.html#optional--\">optional</a>"
+ "=\"Method Annotation\",\n"
+ " <a href=\"AnnotationType.html#required--\">"
+ "required</a>=1994)\n"
+ "public&nbsp;void&nbsp;method()</pre>",
// METHOD PARAMS
"<pre>public&nbsp;void&nbsp;methodWithParams&#8203;("
+ "<a href=\"AnnotationType.html\" title=\"annotation in pkg\">"
+ "@AnnotationType</a>(<a href=\"AnnotationType.html#optional--\">"
+ "optional</a>=\"Parameter Annotation\",<a "
+ "href=\"AnnotationType.html#required--\">required</a>=1994)\n"
+ " int&nbsp;documented,\n"
+ " int&nbsp;undocmented)</pre>",
// CONSTRUCTOR PARAMS
"<pre>public&nbsp;AnnotationTypeUsage&#8203;(<a "
+ "href=\"AnnotationType.html\" title=\"annotation in pkg\">"
+ "@AnnotationType</a>(<a href=\"AnnotationType.html#optional--\">"
+ "optional</a>=\"Constructor Param Annotation\",<a "
+ "href=\"AnnotationType.html#required--\">required</a>=1994)\n"
+ " int&nbsp;documented,\n"
+ " int&nbsp;undocmented)</pre>");
//================================= //=================================
// ANNOTATION TYPE USAGE TESTING (All Different Types). // ANNOTATION TYPE USAGE TESTING (All Different Types).
//================================= //=================================
@ -667,14 +905,5 @@ public class TestNewLanguageFeatures extends JavadocTester {
"<a href=\"A.html#sa--\">sa</a>={\"up\",\"down\"},", "<a href=\"A.html#sa--\">sa</a>={\"up\",\"down\"},",
// Primitive // Primitive
"<a href=\"A.html#primitiveClassTest--\">primitiveClassTest</a>=boolean.class,"); "<a href=\"A.html#primitiveClassTest--\">primitiveClassTest</a>=boolean.class,");
// XXX: Add array test case after this if fixed:
//5020899: Incorrect internal representation of class-valued annotation elements
// Make sure that annotations are surrounded by <pre> and </pre>
checkOutput("pkg1/B.html", true,
"<pre><a href=\"A.html\" title=\"annotation in pkg1\">@A</a>",
"public interface <span class=\"typeNameLabel\">B</span></pre>");
} }
} }

View File

@ -23,7 +23,7 @@
/* /*
* @test * @test
* @bug 8048628 8174715 * @bug 8048628 8174715 8182765
* @summary Verify html inline tags are removed correctly in the first sentence. * @summary Verify html inline tags are removed correctly in the first sentence.
* @library ../lib * @library ../lib
* @modules jdk.javadoc/jdk.javadoc.internal.tool * @modules jdk.javadoc/jdk.javadoc.internal.tool
@ -43,7 +43,11 @@ public class TestNonInlineHtmlTagRemoval extends JavadocTester {
javadoc("-d", "out1", javadoc("-d", "out1",
"-sourcepath", testSrc, "-sourcepath", testSrc,
testSrc("C.java")); testSrc("C.java"));
checkExit(Exit.OK); checkExit(Exit.ERROR);
checkOutput(Output.OUT, true,
"attribute not supported in HTML5: compact",
"attribute not supported in HTML5: type");
checkOutput("C.html", true, checkOutput("C.html", true,
"<div class=\"block\">case1 end of sentence.</div>", "<div class=\"block\">case1 end of sentence.</div>",
@ -59,6 +63,15 @@ public class TestNonInlineHtmlTagRemoval extends JavadocTester {
"<div class=\"block\">caseB A block quote example:</div>"); "<div class=\"block\">caseB A block quote example:</div>");
} }
@Test
void testPositive_html4() {
javadoc("-d", "out1-html4",
"-html4",
"-sourcepath", testSrc,
testSrc("C.java"));
checkExit(Exit.OK);
}
@Test @Test
void testNegative() { void testNegative() {
javadoc("-d", "out2", javadoc("-d", "out2",

View File

@ -23,7 +23,7 @@
/* /*
* @test * @test
* @bug 4749567 8071982 8175200 8186332 8185371 * @bug 4749567 8071982 8175200 8186332 8185371 8182765
* @summary Test the output for -header, -footer, -nooverview, -nodeprecatedlist, -nonavbar, -notree, * @summary Test the output for -header, -footer, -nooverview, -nodeprecatedlist, -nonavbar, -notree,
* -stylesheetfile, --main-stylesheet, --add-stylesheet options. * -stylesheetfile, --main-stylesheet, --add-stylesheet options.
* @author Bhavesh Patel * @author Bhavesh Patel
@ -198,7 +198,7 @@ public class TestOptions extends JavadocTester {
checkOutput("src-html/linksource/AnnotationTypeField.html", true, checkOutput("src-html/linksource/AnnotationTypeField.html", true,
"<title>Source code</title>", "<title>Source code</title>",
"<span class=\"sourceLineNo\">031</span><a name=\"line.31\">" "<span class=\"sourceLineNo\">031</span><a id=\"line.31\">"
+ "@Documented public @interface AnnotationTypeField {</a>"); + "@Documented public @interface AnnotationTypeField {</a>");
checkOutput("linksource/Properties.html", true, checkOutput("linksource/Properties.html", true,
@ -211,7 +211,7 @@ public class TestOptions extends JavadocTester {
checkOutput("src-html/linksource/Properties.html", true, checkOutput("src-html/linksource/Properties.html", true,
"<title>Source code</title>", "<title>Source code</title>",
"<span class=\"sourceLineNo\">031</span><a name=\"line.31\"> " "<span class=\"sourceLineNo\">031</span><a id=\"line.31\"> "
+ "public Object someProperty() {</a>"); + "public Object someProperty() {</a>");
checkOutput("linksource/SomeClass.html", true, checkOutput("linksource/SomeClass.html", true,
@ -226,13 +226,13 @@ public class TestOptions extends JavadocTester {
checkOutput("src-html/linksource/SomeClass.html", true, checkOutput("src-html/linksource/SomeClass.html", true,
"<title>Source code</title>", "<title>Source code</title>",
"<span class=\"sourceLineNo\">029</span><a name=\"line.29\">" "<span class=\"sourceLineNo\">029</span><a id=\"line.29\">"
+ "public class SomeClass {</a>", + "public class SomeClass {</a>",
"<span class=\"sourceLineNo\">031</span><a name=\"line.31\"> " "<span class=\"sourceLineNo\">031</span><a id=\"line.31\"> "
+ "public int field;</a>", + "public int field;</a>",
"<span class=\"sourceLineNo\">033</span><a name=\"line.33\"> " "<span class=\"sourceLineNo\">033</span><a id=\"line.33\"> "
+ "public SomeClass() {</a>", + "public SomeClass() {</a>",
"<span class=\"sourceLineNo\">036</span><a name=\"line.36\"> " "<span class=\"sourceLineNo\">036</span><a id=\"line.36\"> "
+ "public int method() {</a>"); + "public int method() {</a>");
checkOutput("linksource/SomeEnum.html", true, checkOutput("linksource/SomeEnum.html", true,
@ -243,6 +243,40 @@ public class TestOptions extends JavadocTester {
+ "title=\"enum in linksource\">SomeEnum</a> <a href=" + "title=\"enum in linksource\">SomeEnum</a> <a href="
+ "\"../src-html/linksource/SomeEnum.html#line.30\">VALUE2</a></pre>"); + "\"../src-html/linksource/SomeEnum.html#line.30\">VALUE2</a></pre>");
checkOutput("src-html/linksource/SomeEnum.html", true,
"<span class=\"sourceLineNo\">029</span><a id=\"line.29\"> VALUE1,</a>",
"<span class=\"sourceLineNo\">030</span><a id=\"line.30\"> VALUE2</a>");
}
@Test
void testLinkSource_html4() {
javadoc("-d", "out-9-html4",
"-html4",
"-linksource",
"-javafx",
"-sourcepath", testSrc,
"-package",
"linksource");
checkExit(Exit.OK);
checkOutput("src-html/linksource/AnnotationTypeField.html", true,
"<span class=\"sourceLineNo\">031</span><a name=\"line.31\">"
+ "@Documented public @interface AnnotationTypeField {</a>");
checkOutput("src-html/linksource/Properties.html", true,
"<span class=\"sourceLineNo\">031</span><a name=\"line.31\"> "
+ "public Object someProperty() {</a>");
checkOutput("src-html/linksource/SomeClass.html", true,
"<span class=\"sourceLineNo\">029</span><a name=\"line.29\">"
+ "public class SomeClass {</a>",
"<span class=\"sourceLineNo\">031</span><a name=\"line.31\"> "
+ "public int field;</a>",
"<span class=\"sourceLineNo\">033</span><a name=\"line.33\"> "
+ "public SomeClass() {</a>",
"<span class=\"sourceLineNo\">036</span><a name=\"line.36\"> "
+ "public int method() {</a>");
checkOutput("src-html/linksource/SomeEnum.html", true, checkOutput("src-html/linksource/SomeEnum.html", true,
"<span class=\"sourceLineNo\">029</span><a name=\"line.29\"> VALUE1,</a>", "<span class=\"sourceLineNo\">029</span><a name=\"line.29\"> VALUE1,</a>",
"<span class=\"sourceLineNo\">030</span><a name=\"line.30\"> VALUE2</a>"); "<span class=\"sourceLineNo\">030</span><a name=\"line.30\"> VALUE2</a>");

View File

@ -23,7 +23,7 @@
/* /*
* @test * @test
* @bug 8039410 8042601 8042829 8049393 8050031 8155061 8155995 8167967 8169813 * @bug 8039410 8042601 8042829 8049393 8050031 8155061 8155995 8167967 8169813 8182765
* @summary test to determine if members are ordered correctly * @summary test to determine if members are ordered correctly
* @library ../lib/ * @library ../lib/
* @modules jdk.javadoc/jdk.javadoc.internal.tool * @modules jdk.javadoc/jdk.javadoc.internal.tool
@ -93,9 +93,9 @@ public class TestOrdering extends JavadocTester {
String contents = tester.readFile(usePage); String contents = tester.readFile(usePage);
// check constructors // check constructors
tester.checking("constructors"); tester.checking("constructors");
int idx1 = contents.indexOf("C.html#C-UsedInC"); int idx1 = contents.indexOf("C.html#%3Cinit%3E(UsedInC");
int idx2 = contents.indexOf("C.html#C-UsedInC-int"); int idx2 = contents.indexOf("C.html#%3Cinit%3E(UsedInC,int");
int idx3 = contents.indexOf("C.html#C-UsedInC-java.lang.String"); int idx3 = contents.indexOf("C.html#%3Cinit%3E(UsedInC,java.lang.String");
if (idx1 == -1 || idx2 == -1 || idx3 == -1) { if (idx1 == -1 || idx2 == -1 || idx3 == -1) {
tester.failed("ctor strings not found"); tester.failed("ctor strings not found");
} else if (idx1 > idx2 || idx2 > idx3 || idx1 > idx3) { } else if (idx1 > idx2 || idx2 > idx3 || idx1 > idx3) {
@ -106,8 +106,8 @@ public class TestOrdering extends JavadocTester {
// check methods // check methods
tester.checking("methods"); tester.checking("methods");
idx1 = contents.indexOf("C.html#ymethod-int"); idx1 = contents.indexOf("C.html#ymethod(int");
idx2 = contents.indexOf("C.html#ymethod-java.lang.String"); idx2 = contents.indexOf("C.html#ymethod(java.lang.String");
if (idx1 == -1 || idx2 == -1) { if (idx1 == -1 || idx2 == -1) {
tester.failed("#ymethod strings not found"); tester.failed("#ymethod strings not found");
} else if (idx1 > idx2) { } else if (idx1 > idx2) {
@ -135,42 +135,42 @@ public class TestOrdering extends JavadocTester {
checkClassUseOrdering("pkg1/class-use/UsedClass.html"); checkClassUseOrdering("pkg1/class-use/UsedClass.html");
tester.checkOrder("pkg1/class-use/UsedClass.html", tester.checkOrder("pkg1/class-use/UsedClass.html",
"../MethodOrder.html#m--", "../MethodOrder.html#m()",
"../MethodOrder.html#m-byte:A-", "../MethodOrder.html#m(byte%5B%5D)",
"../MethodOrder.html#m-double-", "../MethodOrder.html#m(double)",
"../MethodOrder.html#m-double-double-", "../MethodOrder.html#m(double,double)",
"../MethodOrder.html#m-double-java.lang.Double-", "../MethodOrder.html#m(double,java.lang.Double)",
"../MethodOrder.html#m-int-", "../MethodOrder.html#m(int)",
"../MethodOrder.html#m-int-int-", "../MethodOrder.html#m(int,int)",
"../MethodOrder.html#m-int-java.lang.Integer-", "../MethodOrder.html#m(int,java.lang.Integer)",
"../MethodOrder.html#m-long-", "../MethodOrder.html#m(long)",
"../MethodOrder.html#m-long-long-", "../MethodOrder.html#m(long,long)",
"../MethodOrder.html#m-long-java.lang.Long-", "../MethodOrder.html#m(long,java.lang.Long)",
"../MethodOrder.html#m-long-java.lang.Long...-", "../MethodOrder.html#m(long,java.lang.Long...)",
"../MethodOrder.html#m-java.lang.Double-", "../MethodOrder.html#m(java.lang.Double)",
"../MethodOrder.html#m-java.lang.Double-double-", "../MethodOrder.html#m(java.lang.Double,double)",
"../MethodOrder.html#m-java.lang.Double-java.lang.Double-", "../MethodOrder.html#m(java.lang.Double,java.lang.Double)",
"../MethodOrder.html#m-java.lang.Integer-", "../MethodOrder.html#m(java.lang.Integer)",
"../MethodOrder.html#m-java.lang.Integer-int-", "../MethodOrder.html#m(java.lang.Integer,int)",
"../MethodOrder.html#m-java.lang.Integer-java.lang.Integer-", "../MethodOrder.html#m(java.lang.Integer,java.lang.Integer)",
"../MethodOrder.html#m-java.lang.Object:A-", "../MethodOrder.html#m(java.lang.Object%5B%5D)",
"../MethodOrder.html#m-java.util.ArrayList-", "../MethodOrder.html#m(java.util.ArrayList)",
"../MethodOrder.html#m-java.util.Collection-", "../MethodOrder.html#m(java.util.Collection)",
"../MethodOrder.html#m-java.util.List-"); "../MethodOrder.html#m(java.util.List)");
tester.checkOrder("pkg1/class-use/UsedClass.html", tester.checkOrder("pkg1/class-use/UsedClass.html",
"../MethodOrder.html#tpm-pkg1.UsedClass-", "../MethodOrder.html#tpm(pkg1.UsedClass)",
"../MethodOrder.html#tpm-pkg1.UsedClass-pkg1.UsedClass-", "../MethodOrder.html#tpm(pkg1.UsedClass,pkg1.UsedClass)",
"../MethodOrder.html#tpm-pkg1.UsedClass-pkg1.UsedClass:A-", "../MethodOrder.html#tpm(pkg1.UsedClass,pkg1.UsedClass%5B%5D)",
"../MethodOrder.html#tpm-pkg1.UsedClass-java.lang.String-"); "../MethodOrder.html#tpm(pkg1.UsedClass,java.lang.String)");
tester.checkOrder("pkg1/class-use/UsedClass.html", tester.checkOrder("pkg1/class-use/UsedClass.html",
"../A.html#A-pkg1.UsedClass-", "../A.html#%3Cinit%3E(pkg1.UsedClass)",
"../B.A.html#A-pkg1.UsedClass-", "../B.A.html#%3Cinit%3E(pkg1.UsedClass)",
"../B.html#B-pkg1.UsedClass-", "../B.html#%3Cinit%3E(pkg1.UsedClass)",
"../A.C.html#C-pkg1.UsedClass-java.lang.Object:A-", "../A.C.html#%3Cinit%3E(pkg1.UsedClass,java.lang.Object%5B%5D)",
"../A.C.html#C-pkg1.UsedClass-java.util.Collection-", "../A.C.html#%3Cinit%3E(pkg1.UsedClass,java.util.Collection)",
"../A.C.html#C-pkg1.UsedClass-java.util.List-"); "../A.C.html#%3Cinit%3E(pkg1.UsedClass,java.util.List)");
tester.checkOrder("pkg1/ImplementsOrdering.html", tester.checkOrder("pkg1/ImplementsOrdering.html",
"<dd><code>close</code>&nbsp;in interface&nbsp;<code>java.lang.AutoCloseable</code></dd>", "<dd><code>close</code>&nbsp;in interface&nbsp;<code>java.lang.AutoCloseable</code></dd>",
@ -213,7 +213,7 @@ public class TestOrdering extends JavadocTester {
void checkClassUseOrdering(String usePage) { void checkClassUseOrdering(String usePage) {
checkClassUseOrdering(usePage, "C#ITERATION#.html#zfield"); checkClassUseOrdering(usePage, "C#ITERATION#.html#zfield");
checkClassUseOrdering(usePage, "C#ITERATION#.html#fieldInC#ITERATION#"); checkClassUseOrdering(usePage, "C#ITERATION#.html#fieldInC#ITERATION#");
checkClassUseOrdering(usePage, "C#ITERATION#.html#zmethod-pkg1.UsedClass"); checkClassUseOrdering(usePage, "C#ITERATION#.html#zmethod(pkg1.UsedClass");
checkClassUseOrdering(usePage, "C#ITERATION#.html#methodInC#ITERATION#"); checkClassUseOrdering(usePage, "C#ITERATION#.html#methodInC#ITERATION#");
} }
@ -346,17 +346,17 @@ public class TestOrdering extends JavadocTester {
}; };
static String expectedMethodOrdering[] = { static String expectedMethodOrdering[] = {
"Add.html#add--", "Add.html#add()",
"Add.html#add-double-", "Add.html#add(double)",
"Add.html#add-double-byte-", "Add.html#add(double,byte)",
"Add.html#add-double-double-", "Add.html#add(double,double)",
"Add.html#add-double-java.lang.Double-", "Add.html#add(double,java.lang.Double)",
"Add.html#add-float-", "Add.html#add(float)",
"Add.html#add-float-int-", "Add.html#add(float,int)",
"Add.html#add-int-", "Add.html#add(int)",
"Add.html#add-int-float-", "Add.html#add(int,float)",
"Add.html#add-java.lang.Double-", "Add.html#add(java.lang.Double)",
"Add.html#add-java.lang.Integer-" "Add.html#add(java.lang.Integer)"
}; };
static String expectedPackageOrdering[] = { static String expectedPackageOrdering[] = {
@ -593,10 +593,10 @@ public class TestOrdering extends JavadocTester {
tester.checkOrder("pkg5/AnnoOptionalTest.html", tester.checkOrder("pkg5/AnnoOptionalTest.html",
"<h3>Optional Element Summary</h3>", "<h3>Optional Element Summary</h3>",
"<a href=\"#four--\">four</a>", "<a href=\"#four()\">four</a>",
"<a href=\"#one--\">one</a>", "<a href=\"#one()\">one</a>",
"<a href=\"#three--\">three</a>", "<a href=\"#three()\">three</a>",
"<a href=\"#two--\">two</a>", "<a href=\"#two()\">two</a>",
"<h3>Element Detail</h3>", "<h3>Element Detail</h3>",
"<h4>one</h4>", "<h4>one</h4>",
"<h4>two</h4>", "<h4>two</h4>",
@ -605,10 +605,10 @@ public class TestOrdering extends JavadocTester {
tester.checkOrder("pkg5/AnnoRequiredTest.html", tester.checkOrder("pkg5/AnnoRequiredTest.html",
"<h3>Required Element Summary</h3>", "<h3>Required Element Summary</h3>",
"<a href=\"#four--\">four</a>", "<a href=\"#four()\">four</a>",
"<a href=\"#one--\">one</a>", "<a href=\"#one()\">one</a>",
"<a href=\"#three--\">three</a>", "<a href=\"#three()\">three</a>",
"<a href=\"#two--\">two</a>", "<a href=\"#two()\">two</a>",
"<h3>Element Detail</h3>", "<h3>Element Detail</h3>",
"<h4>one</h4>", "<h4>one</h4>",
"<h4>two</h4>", "<h4>two</h4>",
@ -617,15 +617,15 @@ public class TestOrdering extends JavadocTester {
tester.checkOrder("pkg5/CtorTest.html", tester.checkOrder("pkg5/CtorTest.html",
"<h3>Constructor Summary</h3>", "<h3>Constructor Summary</h3>",
"<a href=\"#CtorTest-int-\"", "<a href=\"#%3Cinit%3E(int)\"",
"<a href=\"#CtorTest-int-int-\"", "<a href=\"#%3Cinit%3E(int,int)\"",
"<a href=\"#CtorTest-int-int-int-\"", "<a href=\"#%3Cinit%3E(int,int,int)\"",
"<a href=\"#CtorTest-int-int-int-int-\"", "<a href=\"#%3Cinit%3E(int,int,int,int)\"",
"<h3>Constructor Detail</h3>", "<h3>Constructor Detail</h3>",
"<a name=\"CtorTest-int-int-int-int-\">", "<a id=\"&lt;init&gt;(int,int,int,int)\">",
"<a name=\"CtorTest-int-int-int-\">", "<a id=\"&lt;init&gt;(int,int,int)\">",
"<a name=\"CtorTest-int-int-\">", "<a id=\"&lt;init&gt;(int,int)\">",
"<a name=\"CtorTest-int-\">"); "<a id=\"&lt;init&gt;(int)\">");
tester.checkOrder("pkg5/EnumTest.html", tester.checkOrder("pkg5/EnumTest.html",
"<h3>Enum Constant Summary</h3>", "<h3>Enum Constant Summary</h3>",
@ -653,10 +653,10 @@ public class TestOrdering extends JavadocTester {
tester.checkOrder("pkg5/IntfTest.html", tester.checkOrder("pkg5/IntfTest.html",
"<h3>Method Summary</h3>", "<h3>Method Summary</h3>",
"<a href=\"#four--\">four</a>", "<a href=\"#four()\">four</a>",
"<a href=\"#one--\">one</a>", "<a href=\"#one()\">one</a>",
"<a href=\"#three--\">three</a>", "<a href=\"#three()\">three</a>",
"<a href=\"#two--\">two</a>", "<a href=\"#two()\">two</a>",
"<h3>Method Detail</h3>", "<h3>Method Detail</h3>",
"<h4>one</h4>", "<h4>one</h4>",
"<h4>two</h4>", "<h4>two</h4>",
@ -665,10 +665,10 @@ public class TestOrdering extends JavadocTester {
tester.checkOrder("pkg5/MethodTest.html", tester.checkOrder("pkg5/MethodTest.html",
"<h3>Method Summary</h3>", "<h3>Method Summary</h3>",
"<a href=\"#four--\">four</a>", "<a href=\"#four()\">four</a>",
"<a href=\"#one--\">one</a>", "<a href=\"#one()\">one</a>",
"<a href=\"#three--\">three</a>", "<a href=\"#three()\">three</a>",
"<a href=\"#two--\">two</a>", "<a href=\"#two()\">two</a>",
"<h3>Method Detail</h3>", "<h3>Method Detail</h3>",
"<h4>one</h4>", "<h4>one</h4>",
"<h4>two</h4>", "<h4>two</h4>",
@ -686,6 +686,25 @@ public class TestOrdering extends JavadocTester {
"<h4>twoProperty</h4>", "<h4>twoProperty</h4>",
"<h4>threeProperty</h4>", "<h4>threeProperty</h4>",
"<h4>fourProperty</h4>"); "<h4>fourProperty</h4>");
tester.javadoc("-d", "out-5-html4",
"-html4",
"-javafx",
"-sourcepath", tester.testSrc(new File(".").getPath()),
"pkg5"
);
tester.checkExit(Exit.OK);
tester.checkOrder("pkg5/CtorTest.html",
"<a href=\"#CtorTest-int-\"",
"<a href=\"#CtorTest-int-int-\"",
"<a href=\"#CtorTest-int-int-int-\"",
"<a href=\"#CtorTest-int-int-int-int-\"",
"<a name=\"CtorTest-int-int-int-int-\">",
"<a name=\"CtorTest-int-int-int-\">",
"<a name=\"CtorTest-int-int-\">",
"<a name=\"CtorTest-int-\">");
} }
} }
} }

View File

@ -23,7 +23,7 @@
/* /*
* @test * @test
* @bug 4368820 8025633 8026567 * @bug 4368820 8025633 8026567 8182765
* @summary Inherited comment should link directly to member, not just * @summary Inherited comment should link directly to member, not just
* class * class
* @author jamieh * @author jamieh
@ -51,6 +51,20 @@ public class TestOverriddenMethodDocCopy extends JavadocTester {
"pkg1", "pkg2"); "pkg1", "pkg2");
checkExit(Exit.OK); checkExit(Exit.OK);
checkOutput("pkg1/SubClass.html", true,
"<span class=\"descfrmTypeLabel\">Description copied from class:&nbsp;<code>"
+ "<a href=\"BaseClass.html#overridenMethodWithDocsToCopy()\">"
+ "BaseClass</a></code></span>");
}
@Test
void test_html4() {
javadoc("-d", "out-html4",
"-html4",
"-sourcepath", testSrc,
"pkg1", "pkg2");
checkExit(Exit.OK);
checkOutput("pkg1/SubClass.html", true, checkOutput("pkg1/SubClass.html", true,
"<span class=\"descfrmTypeLabel\">Description copied from class:&nbsp;<code>" "<span class=\"descfrmTypeLabel\">Description copied from class:&nbsp;<code>"
+ "<a href=\"BaseClass.html#overridenMethodWithDocsToCopy--\">" + "<a href=\"BaseClass.html#overridenMethodWithDocsToCopy--\">"

View File

@ -23,7 +23,7 @@
/* /*
* @test * @test
* @bug 4634891 8025633 8026567 * @bug 4634891 8025633 8026567 8182765
* @summary Determine if overridden methods are properly documented when * @summary Determine if overridden methods are properly documented when
* -protected (default) visibility flag is used. * -protected (default) visibility flag is used.
* @author jamieh * @author jamieh
@ -48,6 +48,54 @@ public class TestOverriddenPrivateMethodsWithPackageFlag extends JavadocTester {
"pkg1", "pkg2"); "pkg1", "pkg2");
checkExit(Exit.OK); checkExit(Exit.OK);
// The public method should be overridden
checkOutput("pkg1/SubClass.html", true,
"<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n"
+ "<dd><code><a href=\"BaseClass.html#publicMethod()\">"
+ "publicMethod</a></code>&nbsp;in class&nbsp;<code>"
+ "<a href=\"BaseClass.html\" title=\"class in pkg1\">BaseClass</a></code></dd>");
// The public method in different package should be overridden
checkOutput("pkg2/SubClass.html", true,
"<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n"
+ "<dd><code><a href=\"../pkg1/BaseClass.html#publicMethod()\">"
+ "publicMethod</a></code>&nbsp;in class&nbsp;<code>"
+ "<a href=\"../pkg1/BaseClass.html\" title=\"class in pkg1\">BaseClass</a></code></dd>");
// The package private method should be overridden since the base and sub class are in the same
// package.
checkOutput("pkg1/SubClass.html", true,
"<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n"
+ "<dd><code><a href=\"BaseClass.html#packagePrivateMethod()\">"
+ "packagePrivateMethod</a></code>&nbsp;in class&nbsp;<code>"
+ "<a href=\"BaseClass.html\" title=\"class in pkg1\">BaseClass</a></code></dd>");
// The private method in should not be overridden
checkOutput("pkg1/SubClass.html", false,
"<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n"
+ "<dd><code><a href=\"BaseClass.html#privateMethod--\">");
// The private method in different package should not be overridden
checkOutput("pkg2/SubClass.html", false,
"<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n"
+ "<dd><code><a href=\"../pkg1/BaseClass.html#privateMethod--\">");
// The package private method should not be overridden since the base and sub class are in
// different packages.
checkOutput("pkg2/SubClass.html", false,
"<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n"
+ "<dd><code><a href=\"../pkg1/BaseClass.html#packagePrivateMethod--\">");
}
@Test
void test_html4() {
javadoc("-d", "out-html4",
"-html4",
"-sourcepath", testSrc,
"-package",
"pkg1", "pkg2");
checkExit(Exit.OK);
// The public method should be overridden // The public method should be overridden
checkOutput("pkg1/SubClass.html", true, checkOutput("pkg1/SubClass.html", true,
"<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n" "<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n"

View File

@ -23,7 +23,7 @@
/* /*
* @test * @test
* @bug 8157000 8192850 * @bug 8157000 8192850 8182765
* @summary test the behavior of --override-methods option * @summary test the behavior of --override-methods option
* @library ../lib * @library ../lib
* @modules jdk.javadoc/jdk.javadoc.internal.tool * @modules jdk.javadoc/jdk.javadoc.internal.tool
@ -94,11 +94,11 @@ public class TestOverrideMethods extends JavadocTester {
// Check method summary // Check method summary
"Method Summary", "Method Summary",
"void", "void",
"#m1--\">m1", "#m1()\">m1",
"A modified method", "A modified method",
"void", "void",
"#m4-java.lang.String-java.lang.String-\">m4", "#m4(java.lang.String,java.lang.String)\">m4",
"java.lang.String&nbsp;k,", "java.lang.String&nbsp;k,",
"java.lang.String", "java.lang.String",
"&nbsp;v)", "&nbsp;v)",
@ -106,12 +106,12 @@ public class TestOverrideMethods extends JavadocTester {
// Check footnotes // Check footnotes
"Methods declared in class&nbsp;pkg5.<a href=\"Classes.GP.html", "Methods declared in class&nbsp;pkg5.<a href=\"Classes.GP.html",
"Classes.GP", "Classes.GP",
"Classes.GP.html#m0--\">m0", "Classes.GP.html#m0()\">m0",
// Check method details for override // Check method details for override
"overrideSpecifyLabel", "overrideSpecifyLabel",
"Overrides:", "Overrides:",
"Classes.GP.html#m7--\">m7", "Classes.GP.html#m7()\">m7",
"in class", "in class",
"Classes.GP.html", "Classes.GP.html",
"Classes.GP" "Classes.GP"
@ -120,47 +120,47 @@ public class TestOverrideMethods extends JavadocTester {
checkOrder("pkg5/Classes.C.html", checkOrder("pkg5/Classes.C.html",
// Check footnotes 2 // Check footnotes 2
"Methods declared in class&nbsp;pkg5.", "Methods declared in class&nbsp;pkg5.",
"Classes.P.html#getRate--\">getRate", "Classes.P.html#getRate()\">getRate",
"Classes.P.html#m2--\">m2", "Classes.P.html#m2()\">m2",
"Classes.P.html#m3--\">m3", "Classes.P.html#m3()\">m3",
"Classes.P.html#m4-K-V-\">m4", "Classes.P.html#m4(K,V)\">m4",
"Classes.P.html#rateProperty--\">rateProperty", "Classes.P.html#rateProperty()\">rateProperty",
"Classes.P.html#setRate-double-\">setRate", "Classes.P.html#setRate(double)\">setRate",
// Check @link // Check @link
"A test of links to the methods in this class. <p>\n", "A test of links to the methods in this class. <p>\n",
"Classes.GP.html#m0--", "Classes.GP.html#m0()",
"Classes.GP.m0()", "Classes.GP.m0()",
"#m1--", "#m1()",
"m1()", "m1()",
"Classes.P.html#m2--", "Classes.P.html#m2()",
"Classes.P.m2()", "Classes.P.m2()",
"Classes.P.html#m3--", "Classes.P.html#m3()",
"Classes.P.m3()", "Classes.P.m3()",
"m4(java.lang.String,java.lang.String)", "m4(java.lang.String,java.lang.String)",
"Classes.P.html#m5--", "Classes.P.html#m5()",
"Classes.P.m5()", "Classes.P.m5()",
"#m6--", "#m6()",
"m6()", "m6()",
"#m7--", "#m7()",
"m7()", "m7()",
"End of links", "End of links",
// Check @see // Check @see
"See Also:", "See Also:",
"Classes.GP.html#m0--", "Classes.GP.html#m0()",
"Classes.GP.m0()", "Classes.GP.m0()",
"#m1--", "#m1()",
"m1()", "m1()",
"Classes.P.html#m2--", "Classes.P.html#m2()",
"Classes.P.m2()", "Classes.P.m2()",
"Classes.P.html#m3--", "Classes.P.html#m3()",
"Classes.P.m3()", "Classes.P.m3()",
"#m4-java.lang.String-java.lang.String-", "#m4(java.lang.String,java.lang.String)",
"m4(String k, String v)", "m4(String k, String v)",
"Classes.P.html#m5--\"><code>Classes.P.m5()", "Classes.P.html#m5()\"><code>Classes.P.m5()",
"#m6--\"><code>m6()", "#m6()\"><code>m6()",
"#m7--\"><code>m7()" "#m7()\"><code>m7()"
); );
// Tests for interfaces // Tests for interfaces
@ -172,24 +172,24 @@ public class TestOverrideMethods extends JavadocTester {
checkOrder("pkg5/Interfaces.D.html", checkOrder("pkg5/Interfaces.D.html",
"Start of links <p>", "Start of links <p>",
"Interfaces.A.html#m0--\"><code>Interfaces.A.m0()", "Interfaces.A.html#m0()\"><code>Interfaces.A.m0()",
"Interfaces.A.html#m1--\"><code>Interfaces.A.m1()", "Interfaces.A.html#m1()\"><code>Interfaces.A.m1()",
"Interfaces.A.html#m2--\"><code>Interfaces.A.m2()", "Interfaces.A.html#m2()\"><code>Interfaces.A.m2()",
"Interfaces.A.html#m3--\"><code>Interfaces.A.m3()", "Interfaces.A.html#m3()\"><code>Interfaces.A.m3()",
"#m--\"><code>m()", "#m()\"><code>m()",
"#n--\"><code>n()", "#n()\"><code>n()",
"Interfaces.C.html#o--\"><code>Interfaces.C.o()", "Interfaces.C.html#o()\"><code>Interfaces.C.o()",
"End of links", "End of links",
// Check @see links // Check @see links
"See Also:", "See Also:",
"Interfaces.A.html#m0--\"><code>Interfaces.A.m0()", "Interfaces.A.html#m0()\"><code>Interfaces.A.m0()",
"Interfaces.A.html#m1--\"><code>Interfaces.A.m1()", "Interfaces.A.html#m1()\"><code>Interfaces.A.m1()",
"Interfaces.A.html#m2--\"><code>Interfaces.A.m2()", "Interfaces.A.html#m2()\"><code>Interfaces.A.m2()",
"Interfaces.A.html#m3--\"><code>Interfaces.A.m3()", "Interfaces.A.html#m3()\"><code>Interfaces.A.m3()",
"#m--\"><code>m()", "#m()\"><code>m()",
"#n--\"><code>n()", "#n()\"><code>n()",
"Interfaces.C.html#o--\"><code>Interfaces.C.o()", "Interfaces.C.html#o()\"><code>Interfaces.C.o()",
// Check properties // Check properties
"Properties declared in interface&nbsp;pkg5.<a href=\"Interfaces.A.html\" " "Properties declared in interface&nbsp;pkg5.<a href=\"Interfaces.A.html\" "
@ -209,24 +209,128 @@ public class TestOverrideMethods extends JavadocTester {
// Check Method Summary // Check Method Summary
"Method Summary", "Method Summary",
"#m--\">m", "#m()\">m",
"#n--\">n", "#n()\">n",
// Check footnotes // Check footnotes
"Methods declared in interface&nbsp;pkg5.<a href=\"Interfaces.A.html", "Methods declared in interface&nbsp;pkg5.<a href=\"Interfaces.A.html",
"Interfaces.A.html#getRate--\">getRate", "Interfaces.A.html#getRate()\">getRate",
"Interfaces.A.html#rateProperty--\">rateProperty", "Interfaces.A.html#rateProperty()\">rateProperty",
"Interfaces.A.html#setRate-double-", "Interfaces.A.html#setRate(double)",
"Methods declared in interface&nbsp;pkg5.<a href=\"Interfaces.B.html", "Methods declared in interface&nbsp;pkg5.<a href=\"Interfaces.B.html",
"Interfaces.B.html#m1--\">m1", "Interfaces.B.html#m1()\">m1",
"Interfaces.B.html#m3--\">m3", "Interfaces.B.html#m3()\">m3",
"Methods declared in interface&nbsp;pkg5.<a href=\"Interfaces.C.html", "Methods declared in interface&nbsp;pkg5.<a href=\"Interfaces.C.html",
"<a href=\"Interfaces.C.html#o--\">o</a>" "<a href=\"Interfaces.C.html#o()\">o</a>"
); );
// Test synthetic values and valuesof of an enum. // Test synthetic values and valuesof of an enum.
checkOrder("index-all.html", checkOrder("index-all.html",
"<h2 class=\"title\">M</h2>", "<h2 class=\"title\">M</h2>",
"<a href=\"pkg5/Interfaces.C.html#m()\">m()",
"<a href=\"pkg5/Interfaces.D.html#m()\">m()</a>",
"<a href=\"pkg5/Classes.GP.html#m0()\">m0()",
"<a href=\"pkg5/Interfaces.A.html#m0()\">m0()</a>",
"<a href=\"pkg5/Classes.C.html#m1()\">m1()</a>",
"<a href=\"pkg5/Classes.P.html#m1()\">m1()</a>",
"<a href=\"pkg5/Interfaces.A.html#m1()\">m1()</a>",
"<a href=\"pkg5/Interfaces.B.html#m1()\">m1()</a>",
"<a href=\"pkg5/Classes.P.html#m2()\">m2()</a>",
"<a href=\"pkg5/Interfaces.A.html#m2()\">m2()</a>",
"<a href=\"pkg5/Classes.P.html#m3()\">m3()</a>",
"<a href=\"pkg5/Interfaces.A.html#m3()\">m3()</a>",
"<a href=\"pkg5/Interfaces.B.html#m3()\">m3()</a>",
"<a href=\"pkg5/Classes.C.html#m4(java.lang.String,java.lang.String)\">m4(String, String)</a>",
"<a href=\"pkg5/Classes.P.html#m4(K,V)\">m4(K, V)</a>",
"<a href=\"pkg5/Classes.P.html#m5()\">m5()</a>",
"<a href=\"pkg5/Classes.C.html#m6()\">m6()</a>",
"<a href=\"pkg5/Classes.P.html#m6()\">m6()</a>",
"<a href=\"pkg5/Classes.C.html#m7()\">m7()</a>",
"<a href=\"pkg5/Classes.GP.html#m7()\">m7()</a>",
"Returns the enum constant of this type with the specified name.",
"Returns an array containing the constants of this enum type, in\n" +
"the order they are declared."
);
}
@Test
void testSummary_html4() {
javadoc("-d", "out-summary-html4",
"-html4",
"-sourcepath", testSrc,
"-javafx",
"--override-methods=summary",
"pkg5");
checkExit(Exit.OK);
checkOrder("pkg5/Classes.C.html",
"#m1--\">m1",
"#m4-java.lang.String-java.lang.String-\">m4",
"Classes.GP.html#m0--\">m0",
"Classes.GP.html#m7--\">m7"
);
checkOrder("pkg5/Classes.C.html",
// Check footnotes 2
"Classes.P.html#getRate--\">getRate",
"Classes.P.html#m2--\">m2",
"Classes.P.html#m3--\">m3",
"Classes.P.html#m4-K-V-\">m4",
"Classes.P.html#rateProperty--\">rateProperty",
"Classes.P.html#setRate-double-\">setRate",
// Check @link
"Classes.GP.html#m0--",
"#m1--",
"Classes.P.html#m2--",
"Classes.P.html#m3--",
"Classes.P.html#m5--",
"#m6--",
"#m7--",
// Check @see
"Classes.GP.html#m0--",
"#m1--",
"Classes.P.html#m2--",
"Classes.P.html#m3--",
"#m4-java.lang.String-java.lang.String-",
"Classes.P.html#m5--\"><code>Classes.P.m5()",
"#m6--\"><code>m6()",
"#m7--\"><code>m7()"
);
// Tests for interfaces
// Make sure the static methods in the super interface
// do not make it to this interface
checkOrder("pkg5/Interfaces.D.html",
"Interfaces.A.html#m0--\"><code>Interfaces.A.m0()",
"Interfaces.A.html#m1--\"><code>Interfaces.A.m1()",
"Interfaces.A.html#m2--\"><code>Interfaces.A.m2()",
"Interfaces.A.html#m3--\"><code>Interfaces.A.m3()",
"#m--\"><code>m()",
"#n--\"><code>n()",
"Interfaces.C.html#o--\"><code>Interfaces.C.o()",
"Interfaces.A.html#m0--\"><code>Interfaces.A.m0()",
"Interfaces.A.html#m1--\"><code>Interfaces.A.m1()",
"Interfaces.A.html#m2--\"><code>Interfaces.A.m2()",
"Interfaces.A.html#m3--\"><code>Interfaces.A.m3()",
"#m--\"><code>m()",
"#n--\"><code>n()",
"Interfaces.C.html#o--\"><code>Interfaces.C.o()",
"#m--\">m",
"#n--\">n",
"Interfaces.A.html#getRate--\">getRate",
"Interfaces.A.html#rateProperty--\">rateProperty",
"Interfaces.A.html#setRate-double-",
"Interfaces.B.html#m1--\">m1",
"Interfaces.B.html#m3--\">m3",
"<a href=\"Interfaces.C.html#o--\">o</a>"
);
// Test synthetic values and valuesof of an enum.
checkOrder("index-all.html",
"<a href=\"pkg5/Interfaces.C.html#m--\">m()", "<a href=\"pkg5/Interfaces.C.html#m--\">m()",
"<a href=\"pkg5/Interfaces.D.html#m--\">m()</a>", "<a href=\"pkg5/Interfaces.D.html#m--\">m()</a>",
"<a href=\"pkg5/Classes.GP.html#m0--\">m0()", "<a href=\"pkg5/Classes.GP.html#m0--\">m0()",
@ -246,10 +350,7 @@ public class TestOverrideMethods extends JavadocTester {
"<a href=\"pkg5/Classes.C.html#m6--\">m6()</a>", "<a href=\"pkg5/Classes.C.html#m6--\">m6()</a>",
"<a href=\"pkg5/Classes.P.html#m6--\">m6()</a>", "<a href=\"pkg5/Classes.P.html#m6--\">m6()</a>",
"<a href=\"pkg5/Classes.C.html#m7--\">m7()</a>", "<a href=\"pkg5/Classes.C.html#m7--\">m7()</a>",
"<a href=\"pkg5/Classes.GP.html#m7--\">m7()</a>", "<a href=\"pkg5/Classes.GP.html#m7--\">m7()</a>"
"Returns the enum constant of this type with the specified name.",
"Returns an array containing the constants of this enum type, in\n" +
"the order they are declared."
); );
} }
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -23,7 +23,7 @@
/* /*
* @test * @test
* @bug 8173302 * @bug 8173302 8182765
* @summary make sure the overview-summary and module-summary pages don't * @summary make sure the overview-summary and module-summary pages don't
* don't have the See link, and the overview is copied correctly. * don't have the See link, and the overview is copied correctly.
* @library ../lib * @library ../lib
@ -48,15 +48,20 @@ public class TestOverview extends JavadocTester {
"-sourcepath", testSrc("src"), "-sourcepath", testSrc("src"),
"p1", "p2"); "p1", "p2");
checkExit(Exit.OK); checkExit(Exit.OK);
checkOutput("overview-summary.html", true, checkOverview();
"<div class=\"header\">\n" }
+ "<h1 class=\"title\">Document Title</h1>\n"
+ "</div>\n" @Test
+ "<div class=\"contentContainer\">\n" void test1_html4() {
+ "<div class=\"block\">This is line1. This is line 2.</div>\n" javadoc("-d", "out-1-html4",
+ "</div>\n" "-html4",
+ "<div class=\"contentContainer\">" "-doctitle", "Document Title",
); "-windowtitle", "Window Title",
"-overview", testSrc("overview.html"),
"-sourcepath", testSrc("src"),
"p1", "p2");
checkExit(Exit.OK);
checkOverview_html4();
} }
@Test @Test
@ -68,6 +73,35 @@ public class TestOverview extends JavadocTester {
"-sourcepath", testSrc("msrc"), "-sourcepath", testSrc("msrc"),
"p1", "p2"); "p1", "p2");
checkExit(Exit.OK); checkExit(Exit.OK);
checkOverview();
}
@Test
void test2_html4() {
javadoc("-d", "out-2-html4",
"-html4",
"-doctitle", "Document Title",
"-windowtitle", "Window Title",
"-overview", testSrc("overview.html"),
"-sourcepath", testSrc("msrc"),
"p1", "p2");
checkExit(Exit.OK);
checkOverview_html4();
}
void checkOverview() {
checkOutput("overview-summary.html", true,
"<div class=\"header\">\n"
+ "<h1 class=\"title\">Document Title</h1>\n"
+ "</div>\n"
+ "<main role=\"main\">\n"
+ "<div class=\"contentContainer\">\n"
+ "<div class=\"block\">This is line1. This is line 2.</div>\n"
+ "</div>\n"
+ "<div class=\"contentContainer\">");
}
void checkOverview_html4() {
checkOutput("overview-summary.html", true, checkOutput("overview-summary.html", true,
"<div class=\"header\">\n" "<div class=\"header\">\n"
+ "<h1 class=\"title\">Document Title</h1>\n" + "<h1 class=\"title\">Document Title</h1>\n"
@ -75,7 +109,6 @@ public class TestOverview extends JavadocTester {
+ "<div class=\"contentContainer\">\n" + "<div class=\"contentContainer\">\n"
+ "<div class=\"block\">This is line1. This is line 2.</div>\n" + "<div class=\"block\">This is line1. This is line 2.</div>\n"
+ "</div>\n" + "</div>\n"
+ "<div class=\"contentContainer\">" + "<div class=\"contentContainer\">");
);
} }
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -23,7 +23,7 @@
/* /*
* @test * @test
* @bug 8185194 * @bug 8185194 8182765
* @summary Test anchor for package description in package summary page * @summary Test anchor for package description in package summary page
* @library ../lib/ * @library ../lib/
* @modules jdk.javadoc/jdk.javadoc.internal.tool * @modules jdk.javadoc/jdk.javadoc.internal.tool
@ -42,8 +42,7 @@ public class TestPackageDescription extends JavadocTester {
void test1() { void test1() {
javadoc("-d", "out", javadoc("-d", "out",
"-sourcepath", testSrc, "-sourcepath", testSrc,
"pkg", "pkg");
"-html5");
checkExit(Exit.OK); checkExit(Exit.OK);
checkOutput("pkg/package-summary.html", true, checkOutput("pkg/package-summary.html", true,
@ -56,6 +55,7 @@ public class TestPackageDescription extends JavadocTester {
@Test @Test
void test2() { void test2() {
javadoc("-d", "out-2", javadoc("-d", "out-2",
"-html4",
"-sourcepath", testSrc, "-sourcepath", testSrc,
"pkg"); "pkg");
checkExit(Exit.OK); checkExit(Exit.OK);

View File

@ -23,7 +23,7 @@
/* /*
* @test * @test
* @bug 4780441 4874845 4978816 8014017 8016328 8025633 8026567 8175200 * @bug 4780441 4874845 4978816 8014017 8016328 8025633 8026567 8175200 8182765
* @summary Make sure that when the -private flag is not used, members * @summary Make sure that when the -private flag is not used, members
* inherited from package private class are documented in the child. * inherited from package private class are documented in the child.
* *
@ -42,7 +42,6 @@
* @build JavadocTester * @build JavadocTester
* @run main TestPrivateClasses * @run main TestPrivateClasses
*/ */
public class TestPrivateClasses extends JavadocTester { public class TestPrivateClasses extends JavadocTester {
public static void main(String... args) throws Exception { public static void main(String... args) throws Exception {
@ -62,7 +61,7 @@ public class TestPrivateClasses extends JavadocTester {
"<a href=\"#fieldInheritedFromParent\">" "<a href=\"#fieldInheritedFromParent\">"
+ "fieldInheritedFromParent</a>", + "fieldInheritedFromParent</a>",
// Method inheritance from non-public superclass. // Method inheritance from non-public superclass.
"<a href=\"#methodInheritedFromParent-int-\">" "<a href=\"#methodInheritedFromParent(int)\">"
+ "methodInheritedFromParent</a>", + "methodInheritedFromParent</a>",
// private class does not show up in tree // private class does not show up in tree
"<ul class=\"inheritance\">\n" "<ul class=\"inheritance\">\n"
@ -94,15 +93,15 @@ public class TestPrivateClasses extends JavadocTester {
checkOutput("pkg/PublicChild.html", false, checkOutput("pkg/PublicChild.html", false,
// Should not document comments from private inherited interfaces // Should not document comments from private inherited interfaces
"<td class=\"colLast\"><code><span class=\"memberNameLink\">" + "<td class=\"colLast\"><code><span class=\"memberNameLink\">"
"<a href=\"#methodInterface-int-\">" + + "<a href=\"#methodInterface(int)\">"
"methodInterface</a></span>&#8203;(int&nbsp;p1)</code>\n" + + "methodInterface</a></span>&#8203;(int&nbsp;p1)</code>\n"
"<div class=\"block\">Comment from interface.</div>\n</td>", + "<div class=\"block\">Comment from interface.</div>\n</td>",
// and similarly one more // and similarly one more
"<td class=\"colLast\"><code><span class=\"memberNameLink\">" + "<td class=\"colLast\"><code><span class=\"memberNameLink\">"
"<a href=\"#methodInterface2-int-\">" + + "<a href=\"#methodInterface2(int)\">"
"methodInterface2</a></span>&#8203;(int&nbsp;p1)</code>\n" + + "methodInterface2</a></span>&#8203;(int&nbsp;p1)</code>\n"
"<div class=\"block\">Comment from interface.</div>\n</td>" + "<div class=\"block\">Comment from interface.</div>\n</td>"
); );
checkOutput("pkg/PublicInterface.html", true, checkOutput("pkg/PublicInterface.html", true,
@ -110,7 +109,7 @@ public class TestPrivateClasses extends JavadocTester {
"<a href=\"#fieldInheritedFromInterface\">" "<a href=\"#fieldInheritedFromInterface\">"
+ "fieldInheritedFromInterface</a>", + "fieldInheritedFromInterface</a>",
// Method inheritance from non-public superinterface. // Method inheritance from non-public superinterface.
"<a href=\"#methodInterface-int-\">" "<a href=\"#methodInterface(int)\">"
+ "methodInterface</a>", + "methodInterface</a>",
//Make sure implemented interfaces from private superclass are inherited //Make sure implemented interfaces from private superclass are inherited
"<dl>\n" "<dl>\n"
@ -132,13 +131,49 @@ public class TestPrivateClasses extends JavadocTester {
checkOutput("pkg2/C.html", false, checkOutput("pkg2/C.html", false,
//Do not inherit private interface method with generic parameters. //Do not inherit private interface method with generic parameters.
//This method has been implemented. //This method has been implemented.
"<span class=\"memberNameLink\"><a href=\"I.html#hello-T-\">hello</a></span>"); "<span class=\"memberNameLink\"><a href=\"I.html#hello(T)\">hello</a></span>");
checkOutput("constant-values.html", false, checkOutput("constant-values.html", false,
// Make inherited constant are documented correctly. // Make inherited constant are documented correctly.
"PrivateInterface"); "PrivateInterface");
} }
@Test
void testDefault_html4() {
javadoc("-d", "out-default-html4",
"-html4",
"-sourcepath", testSrc,
"pkg", "pkg2");
checkExit(Exit.OK);
checkOutput("pkg/PublicChild.html", true,
// Method inheritance from non-public superclass.
"<a href=\"#methodInheritedFromParent-int-\">");
checkOutput("pkg/PublicChild.html", false,
// Should not document comments from private inherited interfaces
"<td class=\"colLast\"><code><span class=\"memberNameLink\">"
+ "<a href=\"#methodInterface-int-\">"
+ "methodInterface</a></span>&#8203;(int&nbsp;p1)</code>\n"
+ "<div class=\"block\">Comment from interface.</div>\n</td>",
// and similarly one more
"<td class=\"colLast\"><code><span class=\"memberNameLink\">"
+ "<a href=\"#methodInterface2-int-\">"
+ "methodInterface2</a></span>&#8203;(int&nbsp;p1)</code>\n"
+ "<div class=\"block\">Comment from interface.</div>\n</td>"
);
checkOutput("pkg/PublicInterface.html", true,
// Method inheritance from non-public superinterface.
"<a href=\"#methodInterface-int-\">"
+ "methodInterface</a>");
checkOutput("pkg2/C.html", false,
//Do not inherit private interface method with generic parameters.
//This method has been implemented.
"<span class=\"memberNameLink\"><a href=\"I.html#hello-T-\">hello</a></span>");
}
@Test @Test
void testPrivate() { void testPrivate() {
javadoc("-d", "out-private", javadoc("-d", "out-private",
@ -158,17 +193,17 @@ public class TestPrivateClasses extends JavadocTester {
"Methods inherited from class&nbsp;pkg." "Methods inherited from class&nbsp;pkg."
+ "<a href=\"PrivateParent.html\" title=\"class in pkg\">" + "<a href=\"PrivateParent.html\" title=\"class in pkg\">"
+ "PrivateParent</a>", + "PrivateParent</a>",
"<a href=\"PrivateParent.html#methodInheritedFromParent-int-\">" "<a href=\"PrivateParent.html#methodInheritedFromParent(int)\">"
+ "methodInheritedFromParent</a>", + "methodInheritedFromParent</a>",
// Should document that a method overrides method from private class. // Should document that a method overrides method from private class.
"<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n" "<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n"
+ "<dd><code><a href=\"PrivateParent.html#methodOverridenFromParent-char:A-int-T-V-java.util.List-\">" + "<dd><code><a href=\"PrivateParent.html#methodOverridenFromParent(char%5B%5D,int,T,V,java.util.List)\">"
+ "methodOverridenFromParent</a></code>&nbsp;in class&nbsp;<code>" + "methodOverridenFromParent</a></code>&nbsp;in class&nbsp;<code>"
+ "<a href=\"PrivateParent.html\" title=\"class in pkg\">" + "<a href=\"PrivateParent.html\" title=\"class in pkg\">"
+ "PrivateParent</a></code></dd>", + "PrivateParent</a></code></dd>",
// Should document that a method is specified by private interface. // Should document that a method is specified by private interface.
"<dt><span class=\"overrideSpecifyLabel\">Specified by:</span></dt>\n" "<dt><span class=\"overrideSpecifyLabel\">Specified by:</span></dt>\n"
+ "<dd><code><a href=\"PrivateInterface.html#methodInterface-int-\">" + "<dd><code><a href=\"PrivateInterface.html#methodInterface(int)\">"
+ "methodInterface</a></code>&nbsp;in interface&nbsp;<code>" + "methodInterface</a></code>&nbsp;in interface&nbsp;<code>"
+ "<a href=\"PrivateInterface.html\" title=\"interface in pkg\">" + "<a href=\"PrivateInterface.html\" title=\"interface in pkg\">"
+ "PrivateInterface</a></code></dd>", + "PrivateInterface</a></code></dd>",
@ -208,6 +243,56 @@ public class TestPrivateClasses extends JavadocTester {
+ "</a></code></dd>\n" + "</a></code></dd>\n"
+ "</dl>"); + "</dl>");
checkOutput("pkg/PrivateInterface.html", true,
"<a href=\"#methodInterface(int)\">"
+ "methodInterface</a>"
);
checkOutput("pkg2/C.html", true,
//Since private flag is used, we can document that private interface method
//with generic parameters has been implemented.
"<span class=\"descfrmTypeLabel\">Description copied from interface:&nbsp;<code>"
+ "<a href=\"I.html#hello(T)\">I</a></code></span>",
"<dt><span class=\"overrideSpecifyLabel\">Specified by:</span></dt>\n"
+ "<dd><code><a href=\"I.html#hello(T)\">hello</a></code>"
+ "&nbsp;in interface&nbsp;<code>"
+ "<a href=\"I.html\" title=\"interface in pkg2\">I</a>"
+ "&lt;java.lang.String&gt;</code></dd>");
checkOutput("pkg/PrivateParent.html", true,
//Make sure when no modifier appear in the class signature, the
//signature is displayed correctly without extra space at the beginning.
"<pre>class <span class=\"typeNameLabel\">PrivateParent</span>");
checkOutput("pkg/PrivateParent.html", false,
"<pre> class <span class=\"typeNameLabel\">PrivateParent</span>");
}
@Test
void testPrivate_html4() {
javadoc("-d", "out-private-html4",
"-html4",
"-sourcepath", testSrc,
"-private",
"pkg", "pkg2");
checkExit(Exit.OK);
checkOutput("pkg/PublicChild.html", true,
"<a href=\"PrivateParent.html#methodInheritedFromParent-int-\">"
+ "methodInheritedFromParent</a>",
// Should document that a method overrides method from private class.
"<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n"
+ "<dd><code><a href=\"PrivateParent.html#methodOverridenFromParent-char:A-int-T-V-java.util.List-\">"
+ "methodOverridenFromParent</a></code>&nbsp;in class&nbsp;<code>"
+ "<a href=\"PrivateParent.html\" title=\"class in pkg\">"
+ "PrivateParent</a></code></dd>",
// Should document that a method is specified by private interface.
"<dt><span class=\"overrideSpecifyLabel\">Specified by:</span></dt>\n"
+ "<dd><code><a href=\"PrivateInterface.html#methodInterface-int-\">"
+ "methodInterface</a></code>&nbsp;in interface&nbsp;<code>"
+ "<a href=\"PrivateInterface.html\" title=\"interface in pkg\">"
+ "PrivateInterface</a></code></dd>");
checkOutput("pkg/PrivateInterface.html", true, checkOutput("pkg/PrivateInterface.html", true,
"<a href=\"#methodInterface-int-\">" "<a href=\"#methodInterface-int-\">"
+ "methodInterface</a>" + "methodInterface</a>"
@ -223,13 +308,5 @@ public class TestPrivateClasses extends JavadocTester {
+ "&nbsp;in interface&nbsp;<code>" + "&nbsp;in interface&nbsp;<code>"
+ "<a href=\"I.html\" title=\"interface in pkg2\">I</a>" + "<a href=\"I.html\" title=\"interface in pkg2\">I</a>"
+ "&lt;java.lang.String&gt;</code></dd>"); + "&lt;java.lang.String&gt;</code></dd>");
checkOutput("pkg/PrivateParent.html", true,
//Make sure when no modifier appear in the class signature, the
//signature is displayed correctly without extra space at the beginning.
"<pre>class <span class=\"typeNameLabel\">PrivateParent</span>");
checkOutput("pkg/PrivateParent.html", false,
"<pre> class <span class=\"typeNameLabel\">PrivateParent</span>");
} }
} }

View File

@ -23,7 +23,7 @@
/* /*
* @test * @test
* @bug 8176231 8189843 * @bug 8176231 8189843 8182765
* @summary Test JavaFX property. * @summary Test JavaFX property.
* @library ../lib/ * @library ../lib/
* @modules jdk.javadoc/jdk.javadoc.internal.tool * @modules jdk.javadoc/jdk.javadoc.internal.tool
@ -46,6 +46,77 @@ public class TestProperty extends JavadocTester {
"pkg"); "pkg");
checkExit(Exit.OK); checkExit(Exit.OK);
checkOutput("pkg/MyClass.html", true,
"<pre>public final&nbsp;<a href=\"ObjectProperty.html\" "
+ "title=\"class in pkg\">ObjectProperty</a>"
+ "&lt;<a href=\"MyObj.html\" "
+ "title=\"class in pkg\">MyObj</a>&gt; goodProperty</pre>\n"
+ "<div class=\"block\">This is an Object property where the "
+ "Object is a single Object.</div>\n"
+ "<dl>\n"
+ "<dt><span class=\"seeLabel\">See Also:</span></dt>\n"
+ "<dd><a href=\"#getGood()\"><code>getGood()</code></a>, \n"
+ "<a href=\"#setGood(pkg.MyObj)\">"
+ "<code>setGood(MyObj)</code></a></dd>\n"
+ "</dl>",
"<pre>public final&nbsp;<a href=\"ObjectProperty.html\" "
+ "title=\"class in pkg\">ObjectProperty</a>"
+ "&lt;<a href=\"MyObj.html\" "
+ "title=\"class in pkg\">MyObj</a>[]&gt; badProperty</pre>\n"
+ "<div class=\"block\">This is an Object property where the "
+ "Object is an array.</div>\n"
+ "<dl>\n"
+ "<dt><span class=\"seeLabel\">See Also:</span></dt>\n"
+ "<dd><a href=\"#getBad()\"><code>getBad()</code></a>, \n"
+ "<a href=\"#setBad(pkg.MyObj%5B%5D)\">"
+ "<code>setBad(MyObj[])</code></a></dd>\n"
+ "</dl>",
// id should not be used in the property table
"<tr class=\"altColor\">\n"
+ "<td class=\"colFirst\"><code><a href=\"ObjectProperty.html\" "
+ "title=\"class in pkg\">ObjectProperty</a>&lt;<a href=\"MyObj.html\" "
+ "title=\"class in pkg\">MyObj</a>[]&gt;</code></td>\n"
+ "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">"
+ "<a href=\"#badProperty\">bad</a></span></code></th>",
// id should be used in the method table
"<tr id=\"i0\" class=\"altColor\">\n"
+ "<td class=\"colFirst\"><code><a href=\"ObjectProperty.html\" "
+ "title=\"class in pkg\">ObjectProperty</a>&lt;<a href=\"MyObj.html\" "
+ "title=\"class in pkg\">MyObj</a>[]&gt;</code></td>\n"
+ "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">"
+ "<a href=\"#badProperty()\">badProperty</a></span>()</code></th>"
);
checkOutput("pkg/MyClassT.html", true,
"<pre>public final&nbsp;<a href=\"ObjectProperty.html\" "
+ "title=\"class in pkg\">ObjectProperty</a>"
+ "&lt;java.util.List&lt;<a href=\"MyClassT.html\" "
+ "title=\"type parameter in MyClassT\">T</a>&gt;&gt; "
+ "listProperty</pre>\n"
+ "<div class=\"block\">This is an Object property where the "
+ "Object is a single <code>List&lt;T&gt;</code>.</div>\n"
+ "<dl>\n"
+ "<dt><span class=\"seeLabel\">See Also:</span></dt>\n"
+ "<dd><a href=\"#getList()\">"
+ "<code>getList()</code></a>, \n"
+ "<a href=\"#setList(java.util.List)\">"
+ "<code>setList(List)</code></a></dd>\n"
+ "</dl>"
);
}
@Test
void testArrays_html4() {
javadoc("-d", "out-html4",
"-html4",
"-javafx",
"-sourcepath", testSrc,
"pkg");
checkExit(Exit.OK);
checkOutput("pkg/MyClass.html", true, checkOutput("pkg/MyClass.html", true,
"<pre>public final&nbsp;<a href=\"ObjectProperty.html\" " "<pre>public final&nbsp;<a href=\"ObjectProperty.html\" "
+ "title=\"class in pkg\">ObjectProperty</a>" + "title=\"class in pkg\">ObjectProperty</a>"
@ -73,14 +144,6 @@ public class TestProperty extends JavadocTester {
+ "<code>setBad(MyObj[])</code></a></dd>\n" + "<code>setBad(MyObj[])</code></a></dd>\n"
+ "</dl>", + "</dl>",
// id should not be used in the property table
"<tr class=\"altColor\">\n"
+ "<td class=\"colFirst\"><code><a href=\"ObjectProperty.html\" "
+ "title=\"class in pkg\">ObjectProperty</a>&lt;<a href=\"MyObj.html\" "
+ "title=\"class in pkg\">MyObj</a>[]&gt;</code></td>\n"
+ "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">"
+ "<a href=\"#badProperty\">bad</a></span></code></th>",
// id should be used in the method table // id should be used in the method table
"<tr id=\"i0\" class=\"altColor\">\n" "<tr id=\"i0\" class=\"altColor\">\n"
+ "<td class=\"colFirst\"><code><a href=\"ObjectProperty.html\" " + "<td class=\"colFirst\"><code><a href=\"ObjectProperty.html\" "

Some files were not shown because too many files have changed in this diff Show More