--- a/.hgtags Tue Feb 26 12:08:20 2019 -0500
+++ b/.hgtags Tue Feb 26 12:11:29 2019 -0500
@@ -544,3 +544,5 @@
b5f7bb57de2f797be34f6c75d45c3245ad37ab97 jdk-12+31
a535ba736cabc6886acdff36de3a096c46e5ddc5 jdk-13+8
4ce47bc1fb92cf94c6e3d1f49d582f02dcb851ab jdk-12+32
+c081f3ea6b9300265a4a34e38f970b1e3ddaae9f jdk-13+9
+b67884871b5fff79c5ef3eb8ac74dd48d71ea9b1 jdk-12+33
--- a/make/RunTests.gmk Tue Feb 26 12:08:20 2019 -0500
+++ b/make/RunTests.gmk Tue Feb 26 12:11:29 2019 -0500
@@ -112,6 +112,9 @@
GTEST_VARIANTS := $(strip $(patsubst $(TEST_IMAGE_DIR)/hotspot/gtest/%, %, \
$(GTEST_LAUNCHER_DIRS)))
+COV_ENVIRONMENT :=
+JTREG_COV_OPTIONS :=
+
ifeq ($(TEST_OPTS_JCOV), true)
JCOV_OUTPUT_DIR := $(TEST_RESULTS_DIR)/jcov-output
JCOV_GRABBER_LOG := $(JCOV_OUTPUT_DIR)/grabber.log
@@ -122,12 +125,18 @@
# Replace our normal test JDK with the JCov image.
JDK_UNDER_TEST := $(JCOV_IMAGE_DIR)
- JCOV_ENVIRONMENT := JAVA_TOOL_OPTIONS="$(JCOV_MEM_OPTIONS)" \
+ COV_ENVIRONMENT += JAVA_TOOL_OPTIONS="$(JCOV_MEM_OPTIONS)" \
_JAVA_OPTIONS="$(JCOV_MEM_OPTIONS)"
- JTREG_JCOV_OPTIONS := -e:JAVA_TOOL_OPTIONS='$(JCOV_MEM_OPTIONS)' \
+ JTREG_COV_OPTIONS += -e:JAVA_TOOL_OPTIONS='$(JCOV_MEM_OPTIONS)' \
-e:_JAVA_OPTIONS='$(JCOV_MEM_OPTIONS)'
endif
+ifeq ($(GCOV_ENABLED), true)
+ GCOV_OUTPUT_DIR := $(TEST_RESULTS_DIR)/gcov-output
+ COV_ENVIRONMENT += GCOV_PREFIX="$(GCOV_OUTPUT_DIR)"
+ JTREG_COV_OPTIONS += -e:GCOV_PREFIX="$(GCOV_OUTPUT_DIR)"
+endif
+
################################################################################
# Optionally create AOT libraries for specified modules before running tests.
# Note, this could not be done during JDK build time.
@@ -170,6 +179,7 @@
$$(call LogWarn, Generating $$(patsubst $$(OUTPUTDIR)/%, %, $$@))
$$(call MakeTargetDir)
$$(call ExecuteWithLog, $$@, \
+ $((COV_ENVIRONMENT) \
$$(FIXPATH) $$(JDK_UNDER_TEST)/bin/jaotc \
$$($1_JAOTC_OPTS) --output $$@ --module $$($1_MODULE) \
)
@@ -907,7 +917,7 @@
$$(call LogWarn, Running test '$$($1_TEST)')
$$(call MakeDir, $$($1_TEST_RESULTS_DIR) $$($1_TEST_SUPPORT_DIR))
$$(call ExecuteWithLog, $$($1_TEST_SUPPORT_DIR)/jtreg, \
- $$(JCOV_ENVIRONMENT) \
+ $$(COV_ENVIRONMENT) \
$$(JAVA) $$($1_JTREG_LAUNCHER_OPTIONS) \
-Dprogram=jtreg -jar $$(JT_HOME)/lib/jtreg.jar \
$$($1_JTREG_BASIC_OPTIONS) \
@@ -917,7 +927,7 @@
-workDir:$$($1_TEST_SUPPORT_DIR) \
$$(JTREG_OPTIONS) \
$$(JTREG_FAILURE_HANDLER_OPTIONS) \
- $$(JTREG_JCOV_OPTIONS) \
+ $$(JTREG_COV_OPTIONS) \
$$($1_TEST_NAME) \
&& $$(ECHO) $$$$? > $$($1_EXITCODE) \
|| $$(ECHO) $$$$? > $$($1_EXITCODE) \
--- a/make/autoconf/jdk-options.m4 Tue Feb 26 12:08:20 2019 -0500
+++ b/make/autoconf/jdk-options.m4 Tue Feb 26 12:11:29 2019 -0500
@@ -364,7 +364,7 @@
################################################################################
#
-# Gcov coverage data for hotspot
+# Native and Java code coverage
#
AC_DEFUN_ONCE([JDKOPT_SETUP_CODE_COVERAGE],
[
--- a/make/conf/jib-profiles.js Tue Feb 26 12:08:20 2019 -0500
+++ b/make/conf/jib-profiles.js Tue Feb 26 12:11:29 2019 -0500
@@ -521,6 +521,15 @@
profiles[maketestName].default_make_targets = [ "test-make" ];
});
+ // Generate -gcov profiles
+ [ "linux-x64", "macosx-x64" ].forEach(function (name) {
+ var gcovName = name + "-gcov";
+ profiles[gcovName] = clone(profiles[name]);
+ profiles[gcovName].default_make_targets = ["product-bundles", "test-bundles"];
+ profiles[gcovName].configure_args = concat(profiles[gcovName].configure_args,
+ ["--enable-native-coverage", "--disable-warnings-as-errors"]);
+ });
+
// Profiles for building the zero jvm variant. These are used for verification.
var zeroProfiles = {
"linux-x64-zero": {
@@ -772,6 +781,40 @@
};
});
+ // Artifacts of gcov (native-code-coverage) profiles
+ [ "linux-x64", "macosx-x64" ].forEach(function (name) {
+ var o = artifactData[name]
+ var pf = o.platform
+ var jdk_subdir = (o.jdk_subdir != null ? o.jdk_subdir : "jdk-" + data.version);
+ var jdk_suffix = (o.jdk_suffix != null ? o.jdk_suffix : "tar.gz");
+ var gcovName = name + "-gcov";
+ profiles[gcovName].artifacts = {
+ jdk: {
+ local: "bundles/\\(jdk.*bin." + jdk_suffix + "\\)",
+ remote: [
+ "bundles/" + pf + "/jdk-" + data.version + "_" + pf + "_bin-gcov." + jdk_suffix,
+ ],
+ subdir: jdk_subdir,
+ exploded: "images/jdk",
+ },
+ test: {
+ local: "bundles/\\(jdk.*bin-tests.tar.gz\\)",
+ remote: [
+ "bundles/" + pf + "/jdk-" + data.version + "_" + pf + "_bin-gcov-tests.tar.gz",
+ ],
+ exploded: "images/test"
+ },
+ jdk_symbols: {
+ local: "bundles/\\(jdk.*bin-symbols.tar.gz\\)",
+ remote: [
+ "bundles/" + pf + "/jdk-" + data.version + "_" + pf + "_bin-gcov-symbols.tar.gz",
+ ],
+ subdir: jdk_subdir,
+ exploded: "images/jdk"
+ },
+ };
+ });
+
// Profiles used to run tests.
var testOnlyProfiles = {
"run-test": {
@@ -798,6 +841,10 @@
} else {
testedProfileTest = testedProfile + ".test";
}
+ var testOnlyMake = [ "run-test-prebuilt", "LOG_CMDLINES=true", "JTREG_VERBOSE=fail,error,time" ];
+ if (testedProfile.endsWith("-gcov")) {
+ testOnlyMake = concat(testOnlyMake, "GCOV_ENABLED=true")
+ }
var testOnlyProfilesPrebuilt = {
"run-test-prebuilt": {
target_os: input.build_os,
@@ -807,7 +854,7 @@
testedProfileTest
],
src: "src.conf",
- make_args: [ "run-test-prebuilt", "LOG_CMDLINES=true", "JTREG_VERBOSE=fail,error,time" ],
+ make_args: testOnlyMake,
environment: {
"BOOT_JDK": common.boot_jdk_home,
"JDK_IMAGE_DIR": input.get(testedProfileJDK, "home_path"),
--- a/make/data/cldr/common/main/my.xml Tue Feb 26 12:08:20 2019 -0500
+++ b/make/data/cldr/common/main/my.xml Tue Feb 26 12:11:29 2019 -0500
@@ -1446,17 +1446,14 @@
<pattern>z HH:mm:ss</pattern>
</timeFormat>
</timeFormatLength>
- <!--Pattern for medium and short replaced with CLDR 29's patterns
- as character 'B' is currently not supported in SimpleDateFormat and java.time.DateTimeFormatter
- classes. This is a restriction until JDK-8209175 is resolved.-->
<timeFormatLength type="medium">
<timeFormat>
- <pattern>HH:mm:ss</pattern>
+ <pattern>B HH:mm:ss</pattern>
</timeFormat>
</timeFormatLength>
<timeFormatLength type="short">
<timeFormat>
- <pattern>H:mm</pattern>
+ <pattern>B H:mm</pattern>
</timeFormat>
</timeFormatLength>
</timeFormats>
--- a/make/jdk/src/classes/build/tools/cldrconverter/Bundle.java Tue Feb 26 12:08:20 2019 -0500
+++ b/make/jdk/src/classes/build/tools/cldrconverter/Bundle.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, 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
@@ -523,36 +523,46 @@
for (String k : patternKeys) {
if (myMap.containsKey(calendarPrefix + k)) {
int len = patternKeys.length;
- List<String> rawPatterns = new ArrayList<>(len);
- List<String> patterns = new ArrayList<>(len);
+ List<String> dateTimePatterns = new ArrayList<>(len);
+ List<String> sdfPatterns = new ArrayList<>(len);
for (int i = 0; i < len; i++) {
String key = calendarPrefix + patternKeys[i];
String pattern = (String) myMap.remove(key);
if (pattern == null) {
pattern = (String) parentsMap.remove(key);
}
- rawPatterns.add(i, pattern);
if (pattern != null) {
- patterns.add(i, translateDateFormatLetters(calendarType, pattern));
+ // Perform date-time format pattern conversion which is
+ // applicable to both SimpleDateFormat and j.t.f.DateTimeFormatter.
+ // For example, character 'B' is mapped with 'a', as 'B' is not
+ // supported in either SimpleDateFormat or j.t.f.DateTimeFormatter
+ String transPattern = translateDateFormatLetters(calendarType, pattern, this::convertDateTimePatternLetter);
+ dateTimePatterns.add(i, transPattern);
+ // Additionally, perform SDF specific date-time format pattern conversion
+ sdfPatterns.add(i, translateDateFormatLetters(calendarType, transPattern, this::convertSDFLetter));
} else {
- patterns.add(i, null);
+ dateTimePatterns.add(i, null);
+ sdfPatterns.add(i, null);
}
}
- // If patterns is empty or has any nulls, discard patterns.
- if (patterns.isEmpty()) {
+ // If empty, discard patterns
+ if (sdfPatterns.isEmpty()) {
return;
}
String key = calendarPrefix + name;
- if (!rawPatterns.equals(patterns)) {
- myMap.put("java.time." + key, rawPatterns.toArray(new String[len]));
+
+ // If additional changes are made in the SDF specific conversion,
+ // keep the commonly converted patterns as java.time patterns
+ if (!dateTimePatterns.equals(sdfPatterns)) {
+ myMap.put("java.time." + key, dateTimePatterns.toArray(String[]::new));
}
- myMap.put(key, patterns.toArray(new String[len]));
+ myMap.put(key, sdfPatterns.toArray(new String[len]));
break;
}
}
}
- private String translateDateFormatLetters(CalendarType calendarType, String cldrFormat) {
+ private String translateDateFormatLetters(CalendarType calendarType, String cldrFormat, ConvertDateTimeLetters converter) {
String pattern = cldrFormat;
int length = pattern.length();
boolean inQuote = false;
@@ -571,7 +581,7 @@
if (nextc == '\'') {
i++;
if (count != 0) {
- convert(calendarType, lastLetter, count, jrePattern);
+ converter.convert(calendarType, lastLetter, count, jrePattern);
lastLetter = 0;
count = 0;
}
@@ -581,7 +591,7 @@
}
if (!inQuote) {
if (count != 0) {
- convert(calendarType, lastLetter, count, jrePattern);
+ converter.convert(calendarType, lastLetter, count, jrePattern);
lastLetter = 0;
count = 0;
}
@@ -598,7 +608,7 @@
}
if (!(c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z')) {
if (count != 0) {
- convert(calendarType, lastLetter, count, jrePattern);
+ converter.convert(calendarType, lastLetter, count, jrePattern);
lastLetter = 0;
count = 0;
}
@@ -611,7 +621,7 @@
count++;
continue;
}
- convert(calendarType, lastLetter, count, jrePattern);
+ converter.convert(calendarType, lastLetter, count, jrePattern);
lastLetter = c;
count = 1;
}
@@ -621,7 +631,7 @@
}
if (count != 0) {
- convert(calendarType, lastLetter, count, jrePattern);
+ converter.convert(calendarType, lastLetter, count, jrePattern);
}
if (cldrFormat.contentEquals(jrePattern)) {
return cldrFormat;
@@ -676,71 +686,91 @@
}
}
- private void convert(CalendarType calendarType, char cldrLetter, int count, StringBuilder sb) {
+ /**
+ * Perform a generic conversion of CLDR date-time format pattern letter based
+ * on the support given by the SimpleDateFormat and the j.t.f.DateTimeFormatter
+ * for date-time formatting.
+ */
+ private void convertDateTimePatternLetter(CalendarType calendarType, char cldrLetter, int count, StringBuilder sb) {
switch (cldrLetter) {
- case 'G':
- if (calendarType != CalendarType.GREGORIAN) {
- // Adjust the number of 'G's for JRE SimpleDateFormat
- if (count == 5) {
- // CLDR narrow -> JRE short
- count = 1;
- } else if (count == 1) {
- // CLDR abbr -> JRE long
- count = 4;
- }
- }
- appendN(cldrLetter, count, sb);
- break;
-
- // TODO: support 'c' and 'e' in JRE SimpleDateFormat
- // Use 'u' and 'E' for now.
- case 'c':
- case 'e':
- switch (count) {
- case 1:
- sb.append('u');
+ case 'u':
+ // Change cldr letter 'u' to 'y', as 'u' is interpreted as
+ // "Extended year (numeric)" in CLDR/LDML,
+ // which is not supported in SimpleDateFormat and
+ // j.t.f.DateTimeFormatter, so it is replaced with 'y'
+ // as the best approximation
+ appendN('y', count, sb);
break;
- case 3:
- case 4:
- appendN('E', count, sb);
+ case 'B':
+ // 'B' character (day period) is not supported by
+ // SimpleDateFormat and j.t.f.DateTimeFormatter,
+ // this is a workaround in which 'B' character
+ // appearing in CLDR date-time pattern is replaced
+ // with 'a' character and hence resolved with am/pm strings.
+ // This workaround is based on the the fallback mechanism
+ // specified in LDML spec for 'B' character, when a locale
+ // does not have data for day period ('B')
+ appendN('a', count, sb);
break;
- case 5:
- appendN('E', 3, sb);
+ default:
+ appendN(cldrLetter, count, sb);
break;
- }
- break;
- case 'l':
- // 'l' is deprecated as a pattern character. Should be ignored.
- break;
+ }
+ }
- case 'u':
- // Use 'y' for now.
- appendN('y', count, sb);
- break;
-
- case 'v':
- case 'V':
- appendN('z', count, sb);
- break;
+ /**
+ * Perform a conversion of CLDR date-time format pattern letter which is
+ * specific to the SimpleDateFormat.
+ */
+ private void convertSDFLetter(CalendarType calendarType, char cldrLetter, int count, StringBuilder sb) {
+ switch (cldrLetter) {
+ case 'G':
+ if (calendarType != CalendarType.GREGORIAN) {
+ // Adjust the number of 'G's for JRE SimpleDateFormat
+ if (count == 5) {
+ // CLDR narrow -> JRE short
+ count = 1;
+ } else if (count == 1) {
+ // CLDR abbr -> JRE long
+ count = 4;
+ }
+ }
+ appendN(cldrLetter, count, sb);
+ break;
- case 'Z':
- if (count == 4 || count == 5) {
- sb.append("XXX");
- }
- break;
+ // TODO: support 'c' and 'e' in JRE SimpleDateFormat
+ // Use 'u' and 'E' for now.
+ case 'c':
+ case 'e':
+ switch (count) {
+ case 1:
+ sb.append('u');
+ break;
+ case 3:
+ case 4:
+ appendN('E', count, sb);
+ break;
+ case 5:
+ appendN('E', 3, sb);
+ break;
+ }
+ break;
- case 'U':
- case 'q':
- case 'Q':
- case 'g':
- case 'j':
- case 'A':
- throw new InternalError(String.format("Unsupported letter: '%c', count=%d, id=%s%n",
- cldrLetter, count, id));
- default:
- appendN(cldrLetter, count, sb);
- break;
+ case 'v':
+ case 'V':
+ appendN('z', count, sb);
+ break;
+
+ case 'Z':
+ if (count == 4 || count == 5) {
+ sb.append("XXX");
+ }
+ break;
+
+ default:
+ appendN(cldrLetter, count, sb);
+ break;
}
}
@@ -758,4 +788,9 @@
}
return false;
}
+
+ @FunctionalInterface
+ private interface ConvertDateTimeLetters {
+ void convert(CalendarType calendarType, char cldrLetter, int count, StringBuilder sb);
+ }
}
--- a/make/lib/Awt2dLibraries.gmk Tue Feb 26 12:08:20 2019 -0500
+++ b/make/lib/Awt2dLibraries.gmk Tue Feb 26 12:11:29 2019 -0500
@@ -613,7 +613,8 @@
type-limits missing-field-initializers implicit-fallthrough \
strict-aliasing undef unused-function, \
DISABLED_WARNINGS_CXX_gcc := reorder delete-non-virtual-dtor strict-overflow \
- maybe-uninitialized, \
+ maybe-uninitialized \
+ missing-attributes class-memaccess, \
DISABLED_WARNINGS_clang := unused-value incompatible-pointer-types \
tautological-constant-out-of-range-compare int-to-pointer-cast \
sign-compare undef missing-field-initializers, \
--- a/src/hotspot/cpu/ppc/nativeInst_ppc.cpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/cpu/ppc/nativeInst_ppc.cpp Tue Feb 26 12:11:29 2019 -0500
@@ -1,6 +1,6 @@
/*
- * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2012, 2015 SAP SE. All rights reserved.
+ * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, SAP SE. 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
@@ -362,8 +362,8 @@
void NativeGeneralJump::insert_unconditional(address code_pos, address entry) {
CodeBuffer cb(code_pos, BytesPerInstWord + 1);
- MacroAssembler* a = new MacroAssembler(&cb);
- a->b(entry);
+ MacroAssembler a(&cb);
+ a.b(entry);
ICache::ppc64_flush_icache_bytes(code_pos, NativeGeneralJump::instruction_size);
}
--- a/src/hotspot/cpu/x86/c2_init_x86.cpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/cpu/x86/c2_init_x86.cpp Tue Feb 26 12:11:29 2019 -0500
@@ -29,7 +29,7 @@
// processor dependent initialization for i486
-extern void reg_mask_init();
+LP64_ONLY(extern void reg_mask_init();)
void Compile::pd_compiler2_init() {
guarantee(CodeEntryAlignment >= InteriorEntryAlignment, "" );
@@ -60,5 +60,5 @@
OptoReg::invalidate(i);
}
}
- reg_mask_init();
+ LP64_ONLY(reg_mask_init();)
}
--- a/src/hotspot/os/aix/os_aix.inline.hpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/os/aix/os_aix.inline.hpp Tue Feb 26 12:11:29 2019 -0500
@@ -27,6 +27,7 @@
#define OS_AIX_OS_AIX_INLINE_HPP
#include "runtime/os.hpp"
+#include "os_posix.inline.hpp"
// System includes
--- a/src/hotspot/os/aix/os_perf_aix.cpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/os/aix/os_perf_aix.cpp Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, 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
@@ -859,11 +859,7 @@
char* SystemProcessInterface::SystemProcesses::ProcessIterator::allocate_string(const char* str) const {
if (str != NULL) {
- size_t len = strlen(str);
- char* tmp = NEW_C_HEAP_ARRAY(char, len+1, mtInternal);
- strncpy(tmp, str, len);
- tmp[len] = '\0';
- return tmp;
+ return os::strdup_check_oom(str, mtInternal);
}
return NULL;
}
--- a/src/hotspot/os/bsd/os_bsd.cpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/os/bsd/os_bsd.cpp Tue Feb 26 12:11:29 2019 -0500
@@ -37,6 +37,7 @@
#include "memory/filemap.hpp"
#include "oops/oop.inline.hpp"
#include "os_bsd.inline.hpp"
+#include "os_posix.inline.hpp"
#include "os_share_bsd.hpp"
#include "prims/jniFastGetField.hpp"
#include "prims/jvm_misc.hpp"
--- a/src/hotspot/os/bsd/os_bsd.inline.hpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/os/bsd/os_bsd.inline.hpp Tue Feb 26 12:11:29 2019 -0500
@@ -26,6 +26,7 @@
#define OS_BSD_OS_BSD_INLINE_HPP
#include "runtime/os.hpp"
+#include "os_posix.inline.hpp"
// System includes
--- a/src/hotspot/os/linux/globals_linux.hpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/os/linux/globals_linux.hpp Tue Feb 26 12:11:29 2019 -0500
@@ -70,7 +70,12 @@
diagnostic(bool, DumpPrivateMappingsInCore, true, \
"If true, sets bit 2 of /proc/PID/coredump_filter, thus " \
"resulting in file-backed private mappings of the process to "\
- "be dumped into the corefile, if UseSharedSpaces is true.") \
+ "be dumped into the corefile.") \
+ \
+ diagnostic(bool, DumpSharedMappingsInCore, true, \
+ "If true, sets bit 3 of /proc/PID/coredump_filter, thus " \
+ "resulting in file-backed shared mappings of the process to " \
+ "be dumped into the corefile.") \
\
diagnostic(bool, UseCpuAllocPath, false, \
"Use CPU_ALLOC code path in os::active_processor_count ")
--- a/src/hotspot/os/linux/os_linux.cpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/os/linux/os_linux.cpp Tue Feb 26 12:11:29 2019 -0500
@@ -38,6 +38,7 @@
#include "memory/filemap.hpp"
#include "oops/oop.inline.hpp"
#include "os_linux.inline.hpp"
+#include "os_posix.inline.hpp"
#include "os_share_linux.hpp"
#include "osContainer_linux.hpp"
#include "prims/jniFastGetField.hpp"
@@ -131,6 +132,7 @@
enum CoredumpFilterBit {
FILE_BACKED_PVT_BIT = 1 << 2,
+ FILE_BACKED_SHARED_BIT = 1 << 3,
LARGEPAGES_BIT = 1 << 6,
DAX_SHARED_BIT = 1 << 8
};
@@ -1357,11 +1359,9 @@
void os::abort(bool dump_core, void* siginfo, const void* context) {
os::shutdown();
if (dump_core) {
-#if INCLUDE_CDS
- if (UseSharedSpaces && DumpPrivateMappingsInCore) {
+ if (DumpPrivateMappingsInCore) {
ClassLoader::close_jrt_image();
}
-#endif
#ifndef PRODUCT
fdStream out(defaultStream::output_fd());
out.print_raw("Current thread is ");
@@ -3432,8 +3432,6 @@
return result;
}
-// Set the coredump_filter bits to include largepages in core dump (bit 6)
-//
// From the coredump_filter documentation:
//
// - (bit 0) anonymous private memory
@@ -5131,11 +5129,13 @@
set_coredump_filter(DAX_SHARED_BIT);
}
-#if INCLUDE_CDS
- if (UseSharedSpaces && DumpPrivateMappingsInCore) {
+ if (DumpPrivateMappingsInCore) {
set_coredump_filter(FILE_BACKED_PVT_BIT);
}
-#endif
+
+ if (DumpSharedMappingsInCore) {
+ set_coredump_filter(FILE_BACKED_SHARED_BIT);
+ }
return JNI_OK;
}
--- a/src/hotspot/os/linux/os_perf_linux.cpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/os/linux/os_perf_linux.cpp Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, 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
@@ -861,11 +861,7 @@
char* SystemProcessInterface::SystemProcesses::ProcessIterator::allocate_string(const char* str) const {
if (str != NULL) {
- size_t len = strlen(str);
- char* tmp = NEW_C_HEAP_ARRAY(char, len+1, mtInternal);
- strncpy(tmp, str, len);
- tmp[len] = '\0';
- return tmp;
+ return os::strdup_check_oom(str, mtInternal);
}
return NULL;
}
@@ -1066,7 +1062,7 @@
snprintf(buf, sizeof(buf), "/sys/class/net/%s/statistics/%s", iface, counter);
- int fd = open(buf, O_RDONLY);
+ int fd = os::open(buf, O_RDONLY, 0);
if (fd == -1) {
return -1;
}
--- a/src/hotspot/os/linux/perfMemory_linux.cpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/os/linux/perfMemory_linux.cpp Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -97,8 +97,8 @@
int result;
- RESTARTABLE(::open(destfile, O_CREAT|O_WRONLY|O_TRUNC, S_IREAD|S_IWRITE),
- result);;
+ RESTARTABLE(os::open(destfile, O_CREAT|O_WRONLY|O_TRUNC, S_IRUSR|S_IWUSR),
+ result);
if (result == OS_ERR) {
if (PrintMiscellaneous && Verbose) {
warning("Could not create Perfdata save file: %s: %s\n",
@@ -871,7 +871,7 @@
// Cannot use O_TRUNC here; truncation of an existing file has to happen
// after the is_file_secure() check below.
int result;
- RESTARTABLE(::open(filename, O_RDWR|O_CREAT|O_NOFOLLOW, S_IREAD|S_IWRITE), result);
+ RESTARTABLE(os::open(filename, O_RDWR|O_CREAT|O_NOFOLLOW, S_IRUSR|S_IWUSR), result);
if (result == OS_ERR) {
if (PrintMiscellaneous && Verbose) {
if (errno == ELOOP) {
@@ -949,7 +949,7 @@
// open the file
int result;
- RESTARTABLE(::open(filename, oflags), result);
+ RESTARTABLE(os::open(filename, oflags, 0), result);
if (result == OS_ERR) {
if (errno == ENOENT) {
THROW_MSG_(vmSymbols::java_lang_IllegalArgumentException(),
--- a/src/hotspot/os/posix/os_posix.cpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/os/posix/os_posix.cpp Tue Feb 26 12:11:29 2019 -0500
@@ -180,20 +180,17 @@
const char name_template[] = "/jvmheap.XXXXXX";
- char *fullname = (char*)os::malloc((strlen(dir) + strlen(name_template) + 1), mtInternal);
+ size_t fullname_len = strlen(dir) + strlen(name_template);
+ char *fullname = (char*)os::malloc(fullname_len + 1, mtInternal);
if (fullname == NULL) {
vm_exit_during_initialization(err_msg("Malloc failed during creation of backing file for heap (%s)", os::strerror(errno)));
return -1;
}
- (void)strncpy(fullname, dir, strlen(dir)+1);
- (void)strncat(fullname, name_template, strlen(name_template));
+ int n = snprintf(fullname, fullname_len + 1, "%s%s", dir, name_template);
+ assert((size_t)n == fullname_len, "Unexpected number of characters in string");
os::native_path(fullname);
- sigset_t set, oldset;
- int ret = sigfillset(&set);
- assert_with_errno(ret == 0, "sigfillset returned error");
-
// set the file creation mask.
mode_t file_mode = S_IRUSR | S_IWUSR;
@@ -207,7 +204,7 @@
}
// delete the name from the filesystem. When 'fd' is closed, the file (and space) will be deleted.
- ret = unlink(fullname);
+ int ret = unlink(fullname);
assert_with_errno(ret == 0, "unlink returned error");
os::free(fullname);
@@ -2218,22 +2215,6 @@
assert_status(status == 0, status, "mutex_destroy");
}
-void os::PlatformMonitor::lock() {
- int status = pthread_mutex_lock(&_mutex);
- assert_status(status == 0, status, "mutex_lock");
-}
-
-void os::PlatformMonitor::unlock() {
- int status = pthread_mutex_unlock(&_mutex);
- assert_status(status == 0, status, "mutex_unlock");
-}
-
-bool os::PlatformMonitor::try_lock() {
- int status = pthread_mutex_trylock(&_mutex);
- assert_status(status == 0 || status == EBUSY, status, "mutex_trylock");
- return status == 0;
-}
-
// Must already be locked
int os::PlatformMonitor::wait(jlong millis) {
assert(millis >= 0, "negative timeout");
@@ -2262,14 +2243,4 @@
}
}
-void os::PlatformMonitor::notify() {
- int status = pthread_cond_signal(&_cond);
- assert_status(status == 0, status, "cond_signal");
-}
-
-void os::PlatformMonitor::notify_all() {
- int status = pthread_cond_broadcast(&_cond);
- assert_status(status == 0, status, "cond_broadcast");
-}
-
#endif // !SOLARIS
--- a/src/hotspot/os/posix/os_posix.inline.hpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/os/posix/os_posix.inline.hpp Tue Feb 26 12:11:29 2019 -0500
@@ -42,6 +42,39 @@
inline int os::Posix::clock_getres(clockid_t clock_id, struct timespec *tp) {
return _clock_getres != NULL ? _clock_getres(clock_id, tp) : -1;
}
+
#endif // SUPPORTS_CLOCK_MONOTONIC
+#ifndef SOLARIS
+
+// Platform Monitor implementation
+
+inline void os::PlatformMonitor::lock() {
+ int status = pthread_mutex_lock(&_mutex);
+ assert_status(status == 0, status, "mutex_lock");
+}
+
+inline void os::PlatformMonitor::unlock() {
+ int status = pthread_mutex_unlock(&_mutex);
+ assert_status(status == 0, status, "mutex_unlock");
+}
+
+inline bool os::PlatformMonitor::try_lock() {
+ int status = pthread_mutex_trylock(&_mutex);
+ assert_status(status == 0 || status == EBUSY, status, "mutex_trylock");
+ return status == 0;
+}
+
+inline void os::PlatformMonitor::notify() {
+ int status = pthread_cond_signal(&_cond);
+ assert_status(status == 0, status, "cond_signal");
+}
+
+inline void os::PlatformMonitor::notify_all() {
+ int status = pthread_cond_broadcast(&_cond);
+ assert_status(status == 0, status, "cond_broadcast");
+}
+
+#endif // !SOLARIS
+
#endif // OS_POSIX_OS_POSIX_INLINE_HPP
--- a/src/hotspot/os/solaris/os_perf_solaris.cpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/os/solaris/os_perf_solaris.cpp Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, 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
@@ -74,7 +74,7 @@
int fd = -1;
- if ((fd = open(path, O_RDONLY)) < 0) {
+ if ((fd = os::open(path, O_RDONLY, 0)) < 0) {
return OS_ERR;
}
if (pread(fd, info, s, o) != s) {
@@ -544,11 +544,7 @@
char* SystemProcessInterface::SystemProcesses::ProcessIterator::allocate_string(const char* str) const {
if (str != NULL) {
- size_t len = strlen(str);
- char* tmp = NEW_C_HEAP_ARRAY(char, len+1, mtInternal);
- strncpy(tmp, str, len);
- tmp[len] = '\0';
- return tmp;
+ return os::strdup_check_oom(str, mtInternal);
}
return NULL;
}
--- a/src/hotspot/os/windows/os_perf_windows.cpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/os/windows/os_perf_windows.cpp Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, 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
@@ -1253,14 +1253,7 @@
char* SystemProcessInterface::SystemProcesses::ProcessIterator::allocate_string(const char* str) const {
if (str != NULL) {
- size_t len = strlen(str);
- char* tmp = NEW_C_HEAP_ARRAY(char, len+1, mtInternal);
- if (NULL == tmp) {
- return NULL;
- }
- strncpy(tmp, str, len);
- tmp[len] = '\0';
- return tmp;
+ return os::strdup_check_oom(str, mtInternal);
}
return NULL;
}
--- a/src/hotspot/os/windows/os_windows.cpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/os/windows/os_windows.cpp Tue Feb 26 12:11:29 2019 -0500
@@ -602,7 +602,7 @@
HANDLE interrupt_event = CreateEvent(NULL, true, false, NULL);
if (interrupt_event == NULL) {
delete osthread;
- return NULL;
+ return false;
}
osthread->set_interrupt_event(interrupt_event);
osthread->set_interrupted(false);
@@ -676,7 +676,7 @@
CloseHandle(osthread->interrupt_event());
thread->set_osthread(NULL);
delete osthread;
- return NULL;
+ return false;
}
Atomic::inc(&os::win32::_os_thread_count);
@@ -2970,14 +2970,15 @@
int os::create_file_for_heap(const char* dir) {
const char name_template[] = "/jvmheap.XXXXXX";
- char *fullname = (char*)os::malloc((strlen(dir) + strlen(name_template) + 1), mtInternal);
+
+ size_t fullname_len = strlen(dir) + strlen(name_template);
+ char *fullname = (char*)os::malloc(fullname_len + 1, mtInternal);
if (fullname == NULL) {
vm_exit_during_initialization(err_msg("Malloc failed during creation of backing file for heap (%s)", os::strerror(errno)));
return -1;
}
-
- (void)strncpy(fullname, dir, strlen(dir)+1);
- (void)strncat(fullname, name_template, strlen(name_template));
+ int n = snprintf(fullname, fullname_len + 1, "%s%s", dir, name_template);
+ assert((size_t)n == fullname_len, "Unexpected number of characters in string");
os::native_path(fullname);
@@ -5319,27 +5320,6 @@
// Platform Monitor implementation
-os::PlatformMonitor::PlatformMonitor() {
- InitializeConditionVariable(&_cond);
- InitializeCriticalSection(&_mutex);
-}
-
-os::PlatformMonitor::~PlatformMonitor() {
- DeleteCriticalSection(&_mutex);
-}
-
-void os::PlatformMonitor::lock() {
- EnterCriticalSection(&_mutex);
-}
-
-void os::PlatformMonitor::unlock() {
- LeaveCriticalSection(&_mutex);
-}
-
-bool os::PlatformMonitor::try_lock() {
- return TryEnterCriticalSection(&_mutex);
-}
-
// Must already be locked
int os::PlatformMonitor::wait(jlong millis) {
assert(millis >= 0, "negative timeout");
@@ -5358,14 +5338,6 @@
return ret;
}
-void os::PlatformMonitor::notify() {
- WakeConditionVariable(&_cond);
-}
-
-void os::PlatformMonitor::notify_all() {
- WakeAllConditionVariable(&_cond);
-}
-
// Run the specified command in a separate process. Return its exit value,
// or -1 on failure (e.g. can't create a new process).
int os::fork_and_exec(char* cmd, bool use_vfork_if_available) {
--- a/src/hotspot/os/windows/os_windows.inline.hpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/os/windows/os_windows.inline.hpp Tue Feb 26 12:11:29 2019 -0500
@@ -86,4 +86,35 @@
win32::exit_process_or_thread(win32::EPT_PROCESS, num);
}
+// Platform Monitor implementation
+
+inline os::PlatformMonitor::PlatformMonitor() {
+ InitializeConditionVariable(&_cond);
+ InitializeCriticalSection(&_mutex);
+}
+
+inline os::PlatformMonitor::~PlatformMonitor() {
+ DeleteCriticalSection(&_mutex);
+}
+
+inline void os::PlatformMonitor::lock() {
+ EnterCriticalSection(&_mutex);
+}
+
+inline void os::PlatformMonitor::unlock() {
+ LeaveCriticalSection(&_mutex);
+}
+
+inline bool os::PlatformMonitor::try_lock() {
+ return TryEnterCriticalSection(&_mutex);
+}
+
+inline void os::PlatformMonitor::notify() {
+ WakeConditionVariable(&_cond);
+}
+
+inline void os::PlatformMonitor::notify_all() {
+ WakeAllConditionVariable(&_cond);
+}
+
#endif // OS_WINDOWS_OS_WINDOWS_INLINE_HPP
--- a/src/hotspot/os_cpu/linux_x86/gc/z/zBackingFile_linux_x86.cpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/os_cpu/linux_x86/gc/z/zBackingFile_linux_x86.cpp Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, 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
@@ -191,7 +191,7 @@
// Try to create an anonymous file using the O_TMPFILE flag. Note that this
// flag requires kernel >= 3.11. If this fails we fall back to open/unlink.
- const int fd_anon = open(path.get(), O_TMPFILE|O_EXCL|O_RDWR|O_CLOEXEC, S_IRUSR|S_IWUSR);
+ const int fd_anon = os::open(path.get(), O_TMPFILE|O_EXCL|O_RDWR|O_CLOEXEC, S_IRUSR|S_IWUSR);
if (fd_anon == -1) {
ZErrno err;
log_debug(gc, init)("Failed to create anonymous file in %s (%s)", path.get(),
@@ -217,7 +217,7 @@
snprintf(filename, sizeof(filename), "%s/%s.%d", path.get(), name, os::current_process_id());
// Create file
- const int fd = open(filename, O_CREAT|O_EXCL|O_RDWR|O_CLOEXEC, S_IRUSR|S_IWUSR);
+ const int fd = os::open(filename, O_CREAT|O_EXCL|O_RDWR|O_CLOEXEC, S_IRUSR|S_IWUSR);
if (fd == -1) {
ZErrno err;
log_error(gc, init)("Failed to create file %s (%s)", filename, err.to_string());
--- a/src/hotspot/share/ci/ciEnv.cpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/share/ci/ciEnv.cpp Tue Feb 26 12:11:29 2019 -0500
@@ -1253,7 +1253,7 @@
static char buffer[O_BUFLEN];
int ret = jio_snprintf(buffer, O_BUFLEN, "replay_pid%p_compid%d.log", os::current_process_id(), compile_id);
if (ret > 0) {
- int fd = open(buffer, O_RDWR | O_CREAT | O_TRUNC, 0666);
+ int fd = os::open(buffer, O_RDWR | O_CREAT | O_TRUNC, 0666);
if (fd != -1) {
FILE* replay_data_file = os::open(fd, "w");
if (replay_data_file != NULL) {
@@ -1271,7 +1271,7 @@
static char buffer[O_BUFLEN];
int ret = jio_snprintf(buffer, O_BUFLEN, "inline_pid%p_compid%d.log", os::current_process_id(), compile_id);
if (ret > 0) {
- int fd = open(buffer, O_RDWR | O_CREAT | O_TRUNC, 0666);
+ int fd = os::open(buffer, O_RDWR | O_CREAT | O_TRUNC, 0666);
if (fd != -1) {
FILE* inline_data_file = os::open(fd, "w");
if (inline_data_file != NULL) {
--- a/src/hotspot/share/classfile/classFileParser.cpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/share/classfile/classFileParser.cpp Tue Feb 26 12:11:29 2019 -0500
@@ -60,6 +60,7 @@
#include "runtime/arguments.hpp"
#include "runtime/handles.inline.hpp"
#include "runtime/javaCalls.hpp"
+#include "runtime/os.hpp"
#include "runtime/perfData.hpp"
#include "runtime/reflection.hpp"
#include "runtime/safepointVerifiers.hpp"
@@ -5743,16 +5744,13 @@
ClassLoader::package_from_name(unsafe_anonymous_host->name()->as_C_string(), NULL);
if (host_pkg_name != NULL) {
- size_t host_pkg_len = strlen(host_pkg_name);
+ int host_pkg_len = (int)strlen(host_pkg_name);
int class_name_len = _class_name->utf8_length();
- char* new_anon_name =
- NEW_RESOURCE_ARRAY(char, host_pkg_len + 1 + class_name_len);
- // Copy host package name and trailing /.
- strncpy(new_anon_name, host_pkg_name, host_pkg_len);
- new_anon_name[host_pkg_len] = '/';
- // Append unsafe anonymous class name. The unsafe anonymous class name can contain odd
- // characters. So, do a strncpy instead of using sprintf("%s...").
- strncpy(new_anon_name + host_pkg_len + 1, (char *)_class_name->base(), class_name_len);
+ int symbol_len = host_pkg_len + 1 + class_name_len;
+ char* new_anon_name = NEW_RESOURCE_ARRAY(char, symbol_len + 1);
+ int n = os::snprintf(new_anon_name, symbol_len + 1, "%s/%.*s",
+ host_pkg_name, class_name_len, _class_name->base());
+ assert(n == symbol_len, "Unexpected number of characters in string");
// Decrement old _class_name to avoid leaking.
_class_name->decrement_refcount();
@@ -5761,9 +5759,7 @@
// The new class name is created with a refcount of one. When installed into the InstanceKlass,
// it'll be two and when the ClassFileParser destructor runs, it'll go back to one and get deleted
// when the class is unloaded.
- _class_name = SymbolTable::new_symbol(new_anon_name,
- (int)host_pkg_len + 1 + class_name_len,
- CHECK);
+ _class_name = SymbolTable::new_symbol(new_anon_name, symbol_len, CHECK);
}
}
--- a/src/hotspot/share/classfile/classLoader.cpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/share/classfile/classLoader.cpp Tue Feb 26 12:11:29 2019 -0500
@@ -620,13 +620,14 @@
update_module_path_entry_list(path, THREAD);
}
+#endif // INCLUDE_CDS
+
void ClassLoader::close_jrt_image() {
- assert(ClassLoader::has_jrt_entry(), "Not applicable for exploded builds");
+ // Not applicable for exploded builds
+ if (!ClassLoader::has_jrt_entry()) return;
_jrt_entry->close_jimage();
}
-#endif // INCLUDE_CDS
-
// Construct the array of module/path pairs as specified to --patch-module
// for the boot loader to search ahead of the jimage, if the class being
// loaded is defined to a module that has been specified to --patch-module.
--- a/src/hotspot/share/classfile/classLoader.hpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/share/classfile/classLoader.hpp Tue Feb 26 12:11:29 2019 -0500
@@ -247,12 +247,12 @@
static void load_zip_library();
static void load_jimage_library();
+
+ public:
static ClassPathEntry* create_class_path_entry(const char *path, const struct stat* st,
bool throw_exception,
bool is_boot_append, TRAPS);
- public:
-
// If the package for the fully qualified class name is in the boot
// loader's package entry table then add_package() sets the classpath_index
// field so that get_system_package() will know to return a non-null value
--- a/src/hotspot/share/classfile/classLoaderExt.cpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/share/classfile/classLoaderExt.cpp Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, 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
@@ -203,13 +203,13 @@
file_end = end;
}
- int name_len = (int)strlen(file_start);
+ size_t name_len = strlen(file_start);
if (name_len > 0) {
ResourceMark rm(THREAD);
- char* libname = NEW_RESOURCE_ARRAY(char, dir_len + name_len + 1);
- *libname = 0;
- strncat(libname, dir_name, dir_len);
- strncat(libname, file_start, name_len);
+ size_t libname_len = dir_len + name_len;
+ char* libname = NEW_RESOURCE_ARRAY(char, libname_len + 1);
+ int n = os::snprintf(libname, libname_len + 1, "%.*s%s", dir_len, dir_name, file_start);
+ assert((size_t)n == libname_len, "Unexpected number of characters in string");
trace_class_path("library = ", libname);
ClassLoader::update_class_path_entry_list(libname, true, false);
}
--- a/src/hotspot/share/classfile/compactHashtable.cpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/share/classfile/compactHashtable.cpp Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2019, 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
@@ -198,7 +198,7 @@
quit("Unable to get hashtable dump file size", filename);
}
_size = st.st_size;
- _fd = open(filename, O_RDONLY | O_BINARY, 0);
+ _fd = os::open(filename, O_RDONLY | O_BINARY, 0);
if (_fd < 0) {
quit("Unable to open hashtable dump file", filename);
}
--- a/src/hotspot/share/classfile/javaClasses.cpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/share/classfile/javaClasses.cpp Tue Feb 26 12:11:29 2019 -0500
@@ -3635,7 +3635,7 @@
// distinct loaders) to ensure the metadata is kept alive.
// This mirror may be different than the one in clazz field.
new_resolved_method->obj_field_put(_vmholder_offset, m->method_holder()->java_mirror());
- resolved_method = ResolvedMethodTable::add_method(Handle(THREAD, new_resolved_method));
+ resolved_method = ResolvedMethodTable::add_method(m, Handle(THREAD, new_resolved_method));
}
return resolved_method;
}
--- a/src/hotspot/share/classfile/klassFactory.cpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/share/classfile/klassFactory.cpp Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+* Copyright (c) 2015, 2019, 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
@@ -46,22 +46,22 @@
InstanceKlass* ik,
Symbol* class_name,
Handle class_loader,
- Handle protection_domain, TRAPS) {
+ Handle protection_domain,
+ const ClassFileStream *cfs,
+ TRAPS) {
#if INCLUDE_CDS && INCLUDE_JVMTI
assert(ik != NULL, "sanity");
assert(ik->is_shared(), "expecting a shared class");
-
if (JvmtiExport::should_post_class_file_load_hook()) {
assert(THREAD->is_Java_thread(), "must be JavaThread");
// Post the CFLH
JvmtiCachedClassFileData* cached_class_file = NULL;
- JvmtiCachedClassFileData* archived_class_data = ik->get_archived_class_data();
- assert(archived_class_data != NULL, "shared class has no archived class data");
- unsigned char* ptr =
- VM_RedefineClasses::get_cached_class_file_bytes(archived_class_data);
- unsigned char* end_ptr =
- ptr + VM_RedefineClasses::get_cached_class_file_len(archived_class_data);
+ if (cfs == NULL) {
+ cfs = FileMapInfo::open_stream_for_jvmti(ik, CHECK_NULL);
+ }
+ unsigned char* ptr = (unsigned char*)cfs->buffer();
+ unsigned char* end_ptr = ptr + cfs->length();
unsigned char* old_ptr = ptr;
JvmtiExport::post_class_file_load_hook(class_name,
class_loader,
@@ -75,25 +75,9 @@
ClassLoaderData* loader_data =
ClassLoaderData::class_loader_data(class_loader());
int path_index = ik->shared_classpath_index();
- const char* pathname;
- if (path_index < 0) {
- // shared classes loaded by user defined class loader
- // do not have shared_classpath_index
- ModuleEntry* mod_entry = ik->module();
- if (mod_entry != NULL && (mod_entry->location() != NULL)) {
- ResourceMark rm;
- pathname = (const char*)(mod_entry->location()->as_C_string());
- } else {
- pathname = "";
- }
- } else {
- SharedClassPathEntry* ent =
- (SharedClassPathEntry*)FileMapInfo::shared_path(path_index);
- pathname = ent == NULL ? NULL : ent->name();
- }
ClassFileStream* stream = new ClassFileStream(ptr,
end_ptr - ptr,
- pathname,
+ cfs->source(),
ClassFileStream::verify);
ClassFileParser parser(stream,
class_name,
@@ -236,24 +220,6 @@
#if INCLUDE_CDS
if (DumpSharedSpaces) {
ClassLoader::record_result(result, stream, THREAD);
-#if INCLUDE_JVMTI
- assert(cached_class_file == NULL, "Sanity");
- // Archive the class stream data into the optional data section
- JvmtiCachedClassFileData *p;
- int len;
- const unsigned char *bytes;
- // event based tracing might set cached_class_file
- if ((bytes = result->get_cached_class_file_bytes()) != NULL) {
- len = result->get_cached_class_file_len();
- } else {
- len = stream->length();
- bytes = stream->buffer();
- }
- p = (JvmtiCachedClassFileData*)os::malloc(offset_of(JvmtiCachedClassFileData, data) + len, mtInternal);
- p->length = len;
- memcpy(p->data, bytes, len);
- result->set_archived_class_data(p);
-#endif // INCLUDE_JVMTI
}
#endif // INCLUDE_CDS
--- a/src/hotspot/share/classfile/klassFactory.hpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/share/classfile/klassFactory.hpp Tue Feb 26 12:11:29 2019 -0500
@@ -80,7 +80,9 @@
InstanceKlass* ik,
Symbol* class_name,
Handle class_loader,
- Handle protection_domain, TRAPS);
+ Handle protection_domain,
+ const ClassFileStream *cfs,
+ TRAPS);
};
#endif // SHARE_CLASSFILE_KLASSFACTORY_HPP
--- a/src/hotspot/share/classfile/symbolTable.cpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/share/classfile/symbolTable.cpp Tue Feb 26 12:11:29 2019 -0500
@@ -436,18 +436,16 @@
}
}
-void SymbolTable::add(ClassLoaderData* loader_data, const constantPoolHandle& cp,
- int names_count, const char** names, int* lengths,
- int* cp_indices, unsigned int* hashValues, TRAPS) {
+void SymbolTable::new_symbols(ClassLoaderData* loader_data, const constantPoolHandle& cp,
+ int names_count, const char** names, int* lengths,
+ int* cp_indices, unsigned int* hashValues, TRAPS) {
bool c_heap = !loader_data->is_the_null_class_loader_data();
for (int i = 0; i < names_count; i++) {
const char *name = names[i];
int len = lengths[i];
unsigned int hash = hashValues[i];
- Symbol* sym = SymbolTable::the_table()->lookup_common(name, len, hash);
- if (sym == NULL) {
- sym = SymbolTable::the_table()->do_add_if_needed(name, len, hash, c_heap, CHECK);
- }
+ assert(SymbolTable::the_table()->lookup_shared(name, len, hash) == NULL, "must have checked already");
+ Symbol* sym = SymbolTable::the_table()->do_add_if_needed(name, len, hash, c_heap, CHECK);
assert(sym->refcount() != 0, "lookup should have incremented the count");
cp->symbol_at_put(cp_indices[i], sym);
}
--- a/src/hotspot/share/classfile/symbolTable.hpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/share/classfile/symbolTable.hpp Tue Feb 26 12:11:29 2019 -0500
@@ -144,18 +144,11 @@
Symbol* do_add_if_needed(const char* name, int len, uintx hash, bool heap, TRAPS);
// Adding elements
- static void add(ClassLoaderData* loader_data,
- const constantPoolHandle& cp, int names_count,
- const char** names, int* lengths, int* cp_indices,
- unsigned int* hashValues, TRAPS);
-
static void new_symbols(ClassLoaderData* loader_data,
const constantPoolHandle& cp, int names_count,
const char** name, int* lengths,
int* cp_indices, unsigned int* hashValues,
- TRAPS) {
- add(loader_data, cp, names_count, name, lengths, cp_indices, hashValues, THREAD);
- }
+ TRAPS);
static Symbol* lookup_shared(const char* name, int len, unsigned int hash);
Symbol* lookup_dynamic(const char* name, int len, unsigned int hash);
--- a/src/hotspot/share/classfile/systemDictionary.cpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/share/classfile/systemDictionary.cpp Tue Feb 26 12:11:29 2019 -0500
@@ -1174,7 +1174,7 @@
TRAPS) {
InstanceKlass* ik = SystemDictionaryShared::find_builtin_class(class_name);
if (ik != NULL && ik->is_shared_boot_class()) {
- return load_shared_class(ik, Handle(), Handle(), THREAD);
+ return load_shared_class(ik, Handle(), Handle(), NULL, THREAD);
}
return NULL;
}
@@ -1274,7 +1274,9 @@
InstanceKlass* SystemDictionary::load_shared_class(InstanceKlass* ik,
Handle class_loader,
- Handle protection_domain, TRAPS) {
+ Handle protection_domain,
+ const ClassFileStream *cfs,
+ TRAPS) {
if (ik != NULL) {
Symbol* class_name = ik->name();
@@ -1321,7 +1323,7 @@
}
InstanceKlass* new_ik = KlassFactory::check_shared_class_file_load_hook(
- ik, class_name, class_loader, protection_domain, CHECK_NULL);
+ ik, class_name, class_loader, protection_domain, cfs, CHECK_NULL);
if (new_ik != NULL) {
// The class is changed by CFLH. Return the new class. The shared class is
// not used.
--- a/src/hotspot/share/classfile/systemDictionary.hpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/share/classfile/systemDictionary.hpp Tue Feb 26 12:11:29 2019 -0500
@@ -628,6 +628,7 @@
static InstanceKlass* load_shared_class(InstanceKlass* ik,
Handle class_loader,
Handle protection_domain,
+ const ClassFileStream *cfs,
TRAPS);
static InstanceKlass* load_shared_boot_class(Symbol* class_name,
TRAPS);
--- a/src/hotspot/share/classfile/systemDictionaryShared.cpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/share/classfile/systemDictionaryShared.cpp Tue Feb 26 12:11:29 2019 -0500
@@ -803,7 +803,7 @@
SystemDictionary::is_platform_class_loader(class_loader()))) {
Handle protection_domain =
SystemDictionaryShared::init_security_info(class_loader, ik, CHECK_NULL);
- return load_shared_class(ik, class_loader, protection_domain, THREAD);
+ return load_shared_class(ik, class_loader, protection_domain, NULL, THREAD);
}
}
return NULL;
@@ -873,13 +873,15 @@
}
return acquire_class_for_current_thread(record->_klass, class_loader,
- protection_domain, THREAD);
+ protection_domain, cfs,
+ THREAD);
}
InstanceKlass* SystemDictionaryShared::acquire_class_for_current_thread(
InstanceKlass *ik,
Handle class_loader,
Handle protection_domain,
+ const ClassFileStream *cfs,
TRAPS) {
ClassLoaderData* loader_data = ClassLoaderData::class_loader_data(class_loader());
@@ -900,7 +902,8 @@
loader_data->add_class(ik);
// Load and check super/interfaces, restore unsharable info
- InstanceKlass* shared_klass = load_shared_class(ik, class_loader, protection_domain, THREAD);
+ InstanceKlass* shared_klass = load_shared_class(ik, class_loader, protection_domain,
+ cfs, THREAD);
if (shared_klass == NULL || HAS_PENDING_EXCEPTION) {
// TODO: clean up <ik> so it can be used again
return NULL;
--- a/src/hotspot/share/classfile/systemDictionaryShared.hpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/share/classfile/systemDictionaryShared.hpp Tue Feb 26 12:11:29 2019 -0500
@@ -207,6 +207,7 @@
InstanceKlass *ik,
Handle class_loader,
Handle protection_domain,
+ const ClassFileStream* cfs,
TRAPS);
static DumpTimeSharedClassInfo* find_or_allocate_info_for(InstanceKlass* k);
static void write_dictionary(RunTimeSharedDictionary* dictionary, bool is_builtin);
--- a/src/hotspot/share/classfile/verifier.cpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/share/classfile/verifier.cpp Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2019, 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
@@ -2981,18 +2981,16 @@
}
// add one dimension to component
length++;
- arr_sig_str = NEW_RESOURCE_ARRAY_IN_THREAD(THREAD, char, length);
- arr_sig_str[0] = '[';
- strncpy(&arr_sig_str[1], component_name, length - 1);
+ arr_sig_str = NEW_RESOURCE_ARRAY_IN_THREAD(THREAD, char, length + 1);
+ int n = os::snprintf(arr_sig_str, length + 1, "[%s", component_name);
+ assert(n == length, "Unexpected number of characters in string");
} else { // it's an object or interface
const char* component_name = component_type.name()->as_utf8();
// add one dimension to component with 'L' prepended and ';' postpended.
length = (int)strlen(component_name) + 3;
- arr_sig_str = NEW_RESOURCE_ARRAY_IN_THREAD(THREAD, char, length);
- arr_sig_str[0] = '[';
- arr_sig_str[1] = 'L';
- strncpy(&arr_sig_str[2], component_name, length - 2);
- arr_sig_str[length - 1] = ';';
+ arr_sig_str = NEW_RESOURCE_ARRAY_IN_THREAD(THREAD, char, length + 1);
+ int n = os::snprintf(arr_sig_str, length + 1, "[L%s;", component_name);
+ assert(n == length, "Unexpected number of characters in string");
}
Symbol* arr_sig = create_temporary_symbol(
arr_sig_str, length, CHECK_VERIFY(this));
--- a/src/hotspot/share/code/nmethod.cpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/share/code/nmethod.cpp Tue Feb 26 12:11:29 2019 -0500
@@ -1370,6 +1370,8 @@
assert(_speculation_log == NULL, "should have been nulled out when transitioned to zombie");
#endif
+ Universe::heap()->flush_nmethod(this);
+
CodeBlob::flush();
CodeCache::free(this);
}
--- a/src/hotspot/share/gc/shared/collectedHeap.hpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/share/gc/shared/collectedHeap.hpp Tue Feb 26 12:11:29 2019 -0500
@@ -521,6 +521,7 @@
// Override with specific mechanism for each specialized heap type.
virtual void register_nmethod(nmethod* nm) {}
virtual void unregister_nmethod(nmethod* nm) {}
+ virtual void flush_nmethod(nmethod* nm) {}
virtual void verify_nmethod(nmethod* nmethod) {}
void trace_heap_before_gc(const GCTracer* gc_tracer);
--- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp Tue Feb 26 12:11:29 2019 -0500
@@ -2639,6 +2639,10 @@
return memory_pools;
}
+MemoryUsage ShenandoahHeap::memory_usage() {
+ return _memory_pool->get_memory_usage();
+}
+
void ShenandoahHeap::enter_evacuation() {
_oom_evac_handler.enter_evacuation();
}
--- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp Tue Feb 26 12:11:29 2019 -0500
@@ -511,6 +511,7 @@
GrowableArray<GCMemoryManager*> memory_managers();
GrowableArray<MemoryPool*> memory_pools();
+ MemoryUsage memory_usage();
GCTracer* tracer();
GCTimer* gc_timer() const;
CollectorPolicy* collector_policy() const;
--- a/src/hotspot/share/gc/shenandoah/shenandoahMemoryPool.cpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/share/gc/shenandoah/shenandoahMemoryPool.cpp Tue Feb 26 12:11:29 2019 -0500
@@ -26,7 +26,7 @@
ShenandoahMemoryPool::ShenandoahMemoryPool(ShenandoahHeap* heap) :
CollectedMemoryPool("Shenandoah",
- heap->capacity(),
+ heap->initial_capacity(),
heap->max_capacity(),
true /* support_usage_threshold */),
_heap(heap) {}
@@ -37,9 +37,15 @@
size_t used = used_in_bytes();
size_t committed = _heap->committed();
+ // These asserts can never fail: max is stable, and all updates to other values never overflow max.
assert(initial <= max, "initial: " SIZE_FORMAT ", max: " SIZE_FORMAT, initial, max);
assert(used <= max, "used: " SIZE_FORMAT ", max: " SIZE_FORMAT, used, max);
assert(committed <= max, "committed: " SIZE_FORMAT ", max: " SIZE_FORMAT, committed, max);
+
+ // Committed and used are updated concurrently and independently. They can momentarily break
+ // the assert below, which would also fail in downstream code. To avoid that, adjust values
+ // to make sense under the race. See JDK-8207200.
+ committed = MAX2(used, committed);
assert(used <= committed, "used: " SIZE_FORMAT ", committed: " SIZE_FORMAT, used, committed);
return MemoryUsage(initial, used, committed, max);
--- a/src/hotspot/share/gc/z/zBarrierSetNMethod.cpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/share/gc/z/zBarrierSetNMethod.cpp Tue Feb 26 12:11:29 2019 -0500
@@ -27,12 +27,12 @@
#include "gc/z/zGlobals.hpp"
#include "gc/z/zLock.inline.hpp"
#include "gc/z/zOopClosures.hpp"
-#include "gc/z/zNMethodTable.hpp"
+#include "gc/z/zNMethod.hpp"
#include "gc/z/zThreadLocalData.hpp"
#include "logging/log.hpp"
bool ZBarrierSetNMethod::nmethod_entry_barrier(nmethod* nm) {
- ZLocker<ZReentrantLock> locker(ZNMethodTable::lock_for_nmethod(nm));
+ ZLocker<ZReentrantLock> locker(ZNMethod::lock_for_nmethod(nm));
log_trace(nmethod, barrier)("Entered critical zone for %p", nm);
if (!is_armed(nm)) {
--- a/src/hotspot/share/gc/z/zCollectedHeap.cpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/share/gc/z/zCollectedHeap.cpp Tue Feb 26 12:11:29 2019 -0500
@@ -27,7 +27,7 @@
#include "gc/z/zCollectedHeap.hpp"
#include "gc/z/zGlobals.hpp"
#include "gc/z/zHeap.inline.hpp"
-#include "gc/z/zNMethodTable.hpp"
+#include "gc/z/zNMethod.hpp"
#include "gc/z/zServiceability.hpp"
#include "gc/z/zStat.hpp"
#include "gc/z/zUtils.inline.hpp"
@@ -255,11 +255,15 @@
}
void ZCollectedHeap::register_nmethod(nmethod* nm) {
- ZNMethodTable::register_nmethod(nm);
+ ZNMethod::register_nmethod(nm);
}
void ZCollectedHeap::unregister_nmethod(nmethod* nm) {
- ZNMethodTable::unregister_nmethod(nm);
+ ZNMethod::unregister_nmethod(nm);
+}
+
+void ZCollectedHeap::flush_nmethod(nmethod* nm) {
+ ZNMethod::flush_nmethod(nm);
}
void ZCollectedHeap::verify_nmethod(nmethod* nm) {
--- a/src/hotspot/share/gc/z/zCollectedHeap.hpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/share/gc/z/zCollectedHeap.hpp Tue Feb 26 12:11:29 2019 -0500
@@ -105,6 +105,7 @@
virtual void register_nmethod(nmethod* nm);
virtual void unregister_nmethod(nmethod* nm);
+ virtual void flush_nmethod(nmethod* nm);
virtual void verify_nmethod(nmethod* nmethod);
virtual WorkGang* get_safepoint_workers();
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/share/gc/z/zNMethod.cpp Tue Feb 26 12:11:29 2019 -0500
@@ -0,0 +1,386 @@
+/*
+ * Copyright (c) 2017, 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.
+ */
+
+#include "precompiled.hpp"
+#include "code/relocInfo.hpp"
+#include "code/nmethod.hpp"
+#include "code/icBuffer.hpp"
+#include "gc/shared/barrierSet.hpp"
+#include "gc/shared/barrierSetNMethod.hpp"
+#include "gc/z/zGlobals.hpp"
+#include "gc/z/zLock.inline.hpp"
+#include "gc/z/zNMethod.hpp"
+#include "gc/z/zNMethodData.hpp"
+#include "gc/z/zNMethodTable.hpp"
+#include "gc/z/zOopClosures.inline.hpp"
+#include "gc/z/zTask.hpp"
+#include "gc/z/zWorkers.hpp"
+#include "logging/log.hpp"
+#include "memory/allocation.inline.hpp"
+#include "memory/iterator.hpp"
+#include "memory/resourceArea.hpp"
+#include "runtime/atomic.hpp"
+#include "runtime/orderAccess.hpp"
+#include "utilities/debug.hpp"
+
+static ZNMethodData* gc_data(const nmethod* nm) {
+ return nm->gc_data<ZNMethodData>();
+}
+
+static void set_gc_data(nmethod* nm, ZNMethodData* data) {
+ return nm->set_gc_data<ZNMethodData>(data);
+}
+
+void ZNMethod::attach_gc_data(nmethod* nm) {
+ GrowableArray<oop*> immediate_oops;
+ bool non_immediate_oops = false;
+
+ // Find all oops relocations
+ RelocIterator iter(nm);
+ while (iter.next()) {
+ if (iter.type() != relocInfo::oop_type) {
+ // Not an oop
+ continue;
+ }
+
+ oop_Relocation* r = iter.oop_reloc();
+
+ if (!r->oop_is_immediate()) {
+ // Non-immediate oop found
+ non_immediate_oops = true;
+ continue;
+ }
+
+ if (r->oop_value() != NULL) {
+ // Non-NULL immediate oop found. NULL oops can safely be
+ // ignored since the method will be re-registered if they
+ // are later patched to be non-NULL.
+ immediate_oops.push(r->oop_addr());
+ }
+ }
+
+ // Attach GC data to nmethod
+ ZNMethodData* data = gc_data(nm);
+ if (data == NULL) {
+ data = new ZNMethodData();
+ set_gc_data(nm, data);
+ }
+
+ // Attach oops in GC data
+ ZNMethodDataOops* const new_oops = ZNMethodDataOops::create(immediate_oops, non_immediate_oops);
+ ZNMethodDataOops* const old_oops = data->swap_oops(new_oops);
+ ZNMethodDataOops::destroy(old_oops);
+}
+
+ZReentrantLock* ZNMethod::lock_for_nmethod(nmethod* nm) {
+ return gc_data(nm)->lock();
+}
+
+void ZNMethod::log_register(const nmethod* nm) {
+ LogTarget(Trace, gc, nmethod) log;
+ if (!log.is_enabled()) {
+ return;
+ }
+
+ const ZNMethodDataOops* const oops = gc_data(nm)->oops();
+
+ log.print("Register NMethod: %s.%s (" PTR_FORMAT "), "
+ "Compiler: %s, Oops: %d, ImmediateOops: " SIZE_FORMAT ", NonImmediateOops: %s",
+ nm->method()->method_holder()->external_name(),
+ nm->method()->name()->as_C_string(),
+ p2i(nm),
+ nm->compiler_name(),
+ nm->oops_count() - 1,
+ oops->immediates_count(),
+ oops->has_non_immediates() ? "Yes" : "No");
+
+ LogTarget(Trace, gc, nmethod, oops) log_oops;
+ if (!log_oops.is_enabled()) {
+ return;
+ }
+
+ // Print nmethod oops table
+ {
+ oop* const begin = nm->oops_begin();
+ oop* const end = nm->oops_end();
+ for (oop* p = begin; p < end; p++) {
+ log_oops.print(" Oop[" SIZE_FORMAT "] " PTR_FORMAT " (%s)",
+ (p - begin), p2i(*p), (*p)->klass()->external_name());
+ }
+ }
+
+ // Print nmethod immediate oops
+ {
+ oop** const begin = oops->immediates_begin();
+ oop** const end = oops->immediates_end();
+ for (oop** p = begin; p < end; p++) {
+ log_oops.print(" ImmediateOop[" SIZE_FORMAT "] " PTR_FORMAT " @ " PTR_FORMAT " (%s)",
+ (p - begin), p2i(**p), p2i(*p), (**p)->klass()->external_name());
+ }
+ }
+}
+
+void ZNMethod::log_unregister(const nmethod* nm) {
+ LogTarget(Debug, gc, nmethod) log;
+ if (!log.is_enabled()) {
+ return;
+ }
+
+ log.print("Unregister NMethod: %s.%s (" PTR_FORMAT ")",
+ nm->method()->method_holder()->external_name(),
+ nm->method()->name()->as_C_string(),
+ p2i(nm));
+}
+
+void ZNMethod::register_nmethod(nmethod* nm) {
+ ResourceMark rm;
+
+ // Create and attach gc data
+ attach_gc_data(nm);
+
+ log_register(nm);
+
+ ZNMethodTable::register_nmethod(nm);
+
+ // Disarm nmethod entry barrier
+ disarm_nmethod(nm);
+}
+
+void ZNMethod::unregister_nmethod(nmethod* nm) {
+ assert(CodeCache_lock->owned_by_self(), "Lock must be held");
+
+ if (Thread::current()->is_Code_cache_sweeper_thread()) {
+ // The sweeper must wait for any ongoing iteration to complete
+ // before it can unregister an nmethod.
+ ZNMethodTable::wait_until_iteration_done();
+ }
+
+ ResourceMark rm;
+
+ log_unregister(nm);
+
+ ZNMethodTable::unregister_nmethod(nm);
+}
+
+void ZNMethod::flush_nmethod(nmethod* nm) {
+ // Destroy GC data
+ delete gc_data(nm);
+}
+
+void ZNMethod::disarm_nmethod(nmethod* nm) {
+ BarrierSetNMethod* const bs = BarrierSet::barrier_set()->barrier_set_nmethod();
+ if (bs != NULL) {
+ bs->disarm(nm);
+ }
+}
+
+void ZNMethod::nmethod_oops_do(nmethod* nm, OopClosure* cl) {
+ // Process oops table
+ {
+ oop* const begin = nm->oops_begin();
+ oop* const end = nm->oops_end();
+ for (oop* p = begin; p < end; p++) {
+ if (*p != Universe::non_oop_word()) {
+ cl->do_oop(p);
+ }
+ }
+ }
+
+ ZNMethodDataOops* const oops = gc_data(nm)->oops();
+
+ // Process immediate oops
+ {
+ oop** const begin = oops->immediates_begin();
+ oop** const end = oops->immediates_end();
+ for (oop** p = begin; p < end; p++) {
+ if (**p != Universe::non_oop_word()) {
+ cl->do_oop(*p);
+ }
+ }
+ }
+
+ // Process non-immediate oops
+ if (oops->has_non_immediates()) {
+ nm->fix_oop_relocations();
+ }
+}
+
+class ZNMethodToOopsDoClosure : public NMethodClosure {
+private:
+ OopClosure* _cl;
+
+public:
+ ZNMethodToOopsDoClosure(OopClosure* cl) :
+ _cl(cl) {}
+
+ virtual void do_nmethod(nmethod* nm) {
+ ZNMethod::nmethod_oops_do(nm, _cl);
+ }
+};
+
+void ZNMethod::oops_do_begin() {
+ ZNMethodTable::nmethods_do_begin();
+}
+
+void ZNMethod::oops_do_end() {
+ ZNMethodTable::nmethods_do_end();
+}
+
+void ZNMethod::oops_do(OopClosure* cl) {
+ ZNMethodToOopsDoClosure nmethod_cl(cl);
+ ZNMethodTable::nmethods_do(&nmethod_cl);
+}
+
+class ZNMethodUnlinkClosure : public NMethodClosure {
+private:
+ bool _unloading_occurred;
+ volatile bool _failed;
+
+ void set_failed() {
+ Atomic::store(true, &_failed);
+ }
+
+public:
+ ZNMethodUnlinkClosure(bool unloading_occurred) :
+ _unloading_occurred(unloading_occurred),
+ _failed(false) {}
+
+ virtual void do_nmethod(nmethod* nm) {
+ if (failed()) {
+ return;
+ }
+
+ if (!nm->is_alive()) {
+ return;
+ }
+
+ ZLocker<ZReentrantLock> locker(ZNMethod::lock_for_nmethod(nm));
+
+ if (nm->is_unloading()) {
+ // Unlinking of the dependencies must happen before the
+ // handshake separating unlink and purge.
+ nm->flush_dependencies(false /* delete_immediately */);
+
+ // We don't need to take the lock when unlinking nmethods from
+ // the Method, because it is only concurrently unlinked by
+ // the entry barrier, which acquires the per nmethod lock.
+ nm->unlink_from_method(false /* acquire_lock */);
+ return;
+ }
+
+ // Heal oops and disarm
+ ZNMethodOopClosure cl;
+ ZNMethod::nmethod_oops_do(nm, &cl);
+ ZNMethod::disarm_nmethod(nm);
+
+ // Clear compiled ICs and exception caches
+ if (!nm->unload_nmethod_caches(_unloading_occurred)) {
+ set_failed();
+ }
+ }
+
+ bool failed() const {
+ return Atomic::load(&_failed);
+ }
+};
+
+class ZNMethodUnlinkTask : public ZTask {
+private:
+ ZNMethodUnlinkClosure _cl;
+ ICRefillVerifier* _verifier;
+
+public:
+ ZNMethodUnlinkTask(bool unloading_occurred, ICRefillVerifier* verifier) :
+ ZTask("ZNMethodUnlinkTask"),
+ _cl(unloading_occurred),
+ _verifier(verifier) {
+ ZNMethodTable::nmethods_do_begin();
+ }
+
+ ~ZNMethodUnlinkTask() {
+ ZNMethodTable::nmethods_do_end();
+ }
+
+ virtual void work() {
+ ICRefillVerifierMark mark(_verifier);
+ ZNMethodTable::nmethods_do(&_cl);
+ }
+
+ bool success() const {
+ return !_cl.failed();
+ }
+};
+
+void ZNMethod::unlink(ZWorkers* workers, bool unloading_occurred) {
+ for (;;) {
+ ICRefillVerifier verifier;
+
+ {
+ ZNMethodUnlinkTask task(unloading_occurred, &verifier);
+ workers->run_concurrent(&task);
+ if (task.success()) {
+ return;
+ }
+ }
+
+ // Cleaning failed because we ran out of transitional IC stubs,
+ // so we have to refill and try again. Refilling requires taking
+ // a safepoint, so we temporarily leave the suspendible thread set.
+ SuspendibleThreadSetLeaver sts;
+ InlineCacheBuffer::refill_ic_stubs();
+ }
+}
+
+class ZNMethodPurgeClosure : public NMethodClosure {
+public:
+ virtual void do_nmethod(nmethod* nm) {
+ if (nm->is_alive() && nm->is_unloading()) {
+ nm->make_unloaded();
+ }
+ }
+};
+
+class ZNMethodPurgeTask : public ZTask {
+private:
+ ZNMethodPurgeClosure _cl;
+
+public:
+ ZNMethodPurgeTask() :
+ ZTask("ZNMethodPurgeTask"),
+ _cl() {
+ ZNMethodTable::nmethods_do_begin();
+ }
+
+ ~ZNMethodPurgeTask() {
+ ZNMethodTable::nmethods_do_end();
+ }
+
+ virtual void work() {
+ ZNMethodTable::nmethods_do(&_cl);
+ }
+};
+
+void ZNMethod::purge(ZWorkers* workers) {
+ ZNMethodPurgeTask task;
+ workers->run_concurrent(&task);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/share/gc/z/zNMethod.hpp Tue Feb 26 12:11:29 2019 -0500
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2017, 2019, 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.
+ */
+
+#ifndef SHARE_GC_Z_ZNMETHOD_HPP
+#define SHARE_GC_Z_ZNMETHOD_HPP
+
+#include "memory/allocation.hpp"
+
+class nmethod;
+class OopClosure;
+class ZReentrantLock;
+class ZWorkers;
+
+class ZNMethod : public AllStatic {
+private:
+ static void attach_gc_data(nmethod* nm);
+
+ static void log_register(const nmethod* nm);
+ static void log_unregister(const nmethod* nm);
+
+public:
+ static void register_nmethod(nmethod* nm);
+ static void unregister_nmethod(nmethod* nm);
+ static void flush_nmethod(nmethod* nm);
+
+ static void disarm_nmethod(nmethod* nm);
+
+ static void nmethod_oops_do(nmethod* nm, OopClosure* cl);
+
+ static void oops_do_begin();
+ static void oops_do_end();
+ static void oops_do(OopClosure* cl);
+
+ static ZReentrantLock* lock_for_nmethod(nmethod* nm);
+
+ static void unlink(ZWorkers* workers, bool unloading_occurred);
+ static void purge(ZWorkers* workers);
+};
+
+#endif // SHARE_GC_Z_ZNMETHOD_HPP
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/share/gc/z/zNMethodAllocator.cpp Tue Feb 26 12:11:29 2019 -0500
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2019, 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.
+ */
+
+#include "precompiled.hpp"
+#include "gc/z/zArray.inline.hpp"
+#include "gc/z/zNMethodAllocator.hpp"
+#include "memory/allocation.hpp"
+
+ZArray<void*> ZNMethodAllocator::_deferred_frees;
+bool ZNMethodAllocator::_defer_frees(false);
+
+void ZNMethodAllocator::immediate_free(void* data) {
+ FREE_C_HEAP_ARRAY(uint8_t, data);
+}
+
+void ZNMethodAllocator::deferred_free(void* data) {
+ _deferred_frees.add(data);
+}
+
+void* ZNMethodAllocator::allocate(size_t size) {
+ return NEW_C_HEAP_ARRAY(uint8_t, size, mtGC);
+}
+
+void ZNMethodAllocator::free(void* data) {
+ if (data == NULL) {
+ return;
+ }
+
+ if (_defer_frees) {
+ deferred_free(data);
+ } else {
+ immediate_free(data);
+ }
+}
+
+void ZNMethodAllocator::activate_deferred_frees() {
+ assert(_deferred_frees.is_empty(), "precondition");
+ _defer_frees = true;
+}
+
+void ZNMethodAllocator::deactivate_and_process_deferred_frees() {
+ _defer_frees = false;
+
+ ZArrayIterator<void*> iter(&_deferred_frees);
+ for (void* data; iter.next(&data);) {
+ immediate_free(data);
+ }
+ _deferred_frees.clear();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/share/gc/z/zNMethodAllocator.hpp Tue Feb 26 12:11:29 2019 -0500
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2019, 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.
+ */
+
+#ifndef SHARE_GC_Z_ZNMETHODALLOCATOR_HPP
+#define SHARE_GC_Z_ZNMETHODALLOCATOR_HPP
+
+#include "memory/allocation.hpp"
+#include "gc/z/zArray.hpp"
+
+class ZNMethodAllocator : public AllStatic {
+private:
+ static ZArray<void*> _deferred_frees;
+ static bool _defer_frees;
+
+ static void immediate_free(void* data);
+ static void deferred_free(void* data);
+
+public:
+ static void* allocate(size_t size);
+ static void free(void* data);
+
+ static void activate_deferred_frees();
+ static void deactivate_and_process_deferred_frees();
+};
+
+#endif // SHARE_GC_Z_ZNMETHODALLOCATOR_HPP
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/share/gc/z/zNMethodData.cpp Tue Feb 26 12:11:29 2019 -0500
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 2017, 2019, 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.
+ */
+
+#include "precompiled.hpp"
+#include "gc/z/zLock.inline.hpp"
+#include "gc/z/zNMethodData.hpp"
+#include "memory/allocation.hpp"
+#include "runtime/atomic.hpp"
+#include "runtime/orderAccess.hpp"
+#include "utilities/align.hpp"
+#include "utilities/debug.hpp"
+#include "utilities/growableArray.hpp"
+
+size_t ZNMethodDataOops::header_size() {
+ const size_t size = sizeof(ZNMethodDataOops);
+ assert(is_aligned(size, sizeof(oop*)), "Header misaligned");
+ return size;
+}
+
+ZNMethodDataOops* ZNMethodDataOops::create(const GrowableArray<oop*>& immediates, bool has_non_immediates) {
+ // Allocate memory for the ZNMethodDataOops object
+ // plus the immediate oop* array that follows right after.
+ const size_t size = ZNMethodDataOops::header_size() + (sizeof(oop*) * immediates.length());
+ void* const mem = NEW_C_HEAP_ARRAY(uint8_t, size, mtGC);
+ return ::new (mem) ZNMethodDataOops(immediates, has_non_immediates);
+}
+
+void ZNMethodDataOops::destroy(ZNMethodDataOops* oops) {
+ FREE_C_HEAP_ARRAY(uint8_t, oops);
+}
+
+ZNMethodDataOops::ZNMethodDataOops(const GrowableArray<oop*>& immediates, bool has_non_immediates) :
+ _nimmediates(immediates.length()),
+ _has_non_immediates(has_non_immediates) {
+ // Save all immediate oops
+ for (size_t i = 0; i < _nimmediates; i++) {
+ immediates_begin()[i] = immediates.at(i);
+ }
+}
+
+size_t ZNMethodDataOops::immediates_count() const {
+ return _nimmediates;
+}
+
+oop** ZNMethodDataOops::immediates_begin() const {
+ // The immediate oop* array starts immediately after this object
+ return (oop**)((uintptr_t)this + header_size());
+}
+
+oop** ZNMethodDataOops::immediates_end() const {
+ return immediates_begin() + immediates_count();
+}
+
+bool ZNMethodDataOops::has_non_immediates() const {
+ return _has_non_immediates;
+}
+
+ZNMethodData::ZNMethodData() :
+ _lock(),
+ _oops(NULL) {}
+
+ZNMethodData::~ZNMethodData() {
+ ZNMethodDataOops::destroy(_oops);
+}
+
+ZReentrantLock* ZNMethodData::lock() {
+ return &_lock;
+}
+
+ZNMethodDataOops* ZNMethodData::oops() const {
+ return OrderAccess::load_acquire(&_oops);
+}
+
+ZNMethodDataOops* ZNMethodData::swap_oops(ZNMethodDataOops* new_oops) {
+ ZLocker<ZReentrantLock> locker(&_lock);
+ ZNMethodDataOops* const old_oops = _oops;
+ _oops = new_oops;
+ return old_oops;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/share/gc/z/zNMethodData.hpp Tue Feb 26 12:11:29 2019 -0500
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2017, 2019, 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.
+ */
+
+#include "gc/z/zLock.hpp"
+#include "memory/allocation.hpp"
+#include "oops/oopsHierarchy.hpp"
+#include "utilities/globalDefinitions.hpp"
+
+#ifndef SHARE_GC_Z_ZNMETHODDATA_HPP
+#define SHARE_GC_Z_ZNMETHODDATA_HPP
+
+class nmethod;
+template <typename T> class GrowableArray;
+
+class ZNMethodDataOops {
+private:
+ const size_t _nimmediates;
+ bool _has_non_immediates;
+
+ static size_t header_size();
+
+ ZNMethodDataOops(const GrowableArray<oop*>& immediates, bool has_non_immediates);
+
+public:
+ static ZNMethodDataOops* create(const GrowableArray<oop*>& immediates, bool has_non_immediates);
+ static void destroy(ZNMethodDataOops* oops);
+
+ size_t immediates_count() const;
+ oop** immediates_begin() const;
+ oop** immediates_end() const;
+
+ bool has_non_immediates() const;
+};
+
+class ZNMethodData : public CHeapObj<mtGC> {
+private:
+ ZReentrantLock _lock;
+ ZNMethodDataOops* volatile _oops;
+
+public:
+ ZNMethodData();
+ ~ZNMethodData();
+
+ ZReentrantLock* lock();
+
+ ZNMethodDataOops* oops() const;
+ ZNMethodDataOops* swap_oops(ZNMethodDataOops* oops);
+};
+
+#endif // SHARE_GC_Z_ZNMETHODDATA_HPP
--- a/src/hotspot/share/gc/z/zNMethodTable.cpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/share/gc/z/zNMethodTable.cpp Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, 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
@@ -27,205 +27,38 @@
#include "code/icBuffer.hpp"
#include "gc/shared/barrierSet.hpp"
#include "gc/shared/barrierSetNMethod.hpp"
-#include "gc/z/zArray.inline.hpp"
#include "gc/z/zGlobals.hpp"
#include "gc/z/zHash.inline.hpp"
#include "gc/z/zLock.inline.hpp"
+#include "gc/z/zNMethodAllocator.hpp"
+#include "gc/z/zNMethodData.hpp"
#include "gc/z/zNMethodTable.hpp"
+#include "gc/z/zNMethodTableEntry.hpp"
+#include "gc/z/zNMethodTableIteration.hpp"
#include "gc/z/zOopClosures.inline.hpp"
#include "gc/z/zTask.hpp"
#include "gc/z/zWorkers.hpp"
#include "logging/log.hpp"
-#include "memory/allocation.inline.hpp"
+#include "memory/allocation.hpp"
+#include "memory/iterator.hpp"
#include "memory/resourceArea.hpp"
#include "runtime/atomic.hpp"
#include "runtime/orderAccess.hpp"
-#include "runtime/os.hpp"
#include "utilities/debug.hpp"
-class ZNMethodDataImmediateOops {
-private:
- const size_t _nimmediate_oops;
-
- static size_t header_size();
-
- ZNMethodDataImmediateOops(const GrowableArray<oop*>& immediate_oops);
-
-public:
- static ZNMethodDataImmediateOops* create(const GrowableArray<oop*>& immediate_oops);
- static void destroy(ZNMethodDataImmediateOops* data_immediate_oops);
-
- size_t immediate_oops_count() const;
- oop** immediate_oops_begin() const;
- oop** immediate_oops_end() const;
-};
-
-size_t ZNMethodDataImmediateOops::header_size() {
- const size_t size = sizeof(ZNMethodDataImmediateOops);
- assert(is_aligned(size, sizeof(oop*)), "Header misaligned");
- return size;
-}
-
-ZNMethodDataImmediateOops* ZNMethodDataImmediateOops::create(const GrowableArray<oop*>& immediate_oops) {
- // Allocate memory for the ZNMethodDataImmediateOops object
- // plus the immediate oop* array that follows right after.
- const size_t size = ZNMethodDataImmediateOops::header_size() + (sizeof(oop*) * immediate_oops.length());
- void* const data_immediate_oops = NEW_C_HEAP_ARRAY(uint8_t, size, mtGC);
- return ::new (data_immediate_oops) ZNMethodDataImmediateOops(immediate_oops);
-}
-
-void ZNMethodDataImmediateOops::destroy(ZNMethodDataImmediateOops* data_immediate_oops) {
- ZNMethodTable::safe_delete(data_immediate_oops);
-}
-
-ZNMethodDataImmediateOops::ZNMethodDataImmediateOops(const GrowableArray<oop*>& immediate_oops) :
- _nimmediate_oops(immediate_oops.length()) {
- // Save all immediate oops
- for (size_t i = 0; i < _nimmediate_oops; i++) {
- immediate_oops_begin()[i] = immediate_oops.at(i);
- }
-}
-
-size_t ZNMethodDataImmediateOops::immediate_oops_count() const {
- return _nimmediate_oops;
-}
-
-oop** ZNMethodDataImmediateOops::immediate_oops_begin() const {
- // The immediate oop* array starts immediately after this object
- return (oop**)((uintptr_t)this + header_size());
-}
-
-oop** ZNMethodDataImmediateOops::immediate_oops_end() const {
- return immediate_oops_begin() + immediate_oops_count();
-}
-
-class ZNMethodData {
-private:
- ZReentrantLock _lock;
- ZNMethodDataImmediateOops* volatile _immediate_oops;
-
- ZNMethodData(nmethod* nm);
-
-public:
- static ZNMethodData* create(nmethod* nm);
- static void destroy(ZNMethodData* data);
-
- ZReentrantLock* lock();
-
- ZNMethodDataImmediateOops* immediate_oops() const;
- ZNMethodDataImmediateOops* swap_immediate_oops(const GrowableArray<oop*>& immediate_oops);
-};
-
-ZNMethodData* ZNMethodData::create(nmethod* nm) {
- void* const method = NEW_C_HEAP_ARRAY(uint8_t, sizeof(ZNMethodData), mtGC);
- return ::new (method) ZNMethodData(nm);
-}
-
-void ZNMethodData::destroy(ZNMethodData* data) {
- ZNMethodDataImmediateOops::destroy(data->immediate_oops());
- ZNMethodTable::safe_delete(data);
-}
-
-ZNMethodData::ZNMethodData(nmethod* nm) :
- _lock(),
- _immediate_oops(NULL) {}
-
-ZReentrantLock* ZNMethodData::lock() {
- return &_lock;
-}
-
-ZNMethodDataImmediateOops* ZNMethodData::immediate_oops() const {
- return OrderAccess::load_acquire(&_immediate_oops);
-}
-
-ZNMethodDataImmediateOops* ZNMethodData::swap_immediate_oops(const GrowableArray<oop*>& immediate_oops) {
- ZNMethodDataImmediateOops* const data_immediate_oops =
- immediate_oops.is_empty() ? NULL : ZNMethodDataImmediateOops::create(immediate_oops);
- return Atomic::xchg(data_immediate_oops, &_immediate_oops);
-}
-
-static ZNMethodData* gc_data(const nmethod* nm) {
- return nm->gc_data<ZNMethodData>();
-}
-
-static void set_gc_data(nmethod* nm, ZNMethodData* data) {
- return nm->set_gc_data<ZNMethodData>(data);
-}
-
ZNMethodTableEntry* ZNMethodTable::_table = NULL;
size_t ZNMethodTable::_size = 0;
-ZLock ZNMethodTable::_iter_lock;
-ZNMethodTableEntry* ZNMethodTable::_iter_table = NULL;
-size_t ZNMethodTable::_iter_table_size = 0;
-ZArray<void*> ZNMethodTable::_iter_deferred_deletes;
size_t ZNMethodTable::_nregistered = 0;
size_t ZNMethodTable::_nunregistered = 0;
-volatile size_t ZNMethodTable::_claimed = 0;
-
-void ZNMethodTable::safe_delete(void* data) {
- if (data == NULL) {
- return;
- }
+ZNMethodTableIteration ZNMethodTable::_iteration;
- ZLocker<ZLock> locker(&_iter_lock);
- if (_iter_table != NULL) {
- // Iteration in progress, defer delete
- _iter_deferred_deletes.add(data);
- } else {
- // Iteration not in progress, delete now
- FREE_C_HEAP_ARRAY(uint8_t, data);
- }
+ZNMethodTableEntry* ZNMethodTable::create(size_t size) {
+ void* const mem = ZNMethodAllocator::allocate(size * sizeof(ZNMethodTableEntry));
+ return ::new (mem) ZNMethodTableEntry[size];
}
-ZNMethodTableEntry ZNMethodTable::create_entry(nmethod* nm) {
- GrowableArray<oop*> immediate_oops;
- bool non_immediate_oops = false;
-
- // Find all oops relocations
- RelocIterator iter(nm);
- while (iter.next()) {
- if (iter.type() != relocInfo::oop_type) {
- // Not an oop
- continue;
- }
-
- oop_Relocation* r = iter.oop_reloc();
-
- if (!r->oop_is_immediate()) {
- // Non-immediate oop found
- non_immediate_oops = true;
- continue;
- }
-
- if (r->oop_value() != NULL) {
- // Non-NULL immediate oop found. NULL oops can safely be
- // ignored since the method will be re-registered if they
- // are later patched to be non-NULL.
- immediate_oops.push(r->oop_addr());
- }
- }
-
- // Attach GC data to nmethod
- ZNMethodData* data = gc_data(nm);
- if (data == NULL) {
- data = ZNMethodData::create(nm);
- set_gc_data(nm, data);
- }
-
- // Attach immediate oops in GC data
- ZNMethodDataImmediateOops* const old_data_immediate_oops = data->swap_immediate_oops(immediate_oops);
- ZNMethodDataImmediateOops::destroy(old_data_immediate_oops);
-
- // Create entry
- return ZNMethodTableEntry(nm, non_immediate_oops, !immediate_oops.is_empty());
-}
-
-ZReentrantLock* ZNMethodTable::lock_for_nmethod(nmethod* nm) {
- ZNMethodData* const data = gc_data(nm);
- if (data == NULL) {
- return NULL;
- }
- return data->lock();
+void ZNMethodTable::destroy(ZNMethodTableEntry* table) {
+ ZNMethodAllocator::free(table);
}
size_t ZNMethodTable::first_index(const nmethod* nm, size_t size) {
@@ -241,8 +74,8 @@
return (prev_index + 1) & mask;
}
-bool ZNMethodTable::register_entry(ZNMethodTableEntry* table, size_t size, ZNMethodTableEntry entry) {
- const nmethod* const nm = entry.method();
+bool ZNMethodTable::register_entry(ZNMethodTableEntry* table, size_t size, nmethod* nm) {
+ const ZNMethodTableEntry entry(nm);
size_t index = first_index(nm, size);
for (;;) {
@@ -265,11 +98,6 @@
}
void ZNMethodTable::unregister_entry(ZNMethodTableEntry* table, size_t size, nmethod* nm) {
- if (size == 0) {
- // Table is empty
- return;
- }
-
size_t index = first_index(nm, size);
for (;;) {
@@ -279,10 +107,6 @@
if (table_entry.registered() && table_entry.method() == nm) {
// Remove entry
table[index] = ZNMethodTableEntry(true /* unregistered */);
-
- // Destroy GC data
- ZNMethodData::destroy(gc_data(nm));
- set_gc_data(nm, NULL);
return;
}
@@ -291,7 +115,8 @@
}
void ZNMethodTable::rebuild(size_t new_size) {
- ZLocker<ZLock> locker(&_iter_lock);
+ assert(CodeCache_lock->owned_by_self(), "Lock must be held");
+
assert(is_power_of_2(new_size), "Invalid size");
log_debug(gc, nmethod)("Rebuilding NMethod Table: "
@@ -303,20 +128,18 @@
_nunregistered, percent_of(_nunregistered, _size), 0.0);
// Allocate new table
- ZNMethodTableEntry* const new_table = new ZNMethodTableEntry[new_size];
+ ZNMethodTableEntry* const new_table = ZNMethodTable::create(new_size);
// Transfer all registered entries
for (size_t i = 0; i < _size; i++) {
const ZNMethodTableEntry entry = _table[i];
if (entry.registered()) {
- register_entry(new_table, new_size, entry);
+ register_entry(new_table, new_size, entry.method());
}
}
- if (_iter_table != _table) {
- // Delete old table
- delete [] _table;
- }
+ // Free old table
+ ZNMethodTable::destroy(_table);
// Install new table
_table = new_table;
@@ -353,61 +176,6 @@
}
}
-void ZNMethodTable::log_register(const nmethod* nm, ZNMethodTableEntry entry) {
- LogTarget(Trace, gc, nmethod) log;
- if (!log.is_enabled()) {
- return;
- }
-
- log.print("Register NMethod: %s.%s (" PTR_FORMAT "), "
- "Compiler: %s, Oops: %d, ImmediateOops: " SIZE_FORMAT ", NonImmediateOops: %s",
- nm->method()->method_holder()->external_name(),
- nm->method()->name()->as_C_string(),
- p2i(nm),
- nm->compiler_name(),
- nm->oops_count() - 1,
- entry.immediate_oops() ? gc_data(nm)->immediate_oops()->immediate_oops_count() : 0,
- entry.non_immediate_oops() ? "Yes" : "No");
-
- LogTarget(Trace, gc, nmethod, oops) log_oops;
- if (!log_oops.is_enabled()) {
- return;
- }
-
- // Print nmethod oops table
- oop* const begin = nm->oops_begin();
- oop* const end = nm->oops_end();
- for (oop* p = begin; p < end; p++) {
- log_oops.print(" Oop[" SIZE_FORMAT "] " PTR_FORMAT " (%s)",
- (p - begin), p2i(*p), (*p)->klass()->external_name());
- }
-
- if (entry.immediate_oops()) {
- // Print nmethod immediate oops
- const ZNMethodDataImmediateOops* const nmi = gc_data(nm)->immediate_oops();
- if (nmi != NULL) {
- oop** const begin = nmi->immediate_oops_begin();
- oop** const end = nmi->immediate_oops_end();
- for (oop** p = begin; p < end; p++) {
- log_oops.print(" ImmediateOop[" SIZE_FORMAT "] " PTR_FORMAT " @ " PTR_FORMAT " (%s)",
- (p - begin), p2i(**p), p2i(*p), (**p)->klass()->external_name());
- }
- }
- }
-}
-
-void ZNMethodTable::log_unregister(const nmethod* nm) {
- LogTarget(Debug, gc, nmethod) log;
- if (!log.is_enabled()) {
- return;
- }
-
- log.print("Unregister NMethod: %s.%s (" PTR_FORMAT ")",
- nm->method()->method_holder()->external_name(),
- nm->method()->name()->as_C_string(),
- p2i(nm));
-}
-
size_t ZNMethodTable::registered_nmethods() {
return _nregistered;
}
@@ -418,48 +186,29 @@
void ZNMethodTable::register_nmethod(nmethod* nm) {
assert(CodeCache_lock->owned_by_self(), "Lock must be held");
- ResourceMark rm;
// Grow/Shrink/Prune table if needed
rebuild_if_needed();
- // Create entry
- const ZNMethodTableEntry entry = create_entry(nm);
-
- log_register(nm, entry);
-
// Insert new entry
- if (register_entry(_table, _size, entry)) {
+ if (register_entry(_table, _size, nm)) {
// New entry registered. When register_entry() instead returns
// false the nmethod was already in the table so we do not want
// to increase number of registered entries in that case.
_nregistered++;
}
-
- // Disarm nmethod entry barrier
- disarm_nmethod(nm);
}
-void ZNMethodTable::sweeper_wait_for_iteration() {
- // The sweeper must wait for any ongoing iteration to complete
- // before it can unregister an nmethod.
- if (!Thread::current()->is_Code_cache_sweeper_thread()) {
- return;
- }
+void ZNMethodTable::wait_until_iteration_done() {
+ assert(CodeCache_lock->owned_by_self(), "Lock must be held");
- while (_iter_table != NULL) {
- MutexUnlockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
- os::naked_short_sleep(1);
+ while (_iteration.in_progress()) {
+ CodeCache_lock->wait(Monitor::_no_safepoint_check_flag);
}
}
void ZNMethodTable::unregister_nmethod(nmethod* nm) {
assert(CodeCache_lock->owned_by_self(), "Lock must be held");
- ResourceMark rm;
-
- sweeper_wait_for_iteration();
-
- log_unregister(nm);
// Remove entry
unregister_entry(_table, _size, nm);
@@ -467,248 +216,29 @@
_nregistered--;
}
-void ZNMethodTable::disarm_nmethod(nmethod* nm) {
- BarrierSetNMethod* const bs = BarrierSet::barrier_set()->barrier_set_nmethod();
- if (bs != NULL) {
- bs->disarm(nm);
- }
-}
+void ZNMethodTable::nmethods_do_begin() {
+ MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
-void ZNMethodTable::nmethod_entries_do_begin() {
- MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
- ZLocker<ZLock> locker(&_iter_lock);
+ // Make sure we don't free data while iterating
+ ZNMethodAllocator::activate_deferred_frees();
// Prepare iteration
- _iter_table = _table;
- _iter_table_size = _size;
- _claimed = 0;
- assert(_iter_deferred_deletes.is_empty(), "Should be emtpy");
-}
-
-void ZNMethodTable::nmethod_entries_do_end() {
- MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
- ZLocker<ZLock> locker(&_iter_lock);
-
- // Finish iteration
- if (_iter_table != _table) {
- delete [] _iter_table;
- }
- _iter_table = NULL;
- assert(_claimed >= _iter_table_size, "Failed to claim all table entries");
-
- // Process deferred deletes
- ZArrayIterator<void*> iter(&_iter_deferred_deletes);
- for (void* data; iter.next(&data);) {
- FREE_C_HEAP_ARRAY(uint8_t, data);
- }
- _iter_deferred_deletes.clear();
-}
-
-void ZNMethodTable::entry_oops_do(ZNMethodTableEntry entry, OopClosure* cl) {
- nmethod* const nm = entry.method();
-
- // Process oops table
- oop* const begin = nm->oops_begin();
- oop* const end = nm->oops_end();
- for (oop* p = begin; p < end; p++) {
- if (*p != Universe::non_oop_word()) {
- cl->do_oop(p);
- }
- }
-
- // Process immediate oops
- if (entry.immediate_oops()) {
- const ZNMethodDataImmediateOops* const nmi = gc_data(nm)->immediate_oops();
- if (nmi != NULL) {
- oop** const begin = nmi->immediate_oops_begin();
- oop** const end = nmi->immediate_oops_end();
- for (oop** p = begin; p < end; p++) {
- if (**p != Universe::non_oop_word()) {
- cl->do_oop(*p);
- }
- }
- }
- }
-
- // Process non-immediate oops
- if (entry.non_immediate_oops()) {
- nmethod* const nm = entry.method();
- nm->fix_oop_relocations();
- }
-}
-
-class ZNMethodTableEntryToOopsDo : public ZNMethodTableEntryClosure {
-private:
- OopClosure* _cl;
-
-public:
- ZNMethodTableEntryToOopsDo(OopClosure* cl) :
- _cl(cl) {}
-
- void do_nmethod_entry(ZNMethodTableEntry entry) {
- ZNMethodTable::entry_oops_do(entry, _cl);
- }
-};
-
-void ZNMethodTable::oops_do(OopClosure* cl) {
- ZNMethodTableEntryToOopsDo entry_cl(cl);
- nmethod_entries_do(&entry_cl);
-}
-
-void ZNMethodTable::nmethod_entries_do(ZNMethodTableEntryClosure* cl) {
- for (;;) {
- // Claim table partition. Each partition is currently sized to span
- // two cache lines. This number is just a guess, but seems to work well.
- const size_t partition_size = (ZCacheLineSize * 2) / sizeof(ZNMethodTableEntry);
- const size_t partition_start = MIN2(Atomic::add(partition_size, &_claimed) - partition_size, _iter_table_size);
- const size_t partition_end = MIN2(partition_start + partition_size, _iter_table_size);
- if (partition_start == partition_end) {
- // End of table
- break;
- }
-
- // Process table partition
- for (size_t i = partition_start; i < partition_end; i++) {
- const ZNMethodTableEntry entry = _iter_table[i];
- if (entry.registered()) {
- cl->do_nmethod_entry(entry);
- }
- }
- }
+ _iteration.nmethods_do_begin(_table, _size);
}
-class ZNMethodTableUnlinkClosure : public ZNMethodTableEntryClosure {
-private:
- bool _unloading_occurred;
- volatile bool _failed;
-
- void set_failed() {
- Atomic::store(true, &_failed);
- }
-
-public:
- ZNMethodTableUnlinkClosure(bool unloading_occurred) :
- _unloading_occurred(unloading_occurred),
- _failed(false) {}
-
- virtual void do_nmethod_entry(ZNMethodTableEntry entry) {
- if (failed()) {
- return;
- }
-
- nmethod* const nm = entry.method();
- if (!nm->is_alive()) {
- return;
- }
+void ZNMethodTable::nmethods_do_end() {
+ MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
- ZLocker<ZReentrantLock> locker(ZNMethodTable::lock_for_nmethod(nm));
-
- if (nm->is_unloading()) {
- // Unlinking of the dependencies must happen before the
- // handshake separating unlink and purge.
- nm->flush_dependencies(false /* delete_immediately */);
-
- // We don't need to take the lock when unlinking nmethods from
- // the Method, because it is only concurrently unlinked by
- // the entry barrier, which acquires the per nmethod lock.
- nm->unlink_from_method(false /* acquire_lock */);
- return;
- }
-
- // Heal oops and disarm
- ZNMethodOopClosure cl;
- ZNMethodTable::entry_oops_do(entry, &cl);
- ZNMethodTable::disarm_nmethod(nm);
-
- // Clear compiled ICs and exception caches
- if (!nm->unload_nmethod_caches(_unloading_occurred)) {
- set_failed();
- }
- }
+ // Finish iteration
+ _iteration.nmethods_do_end();
- bool failed() const {
- return Atomic::load(&_failed);
- }
-};
-
-class ZNMethodTableUnlinkTask : public ZTask {
-private:
- ZNMethodTableUnlinkClosure _cl;
- ICRefillVerifier* _verifier;
-
-public:
- ZNMethodTableUnlinkTask(bool unloading_occurred, ICRefillVerifier* verifier) :
- ZTask("ZNMethodTableUnlinkTask"),
- _cl(unloading_occurred),
- _verifier(verifier) {
- ZNMethodTable::nmethod_entries_do_begin();
- }
-
- ~ZNMethodTableUnlinkTask() {
- ZNMethodTable::nmethod_entries_do_end();
- }
+ // Process deferred frees
+ ZNMethodAllocator::deactivate_and_process_deferred_frees();
- virtual void work() {
- ICRefillVerifierMark mark(_verifier);
- ZNMethodTable::nmethod_entries_do(&_cl);
- }
-
- bool success() const {
- return !_cl.failed();
- }
-};
-
-void ZNMethodTable::unlink(ZWorkers* workers, bool unloading_occurred) {
- for (;;) {
- ICRefillVerifier verifier;
-
- {
- ZNMethodTableUnlinkTask task(unloading_occurred, &verifier);
- workers->run_concurrent(&task);
- if (task.success()) {
- return;
- }
- }
-
- // Cleaning failed because we ran out of transitional IC stubs,
- // so we have to refill and try again. Refilling requires taking
- // a safepoint, so we temporarily leave the suspendible thread set.
- SuspendibleThreadSetLeaver sts;
- InlineCacheBuffer::refill_ic_stubs();
- }
+ // Notify iteration done
+ CodeCache_lock->notify_all();
}
-class ZNMethodTablePurgeClosure : public ZNMethodTableEntryClosure {
-public:
- virtual void do_nmethod_entry(ZNMethodTableEntry entry) {
- nmethod* const nm = entry.method();
- if (nm->is_alive() && nm->is_unloading()) {
- nm->make_unloaded();
- }
- }
-};
-
-class ZNMethodTablePurgeTask : public ZTask {
-private:
- ZNMethodTablePurgeClosure _cl;
-
-public:
- ZNMethodTablePurgeTask() :
- ZTask("ZNMethodTablePurgeTask"),
- _cl() {
- ZNMethodTable::nmethod_entries_do_begin();
- }
-
- ~ZNMethodTablePurgeTask() {
- ZNMethodTable::nmethod_entries_do_end();
- }
-
- virtual void work() {
- ZNMethodTable::nmethod_entries_do(&_cl);
- }
-};
-
-void ZNMethodTable::purge(ZWorkers* workers) {
- ZNMethodTablePurgeTask task;
- workers->run_concurrent(&task);
+void ZNMethodTable::nmethods_do(NMethodClosure* cl) {
+ _iteration.nmethods_do(cl);
}
--- a/src/hotspot/share/gc/z/zNMethodTable.hpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/share/gc/z/zNMethodTable.hpp Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, 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
@@ -24,66 +24,46 @@
#ifndef SHARE_GC_Z_ZNMETHODTABLE_HPP
#define SHARE_GC_Z_ZNMETHODTABLE_HPP
-#include "gc/z/zArray.hpp"
-#include "gc/z/zGlobals.hpp"
-#include "gc/z/zLock.hpp"
-#include "gc/z/zNMethodTableEntry.hpp"
+#include "gc/z/zNMethodTableIteration.hpp"
#include "memory/allocation.hpp"
+class nmethod;
+class NMethodClosure;
+class ZNMethodTableEntry;
class ZWorkers;
-class ZNMethodTableEntryClosure {
-public:
- virtual void do_nmethod_entry(ZNMethodTableEntry entry) = 0;
-};
-
class ZNMethodTable : public AllStatic {
private:
- static ZNMethodTableEntry* _table;
- static size_t _size;
- static ZLock _iter_lock;
- static ZNMethodTableEntry* _iter_table;
- static size_t _iter_table_size;
- static ZArray<void*> _iter_deferred_deletes;
- static size_t _nregistered;
- static size_t _nunregistered;
- static volatile size_t _claimed ATTRIBUTE_ALIGNED(ZCacheLineSize);
+ static ZNMethodTableEntry* _table;
+ static size_t _size;
+ static size_t _nregistered;
+ static size_t _nunregistered;
+ static ZNMethodTableIteration _iteration;
- static ZNMethodTableEntry create_entry(nmethod* nm);
+ static ZNMethodTableEntry* create(size_t size);
+ static void destroy(ZNMethodTableEntry* table);
static size_t first_index(const nmethod* nm, size_t size);
static size_t next_index(size_t prev_index, size_t size);
- static void sweeper_wait_for_iteration();
-
- static bool register_entry(ZNMethodTableEntry* table, size_t size, ZNMethodTableEntry entry);
+ static bool register_entry(ZNMethodTableEntry* table, size_t size, nmethod* nm);
static void unregister_entry(ZNMethodTableEntry* table, size_t size, nmethod* nm);
static void rebuild(size_t new_size);
static void rebuild_if_needed();
- static void log_register(const nmethod* nm, ZNMethodTableEntry entry);
- static void log_unregister(const nmethod* nm);
-
public:
- static void safe_delete(void* data);
-
static size_t registered_nmethods();
static size_t unregistered_nmethods();
static void register_nmethod(nmethod* nm);
static void unregister_nmethod(nmethod* nm);
- static void disarm_nmethod(nmethod* nm);
- static ZReentrantLock* lock_for_nmethod(nmethod* nm);
-
- static void oops_do(OopClosure* cl);
+ static void wait_until_iteration_done();
- static void entry_oops_do(ZNMethodTableEntry entry, OopClosure* cl);
-
- static void nmethod_entries_do_begin();
- static void nmethod_entries_do_end();
- static void nmethod_entries_do(ZNMethodTableEntryClosure* cl);
+ static void nmethods_do_begin();
+ static void nmethods_do_end();
+ static void nmethods_do(NMethodClosure* cl);
static void unlink(ZWorkers* workers, bool unloading_occurred);
static void purge(ZWorkers* workers);
--- a/src/hotspot/share/gc/z/zNMethodTableEntry.hpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/share/gc/z/zNMethodTableEntry.hpp Tue Feb 26 12:11:29 2019 -0500
@@ -32,16 +32,16 @@
// --------------------------
//
// 6
-// 3 3 2 1 0
-// +--------------------------------------------------------------------+-+-+-+
-// |11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111|1|1|1|
-// +--------------------------------------------------------------------+-+-+-+
-// | | | |
-// | 2-2 Non-immediate Oops Flag (1-bits) * | |
-// | | |
-// | 1-1 Immediate Oops/Unregistered Flag (1-bits) * |
-// | |
-// | 0-0 Registered Flag (1-bits) *
+// 3 2 1 0
+// +---------------------------------------------------------------------+-+-+
+// |11111111 11111111 11111111 11111111 11111111 11111111 11111111 111111|1|1|
+// +---------------------------------------------------------------------+-+-+
+// | | |
+// | | |
+// | | |
+// | 1-1 Unregistered Flag (1-bits) * |
+// | |
+// | 0-0 Registered Flag (1-bits) *
// |
// * 63-3 NMethod Address (61-bits)
//
@@ -52,22 +52,20 @@
private:
typedef ZBitField<uint64_t, bool, 0, 1> field_registered;
typedef ZBitField<uint64_t, bool, 1, 1> field_unregistered;
- typedef ZBitField<uint64_t, bool, 1, 1> field_immediate_oops;
- typedef ZBitField<uint64_t, bool, 2, 1> field_non_immediate_oops;
- typedef ZBitField<uint64_t, nmethod*, 3, 61, 3> field_method;
+ typedef ZBitField<uint64_t, nmethod*, 2, 62, 2> field_method;
uint64_t _entry;
public:
explicit ZNMethodTableEntry(bool unregistered = false) :
- _entry(field_unregistered::encode(unregistered) |
- field_registered::encode(false)) {}
+ _entry(field_registered::encode(false) |
+ field_unregistered::encode(unregistered) |
+ field_method::encode(NULL)) {}
- ZNMethodTableEntry(nmethod* method, bool non_immediate_oops, bool immediate_oops) :
- _entry(field_method::encode(method) |
- field_non_immediate_oops::encode(non_immediate_oops) |
- field_immediate_oops::encode(immediate_oops) |
- field_registered::encode(true)) {}
+ explicit ZNMethodTableEntry(nmethod* method) :
+ _entry(field_registered::encode(true) |
+ field_unregistered::encode(false) |
+ field_method::encode(method)) {}
bool registered() const {
return field_registered::decode(_entry);
@@ -77,14 +75,6 @@
return field_unregistered::decode(_entry);
}
- bool immediate_oops() const {
- return field_immediate_oops::decode(_entry);
- }
-
- bool non_immediate_oops() const {
- return field_non_immediate_oops::decode(_entry);
- }
-
nmethod* method() const {
return field_method::decode(_entry);
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/share/gc/z/zNMethodTableIteration.cpp Tue Feb 26 12:11:29 2019 -0500
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2017, 2019, 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.
+ */
+
+#include "precompiled.hpp"
+#include "gc/z/zNMethodTableEntry.hpp"
+#include "gc/z/zNMethodTableIteration.hpp"
+#include "memory/iterator.hpp"
+#include "runtime/atomic.hpp"
+#include "utilities/debug.hpp"
+#include "utilities/globalDefinitions.hpp"
+
+ZNMethodTableIteration::ZNMethodTableIteration() :
+ _table(NULL),
+ _size(0),
+ _claimed(0) {}
+
+bool ZNMethodTableIteration::in_progress() const {
+ return _table != NULL;
+}
+
+void ZNMethodTableIteration::nmethods_do_begin(ZNMethodTableEntry* table, size_t size) {
+ assert(!in_progress(), "precondition");
+
+ _table = table;
+ _size = size;
+ _claimed = 0;
+}
+
+void ZNMethodTableIteration::nmethods_do_end() {
+ assert(_claimed >= _size, "Failed to claim all table entries");
+
+ // Finish iteration
+ _table = NULL;
+}
+
+void ZNMethodTableIteration::nmethods_do(NMethodClosure* cl) {
+ for (;;) {
+ // Claim table partition. Each partition is currently sized to span
+ // two cache lines. This number is just a guess, but seems to work well.
+ const size_t partition_size = (ZCacheLineSize * 2) / sizeof(ZNMethodTableEntry);
+ const size_t partition_start = MIN2(Atomic::add(partition_size, &_claimed) - partition_size, _size);
+ const size_t partition_end = MIN2(partition_start + partition_size, _size);
+ if (partition_start == partition_end) {
+ // End of table
+ break;
+ }
+
+ // Process table partition
+ for (size_t i = partition_start; i < partition_end; i++) {
+ const ZNMethodTableEntry entry = _table[i];
+ if (entry.registered()) {
+ cl->do_nmethod(entry.method());
+ }
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/share/gc/z/zNMethodTableIteration.hpp Tue Feb 26 12:11:29 2019 -0500
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2019, 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.
+ */
+
+#ifndef SHARE_GC_Z_ZNMETHODTABLEITERATION_HPP
+#define SHARE_GC_Z_ZNMETHODTABLEITERATION_HPP
+
+#include "gc/z/zGlobals.hpp"
+
+class NMethodClosure;
+class ZNMethodTableEntry;
+
+class ZNMethodTableIteration {
+private:
+ ZNMethodTableEntry* _table;
+ size_t _size;
+ volatile size_t _claimed ATTRIBUTE_ALIGNED(ZCacheLineSize);
+
+public:
+ ZNMethodTableIteration();
+
+ bool in_progress() const;
+
+ void nmethods_do_begin(ZNMethodTableEntry* table, size_t size);
+ void nmethods_do_end();
+ void nmethods_do(NMethodClosure* cl);
+};
+
+#endif // SHARE_GC_Z_ZNMETHODTABLEITERATION_HPP
--- a/src/hotspot/share/gc/z/zRootsIterator.cpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/share/gc/z/zRootsIterator.cpp Tue Feb 26 12:11:29 2019 -0500
@@ -33,7 +33,7 @@
#include "gc/shared/suspendibleThreadSet.hpp"
#include "gc/z/zBarrierSetNMethod.hpp"
#include "gc/z/zGlobals.hpp"
-#include "gc/z/zNMethodTable.hpp"
+#include "gc/z/zNMethod.hpp"
#include "gc/z/zOopClosures.inline.hpp"
#include "gc/z/zRootsIterator.hpp"
#include "gc/z/zStat.hpp"
@@ -184,7 +184,7 @@
if (ClassUnloading) {
nmethod::oops_do_marking_prologue();
} else {
- ZNMethodTable::nmethod_entries_do_begin();
+ ZNMethod::oops_do_begin();
}
}
@@ -194,7 +194,7 @@
if (ClassUnloading) {
nmethod::oops_do_marking_epilogue();
} else {
- ZNMethodTable::nmethod_entries_do_end();
+ ZNMethod::oops_do_end();
}
JvmtiExport::gc_epilogue();
@@ -242,7 +242,7 @@
void ZRootsIterator::do_code_cache(ZRootsIteratorClosure* cl) {
ZStatTimer timer(ZSubPhasePauseRootsCodeCache);
- ZNMethodTable::oops_do(cl);
+ ZNMethod::oops_do(cl);
}
void ZRootsIterator::oops_do(ZRootsIteratorClosure* cl, bool visit_jvmti_weak_export) {
--- a/src/hotspot/share/gc/z/zUnload.cpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/share/gc/z/zUnload.cpp Tue Feb 26 12:11:29 2019 -0500
@@ -30,7 +30,7 @@
#include "gc/shared/gcBehaviours.hpp"
#include "gc/shared/suspendibleThreadSet.hpp"
#include "gc/z/zLock.inline.hpp"
-#include "gc/z/zNMethodTable.hpp"
+#include "gc/z/zNMethod.hpp"
#include "gc/z/zOopClosures.hpp"
#include "gc/z/zStat.hpp"
#include "gc/z/zUnload.hpp"
@@ -65,43 +65,30 @@
};
class ZIsUnloadingBehaviour : public IsUnloadingBehaviour {
-private:
- bool is_unloading(nmethod* nm) const {
+public:
+ virtual bool is_unloading(CompiledMethod* method) const {
+ nmethod* const nm = method->as_nmethod();
+ ZReentrantLock* const lock = ZNMethod::lock_for_nmethod(nm);
+ ZLocker<ZReentrantLock> locker(lock);
ZIsUnloadingOopClosure cl;
nm->oops_do(&cl, true /* allow_zombie */);
return cl.is_unloading();
}
-
-public:
- virtual bool is_unloading(CompiledMethod* method) const {
- nmethod* const nm = method->as_nmethod();
- ZReentrantLock* const lock = ZNMethodTable::lock_for_nmethod(nm);
- if (lock == NULL) {
- return is_unloading(nm);
- } else {
- ZLocker<ZReentrantLock> locker(lock);
- return is_unloading(nm);
- }
- }
};
class ZCompiledICProtectionBehaviour : public CompiledICProtectionBehaviour {
public:
virtual bool lock(CompiledMethod* method) {
nmethod* const nm = method->as_nmethod();
- ZReentrantLock* const lock = ZNMethodTable::lock_for_nmethod(nm);
- if (lock != NULL) {
- lock->lock();
- }
+ ZReentrantLock* const lock = ZNMethod::lock_for_nmethod(nm);
+ lock->lock();
return true;
}
virtual void unlock(CompiledMethod* method) {
nmethod* const nm = method->as_nmethod();
- ZReentrantLock* const lock = ZNMethodTable::lock_for_nmethod(nm);
- if (lock != NULL) {
- lock->unlock();
- }
+ ZReentrantLock* const lock = ZNMethod::lock_for_nmethod(nm);
+ lock->unlock();
}
virtual bool is_safe(CompiledMethod* method) {
@@ -110,8 +97,8 @@
}
nmethod* const nm = method->as_nmethod();
- ZReentrantLock* const lock = ZNMethodTable::lock_for_nmethod(nm);
- return lock == NULL || lock->is_owned();
+ ZReentrantLock* const lock = ZNMethod::lock_for_nmethod(nm);
+ return lock->is_owned();
}
};
@@ -149,7 +136,7 @@
Klass::clean_weak_klass_links(unloading_occurred);
- ZNMethodTable::unlink(_workers, unloading_occurred);
+ ZNMethod::unlink(_workers, unloading_occurred);
DependencyContext::cleaning_end();
}
@@ -157,7 +144,7 @@
void ZUnload::purge() {
{
SuspendibleThreadSetJoiner sts;
- ZNMethodTable::purge(_workers);
+ ZNMethod::purge(_workers);
}
ClassLoaderDataGraph::purge();
--- a/src/hotspot/share/jfr/jni/jfrJniMethod.cpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/share/jfr/jni/jfrJniMethod.cpp Tue Feb 26 12:11:29 2019 -0500
@@ -114,7 +114,7 @@
NO_TRANSITION_END
NO_TRANSITION(void, jfr_set_file_notification(JNIEnv* env, jobject jvm, jlong threshold))
- JfrChunkRotation::set_threshold((intptr_t)threshold);
+ JfrChunkRotation::set_threshold(threshold);
NO_TRANSITION_END
NO_TRANSITION(void, jfr_set_sample_threads(JNIEnv* env, jobject jvm, jboolean sampleThreads))
--- a/src/hotspot/share/jfr/metadata/metadata.xml Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/share/jfr/metadata/metadata.xml Tue Feb 26 12:11:29 2019 -0500
@@ -533,12 +533,6 @@
<Field type="int" name="iterations" label="Iterations" description="Number of state check iterations" />
</Event>
- <Event name="SafepointWaitBlocked" category="Java Virtual Machine, Runtime, Safepoint" label="Safepoint Wait Blocked" description="Safepointing begin waiting on running threads to block"
- thread="true">
- <Field type="ulong" name="safepointId" label="Safepoint Identifier" relation="SafepointId" />
- <Field type="int" name="runningThreadCount" label="Running Threads" description="The number running of threads wait for safe point" />
- </Event>
-
<Event name="SafepointCleanup" category="Java Virtual Machine, Runtime, Safepoint" label="Safepoint Cleanup" description="Safepointing begin running cleanup tasks"
thread="true">
<Field type="ulong" name="safepointId" label="Safepoint Identifier" relation="SafepointId" />
--- a/src/hotspot/share/jfr/recorder/checkpoint/jfrCheckpointWriter.cpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/share/jfr/recorder/checkpoint/jfrCheckpointWriter.cpp Tue Feb 26 12:11:29 2019 -0500
@@ -44,13 +44,13 @@
}
}
-static void write_checkpoint_header(u1* pos, jlong size, jlong time, bool flushpoint, juint type_count) {
+static void write_checkpoint_header(u1* pos, int64_t size, jlong time, bool flushpoint, u4 type_count) {
assert(pos != NULL, "invariant");
JfrBigEndianWriter be_writer(pos, sizeof(JfrCheckpointEntry));
be_writer.write(size);
be_writer.write(time);
be_writer.write(JfrTicks::now().value() - time);
- be_writer.write(flushpoint ? (juint)1 : (juint)0);
+ be_writer.write(flushpoint ? (u4)1 : (u4)0);
be_writer.write(type_count);
assert(be_writer.is_valid(), "invariant");
}
@@ -71,7 +71,7 @@
assert(this->is_valid(), "invariant");
assert(count() > 0, "invariant");
assert(this->used_size() > sizeof(JfrCheckpointEntry), "invariant");
- const jlong size = this->current_offset();
+ const int64_t size = this->current_offset();
assert(size + this->start_pos() == this->current_pos(), "invariant");
write_checkpoint_header(const_cast<u1*>(this->start_pos()), size, _time, is_flushpoint(), count());
release();
@@ -85,11 +85,11 @@
return _flushpoint;
}
-juint JfrCheckpointWriter::count() const {
+u4 JfrCheckpointWriter::count() const {
return _count;
}
-void JfrCheckpointWriter::set_count(juint count) {
+void JfrCheckpointWriter::set_count(u4 count) {
_count = count;
}
@@ -111,7 +111,7 @@
}
void JfrCheckpointWriter::write_key(u8 key) {
- write<u8>(key);
+ write(key);
}
void JfrCheckpointWriter::increment() {
@@ -119,10 +119,10 @@
}
void JfrCheckpointWriter::write_count(u4 nof_entries) {
- write<u4>((u4)nof_entries);
+ write(nof_entries);
}
-void JfrCheckpointWriter::write_count(u4 nof_entries, jlong offset) {
+void JfrCheckpointWriter::write_count(u4 nof_entries, int64_t offset) {
write_padded_at_offset(nof_entries, offset);
}
--- a/src/hotspot/share/jfr/recorder/checkpoint/jfrCheckpointWriter.hpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/share/jfr/recorder/checkpoint/jfrCheckpointWriter.hpp Tue Feb 26 12:11:29 2019 -0500
@@ -49,21 +49,21 @@
typedef EventWriterHost<BigEndianEncoder, CompressedIntegerEncoder, JfrTransactionalCheckpointWriter> JfrCheckpointWriterBase;
struct JfrCheckpointContext {
- jlong offset;
- juint count;
+ int64_t offset;
+ u4 count;
};
class JfrCheckpointWriter : public JfrCheckpointWriterBase {
friend class JfrSerializerRegistration;
private:
JfrTicks _time;
- jlong _offset;
- juint _count;
+ int64_t _offset;
+ u4 _count;
bool _flushpoint;
bool _header;
- juint count() const;
- void set_count(juint count);
+ u4 count() const;
+ void set_count(u4 count);
void increment();
void set_flushpoint(bool flushpoint);
bool is_flushpoint() const;
@@ -75,7 +75,7 @@
~JfrCheckpointWriter();
void write_type(JfrTypeId type_id);
void write_count(u4 nof_entries);
- void write_count(u4 nof_entries, jlong offset);
+ void write_count(u4 nof_entries, int64_t offset);
void write_key(u8 key);
const JfrCheckpointContext context() const;
void set_context(const JfrCheckpointContext ctx);
--- a/src/hotspot/share/jfr/recorder/checkpoint/types/jfrType.cpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/share/jfr/recorder/checkpoint/types/jfrType.cpp Tue Feb 26 12:11:29 2019 -0500
@@ -65,7 +65,7 @@
private:
JfrCheckpointWriter& _writer;
JfrCheckpointContext _ctx;
- const intptr_t _count_position;
+ const int64_t _count_position;
Thread* const _curthread;
u4 _count;
--- a/src/hotspot/share/jfr/recorder/checkpoint/types/jfrTypeSetWriter.hpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/share/jfr/recorder/checkpoint/types/jfrTypeSetWriter.hpp Tue Feb 26 12:11:29 2019 -0500
@@ -35,7 +35,7 @@
WriterImpl _impl;
JfrCheckpointWriter* _writer;
JfrCheckpointContext _ctx;
- jlong _count_offset;
+ int64_t _count_offset;
int _count;
bool _skip_header;
public:
--- a/src/hotspot/share/jfr/recorder/repository/jfrChunkRotation.cpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/share/jfr/recorder/repository/jfrChunkRotation.cpp Tue Feb 26 12:11:29 2019 -0500
@@ -29,7 +29,7 @@
#include "runtime/handles.inline.hpp"
static jobject chunk_monitor = NULL;
-static intptr_t threshold = 0;
+static int64_t threshold = 0;
static bool rotate = false;
static jobject install_chunk_monitor(Thread* thread) {
@@ -62,7 +62,6 @@
// already in progress
return;
}
- assert(!rotate, "invariant");
if (writer.size_written() > threshold) {
rotate = true;
notify();
@@ -77,6 +76,6 @@
rotate = false;
}
-void JfrChunkRotation::set_threshold(intptr_t bytes) {
+void JfrChunkRotation::set_threshold(int64_t bytes) {
threshold = bytes;
}
--- a/src/hotspot/share/jfr/recorder/repository/jfrChunkRotation.hpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/share/jfr/recorder/repository/jfrChunkRotation.hpp Tue Feb 26 12:11:29 2019 -0500
@@ -36,7 +36,7 @@
class JfrChunkRotation : AllStatic {
public:
static void evaluate(const JfrChunkWriter& writer);
- static void set_threshold(intptr_t bytes);
+ static void set_threshold(int64_t bytes);
static bool should_rotate();
static void on_rotation();
};
--- a/src/hotspot/share/jfr/recorder/repository/jfrChunkState.cpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/share/jfr/recorder/repository/jfrChunkState.cpp Tue Feb 26 12:11:29 2019 -0500
@@ -53,19 +53,19 @@
set_previous_checkpoint_offset(0);
}
-void JfrChunkState::set_previous_checkpoint_offset(jlong offset) {
+void JfrChunkState::set_previous_checkpoint_offset(int64_t offset) {
_previous_checkpoint_offset = offset;
}
-jlong JfrChunkState::previous_checkpoint_offset() const {
+int64_t JfrChunkState::previous_checkpoint_offset() const {
return _previous_checkpoint_offset;
}
-jlong JfrChunkState::previous_start_ticks() const {
+int64_t JfrChunkState::previous_start_ticks() const {
return _previous_start_ticks;
}
-jlong JfrChunkState::previous_start_nanos() const {
+int64_t JfrChunkState::previous_start_nanos() const {
return _previous_start_nanos;
}
@@ -92,7 +92,7 @@
save_current_and_update_start_ticks();
}
-jlong JfrChunkState::last_chunk_duration() const {
+int64_t JfrChunkState::last_chunk_duration() const {
return _start_nanos - _previous_start_nanos;
}
--- a/src/hotspot/share/jfr/recorder/repository/jfrChunkState.hpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/share/jfr/recorder/repository/jfrChunkState.hpp Tue Feb 26 12:11:29 2019 -0500
@@ -25,7 +25,6 @@
#ifndef SHARE_JFR_RECORDER_REPOSITORY_JFRCHUNKSTATE_HPP
#define SHARE_JFR_RECORDER_REPOSITORY_JFRCHUNKSTATE_HPP
-#include "jni.h"
#include "jfr/utilities/jfrAllocation.hpp"
#include "jfr/utilities/jfrTypes.hpp"
@@ -33,11 +32,11 @@
friend class JfrChunkWriter;
private:
char* _path;
- jlong _start_ticks;
- jlong _start_nanos;
- jlong _previous_start_ticks;
- jlong _previous_start_nanos;
- jlong _previous_checkpoint_offset;
+ int64_t _start_ticks;
+ int64_t _start_nanos;
+ int64_t _previous_start_ticks;
+ int64_t _previous_start_nanos;
+ int64_t _previous_checkpoint_offset;
void update_start_ticks();
void update_start_nanos();
@@ -47,11 +46,11 @@
JfrChunkState();
~JfrChunkState();
void reset();
- jlong previous_checkpoint_offset() const;
- void set_previous_checkpoint_offset(jlong offset);
- jlong previous_start_ticks() const;
- jlong previous_start_nanos() const;
- jlong last_chunk_duration() const;
+ int64_t previous_checkpoint_offset() const;
+ void set_previous_checkpoint_offset(int64_t offset);
+ int64_t previous_start_ticks() const;
+ int64_t previous_start_nanos() const;
+ int64_t last_chunk_duration() const;
void update_time_to_now();
void set_path(const char* path);
const char* path() const;
--- a/src/hotspot/share/jfr/recorder/repository/jfrChunkWriter.cpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/share/jfr/recorder/repository/jfrChunkWriter.cpp Tue Feb 26 12:11:29 2019 -0500
@@ -32,9 +32,8 @@
#include "runtime/os.hpp"
#include "runtime/os.inline.hpp"
-const u2 JFR_VERSION_MAJOR = 2;
-const u2 JFR_VERSION_MINOR = 0;
-
+static const u2 JFR_VERSION_MAJOR = 2;
+static const u2 JFR_VERSION_MINOR = 0;
static const size_t MAGIC_LEN = 4;
static const size_t FILEHEADER_SLOT_SIZE = 8;
static const size_t CHUNK_SIZE_OFFSET = 8;
@@ -79,14 +78,14 @@
return is_open;
}
-size_t JfrChunkWriter::close(intptr_t metadata_offset) {
+size_t JfrChunkWriter::close(int64_t metadata_offset) {
write_header(metadata_offset);
this->flush();
this->close_fd();
- return size_written();
+ return (size_t)size_written();
}
-void JfrChunkWriter::write_header(intptr_t metadata_offset) {
+void JfrChunkWriter::write_header(int64_t metadata_offset) {
assert(this->is_valid(), "invariant");
// Chunk size
this->write_be_at_offset(size_written(), CHUNK_SIZE_OFFSET);
@@ -106,15 +105,15 @@
_chunkstate->set_path(chunk_path);
}
-intptr_t JfrChunkWriter::size_written() const {
+int64_t JfrChunkWriter::size_written() const {
return this->is_valid() ? this->current_offset() : 0;
}
-intptr_t JfrChunkWriter::previous_checkpoint_offset() const {
+int64_t JfrChunkWriter::previous_checkpoint_offset() const {
return _chunkstate->previous_checkpoint_offset();
}
-void JfrChunkWriter::set_previous_checkpoint_offset(intptr_t offset) {
+void JfrChunkWriter::set_previous_checkpoint_offset(int64_t offset) {
_chunkstate->set_previous_checkpoint_offset(offset);
}
--- a/src/hotspot/share/jfr/recorder/repository/jfrChunkWriter.hpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/share/jfr/recorder/repository/jfrChunkWriter.hpp Tue Feb 26 12:11:29 2019 -0500
@@ -41,16 +41,16 @@
JfrChunkState* _chunkstate;
bool open();
- size_t close(intptr_t metadata_offset);
- void write_header(intptr_t metadata_offset);
+ size_t close(int64_t metadata_offset);
+ void write_header(int64_t metadata_offset);
void set_chunk_path(const char* chunk_path);
public:
JfrChunkWriter();
bool initialize();
- intptr_t size_written() const;
- intptr_t previous_checkpoint_offset() const;
- void set_previous_checkpoint_offset(intptr_t offset);
+ int64_t size_written() const;
+ int64_t previous_checkpoint_offset() const;
+ void set_previous_checkpoint_offset(int64_t offset);
void time_stamp_chunk_now();
};
--- a/src/hotspot/share/jfr/recorder/repository/jfrRepository.cpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/share/jfr/recorder/repository/jfrRepository.cpp Tue Feb 26 12:11:29 2019 -0500
@@ -147,10 +147,10 @@
iso8601_to_date_time(buffer);
}
-static jlong file_size(fio_fd fd) {
+static int64_t file_size(fio_fd fd) {
assert(fd != invalid_fd, "invariant");
- const jlong current_offset = os::current_file_offset(fd);
- const jlong size = os::lseek(fd, 0, SEEK_END);
+ const int64_t current_offset = os::current_file_offset(fd);
+ const int64_t size = os::lseek(fd, 0, SEEK_END);
os::seek_to_file_offset(fd, current_offset);
return size;
}
@@ -218,7 +218,7 @@
if (invalid_fd == entry_fd) {
return NULL;
}
- const jlong entry_size = file_size(entry_fd);
+ const int64_t entry_size = file_size(entry_fd);
os::close(entry_fd);
if (0 == entry_size) {
return NULL;
@@ -260,6 +260,7 @@
}
}
#endif
+
bool RepositoryIterator::has_next() const {
return (_files != NULL && _iterator < _files->length());
}
@@ -275,21 +276,27 @@
if (file_copy_block == NULL) {
return;
}
- jlong bytes_written_total = 0;
+ int64_t bytes_written_total = 0;
while (iterator.has_next()) {
fio_fd current_fd = invalid_fd;
const char* const fqn = iterator.next();
if (fqn != NULL) {
current_fd = open_existing(fqn);
if (current_fd != invalid_fd) {
- const jlong current_filesize = file_size(current_fd);
+ const int64_t current_filesize = file_size(current_fd);
assert(current_filesize > 0, "invariant");
- jlong bytes_read = 0;
- jlong bytes_written = 0;
+ int64_t bytes_read = 0;
+ int64_t bytes_written = 0;
while (bytes_read < current_filesize) {
- bytes_read += (jlong)os::read_at(current_fd, file_copy_block, size_of_file_copy_block, bytes_read);
- assert(bytes_read - bytes_written <= (jlong)size_of_file_copy_block, "invariant");
- bytes_written += (jlong)os::write(emergency_fd, file_copy_block, bytes_read - bytes_written);
+ const ssize_t read_result = os::read_at(current_fd, file_copy_block, size_of_file_copy_block, bytes_read);
+ if (-1 == read_result) {
+ log_info(jfr) ( // For user, should not be "jfr, system"
+ "Unable to recover JFR data");
+ break;
+ }
+ bytes_read += (int64_t)read_result;
+ assert(bytes_read - bytes_written <= (int64_t)size_of_file_copy_block, "invariant");
+ bytes_written += (int64_t)os::write(emergency_fd, file_copy_block, bytes_read - bytes_written);
assert(bytes_read == bytes_written, "invariant");
}
os::close(current_fd);
@@ -468,6 +475,6 @@
return _chunkwriter->open();
}
-size_t JfrRepository::close_chunk(jlong metadata_offset) {
+size_t JfrRepository::close_chunk(int64_t metadata_offset) {
return _chunkwriter->close(metadata_offset);
}
--- a/src/hotspot/share/jfr/recorder/repository/jfrRepository.hpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/share/jfr/recorder/repository/jfrRepository.hpp Tue Feb 26 12:11:29 2019 -0500
@@ -55,7 +55,7 @@
bool set_path(const char* path);
void set_chunk_path(const char* path);
bool open_chunk(bool vm_error = false);
- size_t close_chunk(jlong metadata_offset);
+ size_t close_chunk(int64_t metadata_offset);
void on_vm_error();
static void notify_on_new_chunk_path();
static JfrChunkWriter& chunkwriter();
--- a/src/hotspot/share/jfr/recorder/service/jfrRecorderService.cpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/share/jfr/recorder/service/jfrRecorderService.cpp Tue Feb 26 12:11:29 2019 -0500
@@ -130,18 +130,18 @@
bool not_acquired() const { return !_acquired; }
};
-static intptr_t write_checkpoint_event_prologue(JfrChunkWriter& cw, u8 type_id) {
- const intptr_t prev_cp_offset = cw.previous_checkpoint_offset();
- const intptr_t prev_cp_relative_offset = 0 == prev_cp_offset ? 0 : prev_cp_offset - cw.current_offset();
+static int64_t write_checkpoint_event_prologue(JfrChunkWriter& cw, u8 type_id) {
+ const int64_t prev_cp_offset = cw.previous_checkpoint_offset();
+ const int64_t prev_cp_relative_offset = 0 == prev_cp_offset ? 0 : prev_cp_offset - cw.current_offset();
cw.reserve(sizeof(u4));
cw.write<u8>(EVENT_CHECKPOINT);
cw.write(JfrTicks::now());
- cw.write<jlong>((jlong)0);
+ cw.write((int64_t)0);
cw.write(prev_cp_relative_offset); // write previous checkpoint offset delta
cw.write<bool>(false); // flushpoint
- cw.write<u4>((u4)1); // nof types in this checkpoint
- cw.write<u8>(type_id);
- const intptr_t number_of_elements_offset = cw.current_offset();
+ cw.write((u4)1); // nof types in this checkpoint
+ cw.write(type_id);
+ const int64_t number_of_elements_offset = cw.current_offset();
cw.reserve(sizeof(u4));
return number_of_elements_offset;
}
@@ -161,8 +161,8 @@
}
bool process() {
// current_cp_offset is also offset for the event size header field
- const intptr_t current_cp_offset = _cw.current_offset();
- const intptr_t num_elements_offset = write_checkpoint_event_prologue(_cw, _type_id);
+ const int64_t current_cp_offset = _cw.current_offset();
+ const int64_t num_elements_offset = write_checkpoint_event_prologue(_cw, _type_id);
// invocation
_content_functor.process();
const u4 number_of_elements = (u4)_content_functor.processed();
@@ -468,9 +468,9 @@
JfrMetadataEvent::lock();
}
-static jlong write_metadata_event(JfrChunkWriter& chunkwriter) {
+static int64_t write_metadata_event(JfrChunkWriter& chunkwriter) {
assert(chunkwriter.is_valid(), "invariant");
- const jlong metadata_offset = chunkwriter.current_offset();
+ const int64_t metadata_offset = chunkwriter.current_offset();
JfrMetadataEvent::write(chunkwriter, metadata_offset);
return metadata_offset;
}
--- a/src/hotspot/share/jfr/writers/jfrEventWriterHost.inline.hpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/share/jfr/writers/jfrEventWriterHost.inline.hpp Tue Feb 26 12:11:29 2019 -0500
@@ -49,7 +49,7 @@
inline intptr_t EventWriterHost<BE, IE, WriterPolicyImpl>::end_write(void) {
assert(this->is_acquired(),
"state corruption, calling end with writer with non-acquired state!");
- return this->is_valid() ? this->used_offset() : 0;
+ return this->is_valid() ? (intptr_t)this->used_offset() : 0;
}
template <typename BE, typename IE, typename WriterPolicyImpl>
--- a/src/hotspot/share/jfr/writers/jfrPosition.hpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/share/jfr/writers/jfrPosition.hpp Tue Feb 26 12:11:29 2019 -0500
@@ -48,8 +48,8 @@
public:
size_t available_size() const;
- intptr_t used_offset() const;
- intptr_t current_offset() const;
+ int64_t used_offset() const;
+ int64_t current_offset() const;
size_t used_size() const;
void reset();
};
--- a/src/hotspot/share/jfr/writers/jfrPosition.inline.hpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/share/jfr/writers/jfrPosition.inline.hpp Tue Feb 26 12:11:29 2019 -0500
@@ -80,12 +80,12 @@
}
template <typename AP>
-inline intptr_t Position<AP>::used_offset() const {
+inline int64_t Position<AP>::used_offset() const {
return _current_pos - _start_pos;
}
template <typename AP>
-inline intptr_t Position<AP>::current_offset() const {
+inline int64_t Position<AP>::current_offset() const {
return this->used_offset();
}
--- a/src/hotspot/share/jfr/writers/jfrStreamWriterHost.hpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/share/jfr/writers/jfrStreamWriterHost.hpp Tue Feb 26 12:11:29 2019 -0500
@@ -33,9 +33,9 @@
public:
typedef typename Adapter::StorageType StorageType;
private:
- intptr_t _stream_pos;
+ int64_t _stream_pos;
fio_fd _fd;
- intptr_t current_stream_position() const;
+ int64_t current_stream_position() const;
protected:
StreamWriterHost(StorageType* storage, Thread* thread);
@@ -47,8 +47,8 @@
bool has_valid_fd() const;
public:
- intptr_t current_offset() const;
- void seek(intptr_t offset);
+ int64_t current_offset() const;
+ void seek(int64_t offset);
void flush();
void write_unbuffered(const void* src, size_t len);
bool is_valid() const;
--- a/src/hotspot/share/jfr/writers/jfrStreamWriterHost.inline.hpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/share/jfr/writers/jfrStreamWriterHost.inline.hpp Tue Feb 26 12:11:29 2019 -0500
@@ -44,7 +44,7 @@
}
template <typename Adapter, typename AP>
-inline intptr_t StreamWriterHost<Adapter, AP>::current_stream_position() const {
+inline int64_t StreamWriterHost<Adapter, AP>::current_stream_position() const {
return this->used_offset() + _stream_pos;
}
@@ -73,7 +73,7 @@
inline void StreamWriterHost<Adapter, AP>::flush(size_t size) {
assert(size > 0, "invariant");
assert(this->is_valid(), "invariant");
- _stream_pos += os::write(_fd, this->start_pos(), (int)size);
+ _stream_pos += os::write(_fd, this->start_pos(), (unsigned int)size);
StorageHost<Adapter, AP>::reset();
assert(0 == this->used_offset(), "invariant");
}
@@ -84,12 +84,12 @@
}
template <typename Adapter, typename AP>
-inline intptr_t StreamWriterHost<Adapter, AP>::current_offset() const {
+inline int64_t StreamWriterHost<Adapter, AP>::current_offset() const {
return current_stream_position();
}
template <typename Adapter, typename AP>
-void StreamWriterHost<Adapter, AP>::seek(intptr_t offset) {
+void StreamWriterHost<Adapter, AP>::seek(int64_t offset) {
this->flush();
assert(0 == this->used_offset(), "can only seek from beginning");
_stream_pos = os::seek_to_file_offset(_fd, offset);
@@ -110,7 +110,7 @@
this->flush();
assert(0 == this->used_offset(), "can only seek from beginning");
while (len > 0) {
- const int n = MIN2<int>((int)len, INT_MAX);
+ const unsigned int n = MIN2((unsigned int)len, (unsigned int)INT_MAX);
_stream_pos += os::write(_fd, buf, n);
len -= n;
}
--- a/src/hotspot/share/jfr/writers/jfrWriterHost.hpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/share/jfr/writers/jfrWriterHost.hpp Tue Feb 26 12:11:29 2019 -0500
@@ -91,12 +91,12 @@
void bytes(const void* buf, size_t len);
void write_utf8_u2_len(const char* value);
template <typename T>
- void write_padded_at_offset(T value, intptr_t offset);
+ void write_padded_at_offset(T value, int64_t offset);
template <typename T>
- void write_at_offset(T value, intptr_t offset);
+ void write_at_offset(T value, int64_t offset);
template <typename T>
- void write_be_at_offset(T value, intptr_t offset);
- intptr_t reserve(size_t size);
+ void write_be_at_offset(T value, int64_t offset);
+ int64_t reserve(size_t size);
};
#endif // SHARE_JFR_WRITERS_JFRWRITERHOST_HPP
--- a/src/hotspot/share/jfr/writers/jfrWriterHost.inline.hpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/share/jfr/writers/jfrWriterHost.inline.hpp Tue Feb 26 12:11:29 2019 -0500
@@ -196,7 +196,7 @@
template <typename BE, typename IE, typename WriterPolicyImpl>
inline void WriterHost<BE, IE, WriterPolicyImpl>::write(double value) {
- be_write(*(uintptr_t*)&(value));
+ be_write(*(u8*)&(value));
}
template <typename BE, typename IE, typename WriterPolicyImpl>
@@ -317,9 +317,9 @@
}
template <typename BE, typename IE, typename WriterPolicyImpl>
-inline intptr_t WriterHost<BE, IE, WriterPolicyImpl>::reserve(size_t size) {
+inline int64_t WriterHost<BE, IE, WriterPolicyImpl>::reserve(size_t size) {
if (ensure_size(size) != NULL) {
- intptr_t reserved_offset = this->current_offset();
+ const int64_t reserved_offset = this->current_offset();
this->set_current_pos(size);
return reserved_offset;
}
@@ -329,9 +329,9 @@
template <typename BE, typename IE, typename WriterPolicyImpl>
template <typename T>
-inline void WriterHost<BE, IE, WriterPolicyImpl>::write_padded_at_offset(T value, intptr_t offset) {
+inline void WriterHost<BE, IE, WriterPolicyImpl>::write_padded_at_offset(T value, int64_t offset) {
if (this->is_valid()) {
- const intptr_t current = this->current_offset();
+ const int64_t current = this->current_offset();
this->seek(offset);
write_padded(value);
this->seek(current); // restore
@@ -340,9 +340,9 @@
template <typename BE, typename IE, typename WriterPolicyImpl>
template <typename T>
-inline void WriterHost<BE, IE, WriterPolicyImpl>::write_at_offset(T value, intptr_t offset) {
+inline void WriterHost<BE, IE, WriterPolicyImpl>::write_at_offset(T value, int64_t offset) {
if (this->is_valid()) {
- const intptr_t current = this->current_offset();
+ const int64_t current = this->current_offset();
this->seek(offset);
write(value);
this->seek(current); // restore
@@ -351,9 +351,9 @@
template <typename BE, typename IE, typename WriterPolicyImpl>
template <typename T>
-inline void WriterHost<BE, IE, WriterPolicyImpl>::write_be_at_offset(T value, intptr_t offset) {
+inline void WriterHost<BE, IE, WriterPolicyImpl>::write_be_at_offset(T value, int64_t offset) {
if (this->is_valid()) {
- const intptr_t current = this->current_offset();
+ const int64_t current = this->current_offset();
this->seek(offset);
be_write(value);
this->seek(current); // restore
--- a/src/hotspot/share/memory/filemap.cpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/share/memory/filemap.cpp Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2019, 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
@@ -45,6 +45,7 @@
#include "prims/jvmtiExport.hpp"
#include "runtime/arguments.hpp"
#include "runtime/java.hpp"
+#include "runtime/mutexLocker.hpp"
#include "runtime/os.inline.hpp"
#include "runtime/vm_version.hpp"
#include "services/memTracker.hpp"
@@ -501,6 +502,16 @@
}
_validating_shared_path_table = false;
+
+#if INCLUDE_JVMTI
+ if (_classpath_entries_for_jvmti != NULL) {
+ os::free(_classpath_entries_for_jvmti);
+ }
+ size_t sz = sizeof(ClassPathEntry*) * _shared_path_table_size;
+ _classpath_entries_for_jvmti = (ClassPathEntry**)os::malloc(sz, mtClass);
+ memset(_classpath_entries_for_jvmti, 0, sz);
+#endif
+
return true;
}
@@ -550,7 +561,7 @@
// Read the FileMapInfo information from the file.
bool FileMapInfo::open_for_read() {
_full_path = Arguments::GetSharedArchivePath();
- int fd = open(_full_path, O_RDONLY | O_BINARY, 0);
+ int fd = os::open(_full_path, O_RDONLY | O_BINARY, 0);
if (fd < 0) {
if (errno == ENOENT) {
// Not locating the shared archive is ok.
@@ -585,7 +596,7 @@
// Use remove() to delete the existing file because, on Unix, this will
// allow processes that have it open continued access to the file.
remove(_full_path);
- int fd = open(_full_path, O_RDWR | O_CREAT | O_TRUNC | O_BINARY, 0444);
+ int fd = os::open(_full_path, O_RDWR | O_CREAT | O_TRUNC | O_BINARY, 0444);
if (fd < 0) {
fail_stop("Unable to create shared archive file %s: (%s).", _full_path,
os::strerror(errno));
@@ -1440,3 +1451,57 @@
fail_stop("%s", msg);
}
}
+
+#if INCLUDE_JVMTI
+ClassPathEntry** FileMapInfo::_classpath_entries_for_jvmti = NULL;
+
+ClassPathEntry* FileMapInfo::get_classpath_entry_for_jvmti(int i, TRAPS) {
+ ClassPathEntry* ent = _classpath_entries_for_jvmti[i];
+ if (ent == NULL) {
+ if (i == 0) {
+ ent = ClassLoader:: get_jrt_entry();
+ assert(ent != NULL, "must be");
+ } else {
+ SharedClassPathEntry* scpe = shared_path(i);
+ assert(scpe->is_jar(), "must be"); // other types of scpe will not produce archived classes
+
+ const char* path = scpe->name();
+ struct stat st;
+ if (os::stat(path, &st) != 0) {
+ char *msg = NEW_RESOURCE_ARRAY_IN_THREAD(THREAD, char, strlen(path) + 128); ;
+ jio_snprintf(msg, strlen(path) + 127, "error in opening JAR file %s", path);
+ THROW_MSG_(vmSymbols::java_io_IOException(), msg, NULL);
+ } else {
+ ent = ClassLoader::create_class_path_entry(path, &st, /*throw_exception=*/true, false, CHECK_NULL);
+ }
+ }
+
+ MutexLocker mu(CDSClassFileStream_lock, THREAD);
+ if (_classpath_entries_for_jvmti[i] == NULL) {
+ _classpath_entries_for_jvmti[i] = ent;
+ } else {
+ // Another thread has beat me to creating this entry
+ delete ent;
+ ent = _classpath_entries_for_jvmti[i];
+ }
+ }
+
+ return ent;
+}
+
+ClassFileStream* FileMapInfo::open_stream_for_jvmti(InstanceKlass* ik, TRAPS) {
+ int path_index = ik->shared_classpath_index();
+ assert(path_index >= 0, "should be called for shared built-in classes only");
+ assert(path_index < (int)_shared_path_table_size, "sanity");
+
+ ClassPathEntry* cpe = get_classpath_entry_for_jvmti(path_index, CHECK_NULL);
+ assert(cpe != NULL, "must be");
+
+ Symbol* name = ik->name();
+ const char* const class_name = name->as_C_string();
+ const char* const file_name = ClassLoader::file_name_for_class_name(class_name,
+ name->utf8_length());
+ return cpe->open_stream(file_name, THREAD);
+}
+
+#endif
--- a/src/hotspot/share/memory/filemap.hpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/share/memory/filemap.hpp Tue Feb 26 12:11:29 2019 -0500
@@ -302,6 +302,10 @@
bool validate_shared_path_table();
static void update_shared_classpath(ClassPathEntry *cpe, SharedClassPathEntry* ent, TRAPS);
+#if INCLUDE_JVMTI
+ static ClassFileStream* open_stream_for_jvmti(InstanceKlass* ik, TRAPS);
+#endif
+
static SharedClassPathEntry* shared_path(int index) {
if (index < 0) {
return NULL;
@@ -348,6 +352,11 @@
}
address decode_start_address(CDSFileMapRegion* spc, bool with_current_oop_encoding_mode);
+
+#if INCLUDE_JVMTI
+ static ClassPathEntry** _classpath_entries_for_jvmti;
+ static ClassPathEntry* get_classpath_entry_for_jvmti(int i, TRAPS);
+#endif
};
#endif // SHARE_MEMORY_FILEMAP_HPP
--- a/src/hotspot/share/memory/iterator.hpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/share/memory/iterator.hpp Tue Feb 26 12:11:29 2019 -0500
@@ -263,6 +263,11 @@
virtual void do_code_blob(CodeBlob* cb);
};
+class NMethodClosure : public Closure {
+ public:
+ virtual void do_nmethod(nmethod* n) = 0;
+};
+
// MonitorClosure is used for iterating over monitors in the monitors cache
class ObjectMonitor;
--- a/src/hotspot/share/memory/metaspaceShared.cpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/share/memory/metaspaceShared.cpp Tue Feb 26 12:11:29 2019 -0500
@@ -207,7 +207,7 @@
};
-DumpRegion _mc_region("mc"), _ro_region("ro"), _rw_region("rw"), _md_region("md"), _od_region("od");
+DumpRegion _mc_region("mc"), _ro_region("ro"), _rw_region("rw"), _md_region("md");
size_t _total_closed_archive_region_size = 0, _total_open_archive_region_size = 0;
char* MetaspaceShared::misc_code_space_alloc(size_t num_bytes) {
@@ -598,23 +598,6 @@
}
}
-static void relocate_cached_class_file() {
- for (int i = 0; i < _global_klass_objects->length(); i++) {
- Klass* k = _global_klass_objects->at(i);
- if (k->is_instance_klass()) {
- InstanceKlass* ik = InstanceKlass::cast(k);
- JvmtiCachedClassFileData* p = ik->get_archived_class_data();
- if (p != NULL) {
- int size = offset_of(JvmtiCachedClassFileData, data) + p->length;
- JvmtiCachedClassFileData* q = (JvmtiCachedClassFileData*)_od_region.allocate(size);
- q->length = p->length;
- memcpy(q->data, p->data, p->length);
- ik->set_archived_class_data(q);
- }
- }
- }
-}
-
// Objects of the Metadata types (such as Klass and ConstantPool) have C++ vtables.
// (In GCC this is the field <Type>::_vptr, i.e., first word in the object.)
//
@@ -1438,15 +1421,11 @@
char* vtbl_list = _md_region.top();
MetaspaceShared::allocate_cpp_vtable_clones();
- _md_region.pack(&_od_region);
+ _md_region.pack();
- // Relocate the archived class file data into the od region
- relocate_cached_class_file();
- _od_region.pack();
-
- // The 5 core spaces are allocated consecutively mc->rw->ro->md->od, so there total size
+ // The 4 core spaces are allocated consecutively mc->rw->ro->md, so there total size
// is just the spaces between the two ends.
- size_t core_spaces_size = _od_region.end() - _mc_region.base();
+ size_t core_spaces_size = _md_region.end() - _mc_region.base();
assert(core_spaces_size == (size_t)align_up(core_spaces_size, Metaspace::reserve_alignment()),
"should already be aligned");
@@ -1488,7 +1467,6 @@
write_region(mapinfo, MetaspaceShared::rw, &_rw_region, /*read_only=*/false,/*allow_exec=*/false);
write_region(mapinfo, MetaspaceShared::ro, &_ro_region, /*read_only=*/true, /*allow_exec=*/false);
write_region(mapinfo, MetaspaceShared::md, &_md_region, /*read_only=*/false,/*allow_exec=*/false);
- write_region(mapinfo, MetaspaceShared::od, &_od_region, /*read_only=*/true, /*allow_exec=*/false);
_total_closed_archive_region_size = mapinfo->write_archive_heap_regions(
_closed_archive_heap_regions,
@@ -1535,12 +1513,10 @@
// Print statistics of all the regions
const size_t total_reserved = _ro_region.reserved() + _rw_region.reserved() +
_mc_region.reserved() + _md_region.reserved() +
- _od_region.reserved() +
_total_closed_archive_region_size +
_total_open_archive_region_size;
const size_t total_bytes = _ro_region.used() + _rw_region.used() +
_mc_region.used() + _md_region.used() +
- _od_region.used() +
_total_closed_archive_region_size +
_total_open_archive_region_size;
const double total_u_perc = percent_of(total_bytes, total_reserved);
@@ -1549,7 +1525,6 @@
_rw_region.print(total_reserved);
_ro_region.print(total_reserved);
_md_region.print(total_reserved);
- _od_region.print(total_reserved);
print_heap_region_stats(_closed_archive_heap_regions, "ca", total_reserved);
print_heap_region_stats(_open_archive_heap_regions, "oa", total_reserved);
@@ -1931,33 +1906,30 @@
char* rw_base = NULL; char* rw_top;
char* mc_base = NULL; char* mc_top;
char* md_base = NULL; char* md_top;
- char* od_base = NULL; char* od_top;
// Map each shared region
if ((mc_base = mapinfo->map_region(mc, &mc_top)) != NULL &&
(rw_base = mapinfo->map_region(rw, &rw_top)) != NULL &&
(ro_base = mapinfo->map_region(ro, &ro_top)) != NULL &&
(md_base = mapinfo->map_region(md, &md_top)) != NULL &&
- (od_base = mapinfo->map_region(od, &od_top)) != NULL &&
(image_alignment == (size_t)os::vm_allocation_granularity()) &&
mapinfo->validate_shared_path_table()) {
// Success -- set up MetaspaceObj::_shared_metaspace_{base,top} for
// fast checking in MetaspaceShared::is_in_shared_metaspace() and
// MetaspaceObj::is_shared().
//
- // We require that mc->rw->ro->md->od to be laid out consecutively, with no
+ // We require that mc->rw->ro->md to be laid out consecutively, with no
// gaps between them. That way, we can ensure that the OS won't be able to
// allocate any new memory spaces inside _shared_metaspace_{base,top}, which
// would mess up the simple comparision in MetaspaceShared::is_in_shared_metaspace().
- assert(mc_base < ro_base && mc_base < rw_base && mc_base < md_base && mc_base < od_base, "must be");
- assert(od_top > ro_top && od_top > rw_top && od_top > md_top && od_top > mc_top , "must be");
+ assert(mc_base < ro_base && mc_base < rw_base && mc_base < md_base, "must be");
+ assert(md_top > ro_top && md_top > rw_top && md_top > mc_top , "must be");
assert(mc_top == rw_base, "must be");
assert(rw_top == ro_base, "must be");
assert(ro_top == md_base, "must be");
- assert(md_top == od_base, "must be");
_core_spaces_size = mapinfo->core_spaces_size();
- MetaspaceObj::set_shared_metaspace_range((void*)mc_base, (void*)od_top);
+ MetaspaceObj::set_shared_metaspace_range((void*)mc_base, (void*)md_top);
return true;
} else {
// If there was a failure in mapping any of the spaces, unmap the ones
@@ -1966,7 +1938,6 @@
if (rw_base != NULL) mapinfo->unmap_region(rw);
if (mc_base != NULL) mapinfo->unmap_region(mc);
if (md_base != NULL) mapinfo->unmap_region(md);
- if (od_base != NULL) mapinfo->unmap_region(od);
#ifndef _WINDOWS
// Release the entire mapped region
shared_rs.release();
@@ -2049,7 +2020,6 @@
_rw_region.print_out_of_space_msg(name, needed_bytes);
_ro_region.print_out_of_space_msg(name, needed_bytes);
_md_region.print_out_of_space_msg(name, needed_bytes);
- _od_region.print_out_of_space_msg(name, needed_bytes);
vm_exit_during_initialization(err_msg("Unable to allocate from '%s' region", name),
"Please reduce the number of shared classes.");
--- a/src/hotspot/share/memory/metaspaceShared.hpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/share/memory/metaspaceShared.hpp Tue Feb 26 12:11:29 2019 -0500
@@ -69,14 +69,10 @@
ro = 2, // read-only shared space in the heap
md = 3, // miscellaneous data for initializing tables, etc.
num_core_spaces = 4, // number of non-string regions
-
- // optional mapped spaces
- // Currently it only contains class file data.
- od = num_core_spaces,
- num_non_heap_spaces = od + 1,
+ num_non_heap_spaces = 4,
// mapped java heap regions
- first_closed_archive_heap_region = od + 1,
+ first_closed_archive_heap_region = md + 1,
max_closed_archive_heap_region = 2,
last_closed_archive_heap_region = first_closed_archive_heap_region + max_closed_archive_heap_region - 1,
first_open_archive_heap_region = last_closed_archive_heap_region + 1,
--- a/src/hotspot/share/memory/universe.cpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/share/memory/universe.cpp Tue Feb 26 12:11:29 2019 -0500
@@ -107,6 +107,7 @@
LatestMethodCache* Universe::_finalizer_register_cache = NULL;
LatestMethodCache* Universe::_loader_addClass_cache = NULL;
LatestMethodCache* Universe::_throw_illegal_access_error_cache = NULL;
+LatestMethodCache* Universe::_throw_no_such_method_error_cache = NULL;
LatestMethodCache* Universe::_do_stack_walk_cache = NULL;
oop Universe::_out_of_memory_error_java_heap = NULL;
oop Universe::_out_of_memory_error_metaspace = NULL;
@@ -230,6 +231,7 @@
_finalizer_register_cache->metaspace_pointers_do(it);
_loader_addClass_cache->metaspace_pointers_do(it);
_throw_illegal_access_error_cache->metaspace_pointers_do(it);
+ _throw_no_such_method_error_cache->metaspace_pointers_do(it);
_do_stack_walk_cache->metaspace_pointers_do(it);
}
@@ -271,6 +273,7 @@
_finalizer_register_cache->serialize(f);
_loader_addClass_cache->serialize(f);
_throw_illegal_access_error_cache->serialize(f);
+ _throw_no_such_method_error_cache->serialize(f);
_do_stack_walk_cache->serialize(f);
}
@@ -689,6 +692,7 @@
Universe::_finalizer_register_cache = new LatestMethodCache();
Universe::_loader_addClass_cache = new LatestMethodCache();
Universe::_throw_illegal_access_error_cache = new LatestMethodCache();
+ Universe::_throw_no_such_method_error_cache = new LatestMethodCache();
Universe::_do_stack_walk_cache = new LatestMethodCache();
#if INCLUDE_CDS
@@ -935,6 +939,11 @@
"throwIllegalAccessError",
vmSymbols::void_method_signature(), true, CHECK);
+ initialize_known_method(_throw_no_such_method_error_cache,
+ SystemDictionary::internal_Unsafe_klass(),
+ "throwNoSuchMethodError",
+ vmSymbols::void_method_signature(), true, CHECK);
+
// Set up method for registering loaded classes in class loader vector
initialize_known_method(_loader_addClass_cache,
SystemDictionary::ClassLoader_klass(),
--- a/src/hotspot/share/memory/universe.hpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/share/memory/universe.hpp Tue Feb 26 12:11:29 2019 -0500
@@ -138,6 +138,7 @@
static LatestMethodCache* _finalizer_register_cache; // static method for registering finalizable objects
static LatestMethodCache* _loader_addClass_cache; // method for registering loaded classes in class loader vector
static LatestMethodCache* _throw_illegal_access_error_cache; // Unsafe.throwIllegalAccessError() method
+ static LatestMethodCache* _throw_no_such_method_error_cache; // Unsafe.throwNoSuchMethodError() method
static LatestMethodCache* _do_stack_walk_cache; // method for stack walker callback
// preallocated error objects (no backtrace)
@@ -322,6 +323,7 @@
static Method* loader_addClass_method() { return _loader_addClass_cache->get_method(); }
static Method* throw_illegal_access_error() { return _throw_illegal_access_error_cache->get_method(); }
+ static Method* throw_no_such_method_error() { return _throw_no_such_method_error_cache->get_method(); }
static Method* do_stack_walk_method() { return _do_stack_walk_cache->get_method(); }
--- a/src/hotspot/share/oops/cpCache.cpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/share/oops/cpCache.cpp Tue Feb 26 12:11:29 2019 -0500
@@ -591,7 +591,7 @@
// a constant pool cache entry should never contain old or obsolete methods
bool ConstantPoolCacheEntry::check_no_old_or_obsolete_entries() {
- Method* m = get_interesting_method_entry(NULL);
+ Method* m = get_interesting_method_entry();
// return false if m refers to a non-deleted old or obsolete method
if (m != NULL) {
assert(m->is_valid() && m->is_method(), "m is a valid method");
@@ -601,7 +601,7 @@
}
}
-Method* ConstantPoolCacheEntry::get_interesting_method_entry(Klass* k) {
+Method* ConstantPoolCacheEntry::get_interesting_method_entry() {
if (!is_method_entry()) {
// not a method entry so not interesting by default
return NULL;
@@ -622,12 +622,9 @@
}
}
assert(m != NULL && m->is_method(), "sanity check");
- if (m == NULL || !m->is_method() || (k != NULL && m->method_holder() != k)) {
- // robustness for above sanity checks or method is not in
- // the interesting class
+ if (m == NULL || !m->is_method()) {
return NULL;
}
- // the method is in the interesting class so the entry is interesting
return m;
}
#endif // INCLUDE_JVMTI
@@ -777,10 +774,10 @@
// RedefineClasses() API support:
// If any entry of this ConstantPoolCache points to any of
// old_methods, replace it with the corresponding new_method.
-void ConstantPoolCache::adjust_method_entries(InstanceKlass* holder, bool * trace_name_printed) {
+void ConstantPoolCache::adjust_method_entries(bool * trace_name_printed) {
for (int i = 0; i < length(); i++) {
ConstantPoolCacheEntry* entry = entry_at(i);
- Method* old_method = entry->get_interesting_method_entry(holder);
+ Method* old_method = entry->get_interesting_method_entry();
if (old_method == NULL || !old_method->is_old()) {
continue; // skip uninteresting entries
}
@@ -789,11 +786,7 @@
entry->initialize_entry(entry->constant_pool_index());
continue;
}
- Method* new_method = holder->method_with_idnum(old_method->orig_method_idnum());
-
- assert(new_method != NULL, "method_with_idnum() should not be NULL");
- assert(old_method != new_method, "sanity check");
-
+ Method* new_method = old_method->get_new_method();
entry_at(i)->adjust_method_entry(old_method, new_method, trace_name_printed);
}
}
@@ -801,7 +794,7 @@
// the constant pool cache should never contain old or obsolete methods
bool ConstantPoolCache::check_no_old_or_obsolete_entries() {
for (int i = 1; i < length(); i++) {
- if (entry_at(i)->get_interesting_method_entry(NULL) != NULL &&
+ if (entry_at(i)->get_interesting_method_entry() != NULL &&
!entry_at(i)->check_no_old_or_obsolete_entries()) {
return false;
}
@@ -811,7 +804,7 @@
void ConstantPoolCache::dump_cache() {
for (int i = 1; i < length(); i++) {
- if (entry_at(i)->get_interesting_method_entry(NULL) != NULL) {
+ if (entry_at(i)->get_interesting_method_entry() != NULL) {
entry_at(i)->print(tty, i);
}
}
--- a/src/hotspot/share/oops/cpCache.hpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/share/oops/cpCache.hpp Tue Feb 26 12:11:29 2019 -0500
@@ -376,7 +376,7 @@
void adjust_method_entry(Method* old_method, Method* new_method,
bool* trace_name_printed);
bool check_no_old_or_obsolete_entries();
- Method* get_interesting_method_entry(Klass* k);
+ Method* get_interesting_method_entry();
#endif // INCLUDE_JVMTI
// Debugging & Printing
@@ -496,7 +496,7 @@
// trace_name_printed is set to true if the current call has
// printed the klass name so that other routines in the adjust_*
// group don't print the klass name.
- void adjust_method_entries(InstanceKlass* holder, bool* trace_name_printed);
+ void adjust_method_entries(bool* trace_name_printed);
bool check_no_old_or_obsolete_entries();
void dump_cache();
#endif // INCLUDE_JVMTI
--- a/src/hotspot/share/oops/instanceKlass.cpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/share/oops/instanceKlass.cpp Tue Feb 26 12:11:29 2019 -0500
@@ -183,8 +183,14 @@
if (name == k->name()) {
log_trace(class, nestmates)("- Found it at nest_members[%d] => cp[%d]", i, cp_index);
- // names match so check actual klass - this may trigger class loading if
- // it doesn't match (but that should be impossible)
+ // Names match so check actual klass - this may trigger class loading if
+ // it doesn't match (though that should be impossible). But to be safe we
+ // have to check for a compiler thread executing here.
+ if (!THREAD->can_call_java() && !_constants->tag_at(cp_index).is_klass()) {
+ log_trace(class, nestmates)("- validation required resolution in an unsuitable thread");
+ return false;
+ }
+
Klass* k2 = _constants->klass_at(cp_index, CHECK_false);
if (k2 == k) {
log_trace(class, nestmates)("- class is listed as a nest member");
@@ -296,7 +302,7 @@
error);
}
- if (validationException != NULL) {
+ if (validationException != NULL && THREAD->can_call_java()) {
ResourceMark rm(THREAD);
Exceptions::fthrow(THREAD_AND_LOCATION,
validationException,
@@ -2347,6 +2353,7 @@
#if INCLUDE_JVMTI
guarantee(_breakpoints == NULL, "must be");
guarantee(_previous_versions == NULL, "must be");
+ _cached_class_file = NULL;
#endif
_init_thread = NULL;
@@ -2503,7 +2510,7 @@
}
// deallocate the cached class file
- if (_cached_class_file != NULL && !MetaspaceShared::is_in_shared_metaspace(_cached_class_file)) {
+ if (_cached_class_file != NULL) {
os::free(_cached_class_file);
_cached_class_file = NULL;
}
@@ -2910,22 +2917,18 @@
// not yet in the vtable due to concurrent subclass define and superinterface
// redefinition
// Note: those in the vtable, should have been updated via adjust_method_entries
-void InstanceKlass::adjust_default_methods(InstanceKlass* holder, bool* trace_name_printed) {
+void InstanceKlass::adjust_default_methods(bool* trace_name_printed) {
// search the default_methods for uses of either obsolete or EMCP methods
if (default_methods() != NULL) {
for (int index = 0; index < default_methods()->length(); index ++) {
Method* old_method = default_methods()->at(index);
- if (old_method == NULL || old_method->method_holder() != holder || !old_method->is_old()) {
+ if (old_method == NULL || !old_method->is_old()) {
continue; // skip uninteresting entries
}
assert(!old_method->is_deleted(), "default methods may not be deleted");
-
- Method* new_method = holder->method_with_idnum(old_method->orig_method_idnum());
-
- assert(new_method != NULL, "method_with_idnum() should not be NULL");
- assert(old_method != new_method, "sanity check");
-
+ Method* new_method = old_method->get_new_method();
default_methods()->at_put(index, new_method);
+
if (log_is_enabled(Info, redefine, class, update)) {
ResourceMark rm;
if (!(*trace_name_printed)) {
@@ -3964,12 +3967,7 @@
#if INCLUDE_JVMTI
JvmtiCachedClassFileData* InstanceKlass::get_cached_class_file() {
- if (MetaspaceShared::is_in_shared_metaspace(_cached_class_file)) {
- // Ignore the archived class stream data
- return NULL;
- } else {
- return _cached_class_file;
- }
+ return _cached_class_file;
}
jint InstanceKlass::get_cached_class_file_len() {
@@ -3979,19 +3977,4 @@
unsigned char * InstanceKlass::get_cached_class_file_bytes() {
return VM_RedefineClasses::get_cached_class_file_bytes(_cached_class_file);
}
-
-#if INCLUDE_CDS
-JvmtiCachedClassFileData* InstanceKlass::get_archived_class_data() {
- if (DumpSharedSpaces) {
- return _cached_class_file;
- } else {
- assert(this->is_shared(), "class should be shared");
- if (MetaspaceShared::is_in_shared_metaspace(_cached_class_file)) {
- return _cached_class_file;
- } else {
- return NULL;
- }
- }
-}
#endif
-#endif
--- a/src/hotspot/share/oops/instanceKlass.hpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/share/oops/instanceKlass.hpp Tue Feb 26 12:11:29 2019 -0500
@@ -847,14 +847,6 @@
JvmtiCachedClassFieldMap* jvmti_cached_class_field_map() const {
return _jvmti_cached_class_field_map;
}
-
-#if INCLUDE_CDS
- void set_archived_class_data(JvmtiCachedClassFileData* data) {
- _cached_class_file = data;
- }
-
- JvmtiCachedClassFileData * get_archived_class_data();
-#endif // INCLUDE_CDS
#else // INCLUDE_JVMTI
static void purge_previous_versions(InstanceKlass* ik) { return; };
@@ -1149,7 +1141,7 @@
Method* method_at_itable(Klass* holder, int index, TRAPS);
#if INCLUDE_JVMTI
- void adjust_default_methods(InstanceKlass* holder, bool* trace_name_printed);
+ void adjust_default_methods(bool* trace_name_printed);
#endif // INCLUDE_JVMTI
void clean_weak_instanceklass_links();
--- a/src/hotspot/share/oops/klassVtable.cpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/share/oops/klassVtable.cpp Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2019, 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
@@ -942,21 +942,18 @@
}
// search the vtable for uses of either obsolete or EMCP methods
-void klassVtable::adjust_method_entries(InstanceKlass* holder, bool * trace_name_printed) {
+void klassVtable::adjust_method_entries(bool * trace_name_printed) {
int prn_enabled = 0;
for (int index = 0; index < length(); index++) {
Method* old_method = unchecked_method_at(index);
- if (old_method == NULL || old_method->method_holder() != holder || !old_method->is_old()) {
+ if (old_method == NULL || !old_method->is_old()) {
continue; // skip uninteresting entries
}
assert(!old_method->is_deleted(), "vtable methods may not be deleted");
- Method* new_method = holder->method_with_idnum(old_method->orig_method_idnum());
+ Method* new_method = old_method->get_new_method();
+ put_method_at(new_method, index);
- assert(new_method != NULL, "method_with_idnum() should not be NULL");
- assert(old_method != new_method, "sanity check");
-
- put_method_at(new_method, index);
// For default methods, need to update the _default_methods array
// which can only have one method entry for a given signature
bool updated_default = false;
@@ -1272,21 +1269,16 @@
#if INCLUDE_JVMTI
// search the itable for uses of either obsolete or EMCP methods
-void klassItable::adjust_method_entries(InstanceKlass* holder, bool * trace_name_printed) {
+void klassItable::adjust_method_entries(bool * trace_name_printed) {
itableMethodEntry* ime = method_entry(0);
for (int i = 0; i < _size_method_table; i++, ime++) {
Method* old_method = ime->method();
- if (old_method == NULL || old_method->method_holder() != holder || !old_method->is_old()) {
+ if (old_method == NULL || !old_method->is_old()) {
continue; // skip uninteresting entries
}
assert(!old_method->is_deleted(), "itable methods may not be deleted");
-
- Method* new_method = holder->method_with_idnum(old_method->orig_method_idnum());
-
- assert(new_method != NULL, "method_with_idnum() should not be NULL");
- assert(old_method != new_method, "sanity check");
-
+ Method* new_method = old_method->get_new_method();
ime->initialize(new_method);
if (log_is_enabled(Info, redefine, class, update)) {
--- a/src/hotspot/share/oops/klassVtable.hpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/share/oops/klassVtable.hpp Tue Feb 26 12:11:29 2019 -0500
@@ -103,7 +103,7 @@
// printed the klass name so that other routines in the adjust_*
// group don't print the klass name.
bool adjust_default_method(int vtable_index, Method* old_method, Method* new_method);
- void adjust_method_entries(InstanceKlass* holder, bool * trace_name_printed);
+ void adjust_method_entries(bool* trace_name_printed);
bool check_no_old_or_obsolete_entries();
void dump_vtable();
#endif // INCLUDE_JVMTI
@@ -322,7 +322,7 @@
// trace_name_printed is set to true if the current call has
// printed the klass name so that other routines in the adjust_*
// group don't print the klass name.
- void adjust_method_entries(InstanceKlass* holder, bool * trace_name_printed);
+ void adjust_method_entries(bool* trace_name_printed);
bool check_no_old_or_obsolete_entries();
void dump_itable();
#endif // INCLUDE_JVMTI
--- a/src/hotspot/share/oops/method.cpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/share/oops/method.cpp Tue Feb 26 12:11:29 2019 -0500
@@ -2120,7 +2120,8 @@
// Can't assert the method_holder is the same because the new method has the
// scratch method holder.
assert(resolve_jmethod_id(jmid)->method_holder()->class_loader()
- == new_method->method_holder()->class_loader(),
+ == new_method->method_holder()->class_loader() ||
+ new_method->method_holder()->class_loader() == NULL, // allow Unsafe substitution
"changing to a different class loader");
// Just change the method in place, jmethodID pointer doesn't change.
*((Method**)jmid) = new_method;
--- a/src/hotspot/share/oops/method.hpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/share/oops/method.hpp Tue Feb 26 12:11:29 2019 -0500
@@ -974,6 +974,15 @@
// Deallocation function for redefine classes or if an error occurs
void deallocate_contents(ClassLoaderData* loader_data);
+ Method* get_new_method() const {
+ InstanceKlass* holder = method_holder();
+ Method* new_method = holder->method_with_idnum(orig_method_idnum());
+
+ assert(new_method != NULL, "method_with_idnum() should not be NULL");
+ assert(this != new_method, "sanity check");
+ return new_method;
+ }
+
// Printing
#ifndef PRODUCT
void print_on(outputStream* st) const;
--- a/src/hotspot/share/opto/escape.cpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/share/opto/escape.cpp Tue Feb 26 12:11:29 2019 -0500
@@ -1726,6 +1726,18 @@
// access its field since the field value is unknown after it.
//
Node* n = field->ideal_node();
+
+ // Test for an unsafe access that was parsed as maybe off heap
+ // (with a CheckCastPP to raw memory).
+ assert(n->is_AddP(), "expect an address computation");
+ if (n->in(AddPNode::Base)->is_top() &&
+ n->in(AddPNode::Address)->Opcode() == Op_CheckCastPP) {
+ assert(n->in(AddPNode::Address)->bottom_type()->isa_rawptr(), "raw address so raw cast expected");
+ assert(_igvn->type(n->in(AddPNode::Address)->in(1))->isa_oopptr(), "cast pattern at unsafe access expected");
+ jobj->set_scalar_replaceable(false);
+ return;
+ }
+
for (DUIterator_Fast imax, i = n->fast_outs(imax); i < imax; i++) {
Node* u = n->fast_out(i);
if (u->is_LoadStore() || (u->is_Mem() && u->as_Mem()->is_mismatched_access())) {
--- a/src/hotspot/share/prims/jni.cpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/share/prims/jni.cpp Tue Feb 26 12:11:29 2019 -0500
@@ -3953,9 +3953,6 @@
}
#endif
- // Tracks the time application was running before GC
- RuntimeService::record_application_start();
-
// Notify JVMTI
if (JvmtiExport::should_post_thread_life()) {
JvmtiExport::post_thread_start(thread);
--- a/src/hotspot/share/prims/jvmtiRedefineClasses.cpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/share/prims/jvmtiRedefineClasses.cpp Tue Feb 26 12:11:29 2019 -0500
@@ -62,10 +62,11 @@
Method** VM_RedefineClasses::_matching_new_methods = NULL;
Method** VM_RedefineClasses::_deleted_methods = NULL;
Method** VM_RedefineClasses::_added_methods = NULL;
-int VM_RedefineClasses::_matching_methods_length = 0;
-int VM_RedefineClasses::_deleted_methods_length = 0;
-int VM_RedefineClasses::_added_methods_length = 0;
-Klass* VM_RedefineClasses::_the_class = NULL;
+int VM_RedefineClasses::_matching_methods_length = 0;
+int VM_RedefineClasses::_deleted_methods_length = 0;
+int VM_RedefineClasses::_added_methods_length = 0;
+bool VM_RedefineClasses::_has_redefined_Object = false;
+bool VM_RedefineClasses::_has_null_class_loader = false;
VM_RedefineClasses::VM_RedefineClasses(jint class_count,
@@ -76,6 +77,9 @@
_class_load_kind = class_load_kind;
_any_class_has_resolved_methods = false;
_res = JVMTI_ERROR_NONE;
+ _the_class = NULL;
+ _has_redefined_Object = false;
+ _has_null_class_loader = false;
}
static inline InstanceKlass* get_ik(jclass def) {
@@ -214,11 +218,12 @@
// Flush all compiled code that depends on the classes redefined.
flush_dependent_code();
- // Clean out MethodData pointing to old Method*
+ // Adjust constantpool caches and vtables for all classes
+ // that reference methods of the evolved classes.
// Have to do this after all classes are redefined and all methods that
// are redefined are marked as old.
- MethodDataCleaner clean_weak_method_links;
- ClassLoaderDataGraph::classes_do(&clean_weak_method_links);
+ AdjustAndCleanMetadata adjust_and_clean_metadata(thread);
+ ClassLoaderDataGraph::classes_do(&adjust_and_clean_metadata);
// JSR-292 support
if (_any_class_has_resolved_methods) {
@@ -3415,25 +3420,35 @@
// Unevolving classes may point to methods of the_class directly
// from their constant pool caches, itables, and/or vtables. We
// use the ClassLoaderDataGraph::classes_do() facility and this helper
-// to fix up these pointers.
+// to fix up these pointers. MethodData also points to old methods and
+// must be cleaned.
// Adjust cpools and vtables closure
-void VM_RedefineClasses::AdjustCpoolCacheAndVtable::do_klass(Klass* k) {
+void VM_RedefineClasses::AdjustAndCleanMetadata::do_klass(Klass* k) {
// This is a very busy routine. We don't want too much tracing
// printed out.
bool trace_name_printed = false;
- InstanceKlass *the_class = InstanceKlass::cast(_the_class);
// If the class being redefined is java.lang.Object, we need to fix all
// array class vtables also
- if (k->is_array_klass() && _the_class == SystemDictionary::Object_klass()) {
- k->vtable().adjust_method_entries(the_class, &trace_name_printed);
+ if (k->is_array_klass() && _has_redefined_Object) {
+ k->vtable().adjust_method_entries(&trace_name_printed);
} else if (k->is_instance_klass()) {
HandleMark hm(_thread);
InstanceKlass *ik = InstanceKlass::cast(k);
+ // Clean MethodData of this class's methods so they don't refer to
+ // old methods that are no longer running.
+ Array<Method*>* methods = ik->methods();
+ int num_methods = methods->length();
+ for (int index = 0; index < num_methods; ++index) {
+ if (methods->at(index)->method_data() != NULL) {
+ methods->at(index)->method_data()->clean_weak_method_links();
+ }
+ }
+
// HotSpot specific optimization! HotSpot does not currently
// support delegation from the bootstrap class loader to a
// user-defined class loader. This means that if the bootstrap
@@ -3446,57 +3461,29 @@
// If the current class being redefined has a user-defined class
// loader as its defining class loader, then we can skip all
// classes loaded by the bootstrap class loader.
- bool is_user_defined = (_the_class->class_loader() != NULL);
- if (is_user_defined && ik->class_loader() == NULL) {
+ if (!_has_null_class_loader && ik->class_loader() == NULL) {
return;
}
- // Fix the vtable embedded in the_class and subclasses of the_class,
- // if one exists. We discard scratch_class and we don't keep an
- // InstanceKlass around to hold obsolete methods so we don't have
- // any other InstanceKlass embedded vtables to update. The vtable
- // holds the Method*s for virtual (but not final) methods.
- // Default methods, or concrete methods in interfaces are stored
- // in the vtable, so if an interface changes we need to check
- // adjust_method_entries() for every InstanceKlass, which will also
- // adjust the default method vtable indices.
- // We also need to adjust any default method entries that are
- // not yet in the vtable, because the vtable setup is in progress.
- // This must be done after we adjust the default_methods and
- // default_vtable_indices for methods already in the vtable.
- // If redefining Unsafe, walk all the vtables looking for entries.
- if (ik->vtable_length() > 0 && (_the_class->is_interface()
- || _the_class == SystemDictionary::internal_Unsafe_klass()
- || ik->is_subtype_of(_the_class))) {
- // ik->vtable() creates a wrapper object; rm cleans it up
- ResourceMark rm(_thread);
-
- ik->vtable().adjust_method_entries(the_class, &trace_name_printed);
- ik->adjust_default_methods(the_class, &trace_name_printed);
+ // Adjust all vtables, default methods and itables, to clean out old methods.
+ ResourceMark rm(_thread);
+ if (ik->vtable_length() > 0) {
+ ik->vtable().adjust_method_entries(&trace_name_printed);
+ ik->adjust_default_methods(&trace_name_printed);
}
- // If the current class has an itable and we are either redefining an
- // interface or if the current class is a subclass of the_class, then
- // we potentially have to fix the itable. If we are redefining an
- // interface, then we have to call adjust_method_entries() for
- // every InstanceKlass that has an itable since there isn't a
- // subclass relationship between an interface and an InstanceKlass.
- // If redefining Unsafe, walk all the itables looking for entries.
- if (ik->itable_length() > 0 && (_the_class->is_interface()
- || _the_class == SystemDictionary::internal_Unsafe_klass()
- || ik->is_subclass_of(_the_class))) {
- ResourceMark rm(_thread);
- ik->itable().adjust_method_entries(the_class, &trace_name_printed);
+ if (ik->itable_length() > 0) {
+ ik->itable().adjust_method_entries(&trace_name_printed);
}
// The constant pools in other classes (other_cp) can refer to
- // methods in the_class. We have to update method information in
+ // old methods. We have to update method information in
// other_cp's cache. If other_cp has a previous version, then we
// have to repeat the process for each previous version. The
// constant pool cache holds the Method*s for non-virtual
// methods and for virtual, final methods.
//
- // Special case: if the current class is the_class, then new_cp
+ // Special case: if the current class being redefined, then new_cp
// has already been attached to the_class and old_cp has already
// been added as a previous version. The new_cp doesn't have any
// cached references to old methods so it doesn't need to be
@@ -3505,12 +3492,12 @@
constantPoolHandle other_cp;
ConstantPoolCache* cp_cache;
- if (ik != _the_class) {
+ if (!ik->is_being_redefined()) {
// this klass' constant pool cache may need adjustment
other_cp = constantPoolHandle(ik->constants());
cp_cache = other_cp->cache();
if (cp_cache != NULL) {
- cp_cache->adjust_method_entries(the_class, &trace_name_printed);
+ cp_cache->adjust_method_entries(&trace_name_printed);
}
}
@@ -3520,23 +3507,7 @@
pv_node = pv_node->previous_versions()) {
cp_cache = pv_node->constants()->cache();
if (cp_cache != NULL) {
- cp_cache->adjust_method_entries(pv_node, &trace_name_printed);
- }
- }
- }
-}
-
-// Clean method data for this class
-void VM_RedefineClasses::MethodDataCleaner::do_klass(Klass* k) {
- if (k->is_instance_klass()) {
- InstanceKlass *ik = InstanceKlass::cast(k);
- // Clean MethodData of this class's methods so they don't refer to
- // old methods that are no longer running.
- Array<Method*>* methods = ik->methods();
- int num_methods = methods->length();
- for (int index = 0; index < num_methods; ++index) {
- if (methods->at(index)->method_data() != NULL) {
- methods->at(index)->method_data()->clean_weak_method_links();
+ cp_cache->adjust_method_entries(&trace_name_printed);
}
}
}
@@ -3554,6 +3525,15 @@
"should be replaced");
}
}
+ // Update deleted jmethodID
+ for (int j = 0; j < _deleted_methods_length; ++j) {
+ Method* old_method = _deleted_methods[j];
+ jmethodID jmid = old_method->find_jmethod_id_or_null();
+ if (jmid != NULL) {
+ // Change the jmethodID to point to NSME.
+ Method::change_method_associated_with_jmethod_id(jmid, Universe::throw_no_such_method_error());
+ }
+ }
}
int VM_RedefineClasses::check_methods_and_mark_as_obsolete() {
@@ -3972,6 +3952,10 @@
InstanceKlass* the_class = get_ik(the_jclass);
+ // Set some flags to control and optimize adjusting method entries
+ _has_redefined_Object |= the_class == SystemDictionary::Object_klass();
+ _has_null_class_loader |= the_class->class_loader() == NULL;
+
// Remove all breakpoints in methods of this class
JvmtiBreakpoints& jvmti_breakpoints = JvmtiCurrentBreakpoints::get_jvmti_breakpoints();
jvmti_breakpoints.clearall_in_class_at_safepoint(the_class);
@@ -4193,11 +4177,6 @@
_timer_rsc_phase2.start();
}
- // Adjust constantpool caches and vtables for all classes
- // that reference methods of the evolved class.
- AdjustCpoolCacheAndVtable adjust_cpool_cache_and_vtable(THREAD);
- ClassLoaderDataGraph::classes_do(&adjust_cpool_cache_and_vtable);
-
if (the_class->oop_map_cache() != NULL) {
// Flush references to any obsolete methods from the oop map cache
// so that obsolete methods are not pinned.
--- a/src/hotspot/share/prims/jvmtiRedefineClasses.hpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/share/prims/jvmtiRedefineClasses.hpp Tue Feb 26 12:11:29 2019 -0500
@@ -338,20 +338,22 @@
class VM_RedefineClasses: public VM_Operation {
private:
// These static fields are needed by ClassLoaderDataGraph::classes_do()
- // facility and the AdjustCpoolCacheAndVtable helper:
+ // facility and the CheckClass and AdjustAndCleanMetadata helpers.
static Array<Method*>* _old_methods;
static Array<Method*>* _new_methods;
- static Method** _matching_old_methods;
- static Method** _matching_new_methods;
- static Method** _deleted_methods;
- static Method** _added_methods;
+ static Method** _matching_old_methods;
+ static Method** _matching_new_methods;
+ static Method** _deleted_methods;
+ static Method** _added_methods;
static int _matching_methods_length;
static int _deleted_methods_length;
static int _added_methods_length;
- static Klass* _the_class;
+ static bool _has_redefined_Object;
+ static bool _has_null_class_loader;
// The instance fields are used to pass information from
// doit_prologue() to doit() and doit_epilogue().
+ Klass* _the_class;
jint _class_count;
const jvmtiClassDefinition *_class_defs; // ptr to _class_count defs
@@ -513,20 +515,14 @@
// Unevolving classes may point to methods of the_class directly
// from their constant pool caches, itables, and/or vtables. We
// use the ClassLoaderDataGraph::classes_do() facility and this helper
- // to fix up these pointers.
- class AdjustCpoolCacheAndVtable : public KlassClosure {
+ // to fix up these pointers and clean MethodData out.
+ class AdjustAndCleanMetadata : public KlassClosure {
Thread* _thread;
public:
- AdjustCpoolCacheAndVtable(Thread* t) : _thread(t) {}
+ AdjustAndCleanMetadata(Thread* t) : _thread(t) {}
void do_klass(Klass* k);
};
- // Clean MethodData out
- class MethodDataCleaner : public KlassClosure {
- public:
- MethodDataCleaner() {}
- void do_klass(Klass* k);
- };
public:
VM_RedefineClasses(jint class_count,
const jvmtiClassDefinition *class_defs,
--- a/src/hotspot/share/prims/resolvedMethodTable.cpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/share/prims/resolvedMethodTable.cpp Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, 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
@@ -120,18 +120,21 @@
return entry;
}
-oop ResolvedMethodTable::add_method(Handle resolved_method_name) {
+oop ResolvedMethodTable::add_method(const methodHandle& m, Handle resolved_method_name) {
MutexLocker ml(ResolvedMethodTable_lock);
DEBUG_ONLY(NoSafepointVerifier nsv);
+ Method* method = m();
// Check if method has been redefined while taking out ResolvedMethodTable_lock, if so
- // use new method.
- Method* method = (Method*)java_lang_invoke_ResolvedMethodName::vmtarget(resolved_method_name());
- assert(method->is_method(), "must be method");
+ // use new method. The old method won't be deallocated because it's passed in as a Handle.
if (method->is_old()) {
// Replace method with redefined version
InstanceKlass* holder = method->method_holder();
method = holder->method_with_idnum(method->method_idnum());
+ if (method == NULL) {
+ // Replace deleted method with NSME.
+ method = Universe::throw_no_such_method_error();
+ }
java_lang_invoke_ResolvedMethodName::set_vmtarget(resolved_method_name(), method);
}
// Set flag in class to indicate this InstanceKlass has entries in the table
@@ -226,18 +229,9 @@
if (old_method->is_old()) {
- if (old_method->is_deleted()) {
- // leave deleted method in ResolvedMethod for now (this is a bug that we don't mark
- // these on_stack)
- continue;
- }
-
- InstanceKlass* holder = old_method->method_holder();
- Method* new_method = holder->method_with_idnum(old_method->orig_method_idnum());
- assert(holder == new_method->method_holder(), "call after swapping redefined guts");
- assert(new_method != NULL, "method_with_idnum() should not be NULL");
- assert(old_method != new_method, "sanity check");
-
+ Method* new_method = (old_method->is_deleted()) ?
+ Universe::throw_no_such_method_error() :
+ old_method->get_new_method();
java_lang_invoke_ResolvedMethodName::set_vmtarget(mem_name, new_method);
ResourceMark rm;
--- a/src/hotspot/share/prims/resolvedMethodTable.hpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/share/prims/resolvedMethodTable.hpp Tue Feb 26 12:11:29 2019 -0500
@@ -89,7 +89,7 @@
// Called from java_lang_invoke_ResolvedMethodName
static oop find_method(Method* method);
- static oop add_method(Handle rmethod_name);
+ static oop add_method(const methodHandle& method, Handle rmethod_name);
static bool has_work() { return _dead_entries; }
static void trigger_cleanup();
--- a/src/hotspot/share/runtime/arguments.cpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/share/runtime/arguments.cpp Tue Feb 26 12:11:29 2019 -0500
@@ -529,6 +529,7 @@
{ "InitialRAMFraction", JDK_Version::jdk(10), JDK_Version::undefined(), JDK_Version::undefined() },
{ "UseMembar", JDK_Version::jdk(10), JDK_Version::jdk(12), JDK_Version::undefined() },
{ "CompilationPolicyChoice", JDK_Version::jdk(13), JDK_Version::jdk(14), JDK_Version::undefined() },
+ { "FailOverToOldVerifier", JDK_Version::jdk(13), JDK_Version::jdk(14), JDK_Version::undefined() },
// --- Deprecated alias flags (see also aliased_jvm_flags) - sorted by obsolete_in then expired_in:
{ "DefaultMaxRAMFraction", JDK_Version::jdk(8), JDK_Version::undefined(), JDK_Version::undefined() },
@@ -2453,9 +2454,15 @@
(is_absolute_path = match_option(option, "-agentpath:", &tail))) {
if(tail != NULL) {
const char* pos = strchr(tail, '=');
- size_t len = (pos == NULL) ? strlen(tail) : pos - tail;
- char* name = strncpy(NEW_C_HEAP_ARRAY(char, len + 1, mtArguments), tail, len);
- name[len] = '\0';
+ char* name;
+ if (pos == NULL) {
+ name = os::strdup_check_oom(tail, mtArguments);
+ } else {
+ size_t len = pos - tail;
+ name = NEW_C_HEAP_ARRAY(char, len + 1, mtArguments);
+ memcpy(name, tail, len);
+ name[len] = '\0';
+ }
char *options = NULL;
if(pos != NULL) {
--- a/src/hotspot/share/runtime/init.cpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/share/runtime/init.cpp Tue Feb 26 12:11:29 2019 -0500
@@ -174,10 +174,7 @@
ObjectSynchronizer::audit_and_print_stats(true /* on_exit */);
}
perfMemory_exit();
- if (log_is_enabled(Debug, safepoint, stats)) {
- // Print the collected safepoint statistics.
- SafepointSynchronize::print_stat_on_exit();
- }
+ SafepointTracing::statistics_exit_log();
if (PrintStringTableStatistics) {
SymbolTable::dump(tty);
StringTable::dump(tty);
--- a/src/hotspot/share/runtime/mutexLocker.cpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/share/runtime/mutexLocker.cpp Tue Feb 26 12:11:29 2019 -0500
@@ -150,6 +150,9 @@
#if INCLUDE_NMT
Mutex* NMTQuery_lock = NULL;
#endif
+#if INCLUDE_CDS && INCLUDE_JVMTI
+Mutex* CDSClassFileStream_lock = NULL;
+#endif
#define MAX_NUM_MUTEX 128
static Monitor * _mutex_array[MAX_NUM_MUTEX];
@@ -339,6 +342,9 @@
#if INCLUDE_NMT
def(NMTQuery_lock , PaddedMutex , max_nonleaf, false, Monitor::_safepoint_check_always);
#endif
+#if INCLUDE_CDS && INCLUDE_JVMTI
+ def(CDSClassFileStream_lock , PaddedMutex , max_nonleaf, false, Monitor::_safepoint_check_always);
+#endif
}
GCMutexLocker::GCMutexLocker(Monitor * mutex) {
--- a/src/hotspot/share/runtime/mutexLocker.hpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/share/runtime/mutexLocker.hpp Tue Feb 26 12:11:29 2019 -0500
@@ -133,6 +133,9 @@
#if INCLUDE_NMT
extern Mutex* NMTQuery_lock; // serialize NMT Dcmd queries
#endif
+#if INCLUDE_CDS && INCLUDE_JVMTI
+extern Mutex* CDSClassFileStream_lock; // FileMapInfo::open_stream_for_jvmti
+#endif
#if INCLUDE_JFR
extern Mutex* JfrStacktrace_lock; // used to guard access to the JFR stacktrace table
extern Monitor* JfrMsg_lock; // protects JFR messaging
--- a/src/hotspot/share/runtime/safepoint.cpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/share/runtime/safepoint.cpp Tue Feb 26 12:11:29 2019 -0500
@@ -103,16 +103,6 @@
}
}
-static void post_safepoint_wait_blocked_event(EventSafepointWaitBlocked& event,
- uint64_t safepoint_id,
- int initial_threads_waiting_to_block) {
- if (event.should_commit()) {
- event.set_safepointId(safepoint_id);
- event.set_runningThreadCount(initial_threads_waiting_to_block);
- event.commit();
- }
-}
-
static void post_safepoint_cleanup_task_event(EventSafepointCleanupTask& event,
uint64_t safepoint_id,
const char* name) {
@@ -138,27 +128,21 @@
volatile uint64_t SafepointSynchronize::_safepoint_counter = 0;
const uint64_t SafepointSynchronize::InactiveSafepointCounter = 0;
int SafepointSynchronize::_current_jni_active_count = 0;
-long SafepointSynchronize::_end_of_last_safepoint = 0;
WaitBarrier* SafepointSynchronize::_wait_barrier;
-// We need a place to save the desc since it is released before we need it.
-static char stopped_description[64] = "";
-static bool _vm_is_waiting = false;
-
static volatile bool PageArmed = false; // safepoint polling page is RO|RW vs PROT_NONE
static bool timeout_error_printed = false;
// Statistic related
-julong SafepointSynchronize::_coalesced_vmop_count = 0;
static jlong _safepoint_begin_time = 0;
-static float _ts_of_current_safepoint = 0.0f;
static volatile int _nof_threads_hit_polling_page = 0;
void SafepointSynchronize::init(Thread* vmthread) {
// WaitBarrier should never be destroyed since we will have
// threads waiting on it while exiting.
_wait_barrier = new WaitBarrier(vmthread);
+ SafepointTracing::init();
}
void SafepointSynchronize::increment_jni_active_count() {
@@ -244,16 +228,13 @@
DEBUG_ONLY(assert_list_is_valid(tss_head, still_running);)
*initial_running = still_running;
- if (log_is_enabled(Debug, safepoint, stats)) {
- begin_statistics(nof_threads, still_running);
- }
int iterations = 1; // The first iteration is above.
while (still_running > 0) {
// Check if this has taken too long:
if (SafepointTimeout && safepoint_limit_time < os::javaTimeNanos()) {
- print_safepoint_timeout(_spinning_timeout);
+ print_safepoint_timeout();
}
if (int(iterations) == -1) { // overflow - something is wrong.
// We can only overflow here when we are using global
@@ -291,9 +272,6 @@
assert(tss_head == NULL, "Must be empty");
- if (log_is_enabled(Debug, safepoint, stats)) {
- update_statistics_on_spin_end();
- }
return iterations;
}
@@ -303,8 +281,11 @@
// stopped by different mechanisms:
//
// 1. Running interpreted
- // The interpreter dispatch table is changed to force it to
- // check for a safepoint condition between bytecodes.
+ // When executing branching/returning byte codes interpreter
+ // checks if the poll is armed, if so blocks in SS::block().
+ // When using global polling the interpreter dispatch table
+ // is changed to force it to check for a safepoint condition
+ // between bytecodes.
// 2. Running in native code
// When returning from the native code, a Java thread must check
// the safepoint _state to see if we must block. If the
@@ -322,9 +303,9 @@
// block condition until the safepoint operation is complete.
// 5. In VM or Transitioning between states
// If a Java thread is currently running in the VM or transitioning
- // between states, the safepointing code will wait for the thread to
- // block itself when it attempts transitions to a new state.
- //
+ // between states, the safepointing code will poll the thread state
+ // until the thread blocks itself when it attempts transitions to a
+ // new state or locking a safepoint checked monitor.
// We must never miss a thread with correct safepoint id, so we must make sure we arm
// the wait barrier for the next safepoint id/counter.
@@ -363,17 +344,10 @@
// Roll all threads forward to a safepoint and suspend them all
void SafepointSynchronize::begin() {
- EventSafepointBegin begin_event;
assert(Thread::current()->is_VM_thread(), "Only VM thread may execute a safepoint");
- strncpy(stopped_description, VMThread::vm_safepoint_description(), sizeof(stopped_description) - 1);
- stopped_description[sizeof(stopped_description) - 1] = '\0';
-
- if (log_is_enabled(Debug, safepoint, stats)) {
- _safepoint_begin_time = os::javaTimeNanos();
- _ts_of_current_safepoint = tty->time_stamp().seconds();
- _nof_threads_hit_polling_page = 0;
- }
+ EventSafepointBegin begin_event;
+ SafepointTracing::begin(VMThread::vm_op_type());
Universe::heap()->safepoint_synchronize_begin();
@@ -385,9 +359,9 @@
int nof_threads = Threads::number_of_threads();
- log_debug(safepoint)("Safepoint synchronization initiated using %s wait barrier. (%d threads)", _wait_barrier->description(), nof_threads);
+ _nof_threads_hit_polling_page = 0;
- RuntimeService::record_safepoint_begin();
+ log_debug(safepoint)("Safepoint synchronization initiated using %s wait barrier. (%d threads)", _wait_barrier->description(), nof_threads);
// Reset the count of active JNI critical threads
_current_jni_active_count = 0;
@@ -399,9 +373,9 @@
if (SafepointTimeout) {
// Set the limit time, so that it can be compared to see if this has taken
// too long to complete.
- safepoint_limit_time = os::javaTimeNanos() + (jlong)SafepointTimeoutDelay * MICROUNITS;
+ safepoint_limit_time = SafepointTracing::start_of_safepoint() + (jlong)SafepointTimeoutDelay * (NANOUNITS / MILLIUNITS);
+ timeout_error_printed = false;
}
- timeout_error_printed = false;
EventSafepointStateSynchronization sync_event;
int initial_running = 0;
@@ -413,20 +387,13 @@
int iterations = synchronize_threads(safepoint_limit_time, nof_threads, &initial_running);
assert(_waiting_to_block == 0, "No thread should be running");
- post_safepoint_synchronize_event(sync_event, _safepoint_counter, initial_running,
- _waiting_to_block, iterations);
-
- // Keep event from now.
- EventSafepointWaitBlocked wait_blocked_event;
-
#ifndef PRODUCT
- if (SafepointTimeout) {
+ if (safepoint_limit_time != 0) {
jlong current_time = os::javaTimeNanos();
if (safepoint_limit_time < current_time) {
log_warning(safepoint)("# SafepointSynchronize: Finished after "
INT64_FORMAT_W(6) " ms",
- (int64_t)((current_time - safepoint_limit_time) / MICROUNITS +
- (jlong)SafepointTimeoutDelay));
+ (int64_t)(current_time - SafepointTracing::start_of_safepoint()) / (NANOUNITS / MILLIUNITS));
}
}
#endif
@@ -438,8 +405,6 @@
OrderAccess::fence();
- post_safepoint_wait_blocked_event(wait_blocked_event, _safepoint_counter, 0);
-
#ifdef ASSERT
// Make sure all the threads were visited.
for (JavaThreadIteratorWithHandle jtiwh; JavaThread *cur = jtiwh.next(); ) {
@@ -450,12 +415,12 @@
// Update the count of active JNI critical regions
GCLocker::set_jni_lock_count(_current_jni_active_count);
- log_info(safepoint)("Entering safepoint region: %s", stopped_description);
+ post_safepoint_synchronize_event(sync_event,
+ _safepoint_counter,
+ initial_running,
+ _waiting_to_block, iterations);
- RuntimeService::record_safepoint_synchronized();
- if (log_is_enabled(Debug, safepoint, stats)) {
- update_statistics_on_sync_end(os::javaTimeNanos());
- }
+ SafepointTracing::synchronized(nof_threads, initial_running, _nof_threads_hit_polling_page);
// We do the safepoint cleanup first since a GC related safepoint
// needs cleanup to be completed before running the GC op.
@@ -463,12 +428,8 @@
do_cleanup_tasks();
post_safepoint_cleanup_event(cleanup_event, _safepoint_counter);
- if (log_is_enabled(Debug, safepoint, stats)) {
- // Record how much time spend on the above cleanup tasks
- update_statistics_on_cleanup_end(os::javaTimeNanos());
- }
-
post_safepoint_begin_event(begin_event, _safepoint_counter, nof_threads, _current_jni_active_count);
+ SafepointTracing::cleanup();
}
void SafepointSynchronize::disarm_safepoint() {
@@ -520,10 +481,6 @@
}
} // ~JavaThreadIteratorWithHandle
- log_info(safepoint)("Leaving safepoint region");
-
- RuntimeService::record_safepoint_end();
-
// Release threads lock, so threads can be created/destroyed again.
Threads_lock->unlock();
@@ -539,19 +496,11 @@
uint64_t safepoint_id = _safepoint_counter;
assert(Thread::current()->is_VM_thread(), "Only VM thread can execute a safepoint");
- if (log_is_enabled(Debug, safepoint, stats)) {
- end_statistics(os::javaTimeNanos());
- }
-
disarm_safepoint();
- RuntimeService::record_safepoint_epilog(stopped_description);
-
Universe::heap()->safepoint_synchronize_end();
- // record this time so VMThread can keep track how much time has elapsed
- // since last safepoint.
- _end_of_last_safepoint = os::javaTimeMillis();
+ SafepointTracing::end();
post_safepoint_end_event(event, safepoint_id);
}
@@ -915,7 +864,7 @@
assert(SafepointSynchronize::is_synchronizing(), "polling encountered outside safepoint synchronization");
}
- if (log_is_enabled(Debug, safepoint, stats)) {
+ if (log_is_enabled(Info, safepoint, stats)) {
Atomic::inc(&_nof_threads_hit_polling_page);
}
@@ -925,7 +874,7 @@
}
-void SafepointSynchronize::print_safepoint_timeout(SafepointTimeoutReason reason) {
+void SafepointSynchronize::print_safepoint_timeout() {
if (!timeout_error_printed) {
timeout_error_printed = true;
// Print out the thread info which didn't reach the safepoint for debugging
@@ -937,20 +886,10 @@
ls.cr();
ls.print_cr("# SafepointSynchronize::begin: Timeout detected:");
- if (reason == _spinning_timeout) {
- ls.print_cr("# SafepointSynchronize::begin: Timed out while spinning to reach a safepoint.");
- } else if (reason == _blocking_timeout) {
- ls.print_cr("# SafepointSynchronize::begin: Timed out while waiting for threads to stop.");
- }
-
+ ls.print_cr("# SafepointSynchronize::begin: Timed out while spinning to reach a safepoint.");
ls.print_cr("# SafepointSynchronize::begin: Threads which did not reach the safepoint:");
- ThreadSafepointState *cur_state;
for (JavaThreadIteratorWithHandle jtiwh; JavaThread *cur_thread = jtiwh.next(); ) {
- cur_state = cur_thread->safepoint_state();
-
- if (cur_thread->thread_state() != _thread_blocked &&
- ((reason == _spinning_timeout && cur_state->is_running()) ||
- (reason == _blocking_timeout))) {
+ if (cur_thread->safepoint_state()->is_running()) {
ls.print("# ");
cur_thread->print_on(&ls);
ls.cr();
@@ -964,11 +903,10 @@
// ShowMessageBoxOnError.
if (AbortVMOnSafepointTimeout) {
fatal("Safepoint sync time longer than " INTX_FORMAT "ms detected when executing %s.",
- SafepointTimeoutDelay, VMThread::vm_safepoint_description());
+ SafepointTimeoutDelay, VMThread::vm_operation()->name());
}
}
-
// -------------------------------------------------------------------------------------------------------
// Implementation of ThreadSafepointState
@@ -1176,108 +1114,25 @@
}
-//
-// Statistics & Instrumentations
-//
-struct SafepointStats {
- float _time_stamp; // record when the current safepoint occurs in seconds
- int _vmop_type; // tyep of VM operation triggers the safepoint
- int _nof_total_threads; // total number of Java threads
- int _nof_initial_running_threads; // total number of initially seen running threads
- int _nof_threads_wait_to_block; // total number of threads waiting for to block
- bool _page_armed; // true if polling page is armed, false otherwise
- int _nof_threads_hit_page_trap; // total number of threads hitting the page trap
- jlong _time_to_spin; // total time in millis spent in spinning
- jlong _time_to_wait_to_block; // total time in millis spent in waiting for to block
- jlong _time_to_do_cleanups; // total time in millis spent in performing cleanups
- jlong _time_to_sync; // total time in millis spent in getting to _synchronized
- jlong _time_to_exec_vmop; // total time in millis spent in vm operation itself
-};
-
-static const int _statistics_header_count = 30;
-static int _cur_stat_index = 0;
-static SafepointStats safepoint_stats = {0}; // zero initialize
-static SafepointStats* spstat = &safepoint_stats;
-
-static julong _safepoint_reasons[VM_Operation::VMOp_Terminating];
-static jlong _max_sync_time = 0;
-static jlong _max_vmop_time = 0;
-
-static jlong cleanup_end_time = 0;
-
-void SafepointSynchronize::begin_statistics(int nof_threads, int nof_running) {
-
- spstat->_time_stamp = _ts_of_current_safepoint;
-
- VM_Operation *op = VMThread::vm_operation();
- spstat->_vmop_type = op != NULL ? op->type() : VM_Operation::VMOp_None;
- _safepoint_reasons[spstat->_vmop_type]++;
-
- spstat->_nof_total_threads = nof_threads;
- spstat->_nof_initial_running_threads = nof_running;
-
- // Records the start time of spinning. The real time spent on spinning
- // will be adjusted when spin is done. Same trick is applied for time
- // spent on waiting for threads to block.
- if (nof_running != 0) {
- spstat->_time_to_spin = os::javaTimeNanos();
- } else {
- spstat->_time_to_spin = 0;
- }
-}
+// -------------------------------------------------------------------------------------------------------
+// Implementation of SafepointTracing
-void SafepointSynchronize::update_statistics_on_spin_end() {
- jlong cur_time = os::javaTimeNanos();
-
- spstat->_nof_threads_wait_to_block = _waiting_to_block;
- if (spstat->_nof_initial_running_threads != 0) {
- spstat->_time_to_spin = cur_time - spstat->_time_to_spin;
- }
-
- // Records the start time of waiting for to block. Updated when block is done.
- if (_waiting_to_block != 0) {
- spstat->_time_to_wait_to_block = cur_time;
- } else {
- spstat->_time_to_wait_to_block = 0;
- }
-}
-
-void SafepointSynchronize::update_statistics_on_sync_end(jlong end_time) {
-
- if (spstat->_nof_threads_wait_to_block != 0) {
- spstat->_time_to_wait_to_block = end_time -
- spstat->_time_to_wait_to_block;
- }
+jlong SafepointTracing::_last_safepoint_begin_time_ns = 0;
+jlong SafepointTracing::_last_safepoint_sync_time_ns = 0;
+jlong SafepointTracing::_last_safepoint_cleanup_time_ns = 0;
+jlong SafepointTracing::_last_safepoint_end_time_ns = 0;
+jlong SafepointTracing::_last_app_time_ns = 0;
+int SafepointTracing::_nof_threads = 0;
+int SafepointTracing::_nof_running = 0;
+int SafepointTracing::_page_trap = 0;
+VM_Operation::VMOp_Type SafepointTracing::_current_type;
+jlong SafepointTracing::_max_sync_time = 0;
+jlong SafepointTracing::_max_vmop_time = 0;
+uint64_t SafepointTracing::_op_count[VM_Operation::VMOp_Terminating] = {0};
- // Records the end time of sync which will be used to calculate the total
- // vm operation time. Again, the real time spending in syncing will be deducted
- // from the start of the sync time later when end_statistics is called.
- spstat->_time_to_sync = end_time - _safepoint_begin_time;
- if (spstat->_time_to_sync > _max_sync_time) {
- _max_sync_time = spstat->_time_to_sync;
- }
-
- spstat->_time_to_do_cleanups = end_time;
-}
-
-void SafepointSynchronize::update_statistics_on_cleanup_end(jlong end_time) {
-
- // Record how long spent in cleanup tasks.
- spstat->_time_to_do_cleanups = end_time - spstat->_time_to_do_cleanups;
- cleanup_end_time = end_time;
-}
-
-void SafepointSynchronize::end_statistics(jlong vmop_end_time) {
-
- // Update the vm operation time.
- spstat->_time_to_exec_vmop = vmop_end_time - cleanup_end_time;
- if (spstat->_time_to_exec_vmop > _max_vmop_time) {
- _max_vmop_time = spstat->_time_to_exec_vmop;
- }
-
- spstat->_nof_threads_hit_page_trap = _nof_threads_hit_polling_page;
-
- print_statistics();
+void SafepointTracing::init() {
+ // Application start
+ _last_safepoint_end_time_ns = os::javaTimeNanos();
}
// Helper method to print the header.
@@ -1285,66 +1140,121 @@
// The number of spaces is significant here, and should match the format
// specifiers in print_statistics().
- st->print(" vmop "
- "[ threads: total initially_running wait_to_block ]"
- "[ time: spin block sync cleanup vmop ] ");
+ st->print("VM Operation "
+ "[ threads: total initial_running ]"
+ "[ time: sync cleanup vmop total ]");
- st->print_cr("page_trap_count");
+ st->print_cr(" page_trap_count");
}
// This prints a nice table. To get the statistics to not shift due to the logging uptime
-// decorator, use the option as: -Xlog:safepoint+stats=debug:[outputfile]:none
-void SafepointSynchronize::print_statistics() {
- LogTarget(Debug, safepoint, stats) lt;
+// decorator, use the option as: -Xlog:safepoint+stats:[outputfile]:none
+void SafepointTracing::statistics_log() {
+ LogTarget(Info, safepoint, stats) lt;
assert (lt.is_enabled(), "should only be called when printing statistics is enabled");
LogStream ls(lt);
+ static int _cur_stat_index = 0;
+
// Print header every 30 entries
- if ((_cur_stat_index % _statistics_header_count) == 0) {
+ if ((_cur_stat_index % 30) == 0) {
print_header(&ls);
_cur_stat_index = 1; // wrap
} else {
_cur_stat_index++;
}
- ls.print("%8.3f: ", spstat->_time_stamp);
- ls.print("%-28s [ "
- INT32_FORMAT_W(8) " " INT32_FORMAT_W(17) " " INT32_FORMAT_W(13) " "
+ ls.print("%-28s [ "
+ INT32_FORMAT_W(8) " " INT32_FORMAT_W(8) " "
"]",
- VM_Operation::name(spstat->_vmop_type),
- spstat->_nof_total_threads,
- spstat->_nof_initial_running_threads,
- spstat->_nof_threads_wait_to_block);
- // "/ MICROUNITS " is to convert the unit from nanos to millis.
+ VM_Operation::name(_current_type),
+ _nof_threads,
+ _nof_running);
ls.print("[ "
- INT64_FORMAT_W(7) " " INT64_FORMAT_W(7) " "
- INT64_FORMAT_W(7) " " INT64_FORMAT_W(7) " "
- INT64_FORMAT_W(7) " ] ",
- (int64_t)(spstat->_time_to_spin / MICROUNITS),
- (int64_t)(spstat->_time_to_wait_to_block / MICROUNITS),
- (int64_t)(spstat->_time_to_sync / MICROUNITS),
- (int64_t)(spstat->_time_to_do_cleanups / MICROUNITS),
- (int64_t)(spstat->_time_to_exec_vmop / MICROUNITS));
+ INT64_FORMAT_W(10) " " INT64_FORMAT_W(10) " "
+ INT64_FORMAT_W(10) " " INT64_FORMAT_W(10) " ]",
+ (int64_t)(_last_safepoint_sync_time_ns - _last_safepoint_begin_time_ns),
+ (int64_t)(_last_safepoint_cleanup_time_ns - _last_safepoint_sync_time_ns),
+ (int64_t)(_last_safepoint_end_time_ns - _last_safepoint_cleanup_time_ns),
+ (int64_t)(_last_safepoint_end_time_ns - _last_safepoint_begin_time_ns));
- ls.print_cr(INT32_FORMAT_W(15) " ", spstat->_nof_threads_hit_page_trap);
+ ls.print_cr(INT32_FORMAT_W(16), _page_trap);
}
// This method will be called when VM exits. This tries to summarize the sampling.
// Current thread may already be deleted, so don't use ResourceMark.
-void SafepointSynchronize::print_stat_on_exit() {
-
+void SafepointTracing::statistics_exit_log() {
+ if (!log_is_enabled(Info, safepoint, stats)) {
+ return;
+ }
for (int index = 0; index < VM_Operation::VMOp_Terminating; index++) {
- if (_safepoint_reasons[index] != 0) {
- log_debug(safepoint, stats)("%-28s" UINT64_FORMAT_W(10), VM_Operation::name(index),
- _safepoint_reasons[index]);
+ if (_op_count[index] != 0) {
+ log_info(safepoint, stats)("%-28s" UINT64_FORMAT_W(10), VM_Operation::name(index),
+ _op_count[index]);
}
}
- log_debug(safepoint, stats)("VM operations coalesced during safepoint " INT64_FORMAT,
- _coalesced_vmop_count);
- log_debug(safepoint, stats)("Maximum sync time " INT64_FORMAT" ms",
- (int64_t)(_max_sync_time / MICROUNITS));
- log_debug(safepoint, stats)("Maximum vm operation time (except for Exit VM operation) "
- INT64_FORMAT " ms",
- (int64_t)(_max_vmop_time / MICROUNITS));
+ log_info(safepoint, stats)("VM operations coalesced during safepoint " INT64_FORMAT,
+ VMThread::get_coalesced_count());
+ log_info(safepoint, stats)("Maximum sync time " INT64_FORMAT" ns",
+ (int64_t)(_max_sync_time));
+ log_info(safepoint, stats)("Maximum vm operation time (except for Exit VM operation) "
+ INT64_FORMAT " ns",
+ (int64_t)(_max_vmop_time));
+}
+
+void SafepointTracing::begin(VM_Operation::VMOp_Type type) {
+ _op_count[type]++;
+ _current_type = type;
+
+ // update the time stamp to begin recording safepoint time
+ _last_safepoint_begin_time_ns = os::javaTimeNanos();
+ _last_safepoint_sync_time_ns = 0;
+ _last_safepoint_cleanup_time_ns = 0;
+
+ _last_app_time_ns = _last_safepoint_begin_time_ns - _last_safepoint_end_time_ns;
+ _last_safepoint_end_time_ns = 0;
+
+ RuntimeService::record_safepoint_begin(_last_app_time_ns);
+}
+
+void SafepointTracing::synchronized(int nof_threads, int nof_running, int traps) {
+ _last_safepoint_sync_time_ns = os::javaTimeNanos();
+ _nof_threads = nof_threads;
+ _nof_running = nof_running;
+ _page_trap = traps;
+ RuntimeService::record_safepoint_synchronized(_last_safepoint_sync_time_ns - _last_safepoint_begin_time_ns);
}
+
+void SafepointTracing::cleanup() {
+ _last_safepoint_cleanup_time_ns = os::javaTimeNanos();
+}
+
+void SafepointTracing::end() {
+ _last_safepoint_end_time_ns = os::javaTimeNanos();
+
+ if (_max_sync_time < (_last_safepoint_sync_time_ns - _last_safepoint_begin_time_ns)) {
+ _max_sync_time = _last_safepoint_sync_time_ns - _last_safepoint_begin_time_ns;
+ }
+ if (_max_vmop_time < (_last_safepoint_end_time_ns - _last_safepoint_sync_time_ns)) {
+ _max_vmop_time = _last_safepoint_end_time_ns - _last_safepoint_sync_time_ns;
+ }
+ if (log_is_enabled(Info, safepoint, stats)) {
+ statistics_log();
+ }
+
+ log_info(safepoint)(
+ "Safepoint \"%s\", "
+ "Time since last: " JLONG_FORMAT " ns, "
+ "Reaching safepoint: " JLONG_FORMAT " ns, "
+ "At safepoint: " JLONG_FORMAT " ns, "
+ "Total: " JLONG_FORMAT " ns",
+ VM_Operation::name(_current_type),
+ _last_app_time_ns,
+ _last_safepoint_cleanup_time_ns - _last_safepoint_begin_time_ns,
+ _last_safepoint_end_time_ns - _last_safepoint_cleanup_time_ns,
+ _last_safepoint_end_time_ns - _last_safepoint_begin_time_ns
+ );
+
+ RuntimeService::record_safepoint_end(_last_safepoint_end_time_ns - _last_safepoint_cleanup_time_ns);
+}
--- a/src/hotspot/share/runtime/safepoint.hpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/share/runtime/safepoint.hpp Tue Feb 26 12:11:29 2019 -0500
@@ -28,6 +28,7 @@
#include "memory/allocation.hpp"
#include "runtime/os.hpp"
#include "runtime/thread.hpp"
+#include "runtime/vmOperations.hpp"
#include "utilities/ostream.hpp"
#include "utilities/waitBarrier.hpp"
@@ -77,11 +78,6 @@
friend class ThreadSafepointState;
friend class HandshakeState;
- enum SafepointTimeoutReason {
- _spinning_timeout = 0,
- _blocking_timeout = 1
- };
-
// Threads might read this flag directly, without acquiring the Threads_lock:
static volatile SynchronizeState _state;
// Number of threads we are waiting for to block:
@@ -110,7 +106,7 @@
static void print_statistics();
// For debug long safepoint
- static void print_safepoint_timeout(SafepointTimeoutReason timeout_reason);
+ static void print_safepoint_timeout();
// Helper methods for safepoint procedure:
static void arm_safepoint();
@@ -150,19 +146,9 @@
// Exception handling for page polling
static void handle_polling_page_exception(JavaThread *thread);
- // VM Thread interface for determining safepoint rate
- static long last_non_safepoint_interval() {
- return os::javaTimeMillis() - _end_of_last_safepoint;
- }
- static long end_of_last_safepoint() {
- return _end_of_last_safepoint;
- }
static bool is_cleanup_needed();
static void do_cleanup_tasks();
- static void print_stat_on_exit();
- static void inc_vmop_coalesced_count() { _coalesced_vmop_count++; }
-
static void set_is_at_safepoint() { _state = _synchronized; }
static void set_is_not_at_safepoint() { _state = _not_synchronized; }
@@ -247,6 +233,48 @@
static void destroy(JavaThread *thread);
};
+class SafepointTracing : public AllStatic {
+private:
+ // Absolute
+ static jlong _last_safepoint_begin_time_ns;
+ static jlong _last_safepoint_sync_time_ns;
+ static jlong _last_safepoint_cleanup_time_ns;
+ static jlong _last_safepoint_end_time_ns;
+ // Relative
+ static jlong _last_app_time_ns;
+ static int _nof_threads;
+ static int _nof_running;
+ static int _page_trap;
+
+ static VM_Operation::VMOp_Type _current_type;
+ static jlong _max_sync_time;
+ static jlong _max_vmop_time;
+ static uint64_t _op_count[VM_Operation::VMOp_Terminating];
+
+ static void statistics_log();
+
+public:
+ static void init();
+
+ static void begin(VM_Operation::VMOp_Type type);
+ static void synchronized(int nof_threads, int nof_running, int traps);
+ static void cleanup();
+ static void end();
+
+ static void statistics_exit_log();
+
+ static jlong time_since_last_safepoint_ms() {
+ return (os::javaTimeNanos() - _last_safepoint_end_time_ns) / (NANOUNITS / MILLIUNITS);
+ }
+
+ static jlong end_of_last_safepoint_ms() {
+ return _last_safepoint_end_time_ns / (NANOUNITS / MILLIUNITS);
+ }
+
+ static jlong start_of_safepoint() {
+ return _last_safepoint_begin_time_ns;
+ }
+};
#endif // SHARE_RUNTIME_SAFEPOINT_HPP
--- a/src/hotspot/share/runtime/tieredThresholdPolicy.cpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/share/runtime/tieredThresholdPolicy.cpp Tue Feb 26 12:11:29 2019 -0500
@@ -479,7 +479,7 @@
// We don't update the rate if we've just came out of a safepoint.
// delta_s is the time since last safepoint in milliseconds.
- jlong delta_s = t - SafepointSynchronize::end_of_last_safepoint();
+ jlong delta_s = t - SafepointTracing::end_of_last_safepoint_ms();
jlong delta_t = t - (m->prev_time() != 0 ? m->prev_time() : start_time()); // milliseconds since the last measurement
// How many events were there since the last time?
int event_count = m->invocation_count() + m->backedge_count();
@@ -504,7 +504,7 @@
// Check if this method has been stale from a given number of milliseconds.
// See select_task().
bool TieredThresholdPolicy::is_stale(jlong t, jlong timeout, Method* m) {
- jlong delta_s = t - SafepointSynchronize::end_of_last_safepoint();
+ jlong delta_s = t - SafepointTracing::end_of_last_safepoint_ms();
jlong delta_t = t - m->prev_time();
if (delta_t > timeout && delta_s > timeout) {
int event_count = m->invocation_count() + m->backedge_count();
--- a/src/hotspot/share/runtime/vmOperations.hpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/share/runtime/vmOperations.hpp Tue Feb 26 12:11:29 2019 -0500
@@ -41,6 +41,7 @@
// Note: When new VM_XXX comes up, add 'XXX' to the template table.
#define VM_OPS_DO(template) \
template(None) \
+ template(Cleanup) \
template(ThreadStop) \
template(ThreadDump) \
template(PrintThreads) \
@@ -213,7 +214,7 @@
// Debugging
virtual void print_on_error(outputStream* st) const;
- const char* name() const { return _names[type()]; }
+ virtual const char* name() const { return _names[type()]; }
static const char* name(int type) {
assert(type >= 0 && type < VMOp_Terminating, "invalid VM operation type");
return _names[type];
@@ -223,6 +224,21 @@
#endif
};
+class VM_None: public VM_Operation {
+ const char* _reason;
+ public:
+ VM_None(const char* reason) : _reason(reason) {}
+ const char* name() const { return _reason; }
+ VMOp_Type type() const { return VMOp_None; }
+ void doit() {};
+};
+
+class VM_Cleanup: public VM_Operation {
+ public:
+ VMOp_Type type() const { return VMOp_Cleanup; }
+ void doit() {};
+};
+
class VM_ThreadStop: public VM_Operation {
private:
oop _thread; // The Thread that the Throwable is thrown against
--- a/src/hotspot/share/runtime/vmThread.cpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/share/runtime/vmThread.cpp Tue Feb 26 12:11:29 2019 -0500
@@ -48,19 +48,13 @@
#include "utilities/vmError.hpp"
#include "utilities/xmlstream.hpp"
-// Dummy VM operation to act as first element in our circular double-linked list
-class VM_None: public VM_Operation {
- VMOp_Type type() const { return VMOp_None; }
- void doit() {};
-};
-
VMOperationQueue::VMOperationQueue() {
// The queue is a circular doubled-linked list, which always contains
// one element (i.e., one element means empty).
for(int i = 0; i < nof_priorities; i++) {
_queue_length[i] = 0;
_queue_counter = 0;
- _queue[i] = new VM_None();
+ _queue[i] = new VM_None("QueueHead");
_queue[i]->set_next(_queue[i]);
_queue[i]->set_prev(_queue[i]);
}
@@ -229,14 +223,14 @@
//------------------------------------------------------------------------------------------------------------------
// Implementation of VMThread stuff
-bool VMThread::_should_terminate = false;
+bool VMThread::_should_terminate = false;
bool VMThread::_terminated = false;
Monitor* VMThread::_terminate_lock = NULL;
VMThread* VMThread::_vm_thread = NULL;
VM_Operation* VMThread::_cur_vm_operation = NULL;
VMOperationQueue* VMThread::_vm_queue = NULL;
PerfCounter* VMThread::_perf_accumulated_vm_operation_time = NULL;
-const char* VMThread::_no_op_reason = NULL;
+uint64_t VMThread::_coalesced_count = 0;
VMOperationTimeoutTask* VMThread::_timeout_task = NULL;
@@ -283,6 +277,8 @@
_vm_thread = NULL; // VM thread is gone
}
+static VM_None halt_op("Halt");
+
void VMThread::run() {
assert(this == vm_thread(), "check");
@@ -320,7 +316,7 @@
}
// 4526887 let VM thread exit at Safepoint
- _no_op_reason = "Halt";
+ _cur_vm_operation = &halt_op;
SafepointSynchronize::begin();
if (VerifyBeforeExit) {
@@ -435,24 +431,25 @@
}
}
-bool VMThread::no_op_safepoint_needed(bool check_time) {
+static VM_None safepointALot_op("SafepointALot");
+static VM_Cleanup cleanup_op;
+
+VM_Operation* VMThread::no_op_safepoint(bool check_time) {
if (SafepointALot) {
- _no_op_reason = "SafepointALot";
- return true;
+ return &safepointALot_op;
}
if (!SafepointSynchronize::is_cleanup_needed()) {
- return false;
+ return NULL;
}
if (check_time) {
- long interval = SafepointSynchronize::last_non_safepoint_interval();
+ long interval_ms = SafepointTracing::time_since_last_safepoint_ms();
bool max_time_exceeded = GuaranteedSafepointInterval != 0 &&
- (interval > GuaranteedSafepointInterval);
+ (interval_ms > GuaranteedSafepointInterval);
if (!max_time_exceeded) {
- return false;
+ return NULL;
}
}
- _no_op_reason = "Cleanup";
- return true;
+ return &cleanup_op;
}
void VMThread::loop() {
@@ -494,7 +491,7 @@
exit(-1);
}
- if (timedout && VMThread::no_op_safepoint_needed(false)) {
+ if (timedout && (_cur_vm_operation = VMThread::no_op_safepoint(false)) != NULL) {
MutexUnlockerEx mul(VMOperationQueue_lock,
Mutex::_no_safepoint_check_flag);
// Force a safepoint since we have not had one for at least
@@ -506,6 +503,7 @@
if (GCALotAtAllSafepoints) InterfaceSupport::check_gc_alot();
#endif
SafepointSynchronize::end();
+ _cur_vm_operation = NULL;
}
_cur_vm_operation = _vm_queue->remove_next();
@@ -555,9 +553,7 @@
_vm_queue->set_drain_list(next);
evaluate_operation(_cur_vm_operation);
_cur_vm_operation = next;
- if (log_is_enabled(Debug, safepoint, stats)) {
- SafepointSynchronize::inc_vmop_coalesced_count();
- }
+ _coalesced_count++;
} while (_cur_vm_operation != NULL);
}
// There is a chance that a thread enqueued a safepoint op
@@ -622,10 +618,11 @@
//
// We want to make sure that we get to a safepoint regularly.
//
- if (VMThread::no_op_safepoint_needed(true)) {
+ if ((_cur_vm_operation = VMThread::no_op_safepoint(false)) != NULL) {
HandleMark hm(VMThread::vm_thread());
SafepointSynchronize::begin();
SafepointSynchronize::end();
+ _cur_vm_operation = NULL;
}
}
}
--- a/src/hotspot/share/runtime/vmThread.hpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/share/runtime/vmThread.hpp Tue Feb 26 12:11:29 2019 -0500
@@ -119,12 +119,11 @@
static bool _terminated;
static Monitor * _terminate_lock;
static PerfCounter* _perf_accumulated_vm_operation_time;
-
- static const char* _no_op_reason;
+ static uint64_t _coalesced_count;
static VMOperationTimeoutTask* _timeout_task;
- static bool no_op_safepoint_needed(bool check_time);
+ static VM_Operation* no_op_safepoint(bool check_time);
void evaluate_operation(VM_Operation* op);
@@ -155,9 +154,8 @@
// Returns the current vm operation if any.
static VM_Operation* vm_operation() { return _cur_vm_operation; }
-
- // Returns the current vm operation name or set reason
- static const char* vm_safepoint_description() { return _cur_vm_operation != NULL ? _cur_vm_operation->name() : _no_op_reason; };
+ static VM_Operation::VMOp_Type vm_op_type() { return _cur_vm_operation->type(); }
+ static uint64_t get_coalesced_count() { return _coalesced_count; }
// Returns the single instance of VMThread.
static VMThread* vm_thread() { return _vm_thread; }
--- a/src/hotspot/share/services/attachListener.cpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/share/services/attachListener.cpp Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2019, 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
@@ -257,19 +257,40 @@
// See also: ClassHistogramDCmd class
//
// Input arguments :-
-// arg0: "-live" or "-all"
+// arg0: Name of the dump file or NULL
+// arg1: "-live" or "-all"
static jint heap_inspection(AttachOperation* op, outputStream* out) {
bool live_objects_only = true; // default is true to retain the behavior before this change is made
- const char* arg0 = op->arg(0);
- if (arg0 != NULL && (strlen(arg0) > 0)) {
- if (strcmp(arg0, "-all") != 0 && strcmp(arg0, "-live") != 0) {
- out->print_cr("Invalid argument to inspectheap operation: %s", arg0);
+ outputStream* os = out; // if path not specified or path is NULL, use out
+ fileStream* fs = NULL;
+ const char* path = op->arg(0);
+ if (path != NULL) {
+ if (path[0] == '\0') {
+ out->print_cr("No dump file specified");
+ } else {
+ // create file
+ fs = new (ResourceObj::C_HEAP, mtInternal) fileStream(path);
+ if (fs == NULL) {
+ out->print_cr("Failed to allocate space for file: %s", path);
+ return JNI_ERR;
+ }
+ os = fs;
+ }
+ }
+ const char* arg1 = op->arg(1);
+ if (arg1 != NULL && (strlen(arg1) > 0)) {
+ if (strcmp(arg1, "-all") != 0 && strcmp(arg1, "-live") != 0) {
+ out->print_cr("Invalid argument to inspectheap operation: %s", arg1);
return JNI_ERR;
}
- live_objects_only = strcmp(arg0, "-live") == 0;
+ live_objects_only = strcmp(arg1, "-live") == 0;
}
- VM_GC_HeapInspection heapop(out, live_objects_only /* request full gc */);
+ VM_GC_HeapInspection heapop(os, live_objects_only /* request full gc */);
VMThread::execute(&heapop);
+ if (os != NULL && os != out) {
+ out->print_cr("Heap inspection file created: %s", path);
+ delete fs;
+ }
return JNI_OK;
}
--- a/src/hotspot/share/services/attachListener.hpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/share/services/attachListener.hpp Tue Feb 26 12:11:29 2019 -0500
@@ -106,7 +106,7 @@
enum {
name_length_max = 16, // maximum length of name
arg_length_max = 1024, // maximum length of argument
- arg_count_max = 3 // maximum number of arguments
+ arg_count_max = 4 // maximum number of arguments
};
// name of special operation that can be enqueued when all
--- a/src/hotspot/share/services/diagnosticArgument.cpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/share/services/diagnosticArgument.cpp Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, 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
@@ -179,9 +179,9 @@
if (str == NULL) {
_value = NULL;
} else {
- _value = NEW_C_HEAP_ARRAY(char, len+1, mtInternal);
- strncpy(_value, str, len);
- _value[len] = 0;
+ _value = NEW_C_HEAP_ARRAY(char, len + 1, mtInternal);
+ int n = os::snprintf(_value, len + 1, "%.*s", (int)len, str);
+ assert((size_t)n <= len, "Unexpected number of characters in string");
}
}
--- a/src/hotspot/share/services/runtimeService.cpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/share/services/runtimeService.cpp Tue Feb 26 12:11:29 2019 -0500
@@ -25,7 +25,7 @@
#include "precompiled.hpp"
#include "classfile/classLoader.hpp"
#include "logging/log.hpp"
-#include "runtime/timer.hpp"
+#include "logging/logStream.hpp"
#include "runtime/vm_version.hpp"
#include "services/attachListener.hpp"
#include "services/management.hpp"
@@ -35,18 +35,12 @@
#include "utilities/macros.hpp"
#if INCLUDE_MANAGEMENT
-TimeStamp RuntimeService::_app_timer;
-TimeStamp RuntimeService::_safepoint_timer;
PerfCounter* RuntimeService::_sync_time_ticks = NULL;
PerfCounter* RuntimeService::_total_safepoints = NULL;
PerfCounter* RuntimeService::_safepoint_time_ticks = NULL;
PerfCounter* RuntimeService::_application_time_ticks = NULL;
-jlong RuntimeService::_last_safepoint_sync_time_ns = 0;
-jlong RuntimeService::_last_safepoint_end_time_ns = 0;
-jlong RuntimeService::_last_app_time_ns = 0;
void RuntimeService::init() {
-
if (UsePerfData) {
EXCEPTION_MARK;
@@ -87,85 +81,27 @@
}
}
-void RuntimeService::record_safepoint_begin() {
+void RuntimeService::record_safepoint_begin(jlong app_ticks) {
HS_PRIVATE_SAFEPOINT_BEGIN();
-
- // Print the time interval in which the app was executing
- if (_app_timer.is_updated()) {
- _last_app_time_ns = _app_timer.ticks_since_update();
- log_info(safepoint)("Application time: %3.7f seconds", TimeHelper::counter_to_seconds(_last_app_time_ns));
- }
-
- // update the time stamp to begin recording safepoint time
- _last_safepoint_sync_time_ns = 0;
- _last_safepoint_end_time_ns = 0;
- _safepoint_timer.update();
if (UsePerfData) {
_total_safepoints->inc();
- if (_app_timer.is_updated()) {
- _application_time_ticks->inc(_app_timer.ticks_since_update());
- }
- }
-}
-
-void RuntimeService::record_safepoint_synchronized() {
- if (UsePerfData) {
- _sync_time_ticks->inc(_safepoint_timer.ticks_since_update());
- }
- if (log_is_enabled(Info, safepoint) || log_is_enabled(Info, safepoint, stats)) {
- _last_safepoint_sync_time_ns = _safepoint_timer.ticks_since_update();
+ _application_time_ticks->inc(app_ticks);
}
}
-void RuntimeService::record_safepoint_end() {
- HS_PRIVATE_SAFEPOINT_END();
-
- // Logging of safepoint+stats=info needs _last_safepoint_end_time_ns to be set.
- // Logging of safepoint=info needs _last_safepoint_end_time_ns for following log.
- if (log_is_enabled(Info, safepoint) || log_is_enabled(Info, safepoint, stats)) {
- _last_safepoint_end_time_ns = _safepoint_timer.ticks_since_update();
- log_info(safepoint)(
- "Total time for which application threads were stopped: %3.7f seconds, "
- "Stopping threads took: %3.7f seconds",
- TimeHelper::counter_to_seconds(_last_safepoint_end_time_ns),
- TimeHelper::counter_to_seconds(_last_safepoint_sync_time_ns));
- }
-
- // update the time stamp to begin recording app time
- _app_timer.update();
+void RuntimeService::record_safepoint_synchronized(jlong sync_ticks) {
if (UsePerfData) {
- _safepoint_time_ticks->inc(_safepoint_timer.ticks_since_update());
+ _sync_time_ticks->inc(sync_ticks);
}
}
-void RuntimeService::record_safepoint_epilog(const char* operation_name) {
- if (!log_is_enabled(Info, safepoint, stats)) {
- return;
+void RuntimeService::record_safepoint_end(jlong safepoint_ticks) {
+ HS_PRIVATE_SAFEPOINT_END();
+ if (UsePerfData) {
+ _safepoint_time_ticks->inc(safepoint_ticks);
}
-
- log_info(safepoint, stats)(
- "Safepoint \"%s\", "
- "Time since last: " JLONG_FORMAT " ns; "
- "Reaching safepoint: " JLONG_FORMAT " ns; "
- "At safepoint: " JLONG_FORMAT " ns; "
- "Total: " JLONG_FORMAT " ns",
- operation_name,
- _last_app_time_ns,
- _last_safepoint_sync_time_ns,
- _last_safepoint_end_time_ns - _last_safepoint_sync_time_ns,
- _last_safepoint_end_time_ns
- );
}
-void RuntimeService::record_application_start() {
- // update the time stamp to begin recording app time
- _app_timer.update();
-}
-
-// Don't need to record application end because we currently
-// exit at a safepoint and record_safepoint_begin() handles updating
-// the application time counter at VM exit.
-
jlong RuntimeService::safepoint_sync_time_ms() {
return UsePerfData ?
Management::ticks_to_ms(_sync_time_ticks->get_value()) : -1;
--- a/src/hotspot/share/services/runtimeService.hpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/share/services/runtimeService.hpp Tue Feb 26 12:11:29 2019 -0500
@@ -35,12 +35,6 @@
static PerfCounter* _safepoint_time_ticks; // Accumulated time at safepoints
static PerfCounter* _application_time_ticks; // Accumulated time not at safepoints
- static TimeStamp _safepoint_timer;
- static TimeStamp _app_timer;
- static jlong _last_safepoint_sync_time_ns;
- static jlong _last_safepoint_end_time_ns;
- static jlong _last_app_time_ns;
-
public:
static void init();
@@ -50,12 +44,9 @@
static jlong application_time_ms();
// callbacks
- static void record_safepoint_begin() NOT_MANAGEMENT_RETURN;
- static void record_safepoint_synchronized() NOT_MANAGEMENT_RETURN;
- static void record_safepoint_end() NOT_MANAGEMENT_RETURN;
- static void record_safepoint_epilog(const char* operation_name) NOT_MANAGEMENT_RETURN;
- static void record_application_start() NOT_MANAGEMENT_RETURN;
-
+ static void record_safepoint_begin(jlong app_ticks) NOT_MANAGEMENT_RETURN;
+ static void record_safepoint_synchronized(jlong sync_ticks) NOT_MANAGEMENT_RETURN;
+ static void record_safepoint_end(jlong safepoint_ticks) NOT_MANAGEMENT_RETURN;
};
#endif // SHARE_SERVICES_RUNTIMESERVICE_HPP
--- a/src/hotspot/share/utilities/events.cpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/share/utilities/events.cpp Tue Feb 26 12:11:29 2019 -0500
@@ -36,7 +36,7 @@
EventLog* Events::_logs = NULL;
StringEventLog* Events::_messages = NULL;
-ExtendedStringEventLog* Events::_exceptions = NULL;
+ExceptionsEventLog* Events::_exceptions = NULL;
StringEventLog* Events::_redefinitions = NULL;
UnloadingEventLog* Events::_class_unloading = NULL;
StringEventLog* Events::_deopt_messages = NULL;
@@ -67,7 +67,7 @@
void Events::init() {
if (LogEvents) {
_messages = new StringEventLog("Events");
- _exceptions = new ExtendedStringEventLog("Internal exceptions");
+ _exceptions = new ExceptionsEventLog("Internal exceptions");
_redefinitions = new StringEventLog("Classes redefined");
_class_unloading = new UnloadingEventLog("Classes unloaded");
_deopt_messages = new StringEventLog("Deoptimization events");
@@ -112,3 +112,20 @@
st.print("Unloading class " INTPTR_FORMAT " ", p2i(ik));
ik->name()->print_value_on(&st);
}
+
+void ExceptionsEventLog::log(Thread* thread, Handle h_exception, const char* message, const char* file, int line) {
+ if (!should_log()) return;
+
+ double timestamp = fetch_timestamp();
+ MutexLockerEx ml(&_mutex, Mutex::_no_safepoint_check_flag);
+ int index = compute_log_index();
+ _records[index].thread = thread;
+ _records[index].timestamp = timestamp;
+ stringStream st = _records[index].data.stream();
+ st.print("Exception <");
+ h_exception->print_value_on(&st);
+ st.print("%s%s> (" INTPTR_FORMAT ") \n"
+ "thrown [%s, line %d]\nfor thread " INTPTR_FORMAT,
+ message ? ": " : "", message ? message : "",
+ p2i(h_exception()), file, line, p2i(thread));
+}
--- a/src/hotspot/share/utilities/events.hpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/share/utilities/events.hpp Tue Feb 26 12:11:29 2019 -0500
@@ -183,6 +183,14 @@
void log(Thread* thread, InstanceKlass* ik);
};
+// Event log for exceptions
+class ExceptionsEventLog : public ExtendedStringEventLog {
+ public:
+ ExceptionsEventLog(const char* name, int count = LogEventsBufferEntries) : ExtendedStringEventLog(name, count) {}
+
+ void log(Thread* thread, Handle h_exception, const char* message, const char* file, int line);
+};
+
class Events : AllStatic {
friend class EventLog;
@@ -195,7 +203,7 @@
// A log for internal exception related messages, like internal
// throws and implicit exceptions.
- static ExtendedStringEventLog* _exceptions;
+ static ExceptionsEventLog* _exceptions;
// Deoptization related messages
static StringEventLog* _deopt_messages;
@@ -216,6 +224,7 @@
// Log exception related message
static void log_exception(Thread* thread, const char* format, ...) ATTRIBUTE_PRINTF(2, 3);
+ static void log_exception(Thread* thread, Handle h_exception, const char* message, const char* file, int line);
static void log_redefinition(Thread* thread, const char* format, ...) ATTRIBUTE_PRINTF(2, 3);
@@ -245,6 +254,12 @@
}
}
+inline void Events::log_exception(Thread* thread, Handle h_exception, const char* message, const char* file, int line) {
+ if (LogEvents) {
+ _exceptions->log(thread, h_exception, message, file, line);
+ }
+}
+
inline void Events::log_redefinition(Thread* thread, const char* format, ...) {
if (LogEvents) {
va_list ap;
--- a/src/hotspot/share/utilities/exceptions.cpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/share/utilities/exceptions.cpp Tue Feb 26 12:11:29 2019 -0500
@@ -131,15 +131,17 @@
}
void Exceptions::_throw(Thread* thread, const char* file, int line, Handle h_exception, const char* message) {
- ResourceMark rm;
+ ResourceMark rm(thread);
assert(h_exception() != NULL, "exception should not be NULL");
// tracing (do this up front - so it works during boot strapping)
+ // Note, the print_value_string() argument is not called unless logging is enabled!
log_info(exceptions)("Exception <%s%s%s> (" INTPTR_FORMAT ") \n"
"thrown [%s, line %d]\nfor thread " INTPTR_FORMAT,
h_exception->print_value_string(),
message ? ": " : "", message ? message : "",
p2i(h_exception()), file, line, p2i(thread));
+
// for AbortVMOnException flag
Exceptions::debug_check_abort(h_exception, message);
@@ -162,11 +164,7 @@
thread->set_pending_exception(h_exception(), file, line);
// vm log
- if (LogEvents){
- Events::log_exception(thread, "Exception <%s%s%s> (" INTPTR_FORMAT ") thrown at [%s, line %d]",
- h_exception->print_value_string(), message ? ": " : "", message ? message : "",
- p2i(h_exception()), file, line);
- }
+ Events::log_exception(thread, h_exception, message, file, line);
}
--- a/src/hotspot/share/utilities/ostream.cpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/share/utilities/ostream.cpp Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2019, 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
@@ -559,11 +559,6 @@
fflush(_file);
}
-fdStream::fdStream(const char* file_name) {
- _fd = open(file_name, O_WRONLY | O_CREAT | O_TRUNC, 0666);
- _need_close = true;
-}
-
fdStream::~fdStream() {
if (_fd != -1) {
if (_need_close) close(_fd);
--- a/src/hotspot/share/utilities/xmlstream.cpp Tue Feb 26 12:08:20 2019 -0500
+++ b/src/hotspot/share/utilities/xmlstream.cpp Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2019, 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
@@ -353,11 +353,15 @@
guarantee(format_len + 10 < sizeof(buffer), "bigger format buffer");
const char* kind = format;
const char* kind_end = strchr(kind, ' ');
- size_t kind_len = (kind_end != NULL) ? (kind_end - kind) : format_len;
- strncpy(buffer, kind, kind_len);
- strcpy(buffer + kind_len, "_done");
+ size_t kind_len;
if (kind_end != NULL) {
- strncat(buffer, format + kind_len, sizeof(buffer) - (kind_len + 5 /* _done */) - 1);
+ kind_len = kind_end - kind;
+ int n = os::snprintf(buffer, sizeof(buffer), "%.*s_done", (int)kind_len, kind);
+ assert((size_t)n < sizeof(buffer), "Unexpected number of characters in string");
+ } else {
+ kind_len = format_len;
+ int n = os::snprintf(buffer, sizeof(buffer), "%s_done%s", kind, kind + kind_len);
+ assert((size_t)n < sizeof(buffer), "Unexpected number of characters in string");
}
// Output the trailing event with the timestamp.
va_begin_elem(buffer, ap);
--- a/src/java.base/share/classes/java/lang/constant/ClassDesc.java Tue Feb 26 12:08:20 2019 -0500
+++ b/src/java.base/share/classes/java/lang/constant/ClassDesc.java Tue Feb 26 12:11:29 2019 -0500
@@ -170,7 +170,7 @@
*
* @param rank the rank of the array
* @return a {@linkplain ClassDesc} describing the array type
- * @throws IllegalArgumentException if the rank is less than zero or if the rank of the resulting array type is
+ * @throws IllegalArgumentException if the rank is less than or equal to zero or if the rank of the resulting array type is
* greater than 255
* @jvms 4.4.1 The CONSTANT_Class_info Structure
*/
--- a/src/java.base/share/classes/java/nio/Bits.java Tue Feb 26 12:08:20 2019 -0500
+++ b/src/java.base/share/classes/java/nio/Bits.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, 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
@@ -172,7 +172,10 @@
}
// no luck
- throw new OutOfMemoryError("Direct buffer memory");
+ throw new OutOfMemoryError
+ ("Cannot reserve "
+ + size + " bytes of direct buffer memory (allocated: "
+ + RESERVED_MEMORY.get() + ", limit: " + MAX_MEMORY +")");
} finally {
if (interrupted) {
--- a/src/java.base/share/classes/java/nio/Direct-X-Buffer.java.template Tue Feb 26 12:08:20 2019 -0500
+++ b/src/java.base/share/classes/java/nio/Direct-X-Buffer.java.template Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -29,6 +29,7 @@
import java.io.FileDescriptor;
import java.lang.ref.Reference;
+import java.util.Objects;
import jdk.internal.misc.VM;
import jdk.internal.ref.Cleaner;
import sun.nio.ch.DirectBuffer;
@@ -325,6 +326,40 @@
#end[rw]
}
+ public $Type$Buffer get(int index, $type$[] dst, int offset, int length) {
+#if[rw]
+ if (((long)length << $LG_BYTES_PER_VALUE$) > Bits.JNI_COPY_TO_ARRAY_THRESHOLD) {
+ Objects.checkFromIndexSize(index, length, limit());
+ Objects.checkFromIndexSize(offset, length, dst.length);
+
+ long dstOffset = ARRAY_BASE_OFFSET + ((long)offset << $LG_BYTES_PER_VALUE$);
+ try {
+#if[!byte]
+ if (order() != ByteOrder.nativeOrder())
+ UNSAFE.copySwapMemory(null,
+ ix(index),
+ dst,
+ dstOffset,
+ (long)length << $LG_BYTES_PER_VALUE$,
+ (long)1 << $LG_BYTES_PER_VALUE$);
+ else
+#end[!byte]
+ UNSAFE.copyMemory(null,
+ ix(index),
+ dst,
+ dstOffset,
+ (long)length << $LG_BYTES_PER_VALUE$);
+ } finally {
+ Reference.reachabilityFence(this);
+ }
+ } else {
+ super.get(index, dst, offset, length);
+ }
+ return this;
+#else[rw]
+ throw new ReadOnlyBufferException();
+#end[rw]
+ }
#end[rw]
public $Type$Buffer put($type$ x) {
@@ -440,6 +475,42 @@
#end[rw]
}
+ public $Type$Buffer put(int index, $type$[] src, int offset, int length) {
+#if[rw]
+ if (((long)length << $LG_BYTES_PER_VALUE$) > Bits.JNI_COPY_FROM_ARRAY_THRESHOLD) {
+ Objects.checkFromIndexSize(index, length, limit());
+ Objects.checkFromIndexSize(offset, length, src.length);
+
+
+ long srcOffset = ARRAY_BASE_OFFSET + ((long)offset << $LG_BYTES_PER_VALUE$);
+ try {
+#if[!byte]
+ if (order() != ByteOrder.nativeOrder())
+ UNSAFE.copySwapMemory(src,
+ srcOffset,
+ null,
+ ix(index),
+ (long)length << $LG_BYTES_PER_VALUE$,
+ (long)1 << $LG_BYTES_PER_VALUE$);
+ else
+#end[!byte]
+ UNSAFE.copyMemory(src,
+ srcOffset,
+ null,
+ ix(index),
+ (long)length << $LG_BYTES_PER_VALUE$);
+ } finally {
+ Reference.reachabilityFence(this);
+ }
+ } else {
+ super.put(index, src, offset, length);
+ }
+ return this;
+#else[rw]
+ throw new ReadOnlyBufferException();
+#end[rw]
+ }
+
public $Type$Buffer compact() {
#if[rw]
int pos = position();
--- a/src/java.base/share/classes/java/nio/Heap-X-Buffer.java.template Tue Feb 26 12:08:20 2019 -0500
+++ b/src/java.base/share/classes/java/nio/Heap-X-Buffer.java.template Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, 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
@@ -38,6 +38,8 @@
#end[rw]
*/
+import java.util.Objects;
+
class Heap$Type$Buffer$RW$
extends {#if[ro]?Heap}$Type$Buffer
{
@@ -181,6 +183,13 @@
return this;
}
+ public $Type$Buffer get(int index, $type$[] dst, int offset, int length) {
+ Objects.checkFromIndexSize(index, length, limit());
+ Objects.checkFromIndexSize(offset, length, dst.length);
+ System.arraycopy(hb, ix(index), dst, offset, length);
+ return this;
+ }
+
public boolean isDirect() {
return false;
}
@@ -250,6 +259,36 @@
#end[rw]
}
+ public $Type$Buffer put(int index, $type$[] src, int offset, int length) {
+#if[rw]
+ Objects.checkFromIndexSize(index, length, limit());
+ Objects.checkFromIndexSize(offset, length, src.length);
+ System.arraycopy(src, offset, hb, ix(index), length);
+ return this;
+#else[rw]
+ throw new ReadOnlyBufferException();
+#end[rw]
+ }
+
+#if[char]
+
+ public $Type$Buffer put(String src, int start, int end) {
+ int length = end - start;
+ checkBounds(start, length, src.length());
+ if (isReadOnly())
+ throw new ReadOnlyBufferException();
+ int pos = position();
+ int lim = limit();
+ int rem = (pos <= lim) ? lim - pos : 0;
+ if (length > rem)
+ throw new BufferOverflowException();
+ src.getChars(start, end, hb, ix(pos));
+ position(pos + length);
+ return this;
+ }
+
+#end[char]
+
public $Type$Buffer compact() {
#if[rw]
System.arraycopy(hb, ix(position()), hb, ix(0), remaining());
--- a/src/java.base/share/classes/java/nio/X-Buffer.java.template Tue Feb 26 12:08:20 2019 -0500
+++ b/src/java.base/share/classes/java/nio/X-Buffer.java.template Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, 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
@@ -36,6 +36,7 @@
import java.util.stream.$Streamtype$Stream;
#end[streamableType]
+import java.util.Objects;
import jdk.internal.util.ArraysSupport;
/**
@@ -50,11 +51,11 @@
* {@link #put($type$) <i>put</i>} methods that read and write
* single $type$s; </p></li>
*
- * <li><p> Relative {@link #get($type$[]) <i>bulk get</i>}
+ * <li><p> Absolute and relative {@link #get($type$[]) <i>bulk get</i>}
* methods that transfer contiguous sequences of $type$s from this buffer
* into an array; {#if[!byte]?and}</p></li>
*
- * <li><p> Relative {@link #put($type$[]) <i>bulk put</i>}
+ * <li><p> Absolute and relative {@link #put($type$[]) <i>bulk put</i>}
* methods that transfer contiguous sequences of $type$s from $a$
* $type$ array{#if[char]?, a string,} or some other $type$
* buffer into this buffer;{#if[!byte]? and} </p></li>
@@ -436,7 +437,6 @@
* @return The number of characters added to the buffer, or
* -1 if this source of characters is at its end
* @throws IOException if an I/O error occurs
- * @throws NullPointerException if target is null
* @throws ReadOnlyBufferException if target is a read only buffer
* @since 1.5
*/
@@ -764,6 +764,89 @@
return get(dst, 0, dst.length);
}
+ /**
+ * Absolute bulk <i>get</i> method.
+ *
+ * <p> This method transfers {@code length} $type$s from this
+ * buffer into the given array, starting at the given index in this
+ * buffer and at the given offset in the array. The position of this
+ * buffer is unchanged.
+ *
+ * <p> An invocation of this method of the form
+ * <code>src.get(index, dst, offset, length)</code>
+ * has exactly the same effect as the following loop except that it first
+ * checks the consistency of the supplied parameters and it is potentially
+ * much more efficient:
+ *
+ * <pre>{@code
+ * for (int i = offset, j = index; i < offset + length; i++, j++)
+ * dst[i] = src.get(j);
+ * }</pre>
+ *
+ * @param index
+ * The index in this buffer from which the first $type$ will be
+ * read; must be non-negative and less than {@code limit()}
+ *
+ * @param dst
+ * The destination array
+ *
+ * @param offset
+ * The offset within the array of the first $type$ to be
+ * written; must be non-negative and less than
+ * {@code dst.length}
+ *
+ * @param length
+ * The number of $type$s to be written to the given array;
+ * must be non-negative and no larger than the smaller of
+ * {@code limit() - index} and {@code dst.length - offset}
+ *
+ * @return This buffer
+ *
+ * @throws IndexOutOfBoundsException
+ * If the preconditions on the {@code index}, {@code offset}, and
+ * {@code length} parameters do not hold
+ *
+ * @since 13
+ */
+ public $Type$Buffer get(int index, $type$[] dst, int offset, int length) {
+ Objects.checkFromIndexSize(index, length, limit());
+ Objects.checkFromIndexSize(offset, length, dst.length);
+ int end = offset + length;
+ for (int i = offset, j = index; i < end; i++, j++)
+ dst[i] = get(j);
+ return this;
+ }
+
+ /**
+ * Absolute bulk <i>get</i> method.
+ *
+ * <p> This method transfers $type$s from this buffer into the given
+ * destination array. The position of this buffer is unchanged. An
+ * invocation of this method of the form
+ * <code>src.get(index, dst)</code> behaves in exactly the same
+ * way as the invocation:
+ *
+ * <pre>
+ * src.get(index, dst, 0, dst.length) </pre>
+ *
+ * @param index
+ * The index in this buffer from which the first $type$ will be
+ * read; must be non-negative and less than {@code limit()}
+ *
+ * @param dst
+ * The destination array
+ *
+ * @return This buffer
+ *
+ * @throws IndexOutOfBoundsException
+ * If {@code index} is negative, not smaller than {@code limit()},
+ * or {@code limit() - index < dst.length}
+ *
+ * @since 13
+ */
+ public $Type$Buffer get(int index, $type$[] dst) {
+ return get(index, dst, 0, dst.length);
+ }
// -- Bulk put operations --
@@ -842,7 +925,7 @@
*
* <pre>{@code
* for (int i = off; i < off + len; i++)
- * dst.put(a[i]);
+ * dst.put(src[i]);
* }</pre>
*
* except that it first checks that there is sufficient space in this
@@ -853,12 +936,12 @@
*
* @param offset
* The offset within the array of the first $type$ to be read;
- * must be non-negative and no larger than {@code array.length}
+ * must be non-negative and no larger than {@code src.length}
*
* @param length
* The number of $type$s to be read from the given array;
* must be non-negative and no larger than
- * {@code array.length - offset}
+ * {@code src.length - offset}
*
* @return This buffer
*
@@ -908,6 +991,95 @@
return put(src, 0, src.length);
}
+ /**
+ * Absolute bulk <i>put</i> method <i>(optional operation)</i>.
+ *
+ * <p> This method transfers {@code length} $type$s from the given
+ * array, starting at the given offset in the array and at the given index
+ * in this buffer. The position of this buffer is unchanged.
+ *
+ * <p> An invocation of this method of the form
+ * <code>dst.put(index, src, offset, length)</code>
+ * has exactly the same effect as the following loop except that it first
+ * checks the consistency of the supplied parameters and it is potentially
+ * much more efficient:
+ *
+ * <pre>{@code
+ * for (int i = offset, j = index; i < offset + length; i++, j++)
+ * dst.put(j, src[i]);
+ * }</pre>
+ *
+ * @param index
+ * The index in this buffer at which the first $type$ will be
+ * written; must be non-negative and less than {@code limit()}
+ *
+ * @param src
+ * The array from which $type$s are to be read
+ *
+ * @param offset
+ * The offset within the array of the first $type$ to be read;
+ * must be non-negative and less than {@code src.length}
+ *
+ * @param length
+ * The number of $type$s to be read from the given array;
+ * must be non-negative and no larger than the smaller of
+ * {@code limit() - index} and {@code src.length - offset}
+ *
+ * @return This buffer
+ *
+ * @throws IndexOutOfBoundsException
+ * If the preconditions on the {@code index}, {@code offset}, and
+ * {@code length} parameters do not hold
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
+ *
+ * @since 13
+ */
+ public $Type$Buffer put(int index, $type$[] src, int offset, int length) {
+ if (isReadOnly())
+ throw new ReadOnlyBufferException();
+ Objects.checkFromIndexSize(index, length, limit());
+ Objects.checkFromIndexSize(offset, length, src.length);
+ int end = offset + length;
+ for (int i = offset, j = index; i < end; i++, j++)
+ this.put(j, src[i]);
+ return this;
+ }
+
+ /**
+ * Absolute bulk <i>put</i> method <i>(optional operation)</i>.
+ *
+ * <p> This method copies $type$s into this buffer from the given source
+ * array. The position of this buffer is unchanged. An invocation of this
+ * method of the form <code>dst.put(index, src)</code>
+ * behaves in exactly the same way as the invocation:
+ *
+ * <pre>
+ * dst.put(index, src, 0, src.length); </pre>
+ *
+ * @param index
+ * The index in this buffer at which the first $type$ will be
+ * written; must be non-negative and less than {@code limit()}
+ *
+ * @param src
+ * The array from which $type$s are to be read
+ *
+ * @return This buffer
+ *
+ * @throws IndexOutOfBoundsException
+ * If {@code index} is negative, not smaller than {@code limit()},
+ * or {@code limit() - index < src.length}
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
+ *
+ * @since 13
+ */
+ public $Type$Buffer put(int index, $type$[] src) {
+ return put(index, src, 0, src.length);
+ }
+
#if[char]
/**
--- a/src/java.base/share/classes/java/security/PrivilegedAction.java Tue Feb 26 12:08:20 2019 -0500
+++ b/src/java.base/share/classes/java/security/PrivilegedAction.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2019, 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
@@ -39,7 +39,7 @@
* @see AccessController#doPrivileged(PrivilegedAction)
* @see PrivilegedExceptionAction
*/
-
+@FunctionalInterface
public interface PrivilegedAction<T> {
/**
* Performs the computation. This method will be called by
--- a/src/java.base/share/classes/java/security/PrivilegedExceptionAction.java Tue Feb 26 12:08:20 2019 -0500
+++ b/src/java.base/share/classes/java/security/PrivilegedExceptionAction.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2019, 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
@@ -42,7 +42,7 @@
* AccessControlContext)
* @see PrivilegedAction
*/
-
+@FunctionalInterface
public interface PrivilegedExceptionAction<T> {
/**
* Performs the computation. This method will be called by
--- a/src/java.base/share/classes/jdk/internal/misc/Unsafe.java Tue Feb 26 12:08:20 2019 -0500
+++ b/src/java.base/share/classes/jdk/internal/misc/Unsafe.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, 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
@@ -3114,7 +3114,7 @@
* @param offset field/element offset
* @param mask the mask value
* @return the previous value
- * @since 1.9
+ * @since 9
*/
@ForceInline
public final int getAndBitwiseAndInt(Object o, long offset, int mask) {
@@ -3343,6 +3343,14 @@
}
/**
+ * Throws NoSuchMethodError; for use by the VM for redefinition support.
+ * @since 13
+ */
+ private static void throwNoSuchMethodError() {
+ throw new NoSuchMethodError();
+ }
+
+ /**
* @return Returns true if the native byte ordering of this
* platform is big-endian, false if it is little-endian.
*/
--- a/src/java.base/share/classes/sun/security/ssl/Finished.java Tue Feb 26 12:08:20 2019 -0500
+++ b/src/java.base/share/classes/sun/security/ssl/Finished.java Tue Feb 26 12:11:29 2019 -0500
@@ -102,7 +102,7 @@
}
if (m.remaining() != verifyDataLen) {
- throw context.conContext.fatal(Alert.ILLEGAL_PARAMETER,
+ throw context.conContext.fatal(Alert.DECODE_ERROR,
"Inappropriate finished message: need " + verifyDataLen +
" but remaining " + m.remaining() + " bytes verify_data");
}
@@ -120,7 +120,7 @@
"Failed to generate verify_data", ioe);
}
if (!MessageDigest.isEqual(myVerifyData, verifyData)) {
- throw context.conContext.fatal(Alert.ILLEGAL_PARAMETER,
+ throw context.conContext.fatal(Alert.DECRYPT_ERROR,
"The Finished message cannot be verified.");
}
}
--- a/src/java.base/share/classes/sun/security/ssl/SSLContextImpl.java Tue Feb 26 12:08:20 2019 -0500
+++ b/src/java.base/share/classes/sun/security/ssl/SSLContextImpl.java Tue Feb 26 12:11:29 2019 -0500
@@ -921,29 +921,45 @@
static {
Exception reserved = null;
- TrustManager[] tmMediator;
+ TrustManager[] tmMediator = null;
try {
tmMediator = getTrustManagers();
} catch (Exception e) {
reserved = e;
- tmMediator = new TrustManager[0];
+ if (SSLLogger.isOn && SSLLogger.isOn("ssl,defaultctx")) {
+ SSLLogger.warning(
+ "Failed to load default trust managers", e);
+ }
}
- trustManagers = tmMediator;
+ KeyManager[] kmMediator = null;
if (reserved == null) {
- KeyManager[] kmMediator;
try {
kmMediator = getKeyManagers();
} catch (Exception e) {
reserved = e;
- kmMediator = new KeyManager[0];
+ if (SSLLogger.isOn && SSLLogger.isOn("ssl,defaultctx")) {
+ SSLLogger.warning(
+ "Failed to load default key managers", e);
+ }
}
- keyManagers = kmMediator;
- } else {
- keyManagers = new KeyManager[0];
}
- reservedException = reserved;
+ if (reserved != null) {
+ trustManagers = new TrustManager[0];
+ keyManagers = new KeyManager[0];
+
+ // Important note: please don't reserve the original exception
+ // object, which may be not garbage collection friendly as
+ // 'reservedException' is a static filed.
+ reservedException =
+ new KeyManagementException(reserved.getMessage());
+ } else {
+ trustManagers = tmMediator;
+ keyManagers = kmMediator;
+
+ reservedException = null;
+ }
}
private static TrustManager[] getTrustManagers() throws Exception {
@@ -1071,21 +1087,30 @@
private static final class DefaultSSLContextHolder {
private static final SSLContextImpl sslContext;
- static Exception reservedException = null;
+ private static final Exception reservedException;
static {
+ Exception reserved = null;
SSLContextImpl mediator = null;
if (DefaultManagersHolder.reservedException != null) {
- reservedException = DefaultManagersHolder.reservedException;
+ reserved = DefaultManagersHolder.reservedException;
} else {
try {
mediator = new DefaultSSLContext();
} catch (Exception e) {
- reservedException = e;
+ // Important note: please don't reserve the original
+ // exception object, which may be not garbage collection
+ // friendly as 'reservedException' is a static filed.
+ reserved = new KeyManagementException(e.getMessage());
+ if (SSLLogger.isOn && SSLLogger.isOn("ssl,defaultctx")) {
+ SSLLogger.warning(
+ "Failed to load default SSLContext", e);
+ }
}
}
sslContext = mediator;
+ reservedException = reserved;
}
}
--- a/src/java.base/share/classes/sun/security/x509/CertificateExtensions.java Tue Feb 26 12:08:20 2019 -0500
+++ b/src/java.base/share/classes/sun/security/x509/CertificateExtensions.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2019, 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
@@ -355,7 +355,7 @@
class UnparseableExtension extends Extension {
private String name;
- private Throwable why;
+ private String exceptionDescription;
public UnparseableExtension(Extension ext, Throwable why) {
super(ext);
@@ -371,12 +371,13 @@
// If we cannot find the name, just ignore it
}
- this.why = why;
+ this.exceptionDescription = why.toString();
}
@Override public String toString() {
return super.toString() +
- "Unparseable " + name + "extension due to\n" + why + "\n\n" +
+ "Unparseable " + name + "extension due to\n" +
+ exceptionDescription + "\n\n" +
new HexDumpEncoder().encodeBuffer(getExtensionValue());
}
}
--- a/src/java.base/share/classes/sun/util/cldr/CLDRCalendarDataProviderImpl.java Tue Feb 26 12:08:20 2019 -0500
+++ b/src/java.base/share/classes/sun/util/cldr/CLDRCalendarDataProviderImpl.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, 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
@@ -80,7 +80,8 @@
String region = locale.getCountry();
if (region.isEmpty()) {
- return 0;
+ // Use "US" as default
+ region = "US";
}
Integer val = map.get(region);
--- a/src/java.base/share/classes/sun/util/locale/provider/CalendarDataUtility.java Tue Feb 26 12:08:20 2019 -0500
+++ b/src/java.base/share/classes/sun/util/locale/provider/CalendarDataUtility.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, 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
@@ -256,7 +256,9 @@
default:
throw new InternalError("invalid requestID: " + requestID);
}
- return (value != 0) ? value : null;
+
+ assert value != 0;
+ return value;
}
}
}
--- a/src/java.base/share/classes/sun/util/locale/provider/LocaleServiceProviderPool.java Tue Feb 26 12:08:20 2019 -0500
+++ b/src/java.base/share/classes/sun/util/locale/provider/LocaleServiceProviderPool.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2019, 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
@@ -283,8 +283,8 @@
return providersObj;
} else if (isObjectProvider) {
config(LocaleServiceProviderPool.class,
- "A locale sensitive service provider returned null for a localized objects, which should not happen. provider: "
- + lsp + " locale: " + locale);
+ "A locale sensitive service object provider returned null, " +
+ "which should not happen. Provider: " + lsp + " Locale: " + locale);
}
}
}
--- a/src/java.logging/share/classes/java/util/logging/Handler.java Tue Feb 26 12:08:20 2019 -0500
+++ b/src/java.logging/share/classes/java/util/logging/Handler.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, 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
@@ -329,12 +329,13 @@
* handler from logging the {@code LogRecord}. It will return false if
* the {@code LogRecord} is null.
*
- * @param record a {@code LogRecord}
+ * @param record a {@code LogRecord} (may be null).
* @return true if the {@code LogRecord} would be logged.
*
*/
public boolean isLoggable(LogRecord record) {
final int levelValue = getLevel().intValue();
+ if (record == null) return false;
if (record.getLevel().intValue() < levelValue || levelValue == offValue) {
return false;
}
--- a/src/java.logging/share/classes/java/util/logging/MemoryHandler.java Tue Feb 26 12:08:20 2019 -0500
+++ b/src/java.logging/share/classes/java/util/logging/MemoryHandler.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, 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
@@ -270,7 +270,7 @@
* check whether the {@code LogRecord} would result in a "push" of the
* buffer contents. It will return false if the {@code LogRecord} is null.
*
- * @param record a {@code LogRecord}
+ * @param record a {@code LogRecord} (may be null).
* @return true if the {@code LogRecord} would be logged.
*
*/
--- a/src/java.logging/share/classes/java/util/logging/StreamHandler.java Tue Feb 26 12:08:20 2019 -0500
+++ b/src/java.logging/share/classes/java/util/logging/StreamHandler.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, 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
@@ -225,7 +225,7 @@
* whether it satisfies any {@code Filter}. It will also return false if
* no output stream has been assigned yet or the LogRecord is null.
*
- * @param record a {@code LogRecord}
+ * @param record a {@code LogRecord} (may be null).
* @return true if the {@code LogRecord} would be logged.
*
*/
--- a/src/jdk.attach/aix/classes/sun/tools/attach/VirtualMachineImpl.java Tue Feb 26 12:08:20 2019 -0500
+++ b/src/jdk.attach/aix/classes/sun/tools/attach/VirtualMachineImpl.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2018, SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -138,7 +138,7 @@
* Execute the given command in the target VM.
*/
InputStream execute(String cmd, Object ... args) throws AgentLoadException, IOException {
- assert args.length <= 3; // includes null
+ assert args.length <= 4; // includes null
// did we detach?
synchronized (this) {
@@ -166,7 +166,7 @@
writeString(s, PROTOCOL_VERSION);
writeString(s, cmd);
- for (int i=0; i<3; i++) {
+ for (int i = 0; i < 4; i++) {
if (i < args.length && args[i] != null) {
writeString(s, (String)args[i]);
} else {
--- a/src/jdk.attach/linux/classes/sun/tools/attach/VirtualMachineImpl.java Tue Feb 26 12:08:20 2019 -0500
+++ b/src/jdk.attach/linux/classes/sun/tools/attach/VirtualMachineImpl.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2019, 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
@@ -143,7 +143,7 @@
* Execute the given command in the target VM.
*/
InputStream execute(String cmd, Object ... args) throws AgentLoadException, IOException {
- assert args.length <= 3; // includes null
+ assert args.length <= 4; // includes null
// did we detach?
synchronized (this) {
@@ -171,7 +171,7 @@
writeString(s, PROTOCOL_VERSION);
writeString(s, cmd);
- for (int i=0; i<3; i++) {
+ for (int i = 0; i < 4; i++) {
if (i < args.length && args[i] != null) {
writeString(s, (String)args[i]);
} else {
--- a/src/jdk.attach/macosx/classes/sun/tools/attach/VirtualMachineImpl.java Tue Feb 26 12:08:20 2019 -0500
+++ b/src/jdk.attach/macosx/classes/sun/tools/attach/VirtualMachineImpl.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2019, 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
@@ -139,7 +139,7 @@
* Execute the given command in the target VM.
*/
InputStream execute(String cmd, Object ... args) throws AgentLoadException, IOException {
- assert args.length <= 3; // includes null
+ assert args.length <= 4; // includes null
// did we detach?
synchronized (this) {
@@ -167,7 +167,7 @@
writeString(s, PROTOCOL_VERSION);
writeString(s, cmd);
- for (int i=0; i<3; i++) {
+ for (int i = 0; i < 4; i++) {
if (i < args.length && args[i] != null) {
writeString(s, (String)args[i]);
} else {
--- a/src/jdk.attach/solaris/classes/sun/tools/attach/VirtualMachineImpl.java Tue Feb 26 12:08:20 2019 -0500
+++ b/src/jdk.attach/solaris/classes/sun/tools/attach/VirtualMachineImpl.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2019, 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
@@ -126,7 +126,7 @@
* Execute the given command in the target VM.
*/
InputStream execute(String cmd, Object ... args) throws AgentLoadException, IOException {
- assert args.length <= 3; // includes null
+ assert args.length <= 4; // includes null
// first check that we are still attached
int door;
--- a/src/jdk.attach/windows/classes/sun/tools/attach/VirtualMachineImpl.java Tue Feb 26 12:08:20 2019 -0500
+++ b/src/jdk.attach/windows/classes/sun/tools/attach/VirtualMachineImpl.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2019, 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
@@ -77,7 +77,7 @@
InputStream execute(String cmd, Object ... args)
throws AgentLoadException, IOException
{
- assert args.length <= 3; // includes null
+ assert args.length <= 4; // includes null
// create a pipe using a random name
Random rnd = new Random();
--- a/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11Key.java Tue Feb 26 12:08:20 2019 -0500
+++ b/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11Key.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2019, 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
@@ -106,7 +106,7 @@
static {
PrivilegedAction<String> getKeyExtractionProp =
() -> System.getProperty(
- "sun.security.pkcs11.disableKeyExtraction", "true");
+ "sun.security.pkcs11.disableKeyExtraction", "false");
String disableKeyExtraction =
AccessController.doPrivileged(getKeyExtractionProp);
DISABLE_NATIVE_KEYS_EXTRACTION =
--- a/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_keymgmt.c Tue Feb 26 12:08:20 2019 -0500
+++ b/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_keymgmt.c Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
*/
/* Copyright (c) 2002 Graz University of Technology. All rights reserved.
@@ -151,14 +151,14 @@
unsigned int i = 0U;
unsigned long totalDataSize = 0UL, attributesCount = 0UL;
unsigned long totalCkAttributesSize = 0UL, totalNativeKeyInfoArraySize = 0UL;
- unsigned long* wrappedKeySizePtr = NULL;
+ jbyte* wrappedKeySizePtr = NULL;
jbyte* nativeKeyInfoArrayRawCkAttributes = NULL;
jbyte* nativeKeyInfoArrayRawCkAttributesPtr = NULL;
jbyte* nativeKeyInfoArrayRawDataPtr = NULL;
CK_MECHANISM ckMechanism;
char iv[16] = {0x0};
CK_ULONG ckWrappedKeyLength = 0U;
- unsigned long* wrappedKeySizeWrappedKeyArrayPtr = NULL;
+ jbyte* wrappedKeySizeWrappedKeyArrayPtr = NULL;
CK_BYTE_PTR wrappedKeyBufferPtr = NULL;
CK_FUNCTION_LIST_PTR ckpFunctions = getFunctionList(env, obj);
CK_OBJECT_CLASS class;
@@ -234,7 +234,7 @@
// * sizes are expressed in bytes and data type is unsigned long
totalCkAttributesSize = attributesCount * sizeof(CK_ATTRIBUTE);
TRACE1("DEBUG: GetNativeKeyInfo attributesCount = %lu\n", attributesCount);
- TRACE1("DEBUG: GetNativeKeyInfo sizeof CK_ATTRIBUTE = %lu\n", sizeof(CK_ATTRIBUTE));
+ TRACE1("DEBUG: GetNativeKeyInfo sizeof CK_ATTRIBUTE = %zu\n", sizeof(CK_ATTRIBUTE));
TRACE1("DEBUG: GetNativeKeyInfo totalCkAttributesSize = %lu\n", totalCkAttributesSize);
TRACE1("DEBUG: GetNativeKeyInfo totalDataSize = %lu\n", totalDataSize);
@@ -254,8 +254,8 @@
goto cleanup;
}
- wrappedKeySizePtr = (unsigned long*)(nativeKeyInfoArrayRaw +
- sizeof(unsigned long)*2 + totalCkAttributesSize + totalDataSize);
+ wrappedKeySizePtr = nativeKeyInfoArrayRaw +
+ sizeof(unsigned long)*2 + totalCkAttributesSize + totalDataSize;
memcpy(nativeKeyInfoArrayRaw, &totalCkAttributesSize, sizeof(unsigned long));
memcpy(nativeKeyInfoArrayRaw + sizeof(unsigned long) + totalCkAttributesSize,
@@ -330,15 +330,15 @@
memcpy(nativeKeyInfoWrappedKeyArrayRaw, nativeKeyInfoArrayRaw,
totalNativeKeyInfoArraySize);
wrappedKeySizeWrappedKeyArrayPtr =
- (unsigned long*)(nativeKeyInfoWrappedKeyArrayRaw +
+ nativeKeyInfoWrappedKeyArrayRaw +
sizeof(unsigned long)*2 + totalCkAttributesSize +
- totalDataSize);
+ totalDataSize;
memcpy(wrappedKeySizeWrappedKeyArrayPtr, &ckWrappedKeyLength, sizeof(unsigned long));
TRACE1("DEBUG: GetNativeKeyInfo 1st C_WrapKey wrappedKeyLength = %lu\n", ckWrappedKeyLength);
wrappedKeyBufferPtr =
- (unsigned char*)wrappedKeySizeWrappedKeyArrayPtr +
- sizeof(unsigned long);
+ (CK_BYTE_PTR) (wrappedKeySizeWrappedKeyArrayPtr +
+ sizeof(unsigned long));
rv = (*ckpFunctions->C_WrapKey)(ckSessionHandle, &ckMechanism,
jLongToCKULong(jWrappingKeyHandle),ckObjectHandle,
wrappedKeyBufferPtr, &ckWrappedKeyLength);
@@ -414,7 +414,7 @@
jbyte* nativeKeyInfoArrayRawCkAttributesPtr = NULL;
jbyte* nativeKeyInfoArrayRawDataPtr = NULL;
unsigned long totalDataSize = 0UL;
- unsigned long* wrappedKeySizePtr = NULL;
+ jbyte* wrappedKeySizePtr = NULL;
unsigned int i = 0U;
CK_MECHANISM ckMechanism;
char iv[16] = {0x0};
@@ -443,8 +443,8 @@
sizeof(unsigned long));
TRACE1("DEBUG: createNativeKey totalDataSize = %lu\n", totalDataSize);
- wrappedKeySizePtr = (unsigned long*)(nativeKeyInfoArrayRaw +
- sizeof(unsigned long)*2 + totalCkAttributesSize + totalDataSize);
+ wrappedKeySizePtr = nativeKeyInfoArrayRaw +
+ sizeof(unsigned long)*2 + totalCkAttributesSize + totalDataSize;
memcpy(&ckWrappedKeyLength, wrappedKeySizePtr, sizeof(unsigned long));
TRACE1("DEBUG: createNativeKey wrappedKeyLength = %lu\n", ckWrappedKeyLength);
@@ -470,7 +470,8 @@
jMechanismToCKMechanism(env, jWrappingMech, &ckMechanism);
rv = (*ckpFunctions->C_UnwrapKey)(ckSessionHandle, &ckMechanism,
jLongToCKULong(jWrappingKeyHandle),
- (CK_BYTE_PTR)(wrappedKeySizePtr + 1), ckWrappedKeyLength,
+ (CK_BYTE_PTR)(wrappedKeySizePtr + sizeof(unsigned long)),
+ ckWrappedKeyLength,
(CK_ATTRIBUTE_PTR)nativeKeyInfoArrayRawCkAttributes,
jLongToCKULong(nativeKeyInfoCkAttributesCount),
&ckObjectHandle);
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/HeapHprofBinWriter.java Tue Feb 26 12:08:20 2019 -0500
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/HeapHprofBinWriter.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2019, 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
@@ -938,10 +938,16 @@
}
protected void writeInstance(Instance instance) throws IOException {
+ Klass klass = instance.getKlass();
+ if (klass.getClassLoaderData() == null) {
+ // Ignoring this object since the corresponding Klass is not loaded.
+ // Might be a dormant archive object.
+ return;
+ }
+
out.writeByte((byte) HPROF_GC_INSTANCE_DUMP);
writeObjectID(instance);
out.writeInt(DUMMY_STACK_TRACE_ID);
- Klass klass = instance.getKlass();
writeObjectID(klass.getJavaMirror());
ClassData cd = (ClassData) classDataCache.get(klass);
--- a/src/jdk.javadoc/share/classes/com/sun/javadoc/AnnotatedType.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2003, 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.
- */
-
-package com.sun.javadoc;
-
-
-/**
- * Represents an annotated type.
- * For example:
- * <pre>
- * {@code @NonNull String}
- * {@code @Positive int}
- * </pre>
- *
- * @author Mahmood Ali
- * @since 1.8
- * @deprecated
- * The declarations in this package have been superseded by those
- * in the package {@code jdk.javadoc.doclet}.
- * For more information, see the <i>Migration Guide</i> in the documentation for that package.
- */
-@Deprecated(since="9", forRemoval=true)
-@SuppressWarnings("removal")
-public interface AnnotatedType extends Type {
-
- /**
- * Returns the annotations associated with this type.
- * @return the annotations associated with this type
- */
- AnnotationDesc[] annotations();
-
- /**
- * Returns the underlying type.
- * @return the underlying type
- */
- Type underlyingType();
-}
--- a/src/jdk.javadoc/share/classes/com/sun/javadoc/AnnotationDesc.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,98 +0,0 @@
-/*
- * Copyright (c) 2003, 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.
- */
-
-package com.sun.javadoc;
-
-
-/**
- * Represents an annotation.
- * An annotation associates a value with each element of an annotation type.
- *
- * @author Scott Seligman
- * @since 1.5
- *
- * @deprecated
- * The declarations in this package have been superseded by those
- * in the package {@code jdk.javadoc.doclet}.
- * For more information, see the <i>Migration Guide</i> in the documentation for that package.
- */
-@Deprecated(since="9", forRemoval=true)
-@SuppressWarnings("removal")
-public interface AnnotationDesc {
-
- /**
- * Returns the annotation type of this annotation.
- *
- * @return the annotation type of this annotation.
- */
- AnnotationTypeDoc annotationType();
-
- /**
- * Returns this annotation's elements and their values.
- * Only those explicitly present in the annotation are
- * included, not those assuming their default values.
- * Returns an empty array if there are none.
- *
- * @return this annotation's elements and their values.
- */
- ElementValuePair[] elementValues();
-
- /**
- * Check for the synthesized bit on the annotation.
- *
- * @return true if the annotation is synthesized.
- */
- boolean isSynthesized();
-
- /**
- * Represents an association between an annotation type element
- * and one of its values.
- *
- * @author Scott Seligman
- * @since 1.5
- *
- * @deprecated
- * The declarations in this package have been superseded by those
- * in the package {@code jdk.javadoc.doclet}.
- * For more information, see the <i>Migration Guide</i> in the documentation for that package.
- */
- @Deprecated(since="9", forRemoval=true)
- public interface ElementValuePair {
-
- /**
- * Returns the annotation type element.
- *
- * @return the annotation type element.
- */
- AnnotationTypeElementDoc element();
-
- /**
- * Returns the value associated with the annotation type element.
- *
- * @return the value associated with the annotation type element.
- */
- AnnotationValue value();
- }
-}
--- a/src/jdk.javadoc/share/classes/com/sun/javadoc/AnnotationTypeDoc.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2003, 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.
- */
-
-package com.sun.javadoc;
-
-
-/**
- * Represents an annotation type.
- *
- * @author Scott Seligman
- * @since 1.5
- *
- * @deprecated
- * The declarations in this package have been superseded by those
- * in the package {@code jdk.javadoc.doclet}.
- * For more information, see the <i>Migration Guide</i> in the documentation for that package.
- */
-@Deprecated(since="9", forRemoval=true)
-@SuppressWarnings("removal")
-public interface AnnotationTypeDoc extends ClassDoc {
-
- /**
- * Returns the elements of this annotation type.
- * Returns an empty array if there are none.
- *
- * @return the elements of this annotation type.
- */
- AnnotationTypeElementDoc[] elements();
-}
--- a/src/jdk.javadoc/share/classes/com/sun/javadoc/AnnotationTypeElementDoc.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2003, 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.
- */
-
-package com.sun.javadoc;
-
-
-/**
- * Represents an element of an annotation type.
- *
- * @author Scott Seligman
- * @since 1.5
- *
- * @deprecated
- * The declarations in this package have been superseded by those
- * in the package {@code jdk.javadoc.doclet}.
- * For more information, see the <i>Migration Guide</i> in the documentation for that package.
- */
-@Deprecated(since="9", forRemoval=true)
-@SuppressWarnings("removal")
-public interface AnnotationTypeElementDoc extends MethodDoc {
-
- /**
- * Returns the default value of this element.
- * Returns null if this element has no default.
- *
- * @return the default value of this element.
- */
- AnnotationValue defaultValue();
-}
--- a/src/jdk.javadoc/share/classes/com/sun/javadoc/AnnotationValue.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,66 +0,0 @@
-/*
- * Copyright (c) 2003, 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.
- */
-
-package com.sun.javadoc;
-
-
-/**
- * Represents a value of an annotation type element.
- *
- * @author Scott Seligman
- * @since 1.5
- *
- * @deprecated
- * The declarations in this package have been superseded by those
- * in the package {@code jdk.javadoc.doclet}.
- * For more information, see the <i>Migration Guide</i> in the documentation for that package.
- */
-@Deprecated(since="9", forRemoval=true)
-@SuppressWarnings("removal")
-public interface AnnotationValue {
-
- /**
- * Returns the value.
- * The type of the returned object is one of the following:
- * <ul><li> a wrapper class for a primitive type
- * <li> {@code String}
- * <li> {@code Type} (representing a class literal)
- * <li> {@code FieldDoc} (representing an enum constant)
- * <li> {@code AnnotationDesc}
- * <li> {@code AnnotationValue[]}
- * </ul>
- *
- * @return the value.
- */
- Object value();
-
- /**
- * Returns a string representation of the value.
- *
- * @return the text of a Java language annotation value expression
- * whose value is the value of this element.
- */
- String toString();
-}
--- a/src/jdk.javadoc/share/classes/com/sun/javadoc/ClassDoc.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,362 +0,0 @@
-/*
- * Copyright (c) 1998, 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.
- */
-
-package com.sun.javadoc;
-
-
-/**
- * Represents a java class or interface and provides access to
- * information about the class, the class's comment and tags, and the
- * members of the class. A ClassDoc only exists if it was
- * processed in this run of javadoc. References to classes
- * which may or may not have been processed in this run are
- * referred to using Type (which can be converted to ClassDoc,
- * if possible).
- *
- * @see Type
- *
- * @since 1.2
- * @author Kaiyang Liu (original)
- * @author Robert Field (rewrite)
- *
- * @deprecated
- * The declarations in this package have been superseded by those
- * in the package {@code jdk.javadoc.doclet}.
- * For more information, see the <i>Migration Guide</i> in the documentation for that package.
- */
-@Deprecated(since="9", forRemoval=true)
-@SuppressWarnings("removal")
-public interface ClassDoc extends ProgramElementDoc, Type {
-
- /**
- * Return true if this class is abstract. Return true
- * for all interfaces.
- *
- * @return true if this class is abstract. Return true
- * for all interfaces.
- */
- boolean isAbstract();
-
- /**
- * Return true if this class implements or interface extends
- * {@code java.io.Serializable}.
- *
- * Since {@code java.io.Externalizable} extends
- * {@code java.io.Serializable},
- * Externalizable objects are also Serializable.
- *
- * @return true if this class implements or interface extends
- * {@code java.io.Serializable}.
- */
- boolean isSerializable();
-
- /**
- * Return true if this class implements or interface extends
- * {@code java.io.Externalizable}.
- *
- * @return true if this class implements or interface extends
- * {@code java.io.Externalizable}.
- */
- boolean isExternalizable();
-
- /**
- * Return the serialization methods for this class or
- * interface.
- *
- * @return an array of MethodDoc objects that represents
- * the serialization methods for this class or interface.
- */
- MethodDoc[] serializationMethods();
-
- /**
- * Return the Serializable fields of this class or interface.
- * <p>
- * Return either a list of default fields documented by
- * {@code serial} tag<br>
- * or return a single {@code FieldDoc} for
- * {@code serialPersistentField} member.
- * There should be a {@code serialField} tag for
- * each Serializable field defined by an {@code ObjectStreamField}
- * array component of {@code serialPersistentField}.
- *
- * @return an array of {@code FieldDoc} objects for the Serializable
- * fields of this class or interface.
- *
- * @see #definesSerializableFields()
- * @see SerialFieldTag
- */
- FieldDoc[] serializableFields();
-
- /**
- * Return true if Serializable fields are explicitly defined with
- * the special class member {@code serialPersistentFields}.
- *
- * @return true if Serializable fields are explicitly defined with
- * the special class member {@code serialPersistentFields}.
- *
- * @see #serializableFields()
- * @see SerialFieldTag
- */
- boolean definesSerializableFields();
-
- /**
- * Return the superclass of this class. Return null if this is an
- * interface.
- *
- * <p> <i>This method cannot accommodate certain generic type constructs.
- * The {@code superclassType} method should be used instead.</i>
- *
- * @return the ClassDoc for the superclass of this class, null if
- * there is no superclass.
- * @see #superclassType
- */
- ClassDoc superclass();
-
- /**
- * Return the superclass of this class. Return null if this is an
- * interface. A superclass is represented by either a
- * {@code ClassDoc} or a {@code ParametrizedType}.
- *
- * @return the superclass of this class, or null if there is no superclass.
- * @since 1.5
- */
- Type superclassType();
-
- /**
- * Test whether this class is a subclass of the specified class.
- * If this is an interface, return false for all classes except
- * {@code java.lang.Object} (we must keep this unexpected
- * behavior for compatibility reasons).
- *
- * @param cd the candidate superclass.
- * @return true if cd is a superclass of this class.
- */
- boolean subclassOf(ClassDoc cd);
-
- /**
- * Return interfaces implemented by this class or interfaces extended
- * by this interface. Includes only directly-declared interfaces, not
- * inherited interfaces.
- * Return an empty array if there are no interfaces.
- *
- * <p> <i>This method cannot accommodate certain generic type constructs.
- * The {@code interfaceTypes} method should be used instead.</i>
- *
- * @return an array of ClassDoc objects representing the interfaces.
- * @see #interfaceTypes
- */
- ClassDoc[] interfaces();
-
- /**
- * Return interfaces implemented by this class or interfaces extended
- * by this interface. Includes only directly-declared interfaces, not
- * inherited interfaces.
- * Return an empty array if there are no interfaces.
- *
- * @return an array of interfaces, each represented by a
- * {@code ClassDoc} or a {@code ParametrizedType}.
- * @since 1.5
- */
- Type[] interfaceTypes();
-
- /**
- * Return the formal type parameters of this class or interface.
- * Return an empty array if there are none.
- *
- * @return the formal type parameters of this class or interface.
- * @since 1.5
- */
- TypeVariable[] typeParameters();
-
- /**
- * Return the type parameter tags of this class or interface.
- * Return an empty array if there are none.
- *
- * @return the type parameter tags of this class or interface.
- * @since 1.5
- */
- ParamTag[] typeParamTags();
-
- /**
- * Return
- * <a href="{@docRoot}/jdk.javadoc/com/sun/javadoc/package-summary.html#included">included</a>
- * fields in this class or interface.
- * Excludes enum constants if this is an enum type.
- *
- * @return an array of FieldDoc objects representing the included
- * fields in this class or interface.
- */
- FieldDoc[] fields();
-
- /**
- * Return fields in this class or interface, filtered to the specified
- * <a href="{@docRoot}/jdk.javadoc/com/sun/javadoc/package-summary.html#included">access
- * modifier option</a>.
- * Excludes enum constants if this is an enum type.
- *
- * @param filter Specify true to filter according to the specified access
- * modifier option.
- * Specify false to include all fields regardless of
- * access modifier option.
- * @return an array of FieldDoc objects representing the included
- * fields in this class or interface.
- */
- FieldDoc[] fields(boolean filter);
-
- /**
- * Return the enum constants if this is an enum type.
- * Return an empty array if there are no enum constants, or if
- * this is not an enum type.
- *
- * @return the enum constants if this is an enum type.
- */
- FieldDoc[] enumConstants();
-
- /**
- * Return
- * <a href="{@docRoot}/jdk.javadoc/com/sun/javadoc/package-summary.html#included">included</a>
- * methods in this class or interface.
- * Same as {@code methods(true)}.
- *
- * @return an array of MethodDoc objects representing the included
- * methods in this class or interface. Does not include
- * constructors or annotation type elements.
- */
- MethodDoc[] methods();
-
- /**
- * Return methods in this class or interface, filtered to the specified
- * <a href="{@docRoot}/jdk.javadoc/com/sun/javadoc/package-summary.html#included">access
- * modifier option</a>. Does not include constructors or annotation
- * type elements.
- *
- * @param filter Specify true to filter according to the specified access
- * modifier option.
- * Specify false to include all methods regardless of
- * access modifier option.
- *
- * @return an array of MethodDoc objects representing the included
- * methods in this class or interface.
- */
- MethodDoc[] methods(boolean filter);
-
- /**
- * Return
- * <a href="{@docRoot}/jdk.javadoc/com/sun/javadoc/package-summary.html#included">included</a>
- * constructors in this class. An array containing the default
- * no-arg constructor is returned if no other constructors exist.
- * Return empty array if this is an interface.
- *
- * @return an array of ConstructorDoc objects representing the included
- * constructors in this class.
- */
- ConstructorDoc[] constructors();
-
- /**
- * Return constructors in this class, filtered to the specified
- * <a href="{@docRoot}/jdk.javadoc/com/sun/javadoc/package-summary.html#included">access
- * modifier option</a>. Return an array containing the default
- * no-arg constructor if no other constructors exist.
- *
- * @param filter Specify true to filter according to the specified access
- * modifier option.
- * Specify false to include all constructors regardless of
- * access modifier option.
- * @return an array of ConstructorDoc objects representing the included
- * constructors in this class.
- */
- ConstructorDoc[] constructors(boolean filter);
-
-
- /**
- * Return
- * <a href="{@docRoot}/jdk.javadoc/com/sun/javadoc/package-summary.html#included">included</a>
- * nested classes and interfaces within this class or interface.
- * This includes both static and non-static nested classes.
- * (This method should have been named {@code nestedClasses()},
- * as inner classes are technically non-static.) Anonymous and local classes
- * or interfaces are not included.
- *
- * @return an array of ClassDoc objects representing the included classes
- * and interfaces defined in this class or interface.
- */
- ClassDoc[] innerClasses();
-
- /**
- * Return nested classes and interfaces within this class or interface
- * filtered to the specified
- * <a href="{@docRoot}/jdk.javadoc/com/sun/javadoc/package-summary.html#included">access
- * modifier option</a>.
- * This includes both static and non-static nested classes.
- * Anonymous and local classes are not included.
- *
- * @param filter Specify true to filter according to the specified access
- * modifier option.
- * Specify false to include all nested classes regardless of
- * access modifier option.
- * @return a filtered array of ClassDoc objects representing the included
- * classes and interfaces defined in this class or interface.
- */
- ClassDoc[] innerClasses(boolean filter);
-
- /**
- * Find the specified class or interface within the context of this class doc.
- * Search order: 1) qualified name, 2) nested in this class or interface,
- * 3) in this package, 4) in the class imports, 5) in the package imports.
- * Return the ClassDoc if found, null if not found.
- * @param className Specify the class name to find as a String.
- * @return the ClassDoc if found, null if not found.
- */
- ClassDoc findClass(String className);
-
- /**
- * Get the list of classes and interfaces declared as imported.
- * These are called "single-type-import declarations" in
- * <cite>The Java™ Language Specification</cite>.
- *
- * @return an array of ClassDoc representing the imported classes.
- *
- * @deprecated Import declarations are implementation details that
- * should not be exposed here. In addition, not all imported
- * classes are imported through single-type-import declarations.
- */
- @Deprecated(since="9", forRemoval=true)
- ClassDoc[] importedClasses();
-
- /**
- * Get the list of packages declared as imported.
- * These are called "type-import-on-demand declarations" in
- * <cite>The Java™ Language Specification</cite>.
- *
- * @return an array of PackageDoc representing the imported packages.
- *
- * @deprecated Import declarations are implementation details that
- * should not be exposed here. In addition, this method's
- * return type does not allow for all type-import-on-demand
- * declarations to be returned.
- */
- @Deprecated(since="9", forRemoval=true)
- PackageDoc[] importedPackages();
-}
--- a/src/jdk.javadoc/share/classes/com/sun/javadoc/ConstructorDoc.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 1998, 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.
- */
-
-package com.sun.javadoc;
-
-/**
- * Represents a constructor of a java class.
- *
- * @since 1.2
- * @author Robert Field
- *
- * @deprecated
- * The declarations in this package have been superseded by those
- * in the package {@code jdk.javadoc.doclet}.
- * For more information, see the <i>Migration Guide</i> in the documentation for that package.
- */
-@Deprecated(since="9", forRemoval=true)
-@SuppressWarnings("removal")
-public interface ConstructorDoc extends ExecutableMemberDoc {
-}
--- a/src/jdk.javadoc/share/classes/com/sun/javadoc/Doc.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,286 +0,0 @@
-/*
- * Copyright (c) 1998, 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.
- */
-
-package com.sun.javadoc;
-
-import java.text.BreakIterator;
-import java.util.Locale;
-
-/**
- * Represents Java language constructs (package, class, constructor,
- * method, field) which have comments and have been processed by this
- * run of javadoc. All Doc objects are unique, that is, they
- * are == comparable.
- *
- * @since 1.2
- * @author Robert Field
- * @author Scott Seligman (generics, enums, annotations)
- *
- * @deprecated
- * The declarations in this package have been superseded by those
- * in the package {@code jdk.javadoc.doclet}.
- * For more information, see the <i>Migration Guide</i> in the documentation for that package.
- */
-@Deprecated(since="9", forRemoval=true)
-@SuppressWarnings("removal")
-public interface Doc extends Comparable<Object> {
-
- /**
- * Return the text of the comment for this doc item.
- * Tags have been removed.
- *
- * @return the text of the comment for this doc item.
- */
- String commentText();
-
- /**
- * Return all tags in this Doc item.
- *
- * @return an array of {@link Tag} objects containing all tags on
- * this Doc item.
- */
- Tag[] tags();
-
- /**
- * Return tags of the specified {@linkplain Tag#kind() kind} in
- * this Doc item.
- *
- * For example, if 'tagname' has value "@serial", all tags in
- * this Doc item of kind "@serial" will be returned.
- *
- * @param tagname name of the tag kind to search for.
- * @return an array of Tag containing all tags whose 'kind()'
- * matches 'tagname'.
- */
- Tag[] tags(String tagname);
-
- /**
- * Return the see also tags in this Doc item.
- *
- * @return an array of SeeTag containing all @see tags.
- */
- SeeTag[] seeTags();
-
- /**
- * Return comment as an array of tags. Includes inline tags
- * (i.e. {@link <i>reference</i>} tags) but not
- * block tags.
- * Each section of plain text is represented as a {@link Tag}
- * of {@linkplain Tag#kind() kind} "Text".
- * Inline tags are represented as a {@link SeeTag} of kind "@see"
- * and name "@link".
- *
- * @return an array of {@link Tag}s representing the comment
- */
- Tag[] inlineTags();
-
- /**
- * Return the first sentence of the comment as an array of tags.
- * Includes inline tags
- * (i.e. {@link <i>reference</i>} tags) but not
- * block tags.
- * Each section of plain text is represented as a {@link Tag}
- * of {@linkplain Tag#kind() kind} "Text".
- * Inline tags are represented as a {@link SeeTag} of kind "@see"
- * and name "@link".
- * <p>
- * If the locale is English language, the first sentence is
- * determined by the rules described in the Java Language
- * Specification (first version): "This sentence ends
- * at the first period that is followed by a blank, tab, or
- * line terminator or at the first tagline.", in
- * addition a line will be terminated by block
- * HTML tags: <p> </p> <h1>
- * <h2> <h3> <h4> <h5> <h6>
- * <hr> <pre> or </pre>.
- * If the locale is not English, the sentence end will be
- * determined by
- * {@link BreakIterator#getSentenceInstance(Locale)}.
-
- * @return an array of {@link Tag}s representing the
- * first sentence of the comment
- */
- Tag[] firstSentenceTags();
-
- /**
- * Return the full unprocessed text of the comment. Tags
- * are included as text. Used mainly for store and retrieve
- * operations like internalization.
- *
- * @return the full unprocessed text of the comment.
- */
- String getRawCommentText();
-
- /**
- * Set the full unprocessed text of the comment. Tags
- * are included as text. Used mainly for store and retrieve
- * operations like internalization.
- *
- * @param rawDocumentation A String containing the full unprocessed text of the comment.
- */
- void setRawCommentText(String rawDocumentation);
-
- /**
- * Returns the non-qualified name of this Doc item.
- *
- * @return the name
- */
- String name();
-
- /**
- * Compares this doc object with the specified object for order. Returns a
- * negative integer, zero, or a positive integer as this doc object is less
- * than, equal to, or greater than the given object.
- * <p>
- * This method satisfies the {@link java.lang.Comparable} interface.
- *
- * @param obj the {@code Object} to be compared.
- * @return a negative integer, zero, or a positive integer as this Object
- * is less than, equal to, or greater than the given Object.
- * @exception ClassCastException the specified Object's type prevents it
- * from being compared to this Object.
- */
- int compareTo(Object obj);
-
- /**
- * Is this Doc item a field (but not an enum constant)?
- *
- * @return true if it represents a field
- */
- boolean isField();
-
- /**
- * Is this Doc item an enum constant?
- *
- * @return true if it represents an enum constant
- * @since 1.5
- */
- boolean isEnumConstant();
-
- /**
- * Is this Doc item a constructor?
- *
- * @return true if it represents a constructor
- */
- boolean isConstructor();
-
- /**
- * Is this Doc item a method (but not a constructor or annotation
- * type element)?
- *
- * @return true if it represents a method
- */
- boolean isMethod();
-
- /**
- * Is this Doc item an annotation type element?
- *
- * @return true if it represents an annotation type element
- * @since 1.5
- */
- boolean isAnnotationTypeElement();
-
- /**
- * Is this Doc item an interface (but not an annotation type)?
- *
- * @return true if it represents an interface
- */
- boolean isInterface();
-
- /**
- * Is this Doc item an exception class?
- *
- * @return true if it represents an exception
- */
- boolean isException();
-
- /**
- * Is this Doc item an error class?
- *
- * @return true if it represents a error
- */
- boolean isError();
-
- /**
- * Is this Doc item an enum type?
- *
- * @return true if it represents an enum type
- * @since 1.5
- */
- boolean isEnum();
-
- /**
- * Is this Doc item an annotation type?
- *
- * @return true if it represents an annotation type
- * @since 1.5
- */
- boolean isAnnotationType();
-
- /**
- * Is this Doc item an
- * <a href="{@docRoot}/jdk.javadoc/com/sun/javadoc/package-summary.html#class">ordinary
- * class</a>?
- * (i.e. not an interface, annotation type, enum, exception, or error)?
- *
- * @return true if it represents an ordinary class
- */
- boolean isOrdinaryClass();
-
- /**
- * Is this Doc item a
- * <a href="{@docRoot}/jdk.javadoc/com/sun/javadoc/package-summary.html#class">class</a>
- * (and not an interface or annotation type)?
- * This includes ordinary classes, enums, errors and exceptions.
- *
- * @return true if it represents a class
- */
- boolean isClass();
-
- /**
- * Return true if this Doc item is
- * <a href="{@docRoot}/jdk.javadoc/com/sun/javadoc/package-summary.html#included">included</a>
- * in the result set.
- *
- * @return true if this Doc item is
- * <a href="{@docRoot}/jdk.javadoc/com/sun/javadoc/package-summary.html#included">included</a>
- * in the result set.
- */
- boolean isIncluded();
-
- /**
- * Return the source position of the first line of the
- * corresponding declaration, or null if
- * no position is available. A default constructor returns
- * null because it has no location in the source file.
- *
- * @since 1.4
- * @return the source positino of the first line of the
- * corresponding declaration, or null if
- * no position is available. A default constructor returns
- * null because it has no location in the source file.
- */
- SourcePosition position();
-}
--- a/src/jdk.javadoc/share/classes/com/sun/javadoc/DocErrorReporter.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,90 +0,0 @@
-/*
- * Copyright (c) 1998, 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.
- */
-
-package com.sun.javadoc;
-
-/**
- * This interface provides error, warning and notice printing.
- *
- * @since 1.2
- * @author Robert Field
- *
- * @deprecated
- * The declarations in this package have been superseded by those
- * in the package {@code jdk.javadoc.doclet}.
- * For more information, see the <i>Migration Guide</i> in the documentation for that package.
- */
-@Deprecated(since="9", forRemoval=true)
-@SuppressWarnings("removal")
-public interface DocErrorReporter {
-
- /**
- * Print error message and increment error count.
- *
- * @param msg message to print
- */
- void printError(String msg);
-
- /**
- * Print an error message and increment error count.
- *
- * @param pos the position item where the error occurs
- * @param msg message to print
- * @since 1.4
- */
- void printError(SourcePosition pos, String msg);
-
- /**
- * Print warning message and increment warning count.
- *
- * @param msg message to print
- */
- void printWarning(String msg);
-
- /**
- * Print warning message and increment warning count.
- *
- * @param pos the position item where the warning occurs
- * @param msg message to print
- * @since 1.4
- */
- void printWarning(SourcePosition pos, String msg);
-
- /**
- * Print a message.
- *
- * @param msg message to print
- */
- void printNotice(String msg);
-
- /**
- * Print a message.
- *
- * @param pos the position item where the message occurs
- * @param msg message to print
- * @since 1.4
- */
- void printNotice(SourcePosition pos, String msg);
-}
--- a/src/jdk.javadoc/share/classes/com/sun/javadoc/Doclet.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,122 +0,0 @@
-/*
- * Copyright (c) 1997, 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.
- */
-
-package com.sun.javadoc;
-
-/**
- * This is an example of a starting class for a doclet,
- * showing the entry-point methods. A starting class must
- * import com.sun.javadoc.* and implement the
- * {@code start(RootDoc)} method, as described in the
- * <a href="package-summary.html#package.description">package
- * description</a>. If the doclet takes command line options,
- * it must also implement {@code optionLength} and
- * {@code validOptions}.
- *
- * <p> A doclet supporting the language features added since 1.1
- * (such as generics and annotations) should indicate this
- * by implementing {@code languageVersion}. In the absence of
- * this the doclet should not invoke any of the Doclet API methods
- * added since 1.5, and
- * the results of several other methods are modified so as
- * to conceal the new constructs (such as type parameters) from
- * the doclet.
- *
- * <p> To start the doclet, pass
- * {@code -doclet} followed by the fully-qualified
- * name of the starting class on the javadoc tool command line.
- *
- * @deprecated
- * The declarations in this package have been superseded by those
- * in the package {@code jdk.javadoc.doclet}.
- * For more information, see the <i>Migration Guide</i> in the documentation for that package.
- */
-@Deprecated(since="9", forRemoval=true)
-@SuppressWarnings("removal")
-public abstract class Doclet {
-
- /**
- * Generate documentation here.
- * This method is required for all doclets.
- *
- * @param root Supply the RootDoc to the method.
- * @return true on success.
- */
- public static boolean start(RootDoc root) {
- return true;
- }
-
- /**
- * Check for doclet-added options. Returns the number of
- * arguments you must specify on the command line for the
- * given option. For example, "-d docs" would return 2.
- * <P>
- * This method is required if the doclet contains any options.
- * If this method is missing, Javadoc will print an invalid flag
- * error for every option.
- *
- * @param option the option for which the number of arguements is returned.
- * @return number of arguments on the command line for an option
- * including the option name itself. Zero return means
- * option not known. Negative value means error occurred.
- */
- public static int optionLength(String option) {
- return 0; // default is option unknown
- }
-
- /**
- * Check that options have the correct arguments.
- * <P>
- * This method is not required, but is recommended,
- * as every option will be considered valid if this method
- * is not present. It will default gracefully (to true)
- * if absent.
- * <P>
- * Printing option related error messages (using the provided
- * DocErrorReporter) is the responsibility of this method.
- *
- * @param options Supply valid options as an array of Strings.
- * @param reporter The DocErrorReporter responsible for these options.
- * @return true if the options are valid.
- */
- public static boolean validOptions(String options[][],
- DocErrorReporter reporter) {
- return true; // default is options are valid
- }
-
- /**
- * Return the version of the Java Programming Language supported
- * by this doclet.
- * <p>
- * This method is required by any doclet supporting a language version
- * newer than 1.1.
- *
- * @return the language version supported by this doclet.
- * @since 1.5
- */
- public static LanguageVersion languageVersion() {
- return LanguageVersion.JAVA_1_1;
- }
-}
--- a/src/jdk.javadoc/share/classes/com/sun/javadoc/ExecutableMemberDoc.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,164 +0,0 @@
-/*
- * Copyright (c) 1998, 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.
- */
-
-package com.sun.javadoc;
-
-/**
- * Represents a method or constructor of a java class.
- *
- * @since 1.2
- * @author Robert Field
- *
- * @deprecated
- * The declarations in this package have been superseded by those
- * in the package {@code jdk.javadoc.doclet}.
- * For more information, see the <i>Migration Guide</i> in the documentation for that package.
- */
-@Deprecated(since="9", forRemoval=true)
-@SuppressWarnings("removal")
-public interface ExecutableMemberDoc extends MemberDoc {
-
- /**
- * Return exceptions this method or constructor throws.
- * If the type of the exception is a type variable, return the
- * {@code ClassDoc} of its erasure.
- *
- * <p> <i>The {@code thrownExceptions} method cannot
- * accommodate certain generic type constructs. The
- * {@code thrownExceptionTypes} method should be used
- * instead.</i>
- *
- * @return an array of ClassDoc[] representing the exceptions
- * thrown by this method.
- * @see #thrownExceptionTypes
- */
- ClassDoc[] thrownExceptions();
-
- /**
- * Return exceptions this method or constructor throws.
- *
- * @return an array representing the exceptions thrown by this method.
- * Each array element is either a {@code ClassDoc} or a
- * {@code TypeVariable}.
- * @since 1.5
- */
- Type[] thrownExceptionTypes();
-
- /**
- * Return true if this method is native
- *
- * @return true if this method is native
- */
- boolean isNative();
-
- /**
- * Return true if this method is synchronized
- *
- * @return true if this method is synchronized
- */
- boolean isSynchronized();
-
- /**
- * Return true if this method was declared to take a variable number
- * of arguments.
- *
- * @since 1.5
- * @return true if this method was declared to take a variable number of arguments.
- */
- public boolean isVarArgs();
-
- /**
- * Get argument information.
- *
- * @see Parameter
- *
- * @return an array of Parameter, one element per argument
- * in the order the arguments are present.
- */
- Parameter[] parameters();
-
- /**
- * Get the receiver type of this executable element.
- *
- * @return the receiver type of this executable element.
- * @since 1.8
- */
- Type receiverType();
-
- /**
- * Return the throws tags in this method.
- *
- * @return an array of ThrowTag containing all {@code @exception}
- * and {@code @throws} tags.
- */
- ThrowsTag[] throwsTags();
-
- /**
- * Return the param tags in this method, excluding the type
- * parameter tags.
- *
- * @return an array of ParamTag containing all {@code @param} tags
- * corresponding to the parameters of this method.
- */
- ParamTag[] paramTags();
-
- /**
- * Return the type parameter tags in this method.
- *
- * @return an array of ParamTag containing all {@code @param} tags
- * corresponding to the type parameters of this method.
- * @since 1.5
- */
- ParamTag[] typeParamTags();
-
- /**
- * Get the signature. It is the parameter list, type is qualified.
- * For instance, for a method {@code mymethod(String x, int y)},
- * it will return {@code (java.lang.String,int)}.
- *
- * @return the parameter list where type is qualified.
- */
- String signature();
-
- /**
- * get flat signature. all types are not qualified.
- * return a String, which is the flat signiture of this member.
- * It is the parameter list, type is not qualified.
- * For instance, for a method {@code mymethod(String x, int y)},
- * it will return {@code (String, int)}.
- *
- * @return a String, which is the flat signiture of this member.
- */
- String flatSignature();
-
- /**
- * Return the formal type parameters of this method or constructor.
- * Return an empty array if this method or constructor is not generic.
- *
- * @return the formal type parameters of this method or constructor.
- * @since 1.5
- */
- TypeVariable[] typeParameters();
-}
--- a/src/jdk.javadoc/share/classes/com/sun/javadoc/FieldDoc.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,92 +0,0 @@
-/*
- * Copyright (c) 1998, 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.
- */
-
-package com.sun.javadoc;
-
-/**
- * Represents a field in a java class.
- *
- * @see MemberDoc
- *
- * @since 1.2
- * @author Robert Field
- *
- * @deprecated
- * The declarations in this package have been superseded by those
- * in the package {@code jdk.javadoc.doclet}.
- * For more information, see the <i>Migration Guide</i> in the documentation for that package.
- */
-@Deprecated(since="9", forRemoval=true)
-@SuppressWarnings("removal")
-public interface FieldDoc extends MemberDoc {
-
- /**
- * Get type of this field.
- *
- * @return the type of this field.
- */
- Type type();
-
- /**
- * Return true if this field is transient
- *
- * @return true if this field is transient
- */
- boolean isTransient();
-
- /**
- * Return true if this field is volatile
- *
- * @return true if this field is volatile
- */
- boolean isVolatile();
-
- /**
- * Return the serialField tags in this FieldDoc item.
- *
- * @return an array of {@code SerialFieldTag} objects containing
- * all {@code @serialField} tags.
- */
- SerialFieldTag[] serialFieldTags();
-
- /**
- * Get the value of a constant field.
- *
- * @return the value of a constant field. The value is
- * automatically wrapped in an object if it has a primitive type.
- * If the field is not constant, returns null.
- */
- Object constantValue();
-
- /**
- * Get the value of a constant field.
- *
- * @return the text of a Java language expression whose value
- * is the value of the constant. The expression uses no identifiers
- * other than primitive literals. If the field is
- * not constant, returns null.
- */
- String constantValueExpression();
-}
--- a/src/jdk.javadoc/share/classes/com/sun/javadoc/LanguageVersion.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-/*
- * Copyright (c) 2003, 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.
- */
-
-package com.sun.javadoc;
-
-
-/**
- * Java Programming Language version. The constants of this enum
- * identify the JDK and J2SE releases containing language changes
- * relevant to doclets.
- * <p>
- * All doclets support at least the 1.1 language version.
- * The first release subsequent to this with language changes
- * affecting doclets is 1.5.
- *
- * @since 1.5
- *
- * @deprecated
- * The declarations in this package have been superseded by those
- * in the package {@code jdk.javadoc.doclet}.
- * For more information, see the <i>Migration Guide</i> in the documentation for that package.
- */
-@Deprecated(since="9", forRemoval=true)
-@SuppressWarnings("removal")
-public enum LanguageVersion {
-
- /** 1.1 added nested classes and interfaces. */
- JAVA_1_1,
-
- /** 1.5 added generic types, annotations, enums, and varArgs. */
- JAVA_1_5
-}
--- a/src/jdk.javadoc/share/classes/com/sun/javadoc/MemberDoc.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 1998, 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.
- */
-
-package com.sun.javadoc;
-
-/**
- * Represents a member of a java class: field, constructor, or method.
- * This is an abstract class dealing with information common to
- * method, constructor and field members. Class members of a class
- * (innerclasses) are represented instead by ClassDoc.
- *
- * @see MethodDoc
- * @see FieldDoc
- * @see ClassDoc
- *
- * @author Kaiyang Liu (original)
- * @author Robert Field (rewrite)
- *
- * @deprecated
- * The declarations in this package have been superseded by those
- * in the package {@code jdk.javadoc.doclet}.
- * For more information, see the <i>Migration Guide</i> in the documentation for that package.
- */
-@Deprecated(since="9", forRemoval=true)
-@SuppressWarnings("removal")
-public interface MemberDoc extends ProgramElementDoc {
-
- /**
- * Returns true if this member was synthesized by the compiler.
- *
- * @return true if this member was synthesized by the compiler.
- */
- boolean isSynthetic();
-}
--- a/src/jdk.javadoc/share/classes/com/sun/javadoc/MethodDoc.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,110 +0,0 @@
-/*
- * Copyright (c) 1998, 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.
- */
-
-package com.sun.javadoc;
-
-/**
- * Represents a method of a java class.
- *
- * @since 1.2
- * @author Robert Field
- *
- * @deprecated
- * The declarations in this package have been superseded by those
- * in the package {@code jdk.javadoc.doclet}.
- * For more information, see the <i>Migration Guide</i> in the documentation for that package.
- */
-@Deprecated(since="9", forRemoval=true)
-@SuppressWarnings("removal")
-public interface MethodDoc extends ExecutableMemberDoc {
-
- /**
- * Return true if this method is abstract
- *
- * @return true if this method is abstract
- */
- boolean isAbstract();
-
- /**
- * Return true if this method is default
- *
- * @return true if this method is default
- */
- boolean isDefault();
-
- /**
- * Get return type.
- *
- * @return the return type of this method, null if it
- * is a constructor.
- */
- Type returnType();
-
- /**
- * Return the class containing the method that this method overrides.
- *
- * <p> <i>The {@code overriddenClass} method cannot
- * accommodate certain generic type constructs. The
- * {@code overriddenType} method should be used instead.</i>
- *
- * @return a ClassDoc representing the superclass
- * defining a method that this method overrides, or null if
- * this method does not override.
- */
- ClassDoc overriddenClass();
-
- /**
- * Return the type containing the method that this method overrides.
- * It may be a {@code ClassDoc} or a {@code ParameterizedType}.
- *
- * @return the supertype whose method is overridden, or null if this
- * method does not override another in a superclass
- * @since 1.5
- */
- Type overriddenType();
-
- /**
- * Return the method that this method overrides.
- *
- * @return a MethodDoc representing a method definition
- * in a superclass this method overrides, null if
- * this method does not override.
- */
- MethodDoc overriddenMethod();
-
- /**
- * Tests whether this method overrides another.
- * The overridden method may be one declared in a superclass or
- * a superinterface (unlike {@link #overriddenMethod()}).
- *
- * <p> When a non-abstract method overrides an abstract one, it is
- * also said to <i>implement</i> the other.
- *
- * @param meth the other method to examine
- * @return {@code true} if this method overrides the other
- * @since 1.5
- */
- boolean overrides(MethodDoc meth);
-}
--- a/src/jdk.javadoc/share/classes/com/sun/javadoc/PackageDoc.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,137 +0,0 @@
-/*
- * Copyright (c) 1998, 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.
- */
-
-package com.sun.javadoc;
-
-/**
- * Represents a java package. Provides access to information
- * about the package, the package's comment and tags, and the
- * classes in the package.
- * <p>
- * Each method whose return type is an array will return an empty
- * array (never null) when there are no objects in the result.
- *
- * @since 1.2
- * @author Kaiyang Liu (original)
- * @author Robert Field (rewrite)
- *
- * @deprecated
- * The declarations in this package have been superseded by those
- * in the package {@code jdk.javadoc.doclet}.
- * For more information, see the <i>Migration Guide</i> in the documentation for that package.
- */
-@Deprecated(since="9", forRemoval=true)
-@SuppressWarnings("removal")
-public interface PackageDoc extends Doc {
-
- /**
- * Get all classes and interfaces in the package, filtered to the specified
- * <a href="{@docRoot}/jdk.javadoc/com/sun/javadoc/package-summary.html#included">access
- * modifier option</a>.
- *
- * @return filtered classes and interfaces in this package
- * @param filter Specifying true filters according to the specified access
- * modifier option.
- * Specifying false includes all classes and interfaces
- * regardless of access modifier option.
- * @since 1.4
- */
- ClassDoc[] allClasses(boolean filter);
-
- /**
- * Get all
- * <a href="{@docRoot}/jdk.javadoc/com/sun/javadoc/package-summary.html#included">included</a>
- * classes and interfaces in the package. Same as allClasses(true).
- *
- * @return all included classes and interfaces in this package.
- */
- ClassDoc[] allClasses();
-
- /**
- * Get included
- * <a href="{@docRoot}/jdk.javadoc/com/sun/javadoc/package-summary.html#class">ordinary</a>
- * classes (that is, exclude exceptions, errors, enums, interfaces, and
- * annotation types)
- * in this package.
- *
- * @return included ordinary classes in this package.
- */
- ClassDoc[] ordinaryClasses();
-
- /**
- * Get included Exception classes in this package.
- *
- * @return included Exceptions in this package.
- */
- ClassDoc[] exceptions();
-
- /**
- * Get included Error classes in this package.
- *
- * @return included Errors in this package.
- */
- ClassDoc[] errors();
-
- /**
- * Get included enum types in this package.
- *
- * @return included enum types in this package.
- * @since 1.5
- */
- ClassDoc[] enums();
-
- /**
- * Get included interfaces in this package, omitting annotation types.
- *
- * @return included interfaces in this package.
- */
- ClassDoc[] interfaces();
-
- /**
- * Get included annotation types in this package.
- *
- * @return included annotation types in this package.
- * @since 1.5
- */
- AnnotationTypeDoc[] annotationTypes();
-
- /**
- * Get the annotations of this package.
- * Return an empty array if there are none.
- *
- * @return the annotations of this package.
- * @since 1.5
- */
- AnnotationDesc[] annotations();
-
- /**
- * Lookup a class or interface within this package.
- *
- * @param className A String containing the name of the class to look up.
- * @return ClassDoc of found class or interface,
- * or null if not found.
- */
- ClassDoc findClass(String className);
-}
--- a/src/jdk.javadoc/share/classes/com/sun/javadoc/ParamTag.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,73 +0,0 @@
-/*
- * Copyright (c) 1998, 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.
- */
-
-package com.sun.javadoc;
-
-/**
- * Represents an @param documentation tag.
- * Stores the name and comment parts of the parameter tag.
- * An @param tag may represent either a method or constructor parameter,
- * or a type parameter.
- *
- * @author Robert Field
- *
- * @deprecated
- * The declarations in this package have been superseded by those
- * in the package {@code jdk.javadoc.doclet}.
- * For more information, see the <i>Migration Guide</i> in the documentation for that package.
- */
-@Deprecated(since="9", forRemoval=true)
-@SuppressWarnings("removal")
-public interface ParamTag extends Tag {
-
- /**
- * Return the name of the parameter or type parameter
- * associated with this {@code ParamTag}.
- * The angle brackets delimiting a type parameter are not part of
- * its name.
- *
- * @return the parameter name.
- */
- String parameterName();
-
- /**
- * Return the parameter comment
- * associated with this {@code ParamTag}.
- *
- * @return the parameter comment.
- */
- String parameterComment();
-
- /**
- * Return true if this {@code ParamTag} corresponds to a type
- * parameter. Return false if it corresponds to an ordinary parameter
- * of a method or constructor.
- *
- * @return true if this {@code ParamTag} corresponds to a type
- * parameter.
- * @since 1.5
- */
- boolean isTypeParameter();
-}
--- a/src/jdk.javadoc/share/classes/com/sun/javadoc/Parameter.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,87 +0,0 @@
-/*
- * Copyright (c) 1998, 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.
- */
-
-package com.sun.javadoc;
-
-/**
- * Parameter information.
- * This includes a parameter type and parameter name.
- *
- * @author Robert Field
- *
- * @deprecated
- * The declarations in this package have been superseded by those
- * in the package {@code jdk.javadoc.doclet}.
- * For more information, see the <i>Migration Guide</i> in the documentation for that package.
- */
-@Deprecated(since="9", forRemoval=true)
-@SuppressWarnings("removal")
-public interface Parameter {
-
- /**
- * Get the type of this parameter.
- *
- * @return the type of this parameter.
- */
- Type type();
-
- /**
- * Get local name of this parameter.
- * For example if parameter is the short 'index', returns "index".
- *
- * @return the name of this parameter as a string.
- */
- String name();
-
- /**
- * Get type name of this parameter.
- * For example if parameter is the short 'index', returns "short".
- * <p>
- * This method returns a complete string
- * representation of the type, including the dimensions of arrays and
- * the type arguments of parameterized types. Names are qualified.
- *
- * @return a complete string representation of the type.
- */
- String typeName();
-
- /**
- * Returns a string representation of the parameter.
- * <p>
- * For example if parameter is the short 'index', returns "short index".
- *
- * @return type and parameter name of this parameter.
- */
- String toString();
-
- /**
- * Get the annotations of this parameter.
- * Return an empty array if there are none.
- *
- * @return the annotations of this parameter.
- * @since 1.5
- */
- AnnotationDesc[] annotations();
-}
--- a/src/jdk.javadoc/share/classes/com/sun/javadoc/ParameterizedType.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,115 +0,0 @@
-/*
- * Copyright (c) 2003, 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.
- */
-
-package com.sun.javadoc;
-
-
-/**
- * Represents an invocation of a generic class or interface. For example,
- * given the generic interface {@code List<E>}, possible invocations
- * include:
- * <pre>
- * {@code List<String>}
- * {@code List<T extends Number>}
- * {@code List<?>}
- * </pre>
- * A generic inner class {@code Outer<T>.Inner<S>} might be invoked as:
- * <pre>
- * {@code Outer<Number>.Inner<String>}
- * </pre>
- *
- * @author Scott Seligman
- * @since 1.5
- *
- * @deprecated
- * The declarations in this package have been superseded by those
- * in the package {@code jdk.javadoc.doclet}.
- * For more information, see the <i>Migration Guide</i> in the documentation for that package.
- */
-@Deprecated(since="9", forRemoval=true)
-@SuppressWarnings("removal")
-public interface ParameterizedType extends Type {
-
- /**
- * Return the generic class or interface that declared this type.
- *
- * @return the generic class or interface that declared this type.
- */
- ClassDoc asClassDoc();
-
- /**
- * Return the actual type arguments of this type.
- * For a generic type that is nested within some other generic type
- * (such as {@code Outer<T>.Inner<S>}),
- * only the type arguments of the innermost type are included.
- *
- * @return the actual type arguments of this type.
- */
- Type[] typeArguments();
-
- /**
- * Return the class type that is a direct supertype of this one.
- * This is the superclass of this type's declaring class,
- * with type arguments substituted in.
- * Return null if this is an interface type.
- *
- * <p> For example, if this parameterized type is
- * {@code java.util.ArrayList<String>}, the result will be
- * {@code java.util.AbstractList<String>}.
- *
- * @return the class type that is a direct supertype of this one.
- */
- Type superclassType();
-
- /**
- * Return the interface types directly implemented by or extended by this
- * parameterized type.
- * These are the interfaces directly implemented or extended
- * by this type's declaring class or interface,
- * with type arguments substituted in.
- * Return an empty array if there are no interfaces.
- *
- * <p> For example, the interface extended by
- * {@code java.util.Set<String>} is {@code java.util.Collection<String>}.
- *
- * @return the interface types directly implemented by or extended by this
- * parameterized type.
- */
- Type[] interfaceTypes();
-
- /**
- * Return the type that contains this type as a member.
- * Return null is this is a top-level type.
- *
- * <p> For example, the containing type of
- * {@code AnInterface.Nested<Number>} is the {@code ClassDoc}
- * representing {@code AnInterface}, and the containing type of
- * {@code Outer<String>.Inner<Number>} is the
- * {@code ParameterizedType} representing {@code Outer<String>}.
- *
- * @return the type that contains this type as a member.
- */
- Type containingType();
-}
--- a/src/jdk.javadoc/share/classes/com/sun/javadoc/ProgramElementDoc.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,148 +0,0 @@
-/*
- * Copyright (c) 1998, 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.
- */
-
-package com.sun.javadoc;
-
-/**
- * Represents a java program element: class, interface, field,
- * constructor, or method.
- * This is an abstract class dealing with information common to
- * these elements.
- *
- * @see MemberDoc
- * @see ClassDoc
- *
- * @author Robert Field
- *
- * @deprecated
- * The declarations in this package have been superseded by those
- * in the package {@code jdk.javadoc.doclet}.
- * For more information, see the <i>Migration Guide</i> in the documentation for that package.
- */
-@Deprecated(since="9", forRemoval=true)
-@SuppressWarnings("removal")
-public interface ProgramElementDoc extends Doc {
-
- /**
- * Get the containing class or interface of this program element.
- *
- * @return a ClassDoc for this element's containing class or interface.
- * If this is a top-level class or interface, return null.
- */
- ClassDoc containingClass();
-
- /**
- * Get the package that this program element is contained in.
- *
- * @return a PackageDoc for this element containing package.
- * If in the unnamed package, this PackageDoc will have the
- * name "".
- */
- PackageDoc containingPackage();
-
- /**
- * Get the fully qualified name of this program element.
- * For example, for the class {@code java.util.Hashtable},
- * return "java.util.Hashtable".
- * <p>
- * For the method {@code bar()} in class {@code Foo}
- * in the unnamed package, return "Foo.bar".
- *
- * @return the qualified name of the program element as a String.
- */
- String qualifiedName();
-
- /**
- * Get the modifier specifier integer.
- *
- * @see java.lang.reflect.Modifier
- *
- * @return Get the modifier specifier integer.
- */
- int modifierSpecifier();
-
- /**
- * Get modifiers string.
- * For example, for:
- * <pre>
- * public abstract int foo() { ... }
- * </pre>
- * return "public abstract".
- * Annotations are not included.
- *
- * @return "public abstract".
- */
- String modifiers();
-
- /**
- * Get the annotations of this program element.
- * Return an empty array if there are none.
- *
- * @return the annotations of this program element.
- * @since 1.5
- */
- AnnotationDesc[] annotations();
-
- /**
- * Return true if this program element is public.
- *
- * @return true if this program element is public.
- */
- boolean isPublic();
-
- /**
- * Return true if this program element is protected.
- *
- * @return true if this program element is protected.
- */
- boolean isProtected();
-
- /**
- * Return true if this program element is private.
- *
- * @return true if this program element is private.
- */
- boolean isPrivate();
-
- /**
- * Return true if this program element is package private.
- *
- * @return true if this program element is package private.
- */
- boolean isPackagePrivate();
- /**
- * Return true if this program element is static.
- *
- * @return true if this program element is static.
- */
- boolean isStatic();
-
- /**
- * Return true if this program element is final.
- *
- * @return true if this program element is final.
- */
- boolean isFinal();
-}
--- a/src/jdk.javadoc/share/classes/com/sun/javadoc/RootDoc.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,116 +0,0 @@
-/*
- * Copyright (c) 1998, 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.
- */
-
-package com.sun.javadoc;
-
-/**
- * Represents the root of the program structure information
- * for one run of javadoc. From this root all other program
- * structure information can be extracted.
- * Also represents the command line information -- the
- * packages, classes and options specified by the user.
- *
- * @since 1.2
- * @author Robert Field
- *
- * @deprecated
- * The declarations in this package have been superseded by those
- * in the package {@code jdk.javadoc.doclet}.
- * For more information, see the <i>Migration Guide</i> in the documentation for that package.
- */
-@Deprecated(since="9", forRemoval=true)
-@SuppressWarnings("removal")
-public interface RootDoc extends Doc, DocErrorReporter {
-
- /**
- * Command line options.
- * <p>
- * For example, given:
- * <pre>
- * javadoc -foo this that -bar other ...</pre>
- *
- * this method will return:
- * <pre>
- * options()[0][0] = "-foo"
- * options()[0][1] = "this"
- * options()[0][2] = "that"
- * options()[1][0] = "-bar"
- * options()[1][1] = "other"</pre>
- *
- * @return an array of arrays of String.
- */
- String[][] options();
-
- /**
- * Return the packages
- * <a href="package-summary.html#included">specified</a>
- * on the command line.
- * If {@code -subpackages} and {@code -exclude} options
- * are used, return all the non-excluded packages.
- *
- * @return packages specified on the command line.
- */
- PackageDoc[] specifiedPackages();
-
- /**
- * Return the classes and interfaces
- * <a href="package-summary.html#included">specified</a>
- * as source file names on the command line.
- *
- * @return classes and interfaces specified on the command line.
- */
- ClassDoc[] specifiedClasses();
-
- /**
- * Return the
- * <a href="package-summary.html#included">included</a>
- classes and interfaces in all packages.
- *
- * @return included classes and interfaces in all packages.
- */
- ClassDoc[] classes();
-
- /**
- * Return a PackageDoc for the specified package name.
- *
- * @param name package name
- *
- * @return a PackageDoc holding the specified package, null if
- * this package is not referenced.
- */
- PackageDoc packageNamed(String name);
-
- /**
- * Return a ClassDoc for the specified class or interface name.
- *
- * @param qualifiedName
- * <a href="package-summary.html#qualified">qualified</a>
- * class or package name
- *
- * @return a ClassDoc holding the specified class, null if
- * this class is not referenced.
- */
- ClassDoc classNamed(String qualifiedName);
-}
--- a/src/jdk.javadoc/share/classes/com/sun/javadoc/SeeTag.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,145 +0,0 @@
-/*
- * Copyright (c) 1998, 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.
- */
-
-package com.sun.javadoc;
-
-/**
- * Represents a user-defined cross-reference to related documentation.
- * The tag can reference a package, class or member, or can hold
- * plain text. (The plain text might be a reference
- * to something not online, such as a printed book, or be a hard-coded
- * HTML link.) The reference can either be inline with the comment,
- * using {@code {@link}}, or a separate block comment,
- * using {@code @see}.
- * Method {@code name()} returns "@link" (no curly braces) or
- * "@see", depending on the tag.
- * Method {@code kind()} returns "@see" for both tags.
- *
- * @author Kaiyang Liu (original)
- * @author Robert Field (rewrite)
- * @author Atul M Dambalkar
- *
- * @deprecated
- * The declarations in this package have been superseded by those
- * in the package {@code jdk.javadoc.doclet}.
- * For more information, see the <i>Migration Guide</i> in the documentation for that package.
- */
-@Deprecated(since="9", forRemoval=true)
-@SuppressWarnings("removal")
-public interface SeeTag extends Tag {
-
- /**
- * Get the label of the {@code @see} tag.
- * Return null if no label is present.
- * For example, for:
- * <p>
- * {@code @see String#trim() the trim method}
- * </p>
- * return "the trim method".
- *
- * @return "the trim method".
- */
- String label();
-
- /**
- * Get the package doc when {@code @see} references only a package.
- * Return null if the package cannot be found, or if
- * {@code @see} references any other element (class,
- * interface, field, constructor, method) or non-element.
- * For example, for:
- * <p>
- * {@code @see java.lang}
- * </p>
- * return the {@code PackageDoc} for {@code java.lang}.
- *
- * @return the {@code PackageDoc} for {@code java.lang}.
- */
- public PackageDoc referencedPackage();
-
- /**
- * Get the class or interface name of the {@code @see} reference.
- * The name is fully qualified if the name specified in the
- * original {@code @see} tag was fully qualified, or if the class
- * or interface can be found; otherwise it is unqualified.
- * If {@code @see} references only a package name, then return
- * the package name instead.
- * For example, for:
- * <p>
- * {@code @see String#valueOf(java.lang.Object)}
- * </p>
- * return "java.lang.String".
- * For "{@code @see java.lang}", return "java.lang".
- * Return null if {@code @see} references a non-element, such as
- * {@code @see <a href="java.sun.com">}.
- *
- * @return null if {@code @see} references a non-element, such as
- * {@code @see <a href="java.sun.com">}.
- */
- String referencedClassName();
-
- /**
- * Get the class doc referenced by the class name part of @see.
- * Return null if the class cannot be found.
- * For example, for:
- * <p>
- * {@code @see String#valueOf(java.lang.Object)}
- * </p>
- * return the {@code ClassDoc} for {@code java.lang.String}.
- *
- * @return the {@code ClassDoc} for {@code java.lang.String}.
- */
- ClassDoc referencedClass();
-
- /**
- * Get the field, constructor or method substring of the {@code @see}
- * reference. Return null if the reference is to any other
- * element or to any non-element.
- * References to member classes (nested classes) return null.
- * For example, for:
- * <p>
- * {@code @see String#startsWith(String)}
- * </p>
- * return "startsWith(String)".
- *
- * @return "startsWith(String)".
- */
- String referencedMemberName();
-
- /**
- * Get the member doc for the field, constructor or method
- * referenced by {@code @see}. Return null if the member cannot
- * be found or if the reference is to any other element or to any
- * non-element.
- * References to member classes (nested classes) return null.
- * For example, for:
- * <p>
- * {@code @see String#startsWith(java.lang.String)}
- * </p>
- * return the {@code MethodDoc} for {@code startsWith}.
- *
- * @return the {@code MethodDoc} for {@code startsWith}.
- */
- MemberDoc referencedMember();
-}
--- a/src/jdk.javadoc/share/classes/com/sun/javadoc/SerialFieldTag.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,101 +0,0 @@
-/*
- * Copyright (c) 1998, 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.
- */
-
-package com.sun.javadoc;
-
-/**
- * Documents a Serializable field defined by an ObjectStreamField.
- * <pre>
- * The class parses and stores the three serialField tag parameters:
- *
- * - field name
- * - field type name
- * (fully-qualified or visible from the current import context)
- * - description of the valid values for the field
-
- * </pre>
- * This tag is only allowed in the javadoc for the special member
- * serialPersistentFields.
- *
- * @author Joe Fialli
- *
- * @see java.io.ObjectStreamField
- *
- * @deprecated
- * The declarations in this package have been superseded by those
- * in the package {@code jdk.javadoc.doclet}.
- * For more information, see the <i>Migration Guide</i> in the documentation for that package.
- */
-@Deprecated(since="9", forRemoval=true)
-@SuppressWarnings("removal")
-public interface SerialFieldTag extends Tag, Comparable<Object> {
-
- /**
- * Return the serializable field name.
- *
- * @return the serializable field name.
- */
- public String fieldName();
-
- /**
- * Return the field type string.
- *
- * @return the field type string.
- */
- public String fieldType();
-
- /**
- * Return the ClassDoc for field type.
- *
- * @return null if no ClassDoc for field type is visible from
- * containingClass context.
- */
- public ClassDoc fieldTypeDoc();
-
- /**
- * Return the field comment. If there is no serialField comment, return
- * javadoc comment of corresponding FieldDoc.
- *
- * @return the field comment. If there is no serialField comment, return
- * javadoc comment of corresponding FieldDoc.
- */
- public String description();
-
- /**
- * Compares this Object with the specified Object for order. Returns a
- * negative integer, zero, or a positive integer as this Object is less
- * than, equal to, or greater than the given Object.
- * <p>
- * Included to make SerialFieldTag items java.lang.Comparable.
- *
- * @param obj the {@code Object} to be compared.
- * @return a negative integer, zero, or a positive integer as this Object
- * is less than, equal to, or greater than the given Object.
- * @exception ClassCastException the specified Object's type prevents it
- * from being compared to this Object.
- * @since 1.2
- */
- public int compareTo(Object obj);
-}
--- a/src/jdk.javadoc/share/classes/com/sun/javadoc/SourcePosition.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +0,0 @@
-/*
- * Copyright (c) 2001, 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.
- */
-
-package com.sun.javadoc;
-
-import java.io.File;
-
-/**
- * This interface describes a source position: filename, line number,
- * and column number.
- *
- * @since 1.4
- * @author Neal M Gafter
- *
- * @deprecated
- * The declarations in this package have been superseded by those
- * in the package {@code jdk.javadoc.doclet}.
- * For more information, see the <i>Migration Guide</i> in the documentation for that package.
- */
-@Deprecated(since="9", forRemoval=true)
-@SuppressWarnings("removal")
-public interface SourcePosition {
- /** The source file. Returns null if no file information is
- * available.
- *
- * @return the source file as a File.
- */
- File file();
-
- /** The line in the source file. The first line is numbered 1;
- * 0 means no line number information is available.
- *
- * @return the line number in the source file as an integer.
- */
- int line();
-
- /** The column in the source file. The first column is
- * numbered 1; 0 means no column information is available.
- * Columns count characters in the input stream; a tab
- * advances the column number to the next 8-column tab stop.
- *
- * @return the column on the source line as an integer.
- */
- int column();
-
- /** Convert the source position to the form "Filename:line". */
- String toString();
-}
--- a/src/jdk.javadoc/share/classes/com/sun/javadoc/Tag.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,177 +0,0 @@
-/*
- * Copyright (c) 1998, 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.
- */
-
-package com.sun.javadoc;
-
-import java.text.BreakIterator;
-import java.util.Locale;
-
-/**
- * Represents a simple documentation tag, such as @since, @author, @version.
- * Given a tag (e.g. "@since 1.2"), holds tag name (e.g. "@since")
- * and tag text (e.g. "1.2"). Tags with structure or which require
- * special processing are handled by subclasses such as ParamTag
- * (for @param), SeeTag (for @see and {@link}), and ThrowsTag
- * (for @throws).
- *
- * @author Robert Field
- * @author Atul M Dambalkar
- * @see SeeTag
- * @see ParamTag
- * @see ThrowsTag
- * @see SerialFieldTag
- * @see Doc#tags()
- *
- * @deprecated
- * The declarations in this package have been superseded by those
- * in the package {@code jdk.javadoc.doclet}.
- * For more information, see the <i>Migration Guide</i> in the documentation for that package.
- */
-@Deprecated(since="9", forRemoval=true)
-@SuppressWarnings("removal")
-public interface Tag {
-
- /**
- * Return the name of this tag. The name is the string
- * starting with "@" that is used in a doc comment, such as
- * {@code @return}. For inline tags, such as
- * {@code {@link}}, the curly brackets
- * are not part of the name, so in this example the name
- * would be simply {@code @link}.
- *
- * @return the name of this tag
- */
- String name();
-
- /**
- * Return the containing {@link Doc} of this Tag element.
- *
- * @return the containing {@link Doc} of this Tag element
- */
- Doc holder();
-
- /**
- * Return the kind of this tag.
- * For most tags,
- * {@code kind() == name()};
- * the following table lists those cases where there is more
- * than one tag of a given kind:
- *
- * <table class="striped">
- * <caption>Related Tags</caption>
- * <thead>
- * <tr><th scope="col">{@code name() } <th scope="col">{@code kind() }
- * </thead>
- * <tbody style="text-align:left">
- * <tr><th scope="row">{@code @exception } <td>{@code @throws }
- * <tr><th scope="row">{@code @link } <td>{@code @see }
- * <tr><th scope="row">{@code @linkplain } <td>{@code @see }
- * <tr><th scope="row">{@code @see } <td>{@code @see }
- * <tr><th scope="row">{@code @serial } <td>{@code @serial }
- * <tr><th scope="row">{@code @serialData } <td>{@code @serial }
- * <tr><th scope="row">{@code @throws } <td>{@code @throws }
- * </tbody>
- * </table>
- *
- * @return the kind of this tag.
- */
- String kind();
-
- /**
- * Return the text of this tag, that is, the portion beyond tag name.
- *
- * @return the text of this tag
- */
- String text();
-
- /**
- * Convert this object to a string.
- */
- String toString();
-
- /**
- * For a documentation comment with embedded {@code {@link}}
- * tags, return an array of {@code Tag} objects. The entire
- * doc comment is broken down into strings separated by
- * {@code {@link}} tags, where each successive element
- * of the array represents either a string or
- * {@code {@link}} tag, in order, from start to end.
- * Each string is represented by a {@code Tag} object of
- * name "Text", where {@link #text()} returns the string. Each
- * {@code {@link}} tag is represented by a
- * {@link SeeTag} of name "@link" and kind "@see".
- * For example, given the following comment
- * tag:
- * <p>
- * {@code This is a {@link Doc commentlabel} example.}
- * <p>
- * return an array of Tag objects:
- * <ul>
- * <li> tags[0] is a {@link Tag} with name "Text" and text consisting
- * of "This is a "
- * <li> tags[1] is a {@link SeeTag} with name "@link", referenced
- * class {@code Doc} and label "commentlabel"
- * <li> tags[2] is a {@link Tag} with name "Text" and text consisting
- * of " example."
- * </ul>
- *
- * @return Tag[] array of tags
- * @see ParamTag
- * @see ThrowsTag
- */
- Tag[] inlineTags();
-
- /**
- * Return the first sentence of the comment as an array of tags.
- * Includes inline tags
- * (i.e. {@link <i>reference</i>} tags) but not
- * block tags.
- * Each section of plain text is represented as a {@link Tag}
- * of kind "Text".
- * Inline tags are represented as a {@link SeeTag} of kind "@link".
- * If the locale is English language, the first sentence is
- * determined by the rules described in the Java Language
- * Specification (first version): "This sentence ends
- * at the first period that is followed by a blank, tab, or
- * line terminator or at the first tagline.", in
- * addition a line will be terminated by paragraph and
- * section terminating HTML tags: <p> </p> <h1>
- * <h2> <h3> <h4> <h5> <h6>
- * <hr> <pre> or </pre>.
- * If the locale is not English, the sentence end will be
- * determined by
- * {@link BreakIterator#getSentenceInstance(Locale)}.
- *
- * @return an array of {@link Tag} objects representing the
- * first sentence of the comment
- */
- Tag[] firstSentenceTags();
-
- /**
- * Return the source position of this tag.
- * @return the source position of this tag.
- */
- public SourcePosition position();
-}
--- a/src/jdk.javadoc/share/classes/com/sun/javadoc/ThrowsTag.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,85 +0,0 @@
-/*
- * Copyright (c) 1998, 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.
- */
-
-package com.sun.javadoc;
-
-/**
- * Represents a @throws or @exception documentation tag.
- * Parses and holds the exception name and exception comment.
- * Note: @exception is a backwards compatible synonymy for @throws.
- *
- * @author Robert Field
- * @author Atul M Dambalkar
- * @see ExecutableMemberDoc#throwsTags()
- *
- * @deprecated
- * The declarations in this package have been superseded by those
- * in the package {@code jdk.javadoc.doclet}.
- * For more information, see the <i>Migration Guide</i> in the documentation for that package.
- */
-@Deprecated(since="9", forRemoval=true)
-@SuppressWarnings("removal")
-public interface ThrowsTag extends Tag {
-
- /**
- * Return the name of the exception
- * associated with this {@code ThrowsTag}.
- *
- * @return name of the exception.
- */
- String exceptionName();
-
- /**
- * Return the exception comment
- * associated with this {@code ThrowsTag}.
- *
- * @return exception comment.
- */
- String exceptionComment();
-
- /**
- * Return a {@code ClassDoc} that represents the exception.
- * If the type of the exception is a type variable, return the
- * {@code ClassDoc} of its erasure.
- *
- * <p> <i>This method cannot accommodate certain generic type
- * constructs. The {@code exceptionType} method
- * should be used instead.</i>
- *
- * @return {@code ClassDoc} that represents the exception.
- * @see #exceptionType
- */
- ClassDoc exception();
-
- /**
- * Return the type of the exception
- * associated with this {@code ThrowsTag}.
- * This may be a {@code ClassDoc} or a {@code TypeVariable}.
- *
- * @return the type of the exception.
- * @since 1.5
- */
- Type exceptionType();
-}
--- a/src/jdk.javadoc/share/classes/com/sun/javadoc/Type.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,183 +0,0 @@
-/*
- * Copyright (c) 1997, 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.
- */
-
-package com.sun.javadoc;
-
-/**
- * Represents a type. A type can be a class or interface, an
- * invocation (like {@code List<String>}) of a generic class or interface,
- * a type variable, a wildcard type ("{@code ?}"),
- * or a primitive data type (like {@code char}).
- *
- * @since 1.2
- * @author Kaiyang Liu (original)
- * @author Robert Field (rewrite)
- * @author Scott Seligman (generics)
- *
- * @deprecated
- * The declarations in this package have been superseded by those
- * in the package {@code jdk.javadoc.doclet}.
- * For more information, see the <i>Migration Guide</i> in the documentation for that package.
- */
-@Deprecated(since="9", forRemoval=true)
-@SuppressWarnings("removal")
-public interface Type {
-
- /**
- * Return unqualified name of type excluding any dimension information.
- * <p>
- * For example, a two dimensional array of String returns
- * "{@code String}".
- * @return unqualified name of type excluding any dimension information.
- */
- String typeName();
-
- /**
- * Return qualified name of type excluding any dimension information.
- *<p>
- * For example, a two dimensional array of String
- * returns "{@code java.lang.String}".
- * @return qualified name of this type excluding any dimension information.
- */
- String qualifiedTypeName();
-
- /**
- * Return the simple name of this type excluding any dimension information.
- * This is the unqualified name of the type, except that for nested types
- * only the identifier of the innermost type is included.
- * <p>
- * For example, the class {@code Outer.Inner} returns
- * "{@code Inner}".
- *
- * @since 1.5
- * @return the simple name of this type excluding any dimension information.
- */
- String simpleTypeName();
-
- /**
- * Return the type's dimension information, as a string.
- * <p>
- * For example, a two dimensional array of String returns
- * "{@code [][]}".
- * @return the type's dimension information as a string.
- */
- String dimension();
-
- /**
- * Return a string representation of the type.
- * This includes any dimension information and type arguments.
- * <p>
- * For example, a two dimensional array of String may return
- * "{@code java.lang.String[][]}",
- * and the parameterized type {@code List<Integer>} may return
- * "{@code java.util.List<java.lang.Integer>}".
- *
- * @return a string representation of the type.
- */
- String toString();
-
- /**
- * Return true if this type represents a primitive type.
- *
- * @return true if this type represents a primitive type.
- * @since 1.5
- */
- boolean isPrimitive();
-
- /**
- * Return this type as a {@code ClassDoc} if it represents a class
- * or interface. Array dimensions are ignored.
- * If this type is a {@code ParameterizedType},
- * {@code TypeVariable}, or {@code WildcardType}, return
- * the {@code ClassDoc} of the type's erasure. If this is an
- * {@code AnnotationTypeDoc}, return this as a {@code ClassDoc}
- * (but see {@link #asAnnotationTypeDoc()}).
- * If this is a primitive type, return null.
- *
- * @return the {@code ClassDoc} of this type,
- * or null if it is a primitive type.
- */
- ClassDoc asClassDoc();
-
- /**
- * Return this type as a {@code ParameterizedType} if it represents
- * an invocation of a generic class or interface. Array dimensions
- * are ignored.
- *
- * @return a {@code ParameterizedType} if the type is an
- * invocation of a generic type, or null if it is not.
- * @since 1.5
- */
- ParameterizedType asParameterizedType();
-
- /**
- * Return this type as a {@code TypeVariable} if it represents
- * a type variable. Array dimensions are ignored.
- *
- * @return a {@code TypeVariable} if the type is a type variable,
- * or null if it is not.
- * @since 1.5
- */
- TypeVariable asTypeVariable();
-
- /**
- * Return this type as a {@code WildcardType} if it represents
- * a wildcard type.
- *
- * @return a {@code WildcardType} if the type is a wildcard type,
- * or null if it is not.
- * @since 1.5
- */
- WildcardType asWildcardType();
-
- /**
- * Returns this type as a {@code AnnotatedType} if it represents
- * an annotated type.
- *
- * @return a {@code AnnotatedType} if the type if an annotated type,
- * or null if it is not
- * @since 1.8
- */
- AnnotatedType asAnnotatedType();
-
- /**
- * Return this type as an {@code AnnotationTypeDoc} if it represents
- * an annotation type. Array dimensions are ignored.
- *
- * @return an {@code AnnotationTypeDoc} if the type is an annotation
- * type, or null if it is not.
- * @since 1.5
- */
- AnnotationTypeDoc asAnnotationTypeDoc();
-
- /**
- * If this type is an array type, return the element type of the
- * array. Otherwise, return null.
- *
- * @return a {@code Type} representing the element type or null.
- * @since 1.8
- */
- Type getElementType();
-}
--- a/src/jdk.javadoc/share/classes/com/sun/javadoc/TypeVariable.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,75 +0,0 @@
-/*
- * Copyright (c) 2003, 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.
- */
-
-package com.sun.javadoc;
-
-
-/**
- * Represents a type variable.
- * For example, the generic interface {@code List<E>} has a single
- * type variable {@code E}.
- * A type variable may have explicit bounds, as in
- * {@code C<R extends Remote>}.
- *
- * @author Scott Seligman
- * @since 1.5
- *
- * @deprecated
- * The declarations in this package have been superseded by those
- * in the package {@code jdk.javadoc.doclet}.
- * For more information, see the <i>Migration Guide</i> in the documentation for that package.
- */
-@Deprecated(since="9", forRemoval=true)
-@SuppressWarnings("removal")
-public interface TypeVariable extends Type {
-
- /**
- * Return the bounds of this type variable.
- * These are the types given by the <i>extends</i> clause.
- * Return an empty array if there are no explicit bounds.
- *
- * @return the bounds of this type variable.
- */
- Type[] bounds();
-
- /**
- * Return the class, interface, method, or constructor within
- * which this type variable is declared.
- *
- * @return the class, interface, method, or constructor within
- * which this type variable is declared.
- */
- ProgramElementDoc owner();
-
- /**
- * Get the annotations of this program element.
- * Return an empty array if there are none.
- *
- * @return the annotations of this program element or
- * an empty array if there are none.
- */
- public AnnotationDesc[] annotations();
-
-}
--- a/src/jdk.javadoc/share/classes/com/sun/javadoc/WildcardType.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,68 +0,0 @@
-/*
- * Copyright (c) 2003, 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.
- */
-
-package com.sun.javadoc;
-
-
-/**
- * Represents a wildcard type argument.
- * Examples include: <pre>
- * {@code <?>}
- * {@code <? extends E>}
- * {@code <? super T>}
- * </pre>
- * A wildcard type can have explicit <i>extends</i> bounds
- * or explicit <i>super</i> bounds or neither, but not both.
- *
- * @author Scott Seligman
- * @since 1.5
- *
- * @deprecated
- * The declarations in this package have been superseded by those
- * in the package {@code jdk.javadoc.doclet}.
- * For more information, see the <i>Migration Guide</i> in the documentation for that package.
- */
-@Deprecated(since="9", forRemoval=true)
-@SuppressWarnings("removal")
-public interface WildcardType extends Type {
-
- /**
- * Return the upper bounds of this wildcard type argument
- * as given by the <i>extends</i> clause.
- * Return an empty array if no such bounds are explicitly given.
- *
- * @return the extends bounds of this wildcard type argument
- */
- Type[] extendsBounds();
-
- /**
- * Return the lower bounds of this wildcard type argument
- * as given by the <i>super</i> clause.
- * Return an empty array if no such bounds are explicitly given.
- *
- * @return the super bounds of this wildcard type argument
- */
- Type[] superBounds();
-}
--- a/src/jdk.javadoc/share/classes/com/sun/javadoc/package-info.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,153 +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.
- */
-
-/**
-<p style="font-style: italic; font-size:larger">
-<b>Note:</b> The declarations in this package have been superseded by those
-in the package {@link jdk.javadoc.doclet}.
-For more information, see the <i>Migration Guide</i> in the documentation for that package.
-</p>
-
-The Doclet API (also called the Javadoc API) provides a mechanism
-for clients to inspect the source-level structure of programs and
-libraries, including javadoc comments embedded in the source.
-This is useful for documentation, program checking, automatic
-code generation and many other tools.
-<p>
-
-Doclets are invoked by javadoc and use this API to write out
-program information to files. For example, the standard doclet is called
-by default and writes out documentation to HTML files.
-<p>
-
-The invocation is defined by the abstract {@link com.sun.javadoc.Doclet} class
--- the entry point is the {@link com.sun.javadoc.Doclet#start(RootDoc) start} method:
-<pre>
- public static boolean <b>start</b>(RootDoc root)
-</pre>
-The {@link com.sun.javadoc.RootDoc} instance holds the root of the program structure
-information. From this root all other program structure
-information can be extracted.
-<p>
-
-<a id="terminology"></a>
-<h3>Terminology</h3>
-
-<a id="included"></a>
-When calling javadoc, you pass in package names and source file names --
-these are called the <em>specified</em> packages and classes.
-You also pass in Javadoc options; the <em>access control</em> Javadoc options
-({@code -public}, {@code -protected}, {@code -package},
-and {@code -private}) filter program elements, producing a
-result set, called the <em>included</em> set, or "documented" set.
-(The unfiltered set is also available through
-{@link com.sun.javadoc.PackageDoc#allClasses(boolean) allClasses(false)}.)
-<p>
-
-<a id="class"></a>
-Throughout this API, the term <em>class</em> is normally a
-shorthand for "class or interface", as in: {@link com.sun.javadoc.ClassDoc},
-{@link com.sun.javadoc.PackageDoc#allClasses() allClasses()}, and
-{@link com.sun.javadoc.PackageDoc#findClass(String) findClass(String)}.
-In only a couple of other places, it means "class, as opposed to interface",
-as in: {@link com.sun.javadoc.Doc#isClass()}.
-In the second sense, this API calls out four kinds of classes:
-{@linkplain com.sun.javadoc.Doc#isOrdinaryClass() ordinary classes},
-{@linkplain com.sun.javadoc.Doc#isEnum() enums},
-{@linkplain com.sun.javadoc.Doc#isError() errors} and
-{@linkplain com.sun.javadoc.Doc#isException() exceptions}.
-Throughout the API, the detailed description of each program element
-describes explicitly which meaning is being used.
-<p>
-
-<a id="qualified"></a>
-A <em>qualified</em> class or interface name is one that has its package
-name prepended to it, such as {@code java.lang.String}. A non-qualified
-name has no package name, such as {@code String}.
-<p>
-
-<a id="example"></a>
-<h3>Example</h3>
-
-The following is an example doclet that
-displays information in the {@code @param} tags of the processed
-classes:
-<pre>
-import com.sun.javadoc.*;
-
-public class ListParams extends <span style="color:#E00000" >Doclet</span> {
-
- public static boolean start(<span style="color:#E00000" >RootDoc</span> root) {
- <span style="color:#E00000" >ClassDoc</span>[] classes = root.<span style="color:#E00000" >classes</span>();
- for (int i = 0; i < classes.length; ++i) {
- <span style="color:#E00000" >ClassDoc</span> cd = classes[i];
- printMembers(cd.<span style="color:#E00000" >constructors</span>());
- printMembers(cd.<span style="color:#E00000" >methods</span>());
- }
- return true;
- }
-
- static void printMembers(<span style="color:#E00000" >ExecutableMemberDoc</span>[] mems) {
- for (int i = 0; i < mems.length; ++i) {
- <span style="color:#E00000" >ParamTag</span>[] params = mems[i].<span style="color:#E00000" >paramTags</span>();
- System.out.println(mems[i].<span style="color:#E00000" >qualifiedName</span>());
- for (int j = 0; j < params.length; ++j) {
- System.out.println(" " + params[j].<span style="color:#E00000" >parameterName</span>()
- + " - " + params[j].<span style="color:#E00000" >parameterComment</span>());
- }
- }
- }
-}
-</pre>
-Interfaces and methods from the Javadoc API are marked in
-<span style="color:#E00000" >red</span>.
-{@link com.sun.javadoc.Doclet Doclet} is an abstract class that specifies
-the invocation interface for doclets,
-{@link com.sun.javadoc.Doclet Doclet} holds class or interface information,
-{@link com.sun.javadoc.ExecutableMemberDoc} is a
-superinterface of {@link com.sun.javadoc.MethodDoc} and
-{@link com.sun.javadoc.ConstructorDoc},
-and {@link com.sun.javadoc.ParamTag} holds information
-from "{@code @param}" tags.
-<p>
-This doclet when invoked with a command line like:
-<pre>
- javadoc -doclet ListParams -sourcepath <source-location> java.util
-</pre>
-producing output like:
-<pre>
- ...
- java.util.ArrayList.add
- index - index at which the specified element is to be inserted.
- element - element to be inserted.
- java.util.ArrayList.remove
- index - the index of the element to removed.
- ...
-
-</pre>
-@see com.sun.javadoc.Doclet
-@see com.sun.javadoc.RootDoc
-*/
-package com.sun.javadoc;
--- a/src/jdk.javadoc/share/classes/com/sun/tools/doclets/standard/Standard.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 2017, 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.
- */
-
-package com.sun.tools.doclets.standard;
-
-import com.sun.javadoc.RootDoc;
-
-/**
- * This is not the doclet you are looking for.
- * @deprecated The doclet has been superseded by its replacement,
- * {@link jdk.javadoc.doclet.StandardDoclet}.
- */
-@Deprecated(since="9", forRemoval=true)
-@SuppressWarnings("removal")
-
-public class Standard {
-
- public static boolean start(RootDoc root) {
- root.printNotice("Notice: " + "This is not the Standard Doclet");
- return true;
- }
-
- public static int optionLength(String option) {
- return 0; // all options are unsupported
- }
-}
--- a/src/jdk.javadoc/share/classes/com/sun/tools/doclets/standard/package-info.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2003, 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.
- */
-
-/**
-<p style="font-style: italic; font-size:larger">
-<b>Note:</b> The declarations in this package have been replaced by those
-in the new package {@link jdk.javadoc.doclet}.
-</p>
-*/
-
-package com.sun.tools.doclets.standard;
--- a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/Main.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,205 +0,0 @@
-/*
- * Copyright (c) 2000, 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.
- */
-
-package com.sun.tools.javadoc;
-
-import java.io.PrintWriter;
-
-import com.sun.tools.javadoc.main.Start;
-
-/**
- * Provides external entry points (tool and programmatic)
- * for the javadoc program.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- *
- * @deprecated
- * This class is now deprecated and may be removed in a future release.
- * See
- * {@code javax.tools.ToolProvider::getSystemDocumentationTool}
- * and
- * {@code javax.tools.DocumentationTool}
- * for replacement functionality.
- *
- * @since 1.4
- */
-@Deprecated(since="9", forRemoval=true)
-@SuppressWarnings("removal")
-public class Main {
-
- /**
- * Constructor should never be called.
- */
- private Main() {
- }
-
- /**
- * Command line interface.
- * @param args The command line parameters.
- */
- public static void main(String... args) {
- System.exit(execute(args));
- }
-
- /**
- * Programmatic interface.
- * @param args The command line parameters.
- * @return The return code.
- */
- public static int execute(String... args) {
- Start jdoc = new Start();
- return jdoc.begin(args);
- }
-
- /**
- * Programmatic interface.
- * @param args The command line parameters.
- * @param docletParentClassLoader The parent class loader used when
- * creating the doclet classloader. If null, the class loader used
- * to instantiate doclets will be created without specifying a parent
- * class loader.
- * @return The return code.
- * @since 1.7
- */
- public static int execute(ClassLoader docletParentClassLoader, String... args) {
- Start jdoc = new Start(docletParentClassLoader);
- return jdoc.begin(args);
- }
-
- /**
- * Programmatic interface.
- * @param programName Name of the program (for error messages).
- * @param args The command line parameters.
- * @return The return code.
- */
- public static int execute(String programName, String... args) {
- Start jdoc = new Start(programName);
- return jdoc.begin(args);
- }
-
- /**
- * Programmatic interface.
- * @param programName Name of the program (for error messages).
- * @param args The command line parameters.
- * @param docletParentClassLoader The parent class loader used when
- * creating the doclet classloader. If null, the class loader used
- * to instantiate doclets will be created without specifying a parent
- * class loader.
- * @return The return code.
- * @since 1.7
- */
- public static int execute(String programName, ClassLoader docletParentClassLoader, String... args) {
- Start jdoc = new Start(programName, docletParentClassLoader);
- return jdoc.begin(args);
- }
-
- /**
- * Programmatic interface.
- * @param programName Name of the program (for error messages).
- * @param defaultDocletClassName Fully qualified class name.
- * @param args The command line parameters.
- * @return The return code.
- */
- public static int execute(String programName,
- String defaultDocletClassName,
- String... args) {
- Start jdoc = new Start(programName, defaultDocletClassName);
- return jdoc.begin(args);
- }
-
- /**
- * Programmatic interface.
- * @param programName Name of the program (for error messages).
- * @param defaultDocletClassName Fully qualified class name.
- * @param docletParentClassLoader The parent class loader used when
- * creating the doclet classloader. If null, the class loader used
- * to instantiate doclets will be created without specifying a parent
- * class loader.
- * @param args The command line parameters.
- * @return The return code.
- * @since 1.7
- */
- public static int execute(String programName,
- String defaultDocletClassName,
- ClassLoader docletParentClassLoader,
- String... args) {
- Start jdoc = new Start(programName, defaultDocletClassName, docletParentClassLoader);
- return jdoc.begin(args);
- }
-
- /**
- * Programmatic interface.
- * @param programName Name of the program (for error messages).
- * @param errWriter PrintWriter to receive error messages.
- * @param warnWriter PrintWriter to receive error messages.
- * @param noticeWriter PrintWriter to receive error messages.
- * @param defaultDocletClassName Fully qualified class name.
- * @param args The command line parameters.
- * @return The return code.
- */
- public static int execute(String programName,
- PrintWriter errWriter,
- PrintWriter warnWriter,
- PrintWriter noticeWriter,
- String defaultDocletClassName,
- String... args) {
- Start jdoc = new Start(programName,
- errWriter, warnWriter, noticeWriter,
- defaultDocletClassName);
- return jdoc.begin(args);
- }
-
- /**
- * Programmatic interface.
- * @param programName Name of the program (for error messages).
- * @param errWriter PrintWriter to receive error messages.
- * @param warnWriter PrintWriter to receive error messages.
- * @param noticeWriter PrintWriter to receive error messages.
- * @param defaultDocletClassName Fully qualified class name.
- * @param docletParentClassLoader The parent class loader used when
- * creating the doclet classloader. If null, the class loader used
- * to instantiate doclets will be created without specifying a parent
- * class loader.
- * @param args The command line parameters.
- * @return The return code.
- * @since 1.7
- */
- public static int execute(String programName,
- PrintWriter errWriter,
- PrintWriter warnWriter,
- PrintWriter noticeWriter,
- String defaultDocletClassName,
- ClassLoader docletParentClassLoader,
- String... args) {
- Start jdoc = new Start(programName,
- errWriter, warnWriter, noticeWriter,
- defaultDocletClassName,
- docletParentClassLoader);
- return jdoc.begin(args);
- }
-}
--- a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/AbstractTypeImpl.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,117 +0,0 @@
-/*
- * Copyright (c) 2003, 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.
- */
-
-package com.sun.tools.javadoc.main;
-
-import com.sun.javadoc.*;
-
-import com.sun.tools.javac.code.Type;
-
-
-/**
- * Abstract implementation of <code>Type</code>, with useful
- * defaults for the methods in <code>Type</code> (and a couple from
- * <code>ProgramElementDoc</code>).
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- *
- * @author Scott Seligman
- * @since 1.5
- */
-@Deprecated(since="9", forRemoval=true)
-@SuppressWarnings("removal")
-abstract class AbstractTypeImpl implements com.sun.javadoc.Type {
-
- protected final DocEnv env;
- protected final Type type;
-
- protected AbstractTypeImpl(DocEnv env, Type type) {
- this.env = env;
- this.type = type;
- }
-
- public String typeName() {
- return type.tsym.name.toString();
- }
-
- public String qualifiedTypeName() {
- return type.tsym.getQualifiedName().toString();
- }
-
- public com.sun.javadoc.Type getElementType() {
- return null;
- }
-
- public String simpleTypeName() {
- return type.tsym.name.toString();
- }
-
- public String name() {
- return typeName();
- }
-
- public String qualifiedName() {
- return qualifiedTypeName();
- }
-
- public String toString() {
- return qualifiedTypeName();
- }
-
- public String dimension() {
- return "";
- }
-
- public boolean isPrimitive() {
- return false;
- }
-
- public ClassDoc asClassDoc() {
- return null;
- }
-
- public TypeVariable asTypeVariable() {
- return null;
- }
-
- public WildcardType asWildcardType() {
- return null;
- }
-
- public ParameterizedType asParameterizedType() {
- return null;
- }
-
- public AnnotationTypeDoc asAnnotationTypeDoc() {
- return null;
- }
-
- public AnnotatedType asAnnotatedType() {
- return null;
- }
-}
--- a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/AnnotatedTypeImpl.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,127 +0,0 @@
-/*
- * Copyright (c) 2003, 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.
- */
-
-package com.sun.tools.javadoc.main;
-
-import com.sun.javadoc.*;
-import com.sun.tools.javac.code.Attribute;
-import com.sun.tools.javac.code.Attribute.TypeCompound;
-import com.sun.tools.javac.util.List;
-
-/**
- * Implementation of <code>AnnotatedType</code>, which
- * represents an annotated type.
- *
- * @author Mahmood Ali
- * @since 1.8
- */
-@Deprecated(since="9", forRemoval=true)
-@SuppressWarnings("removal")
-public class AnnotatedTypeImpl
- extends AbstractTypeImpl implements AnnotatedType {
-
- AnnotatedTypeImpl(DocEnv env, com.sun.tools.javac.code.Type type) {
- super(env, type);
- }
-
- /**
- * Get the annotations of this program element.
- * Return an empty array if there are none.
- */
- @Override
- public AnnotationDesc[] annotations() {
- List<? extends TypeCompound> tas = type.getAnnotationMirrors();
- if (tas == null ||
- tas.isEmpty()) {
- return new AnnotationDesc[0];
- }
- AnnotationDesc res[] = new AnnotationDesc[tas.length()];
- int i = 0;
- for (Attribute.Compound a : tas) {
- res[i++] = new AnnotationDescImpl(env, a);
- }
- return res;
- }
-
- @Override
- public com.sun.javadoc.Type underlyingType() {
- return TypeMaker.getType(env, type, true, false);
- }
-
- @Override
- public AnnotatedType asAnnotatedType() {
- return this;
- }
-
- @Override
- public String toString() {
- return typeName();
- }
-
- @Override
- public String typeName() {
- return this.underlyingType().typeName();
- }
-
- @Override
- public String qualifiedTypeName() {
- return this.underlyingType().qualifiedTypeName();
- }
-
- @Override
- public String simpleTypeName() {
- return this.underlyingType().simpleTypeName();
- }
-
- @Override
- public String dimension() {
- return this.underlyingType().dimension();
- }
-
- @Override
- public boolean isPrimitive() {
- return this.underlyingType().isPrimitive();
- }
-
- @Override
- public ClassDoc asClassDoc() {
- return this.underlyingType().asClassDoc();
- }
-
- @Override
- public TypeVariable asTypeVariable() {
- return this.underlyingType().asTypeVariable();
- }
-
- @Override
- public WildcardType asWildcardType() {
- return this.underlyingType().asWildcardType();
- }
-
- @Override
- public ParameterizedType asParameterizedType() {
- return this.underlyingType().asParameterizedType();
- }
-}
--- a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/AnnotationDescImpl.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,179 +0,0 @@
-/*
- * Copyright (c) 2003, 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.
- */
-
-package com.sun.tools.javadoc.main;
-
-import com.sun.javadoc.*;
-
-import com.sun.tools.javac.code.Attribute;
-import com.sun.tools.javac.code.Symbol.*;
-import com.sun.tools.javac.util.List;
-import com.sun.tools.javac.util.Pair;
-
-
-/**
- * Represents an annotation.
- * An annotation associates a value with each element of an annotation type.
- * Sure it ought to be called "Annotation", but that clashes with
- * java.lang.annotation.Annotation.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- *
- * @author Scott Seligman
- * @since 1.5
- */
-
-@Deprecated(since="9", forRemoval=true)
-@SuppressWarnings("removal")
-public class AnnotationDescImpl implements AnnotationDesc {
-
- private final DocEnv env;
- private final Attribute.Compound annotation;
-
-
- AnnotationDescImpl(DocEnv env, Attribute.Compound annotation) {
- this.env = env;
- this.annotation = annotation;
- }
-
- /**
- * Returns the annotation type of this annotation.
- */
- public AnnotationTypeDoc annotationType() {
- ClassSymbol atsym = (ClassSymbol)annotation.type.tsym;
- if (annotation.type.isErroneous()) {
- env.warning(null, "javadoc.class_not_found", annotation.type.toString());
- return new AnnotationTypeDocImpl(env, atsym);
- } else {
- return (AnnotationTypeDoc)env.getClassDoc(atsym);
- }
- }
-
- /**
- * Returns this annotation's elements and their values.
- * Only those explicitly present in the annotation are
- * included, not those assuming their default values.
- * Returns an empty array if there are none.
- */
- public ElementValuePair[] elementValues() {
- List<Pair<MethodSymbol,Attribute>> vals = annotation.values;
- ElementValuePair res[] = new ElementValuePair[vals.length()];
- int i = 0;
- for (Pair<MethodSymbol,Attribute> val : vals) {
- res[i++] = new ElementValuePairImpl(env, val.fst, val.snd);
- }
- return res;
- }
-
- /**
- * Check for the synthesized bit on the annotation.
- *
- * @return true if the annotation is synthesized.
- */
- public boolean isSynthesized() {
- return annotation.isSynthesized();
- }
-
- /**
- * Returns a string representation of this annotation.
- * String is of one of the forms:
- * <pre>
- * {@code @com.example.foo(name1=val1, name2=val2)}
- * {@code @com.example.foo(val)}
- * {@code @com.example.foo}
- * </pre>
- * Omit parens for marker annotations, and omit "value=" when allowed.
- */
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder("@");
- sb.append(annotation.type.tsym);
-
- ElementValuePair vals[] = elementValues();
- if (vals.length > 0) { // omit parens for marker annotation
- sb.append('(');
- boolean first = true;
- for (ElementValuePair val : vals) {
- if (!first) {
- sb.append(", ");
- }
- first = false;
-
- String name = val.element().name();
- if (vals.length == 1 && name.equals("value")) {
- sb.append(val.value());
- } else {
- sb.append(val);
- }
- }
- sb.append(')');
- }
- return sb.toString();
- }
-
-
- /**
- * Represents an association between an annotation type element
- * and one of its values.
- */
- public static class ElementValuePairImpl implements ElementValuePair {
-
- private final DocEnv env;
- private final MethodSymbol meth;
- private final Attribute value;
-
- ElementValuePairImpl(DocEnv env, MethodSymbol meth, Attribute value) {
- this.env = env;
- this.meth = meth;
- this.value = value;
- }
-
- /**
- * Returns the annotation type element.
- */
- public AnnotationTypeElementDoc element() {
- return env.getAnnotationTypeElementDoc(meth);
- }
-
- /**
- * Returns the value associated with the annotation type element.
- */
- public AnnotationValue value() {
- return new AnnotationValueImpl(env, value);
- }
-
- /**
- * Returns a string representation of this pair
- * of the form "name=value".
- */
- @Override
- public String toString() {
- return meth.name + "=" + value();
- }
- }
-}
--- a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/AnnotationTypeDocImpl.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,108 +0,0 @@
-/*
- * Copyright (c) 2003, 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.
- */
-
-package com.sun.tools.javadoc.main;
-
-import com.sun.javadoc.*;
-
-import com.sun.source.util.TreePath;
-import com.sun.tools.javac.code.Symbol;
-import com.sun.tools.javac.code.Symbol.*;
-import com.sun.tools.javac.util.List;
-
-import static com.sun.tools.javac.code.Scope.LookupKind.NON_RECURSIVE;
-
-import static com.sun.tools.javac.code.Kinds.Kind.*;
-
-/**
- * Represents an annotation type.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- *
- * @author Scott Seligman
- * @since 1.5
- */
-
-@Deprecated(since="9", forRemoval=true)
-@SuppressWarnings("removal")
-public class AnnotationTypeDocImpl
- extends ClassDocImpl implements AnnotationTypeDoc {
-
- public AnnotationTypeDocImpl(DocEnv env, ClassSymbol sym) {
- this(env, sym, null);
- }
-
- public AnnotationTypeDocImpl(DocEnv env, ClassSymbol sym, TreePath treePath) {
- super(env, sym, treePath);
- }
-
- /**
- * Returns true, as this is an annotation type.
- * (For legacy doclets, return false.)
- */
- public boolean isAnnotationType() {
- return !isInterface();
- }
-
- /**
- * Returns false. Though technically an interface, an annotation
- * type is not considered an interface for this purpose.
- * (For legacy doclets, returns true.)
- */
- public boolean isInterface() {
- return env.legacyDoclet;
- }
-
- /**
- * Returns an empty array, as all methods are annotation type elements.
- * (For legacy doclets, returns the elements.)
- * @see #elements()
- */
- public MethodDoc[] methods(boolean filter) {
- return env.legacyDoclet
- ? (MethodDoc[])elements()
- : new MethodDoc[0];
- }
-
- /**
- * Returns the elements of this annotation type.
- * Returns an empty array if there are none.
- * Elements are always public, so no need to filter them.
- */
- public AnnotationTypeElementDoc[] elements() {
- List<AnnotationTypeElementDoc> elements = List.nil();
- for (Symbol sym : tsym.members().getSymbols(NON_RECURSIVE)) {
- if (sym != null && sym.kind == MTH) {
- MethodSymbol s = (MethodSymbol)sym;
- elements = elements.prepend(env.getAnnotationTypeElementDoc(s));
- }
- }
- return
- elements.toArray(new AnnotationTypeElementDoc[elements.length()]);
- }
-}
--- a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/AnnotationTypeElementDocImpl.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,92 +0,0 @@
-/*
- * Copyright (c) 2003, 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.
- */
-
-package com.sun.tools.javadoc.main;
-
-import com.sun.javadoc.*;
-
-import com.sun.source.util.TreePath;
-import com.sun.tools.javac.code.Symbol.*;
-
-/**
- * Represents an element of an annotation type.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- *
- * @author Scott Seligman
- * @since 1.5
- */
-
-@Deprecated(since="9", forRemoval=true)
-@SuppressWarnings("removal")
-public class AnnotationTypeElementDocImpl
- extends MethodDocImpl implements AnnotationTypeElementDoc {
-
- public AnnotationTypeElementDocImpl(DocEnv env, MethodSymbol sym) {
- super(env, sym);
- }
-
- public AnnotationTypeElementDocImpl(DocEnv env, MethodSymbol sym, TreePath treePath) {
- super(env, sym, treePath);
- }
-
- /**
- * Returns true, as this is an annotation type element.
- * (For legacy doclets, return false.)
- */
- public boolean isAnnotationTypeElement() {
- return !isMethod();
- }
-
- /**
- * Returns false. Although this is technically a method, we don't
- * consider it one for this purpose.
- * (For legacy doclets, return true.)
- */
- public boolean isMethod() {
- return env.legacyDoclet;
- }
-
- /**
- * Returns false, even though this is indeed abstract. See
- * MethodDocImpl.isAbstract() for the (il)logic behind this.
- */
- public boolean isAbstract() {
- return false;
- }
-
- /**
- * Returns the default value of this element.
- * Returns null if this element has no default.
- */
- public AnnotationValue defaultValue() {
- return (sym.defaultValue == null)
- ? null
- : new AnnotationValueImpl(env, sym.defaultValue);
- }
-}
--- a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/AnnotationValueImpl.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,178 +0,0 @@
-/*
- * Copyright (c) 2003, 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.
- */
-
-package com.sun.tools.javadoc.main;
-
-import com.sun.javadoc.*;
-
-import com.sun.tools.javac.code.Attribute;
-
-import static com.sun.tools.javac.code.TypeTag.BOOLEAN;
-
-/**
- * Represents a value of an annotation type element.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- *
- * @author Scott Seligman
- * @since 1.5
- */
-
-@Deprecated(since="9", forRemoval=true)
-@SuppressWarnings("removal")
-public class AnnotationValueImpl implements AnnotationValue {
-
- private final DocEnv env;
- private final Attribute attr;
-
-
- AnnotationValueImpl(DocEnv env, Attribute attr) {
- this.env = env;
- this.attr = attr;
- }
-
- /**
- * Returns the value.
- * The type of the returned object is one of the following:
- * <ul><li> a wrapper class for a primitive type
- * <li> <code>String</code>
- * <li> <code>Type</code> (representing a class literal)
- * <li> <code>FieldDoc</code> (representing an enum constant)
- * <li> <code>AnnotationDesc</code>
- * <li> <code>AnnotationValue[]</code>
- * </ul>
- */
- public Object value() {
- ValueVisitor vv = new ValueVisitor();
- attr.accept(vv);
- return vv.value;
- }
-
- private class ValueVisitor implements Attribute.Visitor {
- public Object value;
-
- public void visitConstant(Attribute.Constant c) {
- if (c.type.hasTag(BOOLEAN)) {
- // javac represents false and true as integers 0 and 1
- value = Boolean.valueOf(
- ((Integer)c.value).intValue() != 0);
- } else {
- value = c.value;
- }
- }
-
- public void visitClass(Attribute.Class c) {
- value = TypeMaker.getType(env,
- env.types.erasure(c.classType));
- }
-
- public void visitEnum(Attribute.Enum e) {
- value = env.getFieldDoc(e.value);
- }
-
- public void visitCompound(Attribute.Compound c) {
- value = new AnnotationDescImpl(env, c);
- }
-
- public void visitArray(Attribute.Array a) {
- AnnotationValue vals[] = new AnnotationValue[a.values.length];
- for (int i = 0; i < vals.length; i++) {
- vals[i] = new AnnotationValueImpl(env, a.values[i]);
- }
- value = vals;
- }
-
- public void visitError(Attribute.Error e) {
- value = "<error>";
- }
- }
-
- /**
- * Returns a string representation of the value.
- *
- * @return the text of a Java language annotation value expression
- * whose value is the value of this annotation type element.
- */
- @Override
- public String toString() {
- ToStringVisitor tv = new ToStringVisitor();
- attr.accept(tv);
- return tv.toString();
- }
-
- private class ToStringVisitor implements Attribute.Visitor {
- private final StringBuilder sb = new StringBuilder();
-
- @Override
- public String toString() {
- return sb.toString();
- }
-
- public void visitConstant(Attribute.Constant c) {
- if (c.type.hasTag(BOOLEAN)) {
- // javac represents false and true as integers 0 and 1
- sb.append(((Integer)c.value).intValue() != 0);
- } else {
- sb.append(FieldDocImpl.constantValueExpression(c.value));
- }
- }
-
- public void visitClass(Attribute.Class c) {
- sb.append(c);
- }
-
- public void visitEnum(Attribute.Enum e) {
- sb.append(e);
- }
-
- public void visitCompound(Attribute.Compound c) {
- sb.append(new AnnotationDescImpl(env, c));
- }
-
- public void visitArray(Attribute.Array a) {
- // Omit braces from singleton.
- if (a.values.length != 1) sb.append('{');
-
- boolean first = true;
- for (Attribute elem : a.values) {
- if (first) {
- first = false;
- } else {
- sb.append(", ");
- }
- elem.accept(this);
- }
- // Omit braces from singleton.
- if (a.values.length != 1) sb.append('}');
- }
-
- public void visitError(Attribute.Error e) {
- sb.append("<error>");
- }
- }
-}
--- a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ClassDocImpl.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1331 +0,0 @@
-/*
- * Copyright (c) 1997, 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.
- */
-
-package com.sun.tools.javadoc.main;
-
-import java.io.File;
-import java.io.IOException;
-import java.lang.reflect.Modifier;
-import java.net.URI;
-import java.util.HashSet;
-import java.util.Set;
-
-import javax.tools.FileObject;
-import javax.tools.JavaFileManager.Location;
-import javax.tools.StandardJavaFileManager;
-import javax.tools.StandardLocation;
-
-import com.sun.javadoc.*;
-import com.sun.source.util.TreePath;
-import com.sun.tools.javac.code.Flags;
-import com.sun.tools.javac.code.Kinds;
-import com.sun.tools.javac.code.Kinds.KindSelector;
-import com.sun.tools.javac.code.Scope;
-import com.sun.tools.javac.code.Symbol;
-import com.sun.tools.javac.code.Symbol.*;
-import com.sun.tools.javac.code.Type;
-import com.sun.tools.javac.code.Type.ClassType;
-import com.sun.tools.javac.code.TypeTag;
-import com.sun.tools.javac.comp.AttrContext;
-import com.sun.tools.javac.comp.Env;
-import com.sun.tools.javac.tree.JCTree;
-import com.sun.tools.javac.tree.JCTree.JCFieldAccess;
-import com.sun.tools.javac.tree.JCTree.JCImport;
-import com.sun.tools.javac.tree.TreeInfo;
-import com.sun.tools.javac.util.List;
-import com.sun.tools.javac.util.ListBuffer;
-import com.sun.tools.javac.util.Name;
-import com.sun.tools.javac.util.Names;
-import com.sun.tools.javac.util.Position;
-import static com.sun.tools.javac.code.Kinds.Kind.*;
-import static com.sun.tools.javac.code.Scope.LookupKind.NON_RECURSIVE;
-import static com.sun.tools.javac.code.TypeTag.CLASS;
-import static com.sun.tools.javac.tree.JCTree.Tag.*;
-
-/**
- * Represents a java class and provides access to information
- * about the class, the class' comment and tags, and the
- * members of the class. A ClassDocImpl only exists if it was
- * processed in this run of javadoc. References to classes
- * which may or may not have been processed in this run are
- * referred to using Type (which can be converted to ClassDocImpl,
- * if possible).
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- *
- * @see Type
- *
- * @since 1.2
- * @author Robert Field
- * @author Neal Gafter (rewrite)
- * @author Scott Seligman (generics, enums, annotations)
- */
-
-@Deprecated(since="9", forRemoval=true)
-@SuppressWarnings("removal")
-public class ClassDocImpl extends ProgramElementDocImpl implements ClassDoc {
-
- public final ClassType type; // protected->public for debugging
- public final ClassSymbol tsym;
-
- boolean isIncluded = false; // Set in RootDocImpl
-
- private SerializedForm serializedForm;
-
- /**
- * Constructor
- */
- public ClassDocImpl(DocEnv env, ClassSymbol sym) {
- this(env, sym, null);
- }
-
- /**
- * Constructor
- */
- public ClassDocImpl(DocEnv env, ClassSymbol sym, TreePath treePath) {
- super(env, sym, treePath);
- this.type = (ClassType)sym.type;
- this.tsym = sym;
- }
-
- public com.sun.javadoc.Type getElementType() {
- return null;
- }
-
- /**
- * Returns the flags in terms of javac's flags
- */
- protected long getFlags() {
- return getFlags(tsym);
- }
-
- /**
- * Returns the flags of a ClassSymbol in terms of javac's flags
- */
- static long getFlags(ClassSymbol clazz) {
- try {
- return clazz.flags();
- } catch (CompletionFailure ex) {
- /* Quietly ignore completion failures and try again - the type
- * for which the CompletionFailure was thrown shouldn't be completed
- * again by the completer that threw the CompletionFailure.
- */
- return getFlags(clazz);
- }
- }
-
- /**
- * Is a ClassSymbol an annotation type?
- */
- static boolean isAnnotationType(ClassSymbol clazz) {
- return (getFlags(clazz) & Flags.ANNOTATION) != 0;
- }
-
- /**
- * Identify the containing class
- */
- protected ClassSymbol getContainingClass() {
- return tsym.owner.enclClass();
- }
-
- /**
- * Return true if this is a class, not an interface.
- */
- @Override
- public boolean isClass() {
- return !Modifier.isInterface(getModifiers());
- }
-
- /**
- * Return true if this is a ordinary class,
- * not an enumeration, exception, an error, or an interface.
- */
- @Override
- public boolean isOrdinaryClass() {
- if (isEnum() || isInterface() || isAnnotationType()) {
- return false;
- }
- for (Type t = type; t.hasTag(CLASS); t = env.types.supertype(t)) {
- if (t.tsym == env.syms.errorType.tsym ||
- t.tsym == env.syms.exceptionType.tsym) {
- return false;
- }
- }
- return true;
- }
-
- /**
- * Return true if this is an enumeration.
- * (For legacy doclets, return false.)
- */
- @Override
- public boolean isEnum() {
- return (getFlags() & Flags.ENUM) != 0
- &&
- !env.legacyDoclet;
- }
-
- /**
- * Return true if this is an interface, but not an annotation type.
- * Overridden by AnnotationTypeDocImpl.
- */
- @Override
- public boolean isInterface() {
- return Modifier.isInterface(getModifiers());
- }
-
- /**
- * Return true if this is an exception class
- */
- @Override
- public boolean isException() {
- if (isEnum() || isInterface() || isAnnotationType()) {
- return false;
- }
- for (Type t = type; t.hasTag(CLASS); t = env.types.supertype(t)) {
- if (t.tsym == env.syms.exceptionType.tsym) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * Return true if this is an error class
- */
- @Override
- public boolean isError() {
- if (isEnum() || isInterface() || isAnnotationType()) {
- return false;
- }
- for (Type t = type; t.hasTag(CLASS); t = env.types.supertype(t)) {
- if (t.tsym == env.syms.errorType.tsym) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * Return true if this is a throwable class
- */
- public boolean isThrowable() {
- if (isEnum() || isInterface() || isAnnotationType()) {
- return false;
- }
- for (Type t = type; t.hasTag(CLASS); t = env.types.supertype(t)) {
- if (t.tsym == env.syms.throwableType.tsym) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * Return true if this class is abstract
- */
- public boolean isAbstract() {
- return Modifier.isAbstract(getModifiers());
- }
-
- /**
- * Returns true if this class was synthesized by the compiler.
- */
- public boolean isSynthetic() {
- return (getFlags() & Flags.SYNTHETIC) != 0;
- }
-
- /**
- * Return true if this class is included in the active set.
- * A ClassDoc is included iff either it is specified on the
- * commandline, or if it's containing package is specified
- * on the command line, or if it is a member class of an
- * included class.
- */
-
- public boolean isIncluded() {
- if (isIncluded) {
- return true;
- }
- if (env.shouldDocument(tsym)) {
- // Class is nameable from top-level and
- // the class and all enclosing classes
- // pass the modifier filter.
- if (containingPackage().isIncluded()) {
- return isIncluded=true;
- }
- ClassDoc outer = containingClass();
- if (outer != null && outer.isIncluded()) {
- return isIncluded=true;
- }
- }
- return false;
- }
-
- /**
- * Return the package that this class is contained in.
- */
- @Override
- public PackageDoc containingPackage() {
- PackageDocImpl p = env.getPackageDoc(tsym.packge());
- if (p.setDocPath == false) {
- FileObject docPath;
- try {
- Location location = env.fileManager.hasLocation(StandardLocation.SOURCE_PATH)
- ? StandardLocation.SOURCE_PATH : StandardLocation.CLASS_PATH;
-
- docPath = env.fileManager.getFileForInput(
- location, p.qualifiedName(), "package.html");
- } catch (IOException e) {
- docPath = null;
- }
-
- if (docPath == null) {
- // fall back on older semantics of looking in same directory as
- // source file for this class
- SourcePosition po = position();
- if (env.fileManager instanceof StandardJavaFileManager &&
- po instanceof SourcePositionImpl) {
- URI uri = ((SourcePositionImpl) po).filename.toUri();
- if ("file".equals(uri.getScheme())) {
- File f = new File(uri);
- File dir = f.getParentFile();
- if (dir != null) {
- File pf = new File(dir, "package.html");
- if (pf.exists()) {
- StandardJavaFileManager sfm = (StandardJavaFileManager) env.fileManager;
- docPath = sfm.getJavaFileObjects(pf).iterator().next();
- }
- }
-
- }
- }
- }
-
- p.setDocPath(docPath);
- }
- return p;
- }
-
- /**
- * Return the class name without package qualifier - but with
- * enclosing class qualifier - as a String.
- * <pre>
- * Examples:
- * for java.util.Hashtable
- * return Hashtable
- * for java.util.Map.Entry
- * return Map.Entry
- * </pre>
- */
- public String name() {
- if (name == null) {
- name = getClassName(tsym, false);
- }
- return name;
- }
-
- private String name;
-
- /**
- * Return the qualified class name as a String.
- * <pre>
- * Example:
- * for java.util.Hashtable
- * return java.util.Hashtable
- * if no qualifier, just return flat name
- * </pre>
- */
- public String qualifiedName() {
- if (qualifiedName == null) {
- qualifiedName = getClassName(tsym, true);
- }
- return qualifiedName;
- }
-
- private String qualifiedName;
-
- /**
- * Return unqualified name of type excluding any dimension information.
- * <p>
- * For example, a two dimensional array of String returns 'String'.
- */
- public String typeName() {
- return name();
- }
-
- /**
- * Return qualified name of type excluding any dimension information.
- *<p>
- * For example, a two dimensional array of String
- * returns 'java.lang.String'.
- */
- public String qualifiedTypeName() {
- return qualifiedName();
- }
-
- /**
- * Return the simple name of this type.
- */
- public String simpleTypeName() {
- if (simpleTypeName == null) {
- simpleTypeName = tsym.name.toString();
- }
- return simpleTypeName;
- }
-
- private String simpleTypeName;
-
- /**
- * Return the qualified name and any type parameters.
- * Each parameter is a type variable with optional bounds.
- */
- @Override
- public String toString() {
- return classToString(env, tsym, true);
- }
-
- /**
- * Return the class name as a string. If "full" is true the name is
- * qualified, otherwise it is qualified by its enclosing class(es) only.
- */
- static String getClassName(ClassSymbol c, boolean full) {
- if (full) {
- return c.getQualifiedName().toString();
- } else {
- String n = "";
- for ( ; c != null; c = c.owner.enclClass()) {
- n = c.name + (n.isEmpty() ? "" : ".") + n;
- }
- return n;
- }
- }
-
- /**
- * Return the class name with any type parameters as a string.
- * Each parameter is a type variable with optional bounds.
- * If "full" is true all names are qualified, otherwise they are
- * qualified by their enclosing class(es) only.
- */
- static String classToString(DocEnv env, ClassSymbol c, boolean full) {
- StringBuilder s = new StringBuilder();
- if (!c.isInner()) { // if c is not an inner class
- s.append(getClassName(c, full));
- } else {
- // c is an inner class, so include type params of outer.
- ClassSymbol encl = c.owner.enclClass();
- s.append(classToString(env, encl, full))
- .append('.')
- .append(c.name);
- }
- s.append(TypeMaker.typeParametersString(env, c, full));
- return s.toString();
- }
-
- /**
- * Is this class (or any enclosing class) generic? That is, does
- * it have type parameters?
- */
- static boolean isGeneric(ClassSymbol c) {
- return c.type.allparams().nonEmpty();
- }
-
- /**
- * Return the formal type parameters of this class or interface.
- * Return an empty array if there are none.
- */
- public TypeVariable[] typeParameters() {
- if (env.legacyDoclet) {
- return new TypeVariable[0];
- }
- TypeVariable res[] = new TypeVariable[type.getTypeArguments().length()];
- TypeMaker.getTypes(env, type.getTypeArguments(), res);
- return res;
- }
-
- /**
- * Return the type parameter tags of this class or interface.
- */
- public ParamTag[] typeParamTags() {
- return (env.legacyDoclet)
- ? new ParamTag[0]
- : comment().typeParamTags();
- }
-
- /**
- * Return the modifier string for this class. If it's an interface
- * exclude 'abstract' keyword from the modifier string
- */
- @Override
- public String modifiers() {
- return Modifier.toString(modifierSpecifier());
- }
-
- @Override
- public int modifierSpecifier() {
- int modifiers = getModifiers();
- return (isInterface() || isAnnotationType())
- ? modifiers & ~Modifier.ABSTRACT
- : modifiers;
- }
-
- /**
- * Return the superclass of this class
- *
- * @return the ClassDocImpl for the superclass of this class, null
- * if there is no superclass.
- */
- public ClassDoc superclass() {
- if (isInterface() || isAnnotationType()) return null;
- if (tsym == env.syms.objectType.tsym) return null;
- ClassSymbol c = (ClassSymbol)env.types.supertype(type).tsym;
- if (c == null || c == tsym) c = (ClassSymbol)env.syms.objectType.tsym;
- return env.getClassDoc(c);
- }
-
- /**
- * Return the superclass of this class. Return null if this is an
- * interface. A superclass is represented by either a
- * <code>ClassDoc</code> or a <code>ParameterizedType</code>.
- */
- public com.sun.javadoc.Type superclassType() {
- if (isInterface() || isAnnotationType() ||
- (tsym == env.syms.objectType.tsym))
- return null;
- Type sup = env.types.supertype(type);
- return TypeMaker.getType(env,
- (sup.hasTag(TypeTag.NONE)) ? env.syms.objectType : sup);
- }
-
- /**
- * Test whether this class is a subclass of the specified class.
- *
- * @param cd the candidate superclass.
- * @return true if cd is a superclass of this class.
- */
- public boolean subclassOf(ClassDoc cd) {
- return tsym.isSubClass(((ClassDocImpl)cd).tsym, env.types);
- }
-
- /**
- * Return interfaces implemented by this class or interfaces
- * extended by this interface.
- *
- * @return An array of ClassDocImpl representing the interfaces.
- * Return an empty array if there are no interfaces.
- */
- public ClassDoc[] interfaces() {
- ListBuffer<ClassDocImpl> ta = new ListBuffer<>();
- for (Type t : env.types.interfaces(type)) {
- ta.append(env.getClassDoc((ClassSymbol)t.tsym));
- }
- //### Cache ta here?
- return ta.toArray(new ClassDocImpl[ta.length()]);
- }
-
- /**
- * Return interfaces implemented by this class or interfaces extended
- * by this interface. Includes only directly-declared interfaces, not
- * inherited interfaces.
- * Return an empty array if there are no interfaces.
- */
- public com.sun.javadoc.Type[] interfaceTypes() {
- //### Cache result here?
- return TypeMaker.getTypes(env, env.types.interfaces(type));
- }
-
- /**
- * Return fields in class.
- * @param filter include only the included fields if filter==true
- */
- public FieldDoc[] fields(boolean filter) {
- return fields(filter, false);
- }
-
- /**
- * Return included fields in class.
- */
- public FieldDoc[] fields() {
- return fields(true, false);
- }
-
- /**
- * Return the enum constants if this is an enum type.
- */
- public FieldDoc[] enumConstants() {
- return fields(false, true);
- }
-
- /**
- * Return fields in class.
- * @param filter if true, return only the included fields
- * @param enumConstants if true, return the enum constants instead
- */
- private FieldDoc[] fields(boolean filter, boolean enumConstants) {
- List<FieldDocImpl> fields = List.nil();
- for (Symbol sym : tsym.members().getSymbols(NON_RECURSIVE)) {
- if (sym != null && sym.kind == VAR) {
- VarSymbol s = (VarSymbol)sym;
- boolean isEnum = ((s.flags() & Flags.ENUM) != 0) &&
- !env.legacyDoclet;
- if (isEnum == enumConstants &&
- (!filter || env.shouldDocument(s))) {
- fields = fields.prepend(env.getFieldDoc(s));
- }
- }
- }
- return fields.toArray(new FieldDocImpl[fields.length()]);
- }
-
- /**
- * Return methods in class.
- * This method is overridden by AnnotationTypeDocImpl.
- *
- * @param filter include only the included methods if filter==true
- * @return an array of MethodDocImpl for representing the visible
- * methods in this class. Does not include constructors.
- */
- public MethodDoc[] methods(boolean filter) {
- Names names = tsym.name.table.names;
- List<MethodDocImpl> methods = List.nil();
- for (Symbol sym :tsym.members().getSymbols(NON_RECURSIVE)) {
- if (sym != null
- && sym.kind == MTH
- && sym.name != names.init
- && sym.name != names.clinit) {
- MethodSymbol s = (MethodSymbol)sym;
- if (!filter || env.shouldDocument(s)) {
- methods = methods.prepend(env.getMethodDoc(s));
- }
- }
- }
- //### Cache methods here?
- return methods.toArray(new MethodDocImpl[methods.length()]);
- }
-
- /**
- * Return included methods in class.
- *
- * @return an array of MethodDocImpl for representing the visible
- * methods in this class. Does not include constructors.
- */
- public MethodDoc[] methods() {
- return methods(true);
- }
-
- /**
- * Return constructors in class.
- *
- * @param filter include only the included constructors if filter==true
- * @return an array of ConstructorDocImpl for representing the visible
- * constructors in this class.
- */
- public ConstructorDoc[] constructors(boolean filter) {
- Names names = tsym.name.table.names;
- List<ConstructorDocImpl> constructors = List.nil();
- for (Symbol sym : tsym.members().getSymbols(NON_RECURSIVE)) {
- if (sym != null &&
- sym.kind == MTH && sym.name == names.init) {
- MethodSymbol s = (MethodSymbol)sym;
- if (!filter || env.shouldDocument(s)) {
- constructors = constructors.prepend(env.getConstructorDoc(s));
- }
- }
- }
- //### Cache constructors here?
- return constructors.toArray(new ConstructorDocImpl[constructors.length()]);
- }
-
- /**
- * Return included constructors in class.
- *
- * @return an array of ConstructorDocImpl for representing the visible
- * constructors in this class.
- */
- public ConstructorDoc[] constructors() {
- return constructors(true);
- }
-
- /**
- * Adds all inner classes of this class, and their
- * inner classes recursively, to the list l.
- */
- void addAllClasses(ListBuffer<ClassDocImpl> l, boolean filtered) {
- try {
- if (isSynthetic()) return;
- // sometimes synthetic classes are not marked synthetic
- if (!JavadocTool.isValidClassName(tsym.name.toString())) return;
- if (filtered && !env.shouldDocument(tsym)) return;
- if (l.contains(this)) return;
- l.append(this);
- List<ClassDocImpl> more = List.nil();
- for (Symbol sym : tsym.members().getSymbols(NON_RECURSIVE)) {
- if (sym != null && sym.kind == TYP) {
- ClassSymbol s = (ClassSymbol)sym;
- ClassDocImpl c = env.getClassDoc(s);
- if (c.isSynthetic()) continue;
- if (c != null) more = more.prepend(c);
- }
- }
- // this extra step preserves the ordering from oldjavadoc
- for (; more.nonEmpty(); more=more.tail) {
- more.head.addAllClasses(l, filtered);
- }
- } catch (CompletionFailure e) {
- // quietly ignore completion failures
- }
- }
-
- /**
- * Return inner classes within this class.
- *
- * @param filter include only the included inner classes if filter==true.
- * @return an array of ClassDocImpl for representing the visible
- * classes defined in this class. Anonymous and local classes
- * are not included.
- */
- public ClassDoc[] innerClasses(boolean filter) {
- ListBuffer<ClassDocImpl> innerClasses = new ListBuffer<>();
- for (Symbol sym : tsym.members().getSymbols(NON_RECURSIVE)) {
- if (sym != null && sym.kind == TYP) {
- ClassSymbol s = (ClassSymbol)sym;
- if ((s.flags_field & Flags.SYNTHETIC) != 0) continue;
- if (!filter || env.isVisible(s)) {
- innerClasses.prepend(env.getClassDoc(s));
- }
- }
- }
- //### Cache classes here?
- return innerClasses.toArray(new ClassDocImpl[innerClasses.length()]);
- }
-
- /**
- * Return included inner classes within this class.
- *
- * @return an array of ClassDocImpl for representing the visible
- * classes defined in this class. Anonymous and local classes
- * are not included.
- */
- public ClassDoc[] innerClasses() {
- return innerClasses(true);
- }
-
- /**
- * Find a class within the context of this class.
- * Search order: qualified name, in this class (inner),
- * in this package, in the class imports, in the package
- * imports.
- * Return the ClassDocImpl if found, null if not found.
- */
- //### The specified search order is not the normal rule the
- //### compiler would use. Leave as specified or change it?
- public ClassDoc findClass(String className) {
- ClassDoc searchResult = searchClass(className);
- if (searchResult == null) {
- ClassDocImpl enclosingClass = (ClassDocImpl)containingClass();
- //Expand search space to include enclosing class.
- while (enclosingClass != null && enclosingClass.containingClass() != null) {
- enclosingClass = (ClassDocImpl)enclosingClass.containingClass();
- }
- searchResult = enclosingClass == null ?
- null : enclosingClass.searchClass(className);
- }
- return searchResult;
- }
-
- private ClassDoc searchClass(String className) {
- Names names = tsym.name.table.names;
-
- // search by qualified name first
- ClassDoc cd = env.lookupClass(className);
- if (cd != null) {
- return cd;
- }
-
- // search inner classes
- //### Add private entry point to avoid creating array?
- //### Replicate code in innerClasses here to avoid consing?
- for (ClassDoc icd : innerClasses()) {
- if (icd.name().equals(className) ||
- //### This is from original javadoc but it looks suspicious to me...
- //### I believe it is attempting to compensate for the confused
- //### convention of including the nested class qualifiers in the
- //### 'name' of the inner class, rather than the true simple name.
- icd.name().endsWith("." + className)) {
- return icd;
- } else {
- ClassDoc innercd = ((ClassDocImpl) icd).searchClass(className);
- if (innercd != null) {
- return innercd;
- }
- }
- }
-
- // check in this package
- cd = containingPackage().findClass(className);
- if (cd != null) {
- return cd;
- }
-
- // make sure that this symbol has been completed
- tsym.complete();
-
- // search imports
-
- if (tsym.sourcefile != null) {
-
- //### This information is available only for source classes.
-
- Env<AttrContext> compenv = env.enter.getEnv(tsym);
- if (compenv == null) return null;
-
- Scope s = compenv.toplevel.namedImportScope;
- for (Symbol sym : s.getSymbolsByName(names.fromString(className))) {
- if (sym.kind == TYP) {
- ClassDoc c = env.getClassDoc((ClassSymbol)sym);
- return c;
- }
- }
-
- s = compenv.toplevel.starImportScope;
- for (Symbol sym : s.getSymbolsByName(names.fromString(className))) {
- if (sym.kind == TYP) {
- ClassDoc c = env.getClassDoc((ClassSymbol)sym);
- return c;
- }
- }
- }
-
- return null; // not found
- }
-
-
- private boolean hasParameterTypes(MethodSymbol method, String[] argTypes) {
-
- if (argTypes == null) {
- // wildcard
- return true;
- }
-
- int i = 0;
- List<Type> types = method.type.getParameterTypes();
-
- if (argTypes.length != types.length()) {
- return false;
- }
-
- for (Type t : types) {
- String argType = argTypes[i++];
- // For vararg method, "T..." matches type T[].
- if (i == argTypes.length) {
- argType = argType.replace("...", "[]");
- }
- if (!hasTypeName(env.types.erasure(t), argType)) { //###(gj)
- return false;
- }
- }
- return true;
- }
- // where
- private boolean hasTypeName(Type t, String name) {
- return
- name.equals(TypeMaker.getTypeName(t, true))
- ||
- name.equals(TypeMaker.getTypeName(t, false))
- ||
- (qualifiedName() + "." + name).equals(TypeMaker.getTypeName(t, true));
- }
-
-
-
- /**
- * Find a method in this class scope.
- * Search order: this class, interfaces, superclasses, outerclasses.
- * Note that this is not necessarily what the compiler would do!
- *
- * @param methodName the unqualified name to search for.
- * @param paramTypes the array of Strings for method parameter types.
- * @return the first MethodDocImpl which matches, null if not found.
- */
- public MethodDocImpl findMethod(String methodName, String[] paramTypes) {
- // Use hash table 'searched' to avoid searching same class twice.
- //### It is not clear how this could happen.
- return searchMethod(methodName, paramTypes, new HashSet<ClassDocImpl>());
- }
-
- private MethodDocImpl searchMethod(String methodName,
- String[] paramTypes, Set<ClassDocImpl> searched) {
- //### Note that this search is not necessarily what the compiler would do!
-
- Names names = tsym.name.table.names;
- // do not match constructors
- if (names.init.contentEquals(methodName)) {
- return null;
- }
-
- ClassDocImpl cdi;
- MethodDocImpl mdi;
-
- if (searched.contains(this)) {
- return null;
- }
- searched.add(this);
-
- //DEBUG
- /*---------------------------------*
- System.out.print("searching " + this + " for " + methodName);
- if (paramTypes == null) {
- System.out.println("()");
- } else {
- System.out.print("(");
- for (int k=0; k < paramTypes.length; k++) {
- System.out.print(paramTypes[k]);
- if ((k + 1) < paramTypes.length) {
- System.out.print(", ");
- }
- }
- System.out.println(")");
- }
- *---------------------------------*/
-
- // search current class
-
- //### Using modifier filter here isn't really correct,
- //### but emulates the old behavior. Instead, we should
- //### apply the normal rules of visibility and inheritance.
-
- if (paramTypes == null) {
- // If no parameters specified, we are allowed to return
- // any method with a matching name. In practice, the old
- // code returned the first method, which is now the last!
- // In order to provide textually identical results, we
- // attempt to emulate the old behavior.
- MethodSymbol lastFound = null;
- for (Symbol sym : tsym.members().getSymbolsByName(names.fromString(methodName))) {
- if (sym.kind == MTH) {
- //### Should intern methodName as Name.
- if (sym.name.toString().equals(methodName)) {
- lastFound = (MethodSymbol)sym;
- }
- }
- }
- if (lastFound != null) {
- return env.getMethodDoc(lastFound);
- }
- } else {
- for (Symbol sym : tsym.members().getSymbolsByName(names.fromString(methodName))) {
- if (sym != null &&
- sym.kind == MTH) {
- //### Should intern methodName as Name.
- if (hasParameterTypes((MethodSymbol)sym, paramTypes)) {
- return env.getMethodDoc((MethodSymbol)sym);
- }
- }
- }
- }
-
- //### If we found a MethodDoc above, but which did not pass
- //### the modifier filter, we should return failure here!
-
- // search superclass
- cdi = (ClassDocImpl)superclass();
- if (cdi != null) {
- mdi = cdi.searchMethod(methodName, paramTypes, searched);
- if (mdi != null) {
- return mdi;
- }
- }
-
- // search interfaces
- for (ClassDoc intf : interfaces()) {
- cdi = (ClassDocImpl) intf;
- mdi = cdi.searchMethod(methodName, paramTypes, searched);
- if (mdi != null) {
- return mdi;
- }
- }
-
- // search enclosing class
- cdi = (ClassDocImpl)containingClass();
- if (cdi != null) {
- mdi = cdi.searchMethod(methodName, paramTypes, searched);
- if (mdi != null) {
- return mdi;
- }
- }
-
- //###(gj) As a temporary measure until type variables are better
- //### handled, try again without the parameter types.
- //### This should most often find the right method, and occassionally
- //### find the wrong one.
- //if (paramTypes != null) {
- // return findMethod(methodName, null);
- //}
-
- return null;
- }
-
- /**
- * Find constructor in this class.
- *
- * @param constrName the unqualified name to search for.
- * @param paramTypes the array of Strings for constructor parameters.
- * @return the first ConstructorDocImpl which matches, null if not found.
- */
- public ConstructorDoc findConstructor(String constrName,
- String[] paramTypes) {
- Names names = tsym.name.table.names;
- for (Symbol sym : tsym.members().getSymbolsByName(names.fromString("<init>"))) {
- if (sym.kind == MTH) {
- if (hasParameterTypes((MethodSymbol)sym, paramTypes)) {
- return env.getConstructorDoc((MethodSymbol)sym);
- }
- }
- }
-
- //###(gj) As a temporary measure until type variables are better
- //### handled, try again without the parameter types.
- //### This will often find the right constructor, and occassionally
- //### find the wrong one.
- //if (paramTypes != null) {
- // return findConstructor(constrName, null);
- //}
-
- return null;
- }
-
- /**
- * Find a field in this class scope.
- * Search order: this class, outerclasses, interfaces,
- * superclasses. IMP: If see tag is defined in an inner class,
- * which extends a super class and if outerclass and the super
- * class have a visible field in common then Java compiler cribs
- * about the ambiguity, but the following code will search in the
- * above given search order.
- *
- * @param fieldName the unqualified name to search for.
- * @return the first FieldDocImpl which matches, null if not found.
- */
- public FieldDoc findField(String fieldName) {
- return searchField(fieldName, new HashSet<ClassDocImpl>());
- }
-
- private FieldDocImpl searchField(String fieldName, Set<ClassDocImpl> searched) {
- Names names = tsym.name.table.names;
- if (searched.contains(this)) {
- return null;
- }
- searched.add(this);
-
- for (Symbol sym : tsym.members().getSymbolsByName(names.fromString(fieldName))) {
- if (sym.kind == VAR) {
- //### Should intern fieldName as Name.
- return env.getFieldDoc((VarSymbol)sym);
- }
- }
-
- //### If we found a FieldDoc above, but which did not pass
- //### the modifier filter, we should return failure here!
-
- ClassDocImpl cdi = (ClassDocImpl)containingClass();
- if (cdi != null) {
- FieldDocImpl fdi = cdi.searchField(fieldName, searched);
- if (fdi != null) {
- return fdi;
- }
- }
-
- // search superclass
- cdi = (ClassDocImpl)superclass();
- if (cdi != null) {
- FieldDocImpl fdi = cdi.searchField(fieldName, searched);
- if (fdi != null) {
- return fdi;
- }
- }
-
- // search interfaces
- for (ClassDoc intf : interfaces()) {
- cdi = (ClassDocImpl) intf;
- FieldDocImpl fdi = cdi.searchField(fieldName, searched);
- if (fdi != null) {
- return fdi;
- }
- }
-
- return null;
- }
-
- /**
- * Get the list of classes declared as imported.
- * These are called "single-type-import declarations" in the JLS.
- * This method is deprecated in the ClassDoc interface.
- *
- * @return an array of ClassDocImpl representing the imported classes.
- *
- * @deprecated Import declarations are implementation details that
- * should not be exposed here. In addition, not all imported
- * classes are imported through single-type-import declarations.
- */
- @Deprecated(since="9", forRemoval=true)
- public ClassDoc[] importedClasses() {
- // information is not available for binary classfiles
- if (tsym.sourcefile == null) return new ClassDoc[0];
-
- ListBuffer<ClassDocImpl> importedClasses = new ListBuffer<>();
-
- Env<AttrContext> compenv = env.enter.getEnv(tsym);
- if (compenv == null) return new ClassDocImpl[0];
-
- Name asterisk = tsym.name.table.names.asterisk;
- for (JCTree t : compenv.toplevel.defs) {
- if (t.hasTag(IMPORT)) {
- JCTree imp = ((JCImport) t).qualid;
- if ((TreeInfo.name(imp) != asterisk) &&
- imp.type.tsym.kind.matches(KindSelector.TYP)) {
- importedClasses.append(
- env.getClassDoc((ClassSymbol)imp.type.tsym));
- }
- }
- }
-
- return importedClasses.toArray(new ClassDocImpl[importedClasses.length()]);
- }
-
- /**
- * Get the list of packages declared as imported.
- * These are called "type-import-on-demand declarations" in the JLS.
- * This method is deprecated in the ClassDoc interface.
- *
- * @return an array of PackageDocImpl representing the imported packages.
- *
- * ###NOTE: the syntax supports importing all inner classes from a class as well.
- * @deprecated Import declarations are implementation details that
- * should not be exposed here. In addition, this method's
- * return type does not allow for all type-import-on-demand
- * declarations to be returned.
- */
- @Deprecated(since="9", forRemoval=true)
- public PackageDoc[] importedPackages() {
- // information is not available for binary classfiles
- if (tsym.sourcefile == null) return new PackageDoc[0];
-
- ListBuffer<PackageDocImpl> importedPackages = new ListBuffer<>();
-
- //### Add the implicit "import java.lang.*" to the result
- Names names = tsym.name.table.names;
- importedPackages.append(env.getPackageDoc(env.syms.enterPackage(env.syms.java_base, names.java_lang)));
-
- Env<AttrContext> compenv = env.enter.getEnv(tsym);
- if (compenv == null) return new PackageDocImpl[0];
-
- for (JCTree t : compenv.toplevel.defs) {
- if (t.hasTag(IMPORT)) {
- JCTree imp = ((JCImport) t).qualid;
- if (TreeInfo.name(imp) == names.asterisk) {
- JCFieldAccess sel = (JCFieldAccess)imp;
- Symbol s = sel.selected.type.tsym;
- PackageDocImpl pdoc = env.getPackageDoc(s.packge());
- if (!importedPackages.contains(pdoc))
- importedPackages.append(pdoc);
- }
- }
- }
-
- return importedPackages.toArray(new PackageDocImpl[importedPackages.length()]);
- }
-
- /**
- * Return the type's dimension information.
- * Always return "", as this is not an array type.
- */
- public String dimension() {
- return "";
- }
-
- /**
- * Return this type as a class, which it already is.
- */
- public ClassDoc asClassDoc() {
- return this;
- }
-
- /**
- * Return null (unless overridden), as this is not an annotation type.
- */
- public AnnotationTypeDoc asAnnotationTypeDoc() {
- return null;
- }
-
- /**
- * Return null, as this is not a class instantiation.
- */
- public ParameterizedType asParameterizedType() {
- return null;
- }
-
- /**
- * Return null, as this is not a type variable.
- */
- public TypeVariable asTypeVariable() {
- return null;
- }
-
- /**
- * Return null, as this is not a wildcard type.
- */
- public WildcardType asWildcardType() {
- return null;
- }
-
- /**
- * Returns null, as this is not an annotated type.
- */
- public AnnotatedType asAnnotatedType() {
- return null;
- }
-
- /**
- * Return false, as this is not a primitive type.
- */
- public boolean isPrimitive() {
- return false;
- }
-
- //--- Serialization ---
-
- //### These methods ignore modifier filter.
-
- /**
- * Return true if this class implements <code>java.io.Serializable</code>.
- *
- * Since <code>java.io.Externalizable</code> extends
- * <code>java.io.Serializable</code>,
- * Externalizable objects are also Serializable.
- */
- public boolean isSerializable() {
- try {
- return env.types.isSubtype(type, env.syms.serializableType);
- } catch (CompletionFailure ex) {
- // quietly ignore completion failures
- return false;
- }
- }
-
- /**
- * Return true if this class implements
- * <code>java.io.Externalizable</code>.
- */
- public boolean isExternalizable() {
- try {
- return env.types.isSubtype(type, env.externalizableSym.type);
- } catch (CompletionFailure ex) {
- // quietly ignore completion failures
- return false;
- }
- }
-
- /**
- * Return the serialization methods for this class.
- *
- * @return an array of <code>MethodDocImpl</code> that represents
- * the serialization methods for this class.
- */
- public MethodDoc[] serializationMethods() {
- if (serializedForm == null) {
- serializedForm = new SerializedForm(env, tsym, this);
- }
- //### Clone this?
- return serializedForm.methods();
- }
-
- /**
- * Return the Serializable fields of class.<p>
- *
- * Return either a list of default fields documented by
- * <code>serial</code> tag<br>
- * or return a single <code>FieldDoc</code> for
- * <code>serialPersistentField</code> member.
- * There should be a <code>serialField</code> tag for
- * each Serializable field defined by an <code>ObjectStreamField</code>
- * array component of <code>serialPersistentField</code>.
- *
- * @return an array of {@code FieldDoc} for the Serializable fields
- * of this class.
- *
- * @see #definesSerializableFields()
- * @see SerialFieldTagImpl
- */
- public FieldDoc[] serializableFields() {
- if (serializedForm == null) {
- serializedForm = new SerializedForm(env, tsym, this);
- }
- //### Clone this?
- return serializedForm.fields();
- }
-
- /**
- * Return true if Serializable fields are explicitly defined with
- * the special class member <code>serialPersistentFields</code>.
- *
- * @see #serializableFields()
- * @see SerialFieldTagImpl
- */
- public boolean definesSerializableFields() {
- if (!isSerializable() || isExternalizable()) {
- return false;
- } else {
- if (serializedForm == null) {
- serializedForm = new SerializedForm(env, tsym, this);
- }
- //### Clone this?
- return serializedForm.definesSerializableFields();
- }
- }
-
- /**
- * Determine if a class is a RuntimeException.
- * <p>
- * Used only by ThrowsTagImpl.
- */
- boolean isRuntimeException() {
- return tsym.isSubClass(env.syms.runtimeExceptionType.tsym, env.types);
- }
-
- /**
- * Return the source position of the entity, or null if
- * no position is available.
- */
- @Override
- public SourcePosition position() {
- if (tsym.sourcefile == null) return null;
- return SourcePositionImpl.make(tsym.sourcefile,
- (tree==null) ? Position.NOPOS : tree.pos,
- lineMap);
- }
-}
--- a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/Comment.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,462 +0,0 @@
-/*
- * Copyright (c) 1997, 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.
- */
-
-package com.sun.tools.javadoc.main;
-
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import com.sun.javadoc.*;
-import com.sun.tools.javac.util.ListBuffer;
-
-/**
- * Comment contains all information in comment part.
- * It allows users to get first sentence of this comment, get
- * comment for different tags...
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- *
- * @author Kaiyang Liu (original)
- * @author Robert Field (rewrite)
- * @author Atul M Dambalkar
- * @author Neal Gafter (rewrite)
- */
-@Deprecated(since="9", forRemoval=true)
-@SuppressWarnings("removal")
-class Comment {
-
- /**
- * sorted comments with different tags.
- */
- private final ListBuffer<Tag> tagList = new ListBuffer<>();
-
- /**
- * text minus any tags.
- */
- private String text;
-
- /**
- * Doc environment
- */
- private final DocEnv docenv;
-
- /**
- * constructor of Comment.
- */
- Comment(final DocImpl holder, final String commentString) {
- this.docenv = holder.env;
-
- /**
- * Separate the comment into the text part and zero to N tags.
- * Simple state machine is in one of three states:
- * <pre>
- * IN_TEXT: parsing the comment text or tag text.
- * TAG_NAME: parsing the name of a tag.
- * TAG_GAP: skipping through the gap between the tag name and
- * the tag text.
- * </pre>
- */
- @SuppressWarnings("fallthrough")
- class CommentStringParser {
- /**
- * The entry point to the comment string parser
- */
- void parseCommentStateMachine() {
- final int IN_TEXT = 1;
- final int TAG_GAP = 2;
- final int TAG_NAME = 3;
- int state = TAG_GAP;
- boolean newLine = true;
- String tagName = null;
- int tagStart = 0;
- int textStart = 0;
- int lastNonWhite = -1;
- int len = commentString.length();
- for (int inx = 0; inx < len; ++inx) {
- char ch = commentString.charAt(inx);
- boolean isWhite = Character.isWhitespace(ch);
- switch (state) {
- case TAG_NAME:
- if (isWhite) {
- tagName = commentString.substring(tagStart, inx);
- state = TAG_GAP;
- }
- break;
- case TAG_GAP:
- if (isWhite) {
- break;
- }
- textStart = inx;
- state = IN_TEXT;
- /* fall thru */
- case IN_TEXT:
- if (newLine && ch == '@') {
- parseCommentComponent(tagName, textStart,
- lastNonWhite+1);
- tagStart = inx;
- state = TAG_NAME;
- }
- break;
- }
- if (ch == '\n') {
- newLine = true;
- } else if (!isWhite) {
- lastNonWhite = inx;
- newLine = false;
- }
- }
- // Finish what's currently being processed
- switch (state) {
- case TAG_NAME:
- tagName = commentString.substring(tagStart, len);
- /* fall thru */
- case TAG_GAP:
- textStart = len;
- /* fall thru */
- case IN_TEXT:
- parseCommentComponent(tagName, textStart, lastNonWhite+1);
- break;
- }
- }
-
- /**
- * Save away the last parsed item.
- */
- void parseCommentComponent(String tagName,
- int from, int upto) {
- String tx = upto <= from ? "" : commentString.substring(from, upto);
- if (tagName == null) {
- text = tx;
- } else {
- TagImpl tag;
- switch (tagName) {
- case "@exception":
- case "@throws":
- warnIfEmpty(tagName, tx);
- tag = new ThrowsTagImpl(holder, tagName, tx);
- break;
- case "@param":
- warnIfEmpty(tagName, tx);
- tag = new ParamTagImpl(holder, tagName, tx);
- break;
- case "@see":
- warnIfEmpty(tagName, tx);
- tag = new SeeTagImpl(holder, tagName, tx);
- break;
- case "@serialField":
- warnIfEmpty(tagName, tx);
- tag = new SerialFieldTagImpl(holder, tagName, tx);
- break;
- case "@return":
- warnIfEmpty(tagName, tx);
- tag = new TagImpl(holder, tagName, tx);
- break;
- case "@author":
- warnIfEmpty(tagName, tx);
- tag = new TagImpl(holder, tagName, tx);
- break;
- case "@version":
- warnIfEmpty(tagName, tx);
- tag = new TagImpl(holder, tagName, tx);
- break;
- default:
- tag = new TagImpl(holder, tagName, tx);
- break;
- }
- tagList.append(tag);
- }
- }
-
- void warnIfEmpty(String tagName, String tx) {
- if (tx.length() == 0) {
- docenv.warning(holder, "tag.tag_has_no_arguments", tagName);
- }
- }
-
- }
-
- new CommentStringParser().parseCommentStateMachine();
- }
-
- /**
- * Return the text of the comment.
- */
- String commentText() {
- return text;
- }
-
- /**
- * Return all tags in this comment.
- */
- Tag[] tags() {
- return tagList.toArray(new Tag[tagList.length()]);
- }
-
- /**
- * Return tags of the specified kind in this comment.
- */
- Tag[] tags(String tagname) {
- ListBuffer<Tag> found = new ListBuffer<>();
- String target = tagname;
- if (target.charAt(0) != '@') {
- target = "@" + target;
- }
- for (Tag tag : tagList) {
- if (tag.kind().equals(target)) {
- found.append(tag);
- }
- }
- return found.toArray(new Tag[found.length()]);
- }
-
- /**
- * Return throws tags in this comment.
- */
- ThrowsTag[] throwsTags() {
- ListBuffer<ThrowsTag> found = new ListBuffer<>();
- for (Tag next : tagList) {
- if (next instanceof ThrowsTag) {
- found.append((ThrowsTag)next);
- }
- }
- return found.toArray(new ThrowsTag[found.length()]);
- }
-
- /**
- * Return param tags (excluding type param tags) in this comment.
- */
- ParamTag[] paramTags() {
- return paramTags(false);
- }
-
- /**
- * Return type param tags in this comment.
- */
- ParamTag[] typeParamTags() {
- return paramTags(true);
- }
-
- /**
- * Return param tags in this comment. If typeParams is true
- * include only type param tags, otherwise include only ordinary
- * param tags.
- */
- private ParamTag[] paramTags(boolean typeParams) {
- ListBuffer<ParamTag> found = new ListBuffer<>();
- for (Tag next : tagList) {
- if (next instanceof ParamTag) {
- ParamTag p = (ParamTag)next;
- if (typeParams == p.isTypeParameter()) {
- found.append(p);
- }
- }
- }
- return found.toArray(new ParamTag[found.length()]);
- }
-
- /**
- * Return see also tags in this comment.
- */
- SeeTag[] seeTags() {
- ListBuffer<SeeTag> found = new ListBuffer<>();
- for (Tag next : tagList) {
- if (next instanceof SeeTag) {
- found.append((SeeTag)next);
- }
- }
- return found.toArray(new SeeTag[found.length()]);
- }
-
- /**
- * Return serialField tags in this comment.
- */
- SerialFieldTag[] serialFieldTags() {
- ListBuffer<SerialFieldTag> found = new ListBuffer<>();
- for (Tag next : tagList) {
- if (next instanceof SerialFieldTag) {
- found.append((SerialFieldTag)next);
- }
- }
- return found.toArray(new SerialFieldTag[found.length()]);
- }
-
- /**
- * Return array of tags with text and inline See Tags for a Doc comment.
- */
- static Tag[] getInlineTags(DocImpl holder, String inlinetext) {
- ListBuffer<Tag> taglist = new ListBuffer<>();
- int delimend = 0, textstart = 0, len = inlinetext.length();
- boolean inPre = false;
- DocEnv docenv = holder.env;
-
- if (len == 0) {
- return taglist.toArray(new Tag[taglist.length()]);
- }
- while (true) {
- int linkstart;
- if ((linkstart = inlineTagFound(holder, inlinetext,
- textstart)) == -1) {
- taglist.append(new TagImpl(holder, "Text",
- inlinetext.substring(textstart)));
- break;
- } else {
- inPre = scanForPre(inlinetext, textstart, linkstart, inPre);
- int seetextstart = linkstart;
- for (int i = linkstart; i < inlinetext.length(); i++) {
- char c = inlinetext.charAt(i);
- if (Character.isWhitespace(c) ||
- c == '}') {
- seetextstart = i;
- break;
- }
- }
- String linkName = inlinetext.substring(linkstart+2, seetextstart);
- if (!(inPre && (linkName.equals("code") || linkName.equals("literal")))) {
- //Move past the white space after the inline tag name.
- while (Character.isWhitespace(inlinetext.
- charAt(seetextstart))) {
- if (inlinetext.length() <= seetextstart) {
- taglist.append(new TagImpl(holder, "Text",
- inlinetext.substring(textstart, seetextstart)));
- docenv.warning(holder,
- "tag.Improper_Use_Of_Link_Tag",
- inlinetext);
- return taglist.toArray(new Tag[taglist.length()]);
- } else {
- seetextstart++;
- }
- }
- }
- taglist.append(new TagImpl(holder, "Text",
- inlinetext.substring(textstart, linkstart)));
- textstart = seetextstart; // this text is actually seetag
- if ((delimend = findInlineTagDelim(inlinetext, textstart)) == -1) {
- //Missing closing '}' character.
- // store the text as it is with the {@link.
- taglist.append(new TagImpl(holder, "Text",
- inlinetext.substring(textstart)));
- docenv.warning(holder,
- "tag.End_delimiter_missing_for_possible_SeeTag",
- inlinetext);
- return taglist.toArray(new Tag[taglist.length()]);
- } else {
- //Found closing '}' character.
- if (linkName.equals("see")
- || linkName.equals("link")
- || linkName.equals("linkplain")) {
- taglist.append( new SeeTagImpl(holder, "@" + linkName,
- inlinetext.substring(textstart, delimend)));
- } else {
- taglist.append( new TagImpl(holder, "@" + linkName,
- inlinetext.substring(textstart, delimend)));
- }
- textstart = delimend + 1;
- }
- }
- if (textstart == inlinetext.length()) {
- break;
- }
- }
- return taglist.toArray(new Tag[taglist.length()]);
- }
-
- /** regex for case-insensitive match for {@literal <pre> } and {@literal </pre> }. */
- private static final Pattern prePat = Pattern.compile("(?i)<(/?)pre>");
-
- private static boolean scanForPre(String inlinetext, int start, int end, boolean inPre) {
- Matcher m = prePat.matcher(inlinetext).region(start, end);
- while (m.find()) {
- inPre = m.group(1).isEmpty();
- }
- return inPre;
- }
-
- /**
- * Recursively find the index of the closing '}' character for an inline tag
- * and return it. If it can't be found, return -1.
- * @param inlineText the text to search in.
- * @param searchStart the index of the place to start searching at.
- * @return the index of the closing '}' character for an inline tag.
- * If it can't be found, return -1.
- */
- private static int findInlineTagDelim(String inlineText, int searchStart) {
- int delimEnd, nestedOpenBrace;
- if ((delimEnd = inlineText.indexOf("}", searchStart)) == -1) {
- return -1;
- } else if (((nestedOpenBrace = inlineText.indexOf("{", searchStart)) != -1) &&
- nestedOpenBrace < delimEnd){
- //Found a nested open brace.
- int nestedCloseBrace = findInlineTagDelim(inlineText, nestedOpenBrace + 1);
- return (nestedCloseBrace != -1) ?
- findInlineTagDelim(inlineText, nestedCloseBrace + 1) :
- -1;
- } else {
- return delimEnd;
- }
- }
-
- /**
- * Recursively search for the characters '{', '@', followed by
- * name of inline tag and white space,
- * if found
- * return the index of the text following the white space.
- * else
- * return -1.
- */
- private static int inlineTagFound(DocImpl holder, String inlinetext, int start) {
- DocEnv docenv = holder.env;
- int linkstart = inlinetext.indexOf("{@", start);
- if (start == inlinetext.length() || linkstart == -1) {
- return -1;
- } else if (inlinetext.indexOf('}', linkstart) == -1) {
- //Missing '}'.
- docenv.warning(holder, "tag.Improper_Use_Of_Link_Tag",
- inlinetext.substring(linkstart, inlinetext.length()));
- return -1;
- } else {
- return linkstart;
- }
- }
-
-
- /**
- * Return array of tags for the locale specific first sentence in the text.
- */
- static Tag[] firstSentenceTags(DocImpl holder, String text) {
- DocLocale doclocale = holder.env.doclocale;
- return getInlineTags(holder,
- doclocale.localeSpecificFirstSentence(holder, text));
- }
-
- /**
- * Return text for this Doc comment.
- */
- @Override
- public String toString() {
- return text;
- }
-}
--- a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ConstructorDocImpl.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,105 +0,0 @@
-/*
- * Copyright (c) 1997, 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.
- */
-
-package com.sun.tools.javadoc.main;
-
-import com.sun.javadoc.*;
-
-import com.sun.source.util.TreePath;
-import com.sun.tools.javac.code.Symbol.ClassSymbol;
-import com.sun.tools.javac.code.Symbol.MethodSymbol;
-
-/**
- * Represents a constructor of a java class.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- *
- * @since 1.2
- * @author Robert Field
- * @author Neal Gafter (rewrite)
- */
-
-@Deprecated(since="9", forRemoval=true)
-@SuppressWarnings("removal")
-public class ConstructorDocImpl
- extends ExecutableMemberDocImpl implements ConstructorDoc {
-
- /**
- * constructor.
- */
- public ConstructorDocImpl(DocEnv env, MethodSymbol sym) {
- super(env, sym);
- }
-
- /**
- * constructor.
- */
- public ConstructorDocImpl(DocEnv env, MethodSymbol sym, TreePath treePath) {
- super(env, sym, treePath);
- }
-
- /**
- * Return true if it is a constructor, which it is.
- *
- * @return true
- */
- public boolean isConstructor() {
- return true;
- }
-
- /**
- * Get the name.
- *
- * @return the name of the member.
- */
- public String name() {
- ClassSymbol c = sym.enclClass();
- return c.name.toString();
- }
-
- /**
- * Get the name.
- *
- * @return the qualified name of the member.
- */
- public String qualifiedName() {
- return sym.enclClass().getQualifiedName().toString();
- }
-
- /**
- * Returns a string representation of this constructor. Includes the
- * qualified signature and any type parameters.
- * Type parameters precede the class name, as they do in the syntax
- * for invoking constructors with explicit type parameters using "new".
- * (This is unlike the syntax for invoking methods with explicit type
- * parameters.)
- */
- public String toString() {
- return typeParametersString() + qualifiedName() + signature();
- }
-}
--- a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocEnv.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,881 +0,0 @@
-/*
- * Copyright (c) 2000, 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.
- */
-
-package com.sun.tools.javadoc.main;
-
-import java.lang.reflect.Modifier;
-import java.util.*;
-
-import javax.tools.JavaFileManager;
-
-import com.sun.javadoc.*;
-import com.sun.source.tree.CompilationUnitTree;
-import com.sun.source.util.JavacTask;
-import com.sun.source.util.TreePath;
-import com.sun.tools.doclint.DocLint;
-import com.sun.tools.javac.api.BasicJavacTask;
-import com.sun.tools.javac.code.*;
-import com.sun.tools.javac.code.Symbol.*;
-import com.sun.tools.javac.code.Symbol.ClassSymbol;
-import com.sun.tools.javac.code.Symbol.CompletionFailure;
-import com.sun.tools.javac.code.Symbol.MethodSymbol;
-import com.sun.tools.javac.code.Symbol.PackageSymbol;
-import com.sun.tools.javac.code.Symbol.VarSymbol;
-import com.sun.tools.javac.code.Type.ClassType;
-import com.sun.tools.javac.comp.Check;
-import com.sun.tools.javac.comp.Enter;
-import com.sun.tools.javac.file.JavacFileManager;
-import com.sun.tools.javac.tree.JCTree;
-import com.sun.tools.javac.tree.JCTree.JCClassDecl;
-import com.sun.tools.javac.tree.JCTree.JCCompilationUnit;
-import com.sun.tools.javac.tree.JCTree.JCPackageDecl;
-import com.sun.tools.javac.util.Context;
-import com.sun.tools.javac.util.Convert;
-import com.sun.tools.javac.util.Name;
-import com.sun.tools.javac.util.Names;
-
-/**
- * Holds the environment for a run of javadoc.
- * Holds only the information needed throughout the
- * run and not the compiler info that could be GC'ed
- * or ported.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- *
- * @since 1.4
- * @author Robert Field
- * @author Neal Gafter (rewrite)
- * @author Scott Seligman (generics)
- */
-@Deprecated(since="9", forRemoval=true)
-@SuppressWarnings("removal")
-public class DocEnv {
- protected static final Context.Key<DocEnv> docEnvKey = new Context.Key<>();
-
- public static DocEnv instance(Context context) {
- DocEnv instance = context.get(docEnvKey);
- if (instance == null)
- instance = new DocEnv(context);
- return instance;
- }
-
- DocLocale doclocale;
-
- private final Messager messager;
-
- /** Predefined symbols known to the compiler. */
- final Symtab syms;
-
- /** Referenced directly in RootDocImpl. */
- private final ClassFinder finder;
-
- /** Javadoc's own version of the compiler's enter phase. */
- final Enter enter;
-
- /** The name table. */
- private final Names names;
-
- /** The encoding name. */
- private String encoding;
-
- final Symbol externalizableSym;
-
- /** Access filter (public, protected, ...). */
- protected ModifierFilter showAccess;
-
- /** True if we are using a sentence BreakIterator. */
- boolean breakiterator;
-
- /**
- * True if we do not want to print any notifications at all.
- */
- boolean quiet = false;
-
- Check chk;
- Types types;
- JavaFileManager fileManager;
- Context context;
- DocLint doclint;
- JavaScriptScanner javaScriptScanner;
-
- WeakHashMap<JCTree, TreePath> treePaths = new WeakHashMap<>();
-
- /** Allow documenting from class files? */
- boolean docClasses = false;
-
- /** Does the doclet only expect pre-1.5 doclet API? */
- protected boolean legacyDoclet = true;
-
- /**
- * Set this to true if you would like to not emit any errors, warnings and
- * notices.
- */
- private boolean silent = false;
-
- /**
- * The source language version.
- */
- protected Source source;
-
- /**
- * Constructor
- *
- * @param context Context for this javadoc instance.
- */
- protected DocEnv(Context context) {
- context.put(docEnvKey, this);
- this.context = context;
-
- messager = Messager.instance0(context);
- syms = Symtab.instance(context);
- finder = JavadocClassFinder.instance(context);
- enter = JavadocEnter.instance(context);
- names = Names.instance(context);
- externalizableSym = syms.enterClass(syms.java_base, names.fromString("java.io.Externalizable"));
- chk = Check.instance(context);
- types = Types.instance(context);
- fileManager = context.get(JavaFileManager.class);
- if (fileManager instanceof JavacFileManager) {
- ((JavacFileManager)fileManager).setSymbolFileEnabled(false);
- }
-
- // Default. Should normally be reset with setLocale.
- this.doclocale = new DocLocale(this, "", breakiterator);
- source = Source.instance(context);
- }
-
- public void setSilent(boolean silent) {
- this.silent = silent;
- }
-
- /**
- * Look up ClassDoc by qualified name.
- */
- public ClassDocImpl lookupClass(String name) {
- ClassSymbol c = getClassSymbol(name);
- if (c != null) {
- return getClassDoc(c);
- } else {
- return null;
- }
- }
-
- /**
- * Load ClassDoc by qualified name.
- */
- public ClassDocImpl loadClass(String name) {
- try {
- Name nameImpl = names.fromString(name);
- ModuleSymbol mod = syms.inferModule(Convert.packagePart(nameImpl));
- ClassSymbol c = finder.loadClass(mod != null ? mod : syms.errModule, nameImpl);
- return getClassDoc(c);
- } catch (CompletionFailure ex) {
- chk.completionError(null, ex);
- return null;
- }
- }
-
- /**
- * Look up PackageDoc by qualified name.
- */
- public PackageDocImpl lookupPackage(String name) {
- //### Jing alleges that class check is needed
- //### to avoid a compiler bug. Most likely
- //### instead a dummy created for error recovery.
- //### Should investigate this.
- Name nameImpl = names.fromString(name);
- ModuleSymbol mod = syms.inferModule(nameImpl);
- PackageSymbol p = mod != null ? syms.getPackage(mod, nameImpl) : null;
- ClassSymbol c = getClassSymbol(name);
- if (p != null && c == null) {
- return getPackageDoc(p);
- } else {
- return null;
- }
- }
- // where
- /** Retrieve class symbol by fully-qualified name.
- */
- ClassSymbol getClassSymbol(String name) {
- // Name may contain nested class qualification.
- // Generate candidate flatnames with successively shorter
- // package qualifiers and longer nested class qualifiers.
- int nameLen = name.length();
- char[] nameChars = name.toCharArray();
- int idx = name.length();
- for (;;) {
- Name nameImpl = names.fromChars(nameChars, 0, nameLen);
- ModuleSymbol mod = syms.inferModule(Convert.packagePart(nameImpl));
- ClassSymbol s = mod != null ? syms.getClass(mod, nameImpl) : null;
- if (s != null)
- return s; // found it!
- idx = name.substring(0, idx).lastIndexOf('.');
- if (idx < 0) break;
- nameChars[idx] = '$';
- }
- return null;
- }
-
- /**
- * Set the locale.
- */
- public void setLocale(String localeName) {
- // create locale specifics
- doclocale = new DocLocale(this, localeName, breakiterator);
- // update Messager if locale has changed.
- messager.setLocale(doclocale.locale);
- }
-
- /** Check whether this member should be documented. */
- public boolean shouldDocument(VarSymbol sym) {
- long mod = sym.flags();
-
- if ((mod & Flags.SYNTHETIC) != 0) {
- return false;
- }
-
- return showAccess.checkModifier(translateModifiers(mod));
- }
-
- /** Check whether this member should be documented. */
- public boolean shouldDocument(MethodSymbol sym) {
- long mod = sym.flags();
-
- if ((mod & Flags.SYNTHETIC) != 0) {
- return false;
- }
-
- return showAccess.checkModifier(translateModifiers(mod));
- }
-
- /** check whether this class should be documented. */
- public boolean shouldDocument(ClassSymbol sym) {
- return
- (sym.flags_field&Flags.SYNTHETIC) == 0 && // no synthetics
- (docClasses || getClassDoc(sym).tree != null) &&
- isVisible(sym);
- }
-
- //### Comment below is inaccurate wrt modifier filter testing
- /**
- * Check the visibility if this is an nested class.
- * if this is not a nested class, return true.
- * if this is an static visible nested class,
- * return true.
- * if this is an visible nested class
- * if the outer class is visible return true.
- * else return false.
- * IMPORTANT: This also allows, static nested classes
- * to be defined inside an nested class, which is not
- * allowed by the compiler. So such an test case will
- * not reach upto this method itself, but if compiler
- * allows it, then that will go through.
- */
- protected boolean isVisible(ClassSymbol sym) {
- long mod = sym.flags_field;
- if (!showAccess.checkModifier(translateModifiers(mod))) {
- return false;
- }
- ClassSymbol encl = sym.owner.enclClass();
- return (encl == null || (mod & Flags.STATIC) != 0 || isVisible(encl));
- }
-
- //---------------- print forwarders ----------------//
-
- /**
- * Print error message, increment error count.
- *
- * @param msg message to print.
- */
- public void printError(String msg) {
- if (silent)
- return;
- messager.printError(msg);
- }
-
- /**
- * Print error message, increment error count.
- *
- * @param key selects message from resource
- */
- public void error(DocImpl doc, String key) {
- if (silent)
- return;
- messager.error(doc==null ? null : doc.position(), key);
- }
-
- /**
- * Print error message, increment error count.
- *
- * @param key selects message from resource
- */
- public void error(SourcePosition pos, String key) {
- if (silent)
- return;
- messager.error(pos, key);
- }
-
- /**
- * Print error message, increment error count.
- *
- * @param msg message to print.
- */
- public void printError(SourcePosition pos, String msg) {
- if (silent)
- return;
- messager.printError(pos, msg);
- }
-
- /**
- * Print error message, increment error count.
- *
- * @param key selects message from resource
- * @param a1 first argument
- */
- public void error(DocImpl doc, String key, String a1) {
- if (silent)
- return;
- messager.error(doc==null ? null : doc.position(), key, a1);
- }
-
- /**
- * Print error message, increment error count.
- *
- * @param key selects message from resource
- * @param a1 first argument
- * @param a2 second argument
- */
- public void error(DocImpl doc, String key, String a1, String a2) {
- if (silent)
- return;
- messager.error(doc==null ? null : doc.position(), key, a1, a2);
- }
-
- /**
- * Print error message, increment error count.
- *
- * @param key selects message from resource
- * @param a1 first argument
- * @param a2 second argument
- * @param a3 third argument
- */
- public void error(DocImpl doc, String key, String a1, String a2, String a3) {
- if (silent)
- return;
- messager.error(doc==null ? null : doc.position(), key, a1, a2, a3);
- }
-
- /**
- * Print warning message, increment warning count.
- *
- * @param msg message to print.
- */
- public void printWarning(String msg) {
- if (silent)
- return;
- messager.printWarning(msg);
- }
-
- /**
- * Print warning message, increment warning count.
- *
- * @param key selects message from resource
- */
- public void warning(DocImpl doc, String key) {
- if (silent)
- return;
- messager.warning(doc==null ? null : doc.position(), key);
- }
-
- /**
- * Print warning message, increment warning count.
- *
- * @param msg message to print.
- */
- public void printWarning(SourcePosition pos, String msg) {
- if (silent)
- return;
- messager.printWarning(pos, msg);
- }
-
- /**
- * Print warning message, increment warning count.
- *
- * @param key selects message from resource
- * @param a1 first argument
- */
- public void warning(DocImpl doc, String key, String a1) {
- if (silent)
- return;
- // suppress messages that have (probably) been covered by doclint
- if (doclint != null && doc != null && key.startsWith("tag"))
- return;
- messager.warning(doc==null ? null : doc.position(), key, a1);
- }
-
- /**
- * Print warning message, increment warning count.
- *
- * @param key selects message from resource
- * @param a1 first argument
- * @param a2 second argument
- */
- public void warning(DocImpl doc, String key, String a1, String a2) {
- if (silent)
- return;
- messager.warning(doc==null ? null : doc.position(), key, a1, a2);
- }
-
- /**
- * Print warning message, increment warning count.
- *
- * @param key selects message from resource
- * @param a1 first argument
- * @param a2 second argument
- * @param a3 third argument
- */
- public void warning(DocImpl doc, String key, String a1, String a2, String a3) {
- if (silent)
- return;
- messager.warning(doc==null ? null : doc.position(), key, a1, a2, a3);
- }
-
- /**
- * Print warning message, increment warning count.
- *
- * @param key selects message from resource
- * @param a1 first argument
- * @param a2 second argument
- * @param a3 third argument
- */
- public void warning(DocImpl doc, String key, String a1, String a2, String a3,
- String a4) {
- if (silent)
- return;
- messager.warning(doc==null ? null : doc.position(), key, a1, a2, a3, a4);
- }
-
- /**
- * Print a message.
- *
- * @param msg message to print.
- */
- public void printNotice(String msg) {
- if (silent || quiet)
- return;
- messager.printNotice(msg);
- }
-
-
- /**
- * Print a message.
- *
- * @param key selects message from resource
- */
- public void notice(String key) {
- if (silent || quiet)
- return;
- messager.notice(key);
- }
-
- /**
- * Print a message.
- *
- * @param msg message to print.
- */
- public void printNotice(SourcePosition pos, String msg) {
- if (silent || quiet)
- return;
- messager.printNotice(pos, msg);
- }
-
- /**
- * Print a message.
- *
- * @param key selects message from resource
- * @param a1 first argument
- */
- public void notice(String key, String a1) {
- if (silent || quiet)
- return;
- messager.notice(key, a1);
- }
-
- /**
- * Print a message.
- *
- * @param key selects message from resource
- * @param a1 first argument
- * @param a2 second argument
- */
- public void notice(String key, String a1, String a2) {
- if (silent || quiet)
- return;
- messager.notice(key, a1, a2);
- }
-
- /**
- * Print a message.
- *
- * @param key selects message from resource
- * @param a1 first argument
- * @param a2 second argument
- * @param a3 third argument
- */
- public void notice(String key, String a1, String a2, String a3) {
- if (silent || quiet)
- return;
- messager.notice(key, a1, a2, a3);
- }
-
- /**
- * Exit, reporting errors and warnings.
- */
- public void exit() {
- // Messager should be replaced by a more general
- // compilation environment. This can probably
- // subsume DocEnv as well.
- messager.exit();
- }
-
- protected Map<PackageSymbol, PackageDocImpl> packageMap = new HashMap<>();
- /**
- * Return the PackageDoc of this package symbol.
- */
- public PackageDocImpl getPackageDoc(PackageSymbol pack) {
- PackageDocImpl result = packageMap.get(pack);
- if (result != null) return result;
- result = new PackageDocImpl(this, pack);
- packageMap.put(pack, result);
- return result;
- }
-
- /**
- * Create the PackageDoc (or a subtype) for a package symbol.
- */
- void makePackageDoc(PackageSymbol pack, TreePath treePath) {
- PackageDocImpl result = packageMap.get(pack);
- if (result != null) {
- if (treePath != null) result.setTreePath(treePath);
- } else {
- result = new PackageDocImpl(this, pack, treePath);
- packageMap.put(pack, result);
- }
- }
-
-
- protected Map<ClassSymbol, ClassDocImpl> classMap = new HashMap<>();
- /**
- * Return the ClassDoc (or a subtype) of this class symbol.
- */
- public ClassDocImpl getClassDoc(ClassSymbol clazz) {
- ClassDocImpl result = classMap.get(clazz);
- if (result != null) return result;
- if (isAnnotationType(clazz)) {
- result = new AnnotationTypeDocImpl(this, clazz);
- } else {
- result = new ClassDocImpl(this, clazz);
- }
- classMap.put(clazz, result);
- return result;
- }
-
- /**
- * Create the ClassDoc (or a subtype) for a class symbol.
- */
- protected void makeClassDoc(ClassSymbol clazz, TreePath treePath) {
- ClassDocImpl result = classMap.get(clazz);
- if (result != null) {
- if (treePath != null) result.setTreePath(treePath);
- return;
- }
- if (isAnnotationType((JCClassDecl) treePath.getLeaf())) { // flags of clazz may not yet be set
- result = new AnnotationTypeDocImpl(this, clazz, treePath);
- } else {
- result = new ClassDocImpl(this, clazz, treePath);
- }
- classMap.put(clazz, result);
- }
-
- protected static boolean isAnnotationType(ClassSymbol clazz) {
- return ClassDocImpl.isAnnotationType(clazz);
- }
-
- protected static boolean isAnnotationType(JCClassDecl tree) {
- return (tree.mods.flags & Flags.ANNOTATION) != 0;
- }
-
- protected Map<VarSymbol, FieldDocImpl> fieldMap = new HashMap<>();
- /**
- * Return the FieldDoc of this var symbol.
- */
- public FieldDocImpl getFieldDoc(VarSymbol var) {
- FieldDocImpl result = fieldMap.get(var);
- if (result != null) return result;
- result = new FieldDocImpl(this, var);
- fieldMap.put(var, result);
- return result;
- }
- /**
- * Create a FieldDoc for a var symbol.
- */
- protected void makeFieldDoc(VarSymbol var, TreePath treePath) {
- FieldDocImpl result = fieldMap.get(var);
- if (result != null) {
- if (treePath != null) result.setTreePath(treePath);
- } else {
- result = new FieldDocImpl(this, var, treePath);
- fieldMap.put(var, result);
- }
- }
-
- protected Map<MethodSymbol, ExecutableMemberDocImpl> methodMap = new HashMap<>();
- /**
- * Create a MethodDoc for this MethodSymbol.
- * Should be called only on symbols representing methods.
- */
- protected void makeMethodDoc(MethodSymbol meth, TreePath treePath) {
- MethodDocImpl result = (MethodDocImpl)methodMap.get(meth);
- if (result != null) {
- if (treePath != null) result.setTreePath(treePath);
- } else {
- result = new MethodDocImpl(this, meth, treePath);
- methodMap.put(meth, result);
- }
- }
-
- /**
- * Return the MethodDoc for a MethodSymbol.
- * Should be called only on symbols representing methods.
- */
- public MethodDocImpl getMethodDoc(MethodSymbol meth) {
- assert !meth.isConstructor() : "not expecting a constructor symbol";
- MethodDocImpl result = (MethodDocImpl)methodMap.get(meth);
- if (result != null) return result;
- result = new MethodDocImpl(this, meth);
- methodMap.put(meth, result);
- return result;
- }
-
- /**
- * Create the ConstructorDoc for a MethodSymbol.
- * Should be called only on symbols representing constructors.
- */
- protected void makeConstructorDoc(MethodSymbol meth, TreePath treePath) {
- ConstructorDocImpl result = (ConstructorDocImpl)methodMap.get(meth);
- if (result != null) {
- if (treePath != null) result.setTreePath(treePath);
- } else {
- result = new ConstructorDocImpl(this, meth, treePath);
- methodMap.put(meth, result);
- }
- }
-
- /**
- * Return the ConstructorDoc for a MethodSymbol.
- * Should be called only on symbols representing constructors.
- */
- public ConstructorDocImpl getConstructorDoc(MethodSymbol meth) {
- assert meth.isConstructor() : "expecting a constructor symbol";
- ConstructorDocImpl result = (ConstructorDocImpl)methodMap.get(meth);
- if (result != null) return result;
- result = new ConstructorDocImpl(this, meth);
- methodMap.put(meth, result);
- return result;
- }
-
- /**
- * Create the AnnotationTypeElementDoc for a MethodSymbol.
- * Should be called only on symbols representing annotation type elements.
- */
- protected void makeAnnotationTypeElementDoc(MethodSymbol meth, TreePath treePath) {
- AnnotationTypeElementDocImpl result =
- (AnnotationTypeElementDocImpl)methodMap.get(meth);
- if (result != null) {
- if (treePath != null) result.setTreePath(treePath);
- } else {
- result =
- new AnnotationTypeElementDocImpl(this, meth, treePath);
- methodMap.put(meth, result);
- }
- }
-
- /**
- * Return the AnnotationTypeElementDoc for a MethodSymbol.
- * Should be called only on symbols representing annotation type elements.
- */
- public AnnotationTypeElementDocImpl getAnnotationTypeElementDoc(
- MethodSymbol meth) {
-
- AnnotationTypeElementDocImpl result =
- (AnnotationTypeElementDocImpl)methodMap.get(meth);
- if (result != null) return result;
- result = new AnnotationTypeElementDocImpl(this, meth);
- methodMap.put(meth, result);
- return result;
- }
-
-// private Map<ClassType, ParameterizedTypeImpl> parameterizedTypeMap =
-// new HashMap<ClassType, ParameterizedTypeImpl>();
- /**
- * Return the ParameterizedType of this instantiation.
-// * ### Could use Type.sameTypeAs() instead of equality matching in hashmap
-// * ### to avoid some duplication.
- */
- ParameterizedTypeImpl getParameterizedType(ClassType t) {
- return new ParameterizedTypeImpl(this, t);
-// ParameterizedTypeImpl result = parameterizedTypeMap.get(t);
-// if (result != null) return result;
-// result = new ParameterizedTypeImpl(this, t);
-// parameterizedTypeMap.put(t, result);
-// return result;
- }
-
- TreePath getTreePath(JCCompilationUnit tree) {
- TreePath p = treePaths.get(tree);
- if (p == null)
- treePaths.put(tree, p = new TreePath(tree));
- return p;
- }
-
- TreePath getTreePath(JCCompilationUnit toplevel, JCPackageDecl tree) {
- TreePath p = treePaths.get(tree);
- if (p == null)
- treePaths.put(tree, p = new TreePath(getTreePath(toplevel), tree));
- return p;
- }
-
- TreePath getTreePath(JCCompilationUnit toplevel, JCClassDecl tree) {
- TreePath p = treePaths.get(tree);
- if (p == null)
- treePaths.put(tree, p = new TreePath(getTreePath(toplevel), tree));
- return p;
- }
-
- TreePath getTreePath(JCCompilationUnit toplevel, JCClassDecl cdecl, JCTree tree) {
- return new TreePath(getTreePath(toplevel, cdecl), tree);
- }
-
- /**
- * Set the encoding.
- */
- public void setEncoding(String encoding) {
- this.encoding = encoding;
- }
-
- /**
- * Get the encoding.
- */
- public String getEncoding() {
- return encoding;
- }
-
- /**
- * Convert modifier bits from private coding used by
- * the compiler to that of java.lang.reflect.Modifier.
- */
- static int translateModifiers(long flags) {
- int result = 0;
- if ((flags & Flags.ABSTRACT) != 0)
- result |= Modifier.ABSTRACT;
- if ((flags & Flags.FINAL) != 0)
- result |= Modifier.FINAL;
- if ((flags & Flags.INTERFACE) != 0)
- result |= Modifier.INTERFACE;
- if ((flags & Flags.NATIVE) != 0)
- result |= Modifier.NATIVE;
- if ((flags & Flags.PRIVATE) != 0)
- result |= Modifier.PRIVATE;
- if ((flags & Flags.PROTECTED) != 0)
- result |= Modifier.PROTECTED;
- if ((flags & Flags.PUBLIC) != 0)
- result |= Modifier.PUBLIC;
- if ((flags & Flags.STATIC) != 0)
- result |= Modifier.STATIC;
- if ((flags & Flags.SYNCHRONIZED) != 0)
- result |= Modifier.SYNCHRONIZED;
- if ((flags & Flags.TRANSIENT) != 0)
- result |= Modifier.TRANSIENT;
- if ((flags & Flags.VOLATILE) != 0)
- result |= Modifier.VOLATILE;
- return result;
- }
-
- void initDoclint(Collection<String> opts, Collection<String> customTagNames, String htmlVersion) {
- ArrayList<String> doclintOpts = new ArrayList<>();
- boolean msgOptionSeen = false;
-
- for (String opt : opts) {
- if (opt.startsWith(DocLint.XMSGS_OPTION)) {
- if (opt.equals(DocLint.XMSGS_CUSTOM_PREFIX + "none"))
- return;
- msgOptionSeen = true;
- }
- doclintOpts.add(opt);
- }
-
- if (!msgOptionSeen) {
- doclintOpts.add(DocLint.XMSGS_OPTION);
- }
-
- String sep = "";
- StringBuilder customTags = new StringBuilder();
- for (String customTag : customTagNames) {
- customTags.append(sep);
- customTags.append(customTag);
- sep = DocLint.SEPARATOR;
- }
- doclintOpts.add(DocLint.XCUSTOM_TAGS_PREFIX + customTags.toString());
- doclintOpts.add(DocLint.XHTML_VERSION_PREFIX + htmlVersion);
-
- JavacTask t = BasicJavacTask.instance(context);
- doclint = new DocLint();
- // standard doclet normally generates H1, H2
- doclintOpts.add(DocLint.XIMPLICIT_HEADERS + "2");
- doclint.init(t, doclintOpts.toArray(new String[doclintOpts.size()]), false);
- }
-
- JavaScriptScanner initJavaScriptScanner(boolean allowScriptInComments) {
- if (allowScriptInComments) {
- javaScriptScanner = null;
- } else {
- javaScriptScanner = new JavaScriptScanner();
- }
- return javaScriptScanner;
- }
-
- boolean showTagMessages() {
- return (doclint == null);
- }
-
- Map<CompilationUnitTree, Boolean> shouldCheck = new HashMap<>();
-
- boolean shouldCheck(CompilationUnitTree unit) {
- return shouldCheck.computeIfAbsent(unit, doclint :: shouldCheck);
- }
-}
--- a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocImpl.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,455 +0,0 @@
-/*
- * Copyright (c) 1997, 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.
- */
-
-package com.sun.tools.javadoc.main;
-
-import java.io.DataInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.text.CollationKey;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import javax.tools.FileObject;
-
-import com.sun.javadoc.*;
-import com.sun.source.util.TreePath;
-import com.sun.tools.javac.tree.JCTree;
-import com.sun.tools.javac.tree.JCTree.JCCompilationUnit;
-import com.sun.tools.javac.util.Position;
-
-/**
- * abstract base class of all Doc classes. Doc item's are representations
- * of java language constructs (class, package, method,...) which have
- * comments and have been processed by this run of javadoc. All Doc items
- * are unique, that is, they are == comparable.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- *
- * @since 1.2
- * @author Robert Field
- * @author Atul M Dambalkar
- * @author Neal Gafter (rewrite)
- */
-@Deprecated(since="9", forRemoval=true)
-@SuppressWarnings("removal")
-public abstract class DocImpl implements Doc, Comparable<Object> {
-
- /**
- * Doc environment
- */
- protected final DocEnv env; //### Rename this everywhere to 'docenv' ?
-
- /**
- * Back pointer to the tree node for this doc item.
- * May be null if there is no associated tree.
- */
- protected TreePath treePath;
-
- /**
- * The complex comment object, lazily initialized.
- */
- private Comment comment;
-
- /**
- * The cached sort key, to take care of Natural Language Text sorting.
- */
- private CollationKey collationkey = null;
-
- /**
- * Raw documentation string.
- */
- protected String documentation; // Accessed in PackageDocImpl, RootDocImpl
-
- /**
- * Cached first sentence.
- */
- private Tag[] firstSentence;
-
- /**
- * Cached inline tags.
- */
- private Tag[] inlineTags;
-
- /**
- * Constructor.
- */
- DocImpl(DocEnv env, TreePath treePath) {
- this.treePath = treePath;
- this.documentation = getCommentText(treePath);
- this.env = env;
- }
-
- private static String getCommentText(TreePath p) {
- if (p == null)
- return null;
-
- JCCompilationUnit topLevel = (JCCompilationUnit) p.getCompilationUnit();
- JCTree tree = (JCTree) p.getLeaf();
- return topLevel.docComments.getCommentText(tree);
- }
-
- /**
- * So subclasses have the option to do lazy initialization of
- * "documentation" string.
- */
- protected String documentation() {
- if (documentation == null) documentation = "";
- return documentation;
- }
-
- /**
- * For lazy initialization of comment.
- */
- Comment comment() {
- if (comment == null) {
- String d = documentation();
- if (env.javaScriptScanner != null) {
- env.javaScriptScanner.parse(d, new JavaScriptScanner.Reporter() {
- @Override
- public void report() {
- env.error(DocImpl.this, "javadoc.JavaScript_in_comment");
- throw new Error();
- }
- });
- }
- if (env.doclint != null
- && treePath != null
- && env.shouldCheck(treePath.getCompilationUnit())
- && d.equals(getCommentText(treePath))) {
- env.doclint.scan(treePath);
- }
- comment = new Comment(this, d);
- }
- return comment;
- }
-
- /**
- * Return the text of the comment for this doc item.
- * TagImpls have been removed.
- */
- public String commentText() {
- return comment().commentText();
- }
-
- /**
- * Return all tags in this Doc item.
- *
- * @return an array of TagImpl containing all tags on this Doc item.
- */
- public Tag[] tags() {
- return comment().tags();
- }
-
- /**
- * Return tags of the specified kind in this Doc item.
- *
- * @param tagname name of the tag kind to search for.
- * @return an array of TagImpl containing all tags whose 'kind()'
- * matches 'tagname'.
- */
- public Tag[] tags(String tagname) {
- return comment().tags(tagname);
- }
-
- /**
- * Return the see also tags in this Doc item.
- *
- * @return an array of SeeTag containing all @see tags.
- */
- public SeeTag[] seeTags() {
- return comment().seeTags();
- }
-
- public Tag[] inlineTags() {
- if (inlineTags == null) {
- inlineTags = Comment.getInlineTags(this, commentText());
- }
- return inlineTags;
- }
-
- public Tag[] firstSentenceTags() {
- if (firstSentence == null) {
- //Parse all sentences first to avoid duplicate warnings.
- inlineTags();
- try {
- env.setSilent(true);
- firstSentence = Comment.firstSentenceTags(this, commentText());
- } finally {
- env.setSilent(false);
- }
- }
- return firstSentence;
- }
-
- /**
- * Utility for subclasses which read HTML documentation files.
- */
- String readHTMLDocumentation(InputStream input, FileObject filename) throws IOException {
- byte[] filecontents = new byte[input.available()];
- try {
- DataInputStream dataIn = new DataInputStream(input);
- dataIn.readFully(filecontents);
- } finally {
- input.close();
- }
- String encoding = env.getEncoding();
- String rawDoc = (encoding!=null)
- ? new String(filecontents, encoding)
- : new String(filecontents);
- Pattern bodyPat = Pattern.compile("(?is).*<body\\b[^>]*>(.*)</body\\b.*");
- Matcher m = bodyPat.matcher(rawDoc);
- if (m.matches()) {
- return m.group(1);
- } else {
- String key = rawDoc.matches("(?is).*<body\\b.*")
- ? "javadoc.End_body_missing_from_html_file"
- : "javadoc.Body_missing_from_html_file";
- env.error(SourcePositionImpl.make(filename, Position.NOPOS, null), key);
- return "";
- }
- }
-
- /**
- * Return the full unprocessed text of the comment. Tags
- * are included as text. Used mainly for store and retrieve
- * operations like internalization.
- */
- public String getRawCommentText() {
- return documentation();
- }
-
- /**
- * Set the full unprocessed text of the comment. Tags
- * are included as text. Used mainly for store and retrieve
- * operations like internalization.
- */
- public void setRawCommentText(String rawDocumentation) {
- treePath = null;
- documentation = rawDocumentation;
- comment = null;
- }
-
- /**
- * Set the full unprocessed text of the comment and tree path.
- */
- void setTreePath(TreePath treePath) {
- this.treePath = treePath;
- documentation = getCommentText(treePath);
- comment = null;
- }
-
- /**
- * return a key for sorting.
- */
- CollationKey key() {
- if (collationkey == null) {
- collationkey = generateKey();
- }
- return collationkey;
- }
-
- /**
- * Generate a key for sorting.
- * <p>
- * Default is name().
- */
- CollationKey generateKey() {
- String k = name();
- // System.out.println("COLLATION KEY FOR " + this + " is \"" + k + "\"");
- return env.doclocale.collator.getCollationKey(k);
- }
-
- /**
- * Returns a string representation of this Doc item.
- */
- @Override
- public String toString() {
- return qualifiedName();
- }
-
- /**
- * Returns the name of this Doc item.
- *
- * @return the name
- */
- public abstract String name();
-
- /**
- * Returns the qualified name of this Doc item.
- *
- * @return the name
- */
- public abstract String qualifiedName();
-
- /**
- * Compares this Object with the specified Object for order. Returns a
- * negative integer, zero, or a positive integer as this Object is less
- * than, equal to, or greater than the given Object.
- * <p>
- * Included so that Doc item are java.lang.Comparable.
- *
- * @param obj the {@code Object} to be compared.
- * @return a negative integer, zero, or a positive integer as this Object
- * is less than, equal to, or greater than the given Object.
- * @exception ClassCastException the specified Object's type prevents it
- * from being compared to this Object.
- */
- public int compareTo(Object obj) {
- // System.out.println("COMPARE \"" + this + "\" to \"" + obj + "\" = " + key().compareTo(((DocImpl)obj).key()));
- return key().compareTo(((DocImpl)obj).key());
- }
-
- /**
- * Is this Doc item a field? False until overridden.
- *
- * @return true if it represents a field
- */
- public boolean isField() {
- return false;
- }
-
- /**
- * Is this Doc item an enum constant? False until overridden.
- *
- * @return true if it represents an enum constant
- */
- public boolean isEnumConstant() {
- return false;
- }
-
- /**
- * Is this Doc item a constructor? False until overridden.
- *
- * @return true if it represents a constructor
- */
- public boolean isConstructor() {
- return false;
- }
-
- /**
- * Is this Doc item a method (but not a constructor or annotation
- * type element)?
- * False until overridden.
- *
- * @return true if it represents a method
- */
- public boolean isMethod() {
- return false;
- }
-
- /**
- * Is this Doc item an annotation type element?
- * False until overridden.
- *
- * @return true if it represents an annotation type element
- */
- public boolean isAnnotationTypeElement() {
- return false;
- }
-
- /**
- * Is this Doc item a interface (but not an annotation type)?
- * False until overridden.
- *
- * @return true if it represents a interface
- */
- public boolean isInterface() {
- return false;
- }
-
- /**
- * Is this Doc item a exception class? False until overridden.
- *
- * @return true if it represents a exception
- */
- public boolean isException() {
- return false;
- }
-
- /**
- * Is this Doc item a error class? False until overridden.
- *
- * @return true if it represents a error
- */
- public boolean isError() {
- return false;
- }
-
- /**
- * Is this Doc item an enum type? False until overridden.
- *
- * @return true if it represents an enum type
- */
- public boolean isEnum() {
- return false;
- }
-
- /**
- * Is this Doc item an annotation type? False until overridden.
- *
- * @return true if it represents an annotation type
- */
- public boolean isAnnotationType() {
- return false;
- }
-
- /**
- * Is this Doc item an ordinary class (i.e. not an interface,
- * annotation type, enumeration, exception, or error)?
- * False until overridden.
- *
- * @return true if it represents an ordinary class
- */
- public boolean isOrdinaryClass() {
- return false;
- }
-
- /**
- * Is this Doc item a class
- * (and not an interface or annotation type)?
- * This includes ordinary classes, enums, errors and exceptions.
- * False until overridden.
- *
- * @return true if it represents a class
- */
- public boolean isClass() {
- return false;
- }
-
- /**
- * return true if this Doc is include in the active set.
- */
- public abstract boolean isIncluded();
-
- /**
- * Return the source position of the entity, or null if
- * no position is available.
- */
- public SourcePosition position() { return null; }
-}
--- a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocLocale.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,243 +0,0 @@
-/*
- * Copyright (c) 2000, 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.
- */
-
-package com.sun.tools.javadoc.main;
-
-import java.text.BreakIterator;
-import java.text.Collator;
-import java.util.Locale;
-
-/**
- * This class holds the information about locales.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- *
- * @since 1.4
- * @author Robert Field
- */
-@Deprecated(since="9", forRemoval=true)
-@SuppressWarnings("removal")
-class DocLocale {
-
- /**
- * The locale name will be set by Main, if option is provided on the
- * command line.
- */
- final String localeName;
-
- /**
- * The locale to be used. If user doesn't provide this,
- * then set it to default locale value.
- */
- final Locale locale;
-
- /**
- * The collator for this application. This is to take care of Locale
- * Specific or Natural Language Text sorting.
- */
- final Collator collator;
-
- /**
- * Enclosing DocEnv
- */
- private final DocEnv docenv;
-
- /**
- * Sentence instance from the BreakIterator.
- */
- private final BreakIterator sentenceBreaker;
-
- /**
- * True is we should use <code>BreakIterator</code>
- * to compute first sentence.
- */
- private boolean useBreakIterator = false;
-
- /**
- * The HTML sentence terminators.
- */
- static final String[] sentenceTerminators =
- {
- "<p>", "</p>", "<h1>", "<h2>",
- "<h3>", "<h4>", "<h5>", "<h6>",
- "</h1>", "</h2>", "</h3>", "</h4>", "</h5>",
- "</h6>", "<hr>", "<pre>", "</pre>"
- };
-
- /**
- * Constructor
- */
- DocLocale(DocEnv docenv, String localeName, boolean useBreakIterator) {
- this.docenv = docenv;
- this.localeName = localeName;
- this.useBreakIterator = useBreakIterator;
- locale = getLocale();
- if (locale == null) {
- docenv.exit();
- } else {
- Locale.setDefault(locale); // NOTE: updating global state
- }
- collator = Collator.getInstance(locale);
- sentenceBreaker = BreakIterator.getSentenceInstance(locale);
- }
-
- /**
- * Get the locale if specified on the command line
- * else return null and if locale option is not used
- * then return default locale.
- */
- private Locale getLocale() {
- Locale userlocale = null;
- if (localeName.length() > 0) {
- int firstuscore = localeName.indexOf('_');
- int seconduscore = -1;
- String language = null;
- String country = null;
- String variant = null;
- if (firstuscore == 2) {
- language = localeName.substring(0, firstuscore);
- seconduscore = localeName.indexOf('_', firstuscore + 1);
- if (seconduscore > 0) {
- if (seconduscore != firstuscore + 3 ||
- localeName.length() <= seconduscore + 1) {
- docenv.error(null, "main.malformed_locale_name", localeName);
- return null;
- }
- country = localeName.substring(firstuscore + 1,
- seconduscore);
- variant = localeName.substring(seconduscore + 1);
- } else if (localeName.length() == firstuscore + 3) {
- country = localeName.substring(firstuscore + 1);
- } else {
- docenv.error(null, "main.malformed_locale_name", localeName);
- return null;
- }
- } else if (firstuscore == -1 && localeName.length() == 2) {
- language = localeName;
- } else {
- docenv.error(null, "main.malformed_locale_name", localeName);
- return null;
- }
- userlocale = searchLocale(language, country, variant);
- if (userlocale == null) {
- docenv.error(null, "main.illegal_locale_name", localeName);
- return null;
- } else {
- return userlocale;
- }
- } else {
- return Locale.getDefault();
- }
- }
-
- /**
- * Search the locale for specified language, specified country and
- * specified variant.
- */
- private Locale searchLocale(String language, String country,
- String variant) {
- for (Locale loc : Locale.getAvailableLocales()) {
- if (loc.getLanguage().equals(language) &&
- (country == null || loc.getCountry().equals(country)) &&
- (variant == null || loc.getVariant().equals(variant))) {
- return loc;
- }
- }
- return null;
- }
-
- String localeSpecificFirstSentence(DocImpl doc, String s) {
- if (s == null || s.length() == 0) {
- return "";
- }
- int index = s.indexOf("-->");
- if(s.trim().startsWith("<!--") && index != -1) {
- return localeSpecificFirstSentence(doc, s.substring(index + 3, s.length()));
- }
- if (useBreakIterator || !locale.getLanguage().equals("en")) {
- sentenceBreaker.setText(s.replace('\n', ' '));
- int start = sentenceBreaker.first();
- int end = sentenceBreaker.next();
- return s.substring(start, end).trim();
- } else {
- return englishLanguageFirstSentence(s).trim();
- }
- }
-
- /**
- * Return the first sentence of a string, where a sentence ends
- * with a period followed be white space.
- */
- private String englishLanguageFirstSentence(String s) {
- if (s == null) {
- return null;
- }
- int len = s.length();
- boolean period = false;
- for (int i = 0 ; i < len ; i++) {
- switch (s.charAt(i)) {
- case '.':
- period = true;
- break;
- case ' ':
- case '\t':
- case '\n':
- case '\r':
- case '\f':
- if (period) {
- return s.substring(0, i);
- }
- break;
- case '<':
- if (i > 0) {
- if (htmlSentenceTerminatorFound(s, i)) {
- return s.substring(0, i);
- }
- }
- break;
- default:
- period = false;
- }
- }
- return s;
- }
-
- /**
- * Find out if there is any HTML tag in the given string. If found
- * return true else return false.
- */
- private boolean htmlSentenceTerminatorFound(String str, int index) {
- for (String terminator : sentenceTerminators) {
- if (str.regionMatches(true, index, terminator,
- 0, terminator.length())) {
- return true;
- }
- }
- return false;
- }
-}
--- a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocletInvoker.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,438 +0,0 @@
-/*
- * Copyright (c) 1998, 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.
- */
-
-package com.sun.tools.javadoc.main;
-
-import java.io.File;
-import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.util.ArrayList;
-import java.util.regex.Pattern;
-
-import javax.tools.DocumentationTool;
-import javax.tools.JavaFileManager;
-
-import com.sun.javadoc.*;
-import com.sun.tools.javac.util.ClientCodeException;
-import com.sun.tools.javac.util.List;
-
-/**
- * Class creates, controls and invokes doclets.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- *
- * @author Neal Gafter (rewrite)
- */
-@Deprecated(since="9", forRemoval=true)
-@SuppressWarnings("removal")
-public class DocletInvoker {
-
- private final Class<?> docletClass;
-
- private final String docletClassName;
-
- private final ClassLoader appClassLoader;
-
- private final Messager messager;
-
- /**
- * In API mode, exceptions thrown while calling the doclet are
- * propagated using ClientCodeException.
- */
- private final boolean apiMode;
-
- /**
- * Whether javadoc internal API should be exported to doclets
- * and (indirectly) to taglets
- */
- private final boolean exportInternalAPI;
-
- private static class DocletInvokeException extends Exception {
- private static final long serialVersionUID = 0;
- }
-
- private String appendPath(String path1, String path2) {
- if (path1 == null || path1.length() == 0) {
- return path2 == null ? "." : path2;
- } else if (path2 == null || path2.length() == 0) {
- return path1;
- } else {
- return path1 + File.pathSeparator + path2;
- }
- }
-
- public DocletInvoker(Messager messager, Class<?> docletClass, boolean apiMode, boolean exportInternalAPI) {
- this.messager = messager;
- this.docletClass = docletClass;
- docletClassName = docletClass.getName();
- appClassLoader = null;
- this.apiMode = apiMode;
- this.exportInternalAPI = exportInternalAPI; // for backdoor use by standard doclet for taglets
-
- // this may not be soon enough if the class has already been loaded
- if (exportInternalAPI) {
- exportInternalAPI(docletClass.getClassLoader());
- }
- }
-
- public DocletInvoker(Messager messager, JavaFileManager fileManager,
- String docletClassName, String docletPath,
- ClassLoader docletParentClassLoader,
- boolean apiMode,
- boolean exportInternalAPI) {
- this.messager = messager;
- this.docletClassName = docletClassName;
- this.apiMode = apiMode;
- this.exportInternalAPI = exportInternalAPI; // for backdoor use by standard doclet for taglets
-
- if (fileManager != null && fileManager.hasLocation(DocumentationTool.Location.DOCLET_PATH)) {
- appClassLoader = fileManager.getClassLoader(DocumentationTool.Location.DOCLET_PATH);
- } else {
- // construct class loader
- String cpString = null; // make sure env.class.path defaults to dot
-
- // do prepends to get correct ordering
- cpString = appendPath(System.getProperty("env.class.path"), cpString);
- cpString = appendPath(System.getProperty("java.class.path"), cpString);
- cpString = appendPath(docletPath, cpString);
- URL[] urls = pathToURLs(cpString);
- if (docletParentClassLoader == null)
- appClassLoader = new URLClassLoader(urls, getDelegationClassLoader(docletClassName));
- else
- appClassLoader = new URLClassLoader(urls, docletParentClassLoader);
- }
-
- if (exportInternalAPI) {
- exportInternalAPI(appClassLoader);
- }
-
- // attempt to find doclet
- Class<?> dc = null;
- try {
- dc = appClassLoader.loadClass(docletClassName);
- } catch (ClassNotFoundException exc) {
- messager.error(Messager.NOPOS, "main.doclet_class_not_found", docletClassName);
- messager.exit();
- }
- docletClass = dc;
- }
-
- /*
- * Returns the delegation class loader to use when creating
- * appClassLoader (used to load the doclet). The context class
- * loader is the best choice, but legacy behavior was to use the
- * default delegation class loader (aka system class loader).
- *
- * Here we favor using the context class loader. To ensure
- * compatibility with existing apps, we revert to legacy
- * behavior if either or both of the following conditions hold:
- *
- * 1) the doclet is loadable from the system class loader but not
- * from the context class loader,
- *
- * 2) this.getClass() is loadable from the system class loader but not
- * from the context class loader.
- */
- private ClassLoader getDelegationClassLoader(String docletClassName) {
- ClassLoader ctxCL = Thread.currentThread().getContextClassLoader();
- ClassLoader sysCL = ClassLoader.getSystemClassLoader();
- if (sysCL == null)
- return ctxCL;
- if (ctxCL == null)
- return sysCL;
-
- // Condition 1.
- try {
- sysCL.loadClass(docletClassName);
- try {
- ctxCL.loadClass(docletClassName);
- } catch (ClassNotFoundException e) {
- return sysCL;
- }
- } catch (ClassNotFoundException e) {
- }
-
- // Condition 2.
- try {
- if (getClass() == sysCL.loadClass(getClass().getName())) {
- try {
- if (getClass() != ctxCL.loadClass(getClass().getName()))
- return sysCL;
- } catch (ClassNotFoundException e) {
- return sysCL;
- }
- }
- } catch (ClassNotFoundException e) {
- }
-
- return ctxCL;
- }
-
- /**
- * Generate documentation here. Return true on success.
- */
- public boolean start(RootDoc root) {
- Object retVal;
- String methodName = "start";
- Class<?>[] paramTypes = { RootDoc.class };
- Object[] params = { root };
- try {
- retVal = invoke(methodName, null, paramTypes, params);
- } catch (DocletInvokeException exc) {
- return false;
- }
- if (retVal instanceof Boolean) {
- return ((Boolean)retVal);
- } else {
- messager.error(Messager.NOPOS, "main.must_return_boolean",
- docletClassName, methodName);
- return false;
- }
- }
-
- /**
- * Check for doclet added options here. Zero return means
- * option not known. Positive value indicates number of
- * arguments to option. Negative value means error occurred.
- */
- public int optionLength(String option) {
- Object retVal;
- String methodName = "optionLength";
- Class<?>[] paramTypes = { String.class };
- Object[] params = { option };
- try {
- retVal = invoke(methodName, 0, paramTypes, params);
- } catch (DocletInvokeException exc) {
- return -1;
- }
- if (retVal instanceof Integer) {
- return ((Integer)retVal);
- } else {
- messager.error(Messager.NOPOS, "main.must_return_int",
- docletClassName, methodName);
- return -1;
- }
- }
-
- /**
- * Let doclet check that all options are OK. Returning true means
- * options are OK. If method does not exist, assume true.
- */
- public boolean validOptions(List<String[]> optlist) {
- Object retVal;
- String options[][] = optlist.toArray(new String[optlist.length()][]);
- String methodName = "validOptions";
- DocErrorReporter reporter = messager;
- Class<?>[] paramTypes = { String[][].class, DocErrorReporter.class };
- Object[] params = { options, reporter };
- try {
- retVal = invoke(methodName, Boolean.TRUE, paramTypes, params);
- } catch (DocletInvokeException exc) {
- return false;
- }
- if (retVal instanceof Boolean) {
- return ((Boolean)retVal);
- } else {
- messager.error(Messager.NOPOS, "main.must_return_boolean",
- docletClassName, methodName);
- return false;
- }
- }
-
- /**
- * Return the language version supported by this doclet.
- * If the method does not exist in the doclet, assume version 1.1.
- */
- public LanguageVersion languageVersion() {
- try {
- Object retVal;
- String methodName = "languageVersion";
- Class<?>[] paramTypes = new Class<?>[0];
- Object[] params = new Object[0];
- try {
- retVal = invoke(methodName, LanguageVersion.JAVA_1_1, paramTypes, params);
- } catch (DocletInvokeException exc) {
- return LanguageVersion.JAVA_1_1;
- }
- if (retVal instanceof LanguageVersion) {
- return (LanguageVersion)retVal;
- } else {
- messager.error(Messager.NOPOS, "main.must_return_languageversion",
- docletClassName, methodName);
- return LanguageVersion.JAVA_1_1;
- }
- } catch (NoClassDefFoundError ex) { // for boostrapping, no Enum class.
- return null;
- }
- }
-
- /**
- * Utility method for calling doclet functionality
- */
- private Object invoke(String methodName, Object returnValueIfNonExistent,
- Class<?>[] paramTypes, Object[] params)
- throws DocletInvokeException {
- Method meth;
- try {
- meth = docletClass.getMethod(methodName, paramTypes);
- } catch (NoSuchMethodException exc) {
- if (returnValueIfNonExistent == null) {
- messager.error(Messager.NOPOS, "main.doclet_method_not_found",
- docletClassName, methodName);
- throw new DocletInvokeException();
- } else {
- return returnValueIfNonExistent;
- }
- } catch (SecurityException exc) {
- messager.error(Messager.NOPOS, "main.doclet_method_not_accessible",
- docletClassName, methodName);
- throw new DocletInvokeException();
- }
- if (!Modifier.isStatic(meth.getModifiers())) {
- messager.error(Messager.NOPOS, "main.doclet_method_must_be_static",
- docletClassName, methodName);
- throw new DocletInvokeException();
- }
- ClassLoader savedCCL =
- Thread.currentThread().getContextClassLoader();
- try {
- if (appClassLoader != null) // will be null if doclet class provided via API
- Thread.currentThread().setContextClassLoader(appClassLoader);
- return meth.invoke(null , params);
- } catch (IllegalArgumentException | NullPointerException exc) {
- messager.error(Messager.NOPOS, "main.internal_error_exception_thrown",
- docletClassName, methodName, exc.toString());
- throw new DocletInvokeException();
- } catch (IllegalAccessException exc) {
- messager.error(Messager.NOPOS, "main.doclet_method_not_accessible",
- docletClassName, methodName);
- throw new DocletInvokeException();
- }
- catch (InvocationTargetException exc) {
- Throwable err = exc.getTargetException();
- if (apiMode)
- throw new ClientCodeException(err);
- if (err instanceof java.lang.OutOfMemoryError) {
- messager.error(Messager.NOPOS, "main.out.of.memory");
- } else {
- messager.error(Messager.NOPOS, "main.exception_thrown",
- docletClassName, methodName, exc.toString());
- exc.getTargetException().printStackTrace(System.err);
- }
- throw new DocletInvokeException();
- } finally {
- Thread.currentThread().setContextClassLoader(savedCCL);
- }
- }
-
- /**
- * Export javadoc internal API to the unnamed module for a classloader.
- * This is to support continued use of existing non-standard doclets that
- * use the internal toolkit API and related classes.
- * @param cl the classloader
- */
- private void exportInternalAPI(ClassLoader cl) {
- String[] packages = {
- "com.sun.tools.doclets",
- "com.sun.tools.doclets.standard",
- "com.sun.tools.doclets.internal.toolkit",
- "com.sun.tools.doclets.internal.toolkit.taglets",
- "com.sun.tools.doclets.internal.toolkit.builders",
- "com.sun.tools.doclets.internal.toolkit.util",
- "com.sun.tools.doclets.internal.toolkit.util.links",
- "com.sun.tools.doclets.formats.html",
- "com.sun.tools.doclets.formats.html.markup"
- };
-
- try {
- Method getModuleMethod = Class.class.getDeclaredMethod("getModule");
- Object thisModule = getModuleMethod.invoke(getClass());
-
- Class<?> moduleClass = Class.forName("java.lang.Module");
- Method addExportsMethod = moduleClass.getDeclaredMethod("addExports", String.class, moduleClass);
-
- Method getUnnamedModuleMethod = ClassLoader.class.getDeclaredMethod("getUnnamedModule");
- Object target = getUnnamedModuleMethod.invoke(cl);
-
- for (String pack : packages) {
- addExportsMethod.invoke(thisModule, pack, target);
- }
- } catch (Exception e) {
- // do nothing
- }
- }
-
- /**
- * Utility method for converting a search path string to an array of directory and JAR file
- * URLs.
- *
- * Note that this method is called by the DocletInvoker.
- *
- * @param path the search path string
- * @return the resulting array of directory and JAR file URLs
- */
- private static URL[] pathToURLs(String path) {
- java.util.List<URL> urls = new ArrayList<>();
- for (String s: path.split(Pattern.quote(File.pathSeparator))) {
- if (!s.isEmpty()) {
- URL url = fileToURL(Paths.get(s));
- if (url != null) {
- urls.add(url);
- }
- }
- }
- return urls.toArray(new URL[urls.size()]);
- }
-
- /**
- * Returns the directory or JAR file URL corresponding to the specified local file name.
- *
- * @param file the Path object
- * @return the resulting directory or JAR file URL, or null if unknown
- */
- private static URL fileToURL(Path file) {
- Path p;
- try {
- p = file.toRealPath();
- } catch (IOException e) {
- p = file.toAbsolutePath();
- }
- try {
- return p.normalize().toUri().toURL();
- } catch (MalformedURLException e) {
- return null;
- }
- }
-}
--- a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ExecutableMemberDocImpl.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,290 +0,0 @@
-/*
- * Copyright (c) 1997, 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.
- */
-
-package com.sun.tools.javadoc.main;
-
-import java.lang.reflect.Modifier;
-import java.text.CollationKey;
-
-import com.sun.javadoc.*;
-
-import com.sun.source.util.TreePath;
-import com.sun.tools.javac.code.Flags;
-import com.sun.tools.javac.code.Symbol.*;
-import com.sun.tools.javac.code.Type;
-import com.sun.tools.javac.util.List;
-import com.sun.tools.javac.util.ListBuffer;
-
-/**
- * Represents a method or constructor of a java class.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- *
- * @since 1.2
- * @author Robert Field
- * @author Neal Gafter (rewrite)
- * @author Scott Seligman (generics, annotations)
- */
-
-@Deprecated(since="9", forRemoval=true)
-@SuppressWarnings("removal")
-public abstract class ExecutableMemberDocImpl
- extends MemberDocImpl implements ExecutableMemberDoc {
-
- protected final MethodSymbol sym;
-
- /**
- * Constructor.
- */
- public ExecutableMemberDocImpl(DocEnv env, MethodSymbol sym, TreePath treePath) {
- super(env, sym, treePath);
- this.sym = sym;
- }
-
- /**
- * Constructor.
- */
- public ExecutableMemberDocImpl(DocEnv env, MethodSymbol sym) {
- this(env, sym, null);
- }
-
- /**
- * Returns the flags in terms of javac's flags
- */
- protected long getFlags() {
- return sym.flags();
- }
-
- /**
- * Identify the containing class
- */
- protected ClassSymbol getContainingClass() {
- return sym.enclClass();
- }
-
- /**
- * Return true if this method is native
- */
- public boolean isNative() {
- return Modifier.isNative(getModifiers());
- }
-
- /**
- * Return true if this method is synchronized
- */
- public boolean isSynchronized() {
- return Modifier.isSynchronized(getModifiers());
- }
-
- /**
- * Return true if this method was declared to take a variable number
- * of arguments.
- */
- public boolean isVarArgs() {
- return ((sym.flags() & Flags.VARARGS) != 0
- && !env.legacyDoclet);
- }
-
- /**
- * Returns true if this field was synthesized by the compiler.
- */
- public boolean isSynthetic() {
- return ((sym.flags() & Flags.SYNTHETIC) != 0);
- }
-
- public boolean isIncluded() {
- return containingClass().isIncluded() && env.shouldDocument(sym);
- }
-
- /**
- * Return the throws tags in this method.
- *
- * @return an array of ThrowTagImpl containing all {@code @exception}
- * and {@code @throws} tags.
- */
- public ThrowsTag[] throwsTags() {
- return comment().throwsTags();
- }
-
- /**
- * Return the param tags in this method, excluding the type
- * parameter tags.
- *
- * @return an array of ParamTagImpl containing all {@code @param} tags.
- */
- public ParamTag[] paramTags() {
- return comment().paramTags();
- }
-
- /**
- * Return the type parameter tags in this method.
- */
- public ParamTag[] typeParamTags() {
- return env.legacyDoclet
- ? new ParamTag[0]
- : comment().typeParamTags();
- }
-
- /**
- * Return exceptions this method or constructor throws.
- *
- * @return an array of ClassDoc[] representing the exceptions
- * thrown by this method.
- */
- public ClassDoc[] thrownExceptions() {
- ListBuffer<ClassDocImpl> l = new ListBuffer<>();
- for (Type ex : sym.type.getThrownTypes()) {
- ex = env.types.erasure(ex);
- //### Will these casts succeed in the face of static semantic
- //### errors in the documented code?
- ClassDocImpl cdi = env.getClassDoc((ClassSymbol)ex.tsym);
- if (cdi != null) l.append(cdi);
- }
- return l.toArray(new ClassDocImpl[l.length()]);
- }
-
- /**
- * Return exceptions this method or constructor throws.
- * Each array element is either a <code>ClassDoc</code> or a
- * <code>TypeVariable</code>.
- */
- public com.sun.javadoc.Type[] thrownExceptionTypes() {
- return TypeMaker.getTypes(env, sym.type.getThrownTypes());
- }
-
- /**
- * Get argument information.
- *
- * @see ParameterImpl
- *
- * @return an array of ParameterImpl, one element per argument
- * in the order the arguments are present.
- */
- public Parameter[] parameters() {
- // generate the parameters on the fly: they're not cached
- List<VarSymbol> params = sym.params();
- Parameter result[] = new Parameter[params.length()];
-
- int i = 0;
- for (VarSymbol param : params) {
- result[i++] = new ParameterImpl(env, param);
- }
- return result;
- }
-
- /**
- * Get the receiver type of this executable element.
- *
- * @return the receiver type of this executable element.
- * @since 1.8
- */
- public com.sun.javadoc.Type receiverType() {
- Type recvtype = sym.type.asMethodType().recvtype;
- return (recvtype != null) ? TypeMaker.getType(env, recvtype, false, true) : null;
- }
-
- /**
- * Return the formal type parameters of this method or constructor.
- * Return an empty array if there are none.
- */
- public TypeVariable[] typeParameters() {
- if (env.legacyDoclet) {
- return new TypeVariable[0];
- }
- TypeVariable res[] = new TypeVariable[sym.type.getTypeArguments().length()];
- TypeMaker.getTypes(env, sym.type.getTypeArguments(), res);
- return res;
- }
-
- /**
- * Get the signature. It is the parameter list, type is qualified.
- * For instance, for a method <code>mymethod(String x, int y)</code>,
- * it will return <code>(java.lang.String,int)</code>.
- */
- public String signature() {
- return makeSignature(true);
- }
-
- /**
- * Get flat signature. All types are not qualified.
- * Return a String, which is the flat signiture of this member.
- * It is the parameter list, type is not qualified.
- * For instance, for a method <code>mymethod(String x, int y)</code>,
- * it will return <code>(String, int)</code>.
- */
- public String flatSignature() {
- return makeSignature(false);
- }
-
- private String makeSignature(boolean full) {
- StringBuilder result = new StringBuilder();
- result.append("(");
- for (List<Type> types = sym.type.getParameterTypes(); types.nonEmpty(); ) {
- Type t = types.head;
- result.append(TypeMaker.getTypeString(env, t, full));
- types = types.tail;
- if (types.nonEmpty()) {
- result.append(", ");
- }
- }
- if (isVarArgs()) {
- int len = result.length();
- result.replace(len - 2, len, "...");
- }
- result.append(")");
- return result.toString();
- }
-
- protected String typeParametersString() {
- return TypeMaker.typeParametersString(env, sym, true);
- }
-
- /**
- * Generate a key for sorting.
- */
- @Override
- CollationKey generateKey() {
- String k = name() + flatSignature() + typeParametersString();
- // ',' and '&' are between '$' and 'a': normalize to spaces.
- k = k.replace(',', ' ').replace('&', ' ');
- // System.out.println("COLLATION KEY FOR " + this + " is \"" + k + "\"");
- return env.doclocale.collator.getCollationKey(k);
- }
-
- /**
- * Return the source position of the entity, or null if
- * no position is available.
- */
- @Override
- public SourcePosition position() {
- if (sym.enclClass().sourcefile == null) return null;
- return SourcePositionImpl.make(sym.enclClass().sourcefile,
- (tree==null) ? 0 : tree.pos,
- lineMap);
- }
-}
--- a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/FieldDocImpl.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,281 +0,0 @@
-/*
- * Copyright (c) 1997, 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.
- */
-
-package com.sun.tools.javadoc.main;
-
-import com.sun.source.util.TreePath;
-import java.lang.reflect.Modifier;
-
-import com.sun.javadoc.*;
-
-import com.sun.tools.javac.code.Flags;
-import com.sun.tools.javac.code.Symbol.ClassSymbol;
-import com.sun.tools.javac.code.Symbol.VarSymbol;
-
-import static com.sun.tools.javac.code.TypeTag.BOOLEAN;
-
-/**
- * Represents a field in a java class.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- *
- * @see MemberDocImpl
- *
- * @since 1.2
- * @author Robert Field
- * @author Neal Gafter (rewrite)
- * @author Scott Seligman (generics, enums, annotations)
- */
-@Deprecated(since="9", forRemoval=true)
-@SuppressWarnings("removal")
-public class FieldDocImpl extends MemberDocImpl implements FieldDoc {
-
- protected final VarSymbol sym;
-
- /**
- * Constructor.
- */
- public FieldDocImpl(DocEnv env, VarSymbol sym, TreePath treePath) {
- super(env, sym, treePath);
- this.sym = sym;
- }
-
- /**
- * Constructor.
- */
- public FieldDocImpl(DocEnv env, VarSymbol sym) {
- this(env, sym, null);
- }
-
- /**
- * Returns the flags in terms of javac's flags
- */
- protected long getFlags() {
- return sym.flags();
- }
-
- /**
- * Identify the containing class
- */
- protected ClassSymbol getContainingClass() {
- return sym.enclClass();
- }
-
- /**
- * Get type of this field.
- */
- public com.sun.javadoc.Type type() {
- return TypeMaker.getType(env, sym.type, false);
- }
-
- /**
- * Get the value of a constant field.
- *
- * @return the value of a constant field. The value is
- * automatically wrapped in an object if it has a primitive type.
- * If the field is not constant, returns null.
- */
- public Object constantValue() {
- Object result = sym.getConstValue();
- if (result != null && sym.type.hasTag(BOOLEAN))
- // javac represents false and true as Integers 0 and 1
- result = Boolean.valueOf(((Integer)result).intValue() != 0);
- return result;
- }
-
- /**
- * Get the value of a constant field.
- *
- * @return the text of a Java language expression whose value
- * is the value of the constant. The expression uses no identifiers
- * other than primitive literals. If the field is
- * not constant, returns null.
- */
- public String constantValueExpression() {
- return constantValueExpression(constantValue());
- }
-
- /**
- * A static version of the above.
- */
- static String constantValueExpression(Object cb) {
- if (cb == null) return null;
- if (cb instanceof Character) return sourceForm(((Character)cb).charValue());
- if (cb instanceof Byte) return sourceForm(((Byte)cb).byteValue());
- if (cb instanceof String) return sourceForm((String)cb);
- if (cb instanceof Double) return sourceForm(((Double)cb).doubleValue(), 'd');
- if (cb instanceof Float) return sourceForm(((Float)cb).doubleValue(), 'f');
- if (cb instanceof Long) return cb + "L";
- return cb.toString(); // covers int, short
- }
- // where
- private static String sourceForm(double v, char suffix) {
- if (Double.isNaN(v))
- return "0" + suffix + "/0" + suffix;
- if (v == Double.POSITIVE_INFINITY)
- return "1" + suffix + "/0" + suffix;
- if (v == Double.NEGATIVE_INFINITY)
- return "-1" + suffix + "/0" + suffix;
- return v + (suffix == 'f' || suffix == 'F' ? "" + suffix : "");
- }
- private static String sourceForm(char c) {
- StringBuilder buf = new StringBuilder(8);
- buf.append('\'');
- sourceChar(c, buf);
- buf.append('\'');
- return buf.toString();
- }
- private static String sourceForm(byte c) {
- return "0x" + Integer.toString(c & 0xff, 16);
- }
- private static String sourceForm(String s) {
- StringBuilder buf = new StringBuilder(s.length() + 5);
- buf.append('\"');
- for (int i=0; i<s.length(); i++) {
- char c = s.charAt(i);
- sourceChar(c, buf);
- }
- buf.append('\"');
- return buf.toString();
- }
- private static void sourceChar(char c, StringBuilder buf) {
- switch (c) {
- case '\b': buf.append("\\b"); return;
- case '\t': buf.append("\\t"); return;
- case '\n': buf.append("\\n"); return;
- case '\f': buf.append("\\f"); return;
- case '\r': buf.append("\\r"); return;
- case '\"': buf.append("\\\""); return;
- case '\'': buf.append("\\\'"); return;
- case '\\': buf.append("\\\\"); return;
- default:
- if (isPrintableAscii(c)) {
- buf.append(c); return;
- }
- unicodeEscape(c, buf);
- return;
- }
- }
- private static void unicodeEscape(char c, StringBuilder buf) {
- final String chars = "0123456789abcdef";
- buf.append("\\u");
- buf.append(chars.charAt(15 & (c>>12)));
- buf.append(chars.charAt(15 & (c>>8)));
- buf.append(chars.charAt(15 & (c>>4)));
- buf.append(chars.charAt(15 & (c>>0)));
- }
- private static boolean isPrintableAscii(char c) {
- return c >= ' ' && c <= '~';
- }
-
- /**
- * Return true if this field is included in the active set.
- */
- public boolean isIncluded() {
- return containingClass().isIncluded() && env.shouldDocument(sym);
- }
-
- /**
- * Is this Doc item a field (but not an enum constant?
- */
- @Override
- public boolean isField() {
- return !isEnumConstant();
- }
-
- /**
- * Is this Doc item an enum constant?
- * (For legacy doclets, return false.)
- */
- @Override
- public boolean isEnumConstant() {
- return (getFlags() & Flags.ENUM) != 0 &&
- !env.legacyDoclet;
- }
-
- /**
- * Return true if this field is transient
- */
- public boolean isTransient() {
- return Modifier.isTransient(getModifiers());
- }
-
- /**
- * Return true if this field is volatile
- */
- public boolean isVolatile() {
- return Modifier.isVolatile(getModifiers());
- }
-
- /**
- * Returns true if this field was synthesized by the compiler.
- */
- public boolean isSynthetic() {
- return (getFlags() & Flags.SYNTHETIC) != 0;
- }
-
- /**
- * Return the serialField tags in this FieldDocImpl item.
- *
- * @return an array of <tt>SerialFieldTagImpl</tt> containing all
- * <code>@serialField</code> tags.
- */
- public SerialFieldTag[] serialFieldTags() {
- return comment().serialFieldTags();
- }
-
- public String name() {
- if (name == null) {
- name = sym.name.toString();
- }
- return name;
- }
-
- private String name;
-
- public String qualifiedName() {
- if (qualifiedName == null) {
- qualifiedName = sym.enclClass().getQualifiedName() + "." + name();
- }
- return qualifiedName;
- }
-
- private String qualifiedName;
-
- /**
- * Return the source position of the entity, or null if
- * no position is available.
- */
- @Override
- public SourcePosition position() {
- if (sym.enclClass().sourcefile == null) return null;
- return SourcePositionImpl.make(sym.enclClass().sourcefile,
- (tree==null) ? 0 : tree.pos,
- lineMap);
- }
-}
--- a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/JavaScriptScanner.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1104 +0,0 @@
-/*
- * Copyright (c) 2012,2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.javadoc.main;
-
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Locale;
-import java.util.Map;
-import java.util.Set;
-
-import com.sun.tools.javadoc.main.JavaScriptScanner.TagParser.Kind;
-
-import static com.sun.tools.javac.util.LayoutCharacters.EOI;
-
-/**
- * Parser to detect use of JavaScript in documentation comments.
- */
-@Deprecated(since="9", forRemoval=true)
-@SuppressWarnings("removal")
-public class JavaScriptScanner {
- public static interface Reporter {
- void report();
- }
-
- static class ParseException extends Exception {
- private static final long serialVersionUID = 0;
- ParseException(String key) {
- super(key);
- }
- }
-
- private Reporter reporter;
-
- /** The input buffer, index of most recent character read,
- * index of one past last character in buffer.
- */
- protected char[] buf;
- protected int bp;
- protected int buflen;
-
- /** The current character.
- */
- protected char ch;
-
- private boolean newline = true;
-
- Map<String, TagParser> tagParsers;
- Set<String> eventAttrs;
- Set<String> uriAttrs;
-
- public JavaScriptScanner() {
- initTagParsers();
- initEventAttrs();
- initURIAttrs();
- }
-
- public void parse(String comment, Reporter r) {
- reporter = r;
- String c = comment;
- buf = new char[c.length() + 1];
- c.getChars(0, c.length(), buf, 0);
- buf[buf.length - 1] = EOI;
- buflen = buf.length - 1;
- bp = -1;
- newline = true;
- nextChar();
-
- blockContent();
- blockTags();
- }
-
- private void checkHtmlTag(String tag) {
- if (tag.equalsIgnoreCase("script")) {
- reporter.report();
- }
- }
-
- private void checkHtmlAttr(String name, String value) {
- String n = name.toLowerCase(Locale.ENGLISH);
- if (eventAttrs.contains(n)
- || uriAttrs.contains(n)
- && value != null && value.toLowerCase(Locale.ENGLISH).trim().startsWith("javascript:")) {
- reporter.report();
- }
- }
-
- void nextChar() {
- ch = buf[bp < buflen ? ++bp : buflen];
- switch (ch) {
- case '\f': case '\n': case '\r':
- newline = true;
- }
- }
-
- /**
- * Read block content, consisting of text, html and inline tags.
- * Terminated by the end of input, or the beginning of the next block tag:
- * i.e. @ as the first non-whitespace character on a line.
- */
- @SuppressWarnings("fallthrough")
- protected void blockContent() {
-
- loop:
- while (bp < buflen) {
- switch (ch) {
- case '\n': case '\r': case '\f':
- newline = true;
- // fallthrough
-
- case ' ': case '\t':
- nextChar();
- break;
-
- case '&':
- entity(null);
- break;
-
- case '<':
- html();
- break;
-
- case '>':
- newline = false;
- nextChar();
- break;
-
- case '{':
- inlineTag(null);
- break;
-
- case '@':
- if (newline) {
- break loop;
- }
- // fallthrough
-
- default:
- newline = false;
- nextChar();
- }
- }
- }
-
- /**
- * Read a series of block tags, including their content.
- * Standard tags parse their content appropriately.
- * Non-standard tags are represented by {@link UnknownBlockTag}.
- */
- protected void blockTags() {
- while (ch == '@')
- blockTag();
- }
-
- /**
- * Read a single block tag, including its content.
- * Standard tags parse their content appropriately.
- * Non-standard tags are represented by {@link UnknownBlockTag}.
- */
- protected void blockTag() {
- int p = bp;
- try {
- nextChar();
- if (isIdentifierStart(ch)) {
- String name = readTagName();
- TagParser tp = tagParsers.get(name);
- if (tp == null) {
- blockContent();
- } else {
- switch (tp.getKind()) {
- case BLOCK:
- tp.parse(p);
- return;
- case INLINE:
- return;
- }
- }
- }
- blockContent();
- } catch (ParseException e) {
- blockContent();
- }
- }
-
- protected void inlineTag(Void list) {
- newline = false;
- nextChar();
- if (ch == '@') {
- inlineTag();
- }
- }
-
- /**
- * Read a single inline tag, including its content.
- * Standard tags parse their content appropriately.
- * Non-standard tags are represented by {@link UnknownBlockTag}.
- * Malformed tags may be returned as {@link Erroneous}.
- */
- protected void inlineTag() {
- int p = bp - 1;
- try {
- nextChar();
- if (isIdentifierStart(ch)) {
- String name = readTagName();
- TagParser tp = tagParsers.get(name);
-
- if (tp == null) {
- skipWhitespace();
- inlineText(WhitespaceRetentionPolicy.REMOVE_ALL);
- nextChar();
- } else {
- skipWhitespace();
- if (tp.getKind() == TagParser.Kind.INLINE) {
- tp.parse(p);
- } else { // handle block tags (ex: @see) in inline content
- inlineText(WhitespaceRetentionPolicy.REMOVE_ALL); // skip content
- nextChar();
- }
- }
- }
- } catch (ParseException e) {
- }
- }
-
- private static enum WhitespaceRetentionPolicy {
- RETAIN_ALL,
- REMOVE_FIRST_SPACE,
- REMOVE_ALL
- }
-
- /**
- * Read plain text content of an inline tag.
- * Matching pairs of { } are skipped; the text is terminated by the first
- * unmatched }. It is an error if the beginning of the next tag is detected.
- */
- private void inlineText(WhitespaceRetentionPolicy whitespacePolicy) throws ParseException {
- switch (whitespacePolicy) {
- case REMOVE_ALL:
- skipWhitespace();
- break;
- case REMOVE_FIRST_SPACE:
- if (ch == ' ')
- nextChar();
- break;
- case RETAIN_ALL:
- default:
- // do nothing
- break;
-
- }
- int pos = bp;
- int depth = 1;
-
- loop:
- while (bp < buflen) {
- switch (ch) {
- case '\n': case '\r': case '\f':
- newline = true;
- break;
-
- case ' ': case '\t':
- break;
-
- case '{':
- newline = false;
- depth++;
- break;
-
- case '}':
- if (--depth == 0) {
- return;
- }
- newline = false;
- break;
-
- case '@':
- if (newline)
- break loop;
- newline = false;
- break;
-
- default:
- newline = false;
- break;
- }
- nextChar();
- }
- throw new ParseException("dc.unterminated.inline.tag");
- }
-
- /**
- * Read Java class name, possibly followed by member
- * Matching pairs of {@literal < >} are skipped. The text is terminated by the first
- * unmatched }. It is an error if the beginning of the next tag is detected.
- */
- // TODO: boolean allowMember should be enum FORBID, ALLOW, REQUIRE
- // TODO: improve quality of parse to forbid bad constructions.
- // TODO: update to use ReferenceParser
- @SuppressWarnings("fallthrough")
- protected void reference(boolean allowMember) throws ParseException {
- int pos = bp;
- int depth = 0;
-
- // scan to find the end of the signature, by looking for the first
- // whitespace not enclosed in () or <>, or the end of the tag
- loop:
- while (bp < buflen) {
- switch (ch) {
- case '\n': case '\r': case '\f':
- newline = true;
- // fallthrough
-
- case ' ': case '\t':
- if (depth == 0)
- break loop;
- break;
-
- case '(':
- case '<':
- newline = false;
- depth++;
- break;
-
- case ')':
- case '>':
- newline = false;
- --depth;
- break;
-
- case '}':
- if (bp == pos)
- return;
- newline = false;
- break loop;
-
- case '@':
- if (newline)
- break loop;
- // fallthrough
-
- default:
- newline = false;
-
- }
- nextChar();
- }
-
- if (depth != 0)
- throw new ParseException("dc.unterminated.signature");
- }
-
- /**
- * Read Java identifier
- * Matching pairs of { } are skipped; the text is terminated by the first
- * unmatched }. It is an error if the beginning of the next tag is detected.
- */
- @SuppressWarnings("fallthrough")
- protected void identifier() throws ParseException {
- skipWhitespace();
- int pos = bp;
-
- if (isJavaIdentifierStart(ch)) {
- readJavaIdentifier();
- return;
- }
-
- throw new ParseException("dc.identifier.expected");
- }
-
- /**
- * Read a quoted string.
- * It is an error if the beginning of the next tag is detected.
- */
- @SuppressWarnings("fallthrough")
- protected void quotedString() {
- int pos = bp;
- nextChar();
-
- loop:
- while (bp < buflen) {
- switch (ch) {
- case '\n': case '\r': case '\f':
- newline = true;
- break;
-
- case ' ': case '\t':
- break;
-
- case '"':
- nextChar();
- // trim trailing white-space?
- return;
-
- case '@':
- if (newline)
- break loop;
-
- }
- nextChar();
- }
- }
-
- /**
- * Read a term ie. one word.
- * It is an error if the beginning of the next tag is detected.
- */
- @SuppressWarnings("fallthrough")
- protected void inlineWord() {
- int pos = bp;
- int depth = 0;
- loop:
- while (bp < buflen) {
- switch (ch) {
- case '\n':
- newline = true;
- // fallthrough
-
- case '\r': case '\f': case ' ': case '\t':
- return;
-
- case '@':
- if (newline)
- break loop;
-
- case '{':
- depth++;
- break;
-
- case '}':
- if (depth == 0 || --depth == 0)
- return;
- break;
- }
- newline = false;
- nextChar();
- }
- }
-
- /**
- * Read general text content of an inline tag, including HTML entities and elements.
- * Matching pairs of { } are skipped; the text is terminated by the first
- * unmatched }. It is an error if the beginning of the next tag is detected.
- */
- @SuppressWarnings("fallthrough")
- private void inlineContent() {
-
- skipWhitespace();
- int pos = bp;
- int depth = 1;
-
- loop:
- while (bp < buflen) {
-
- switch (ch) {
- case '\n': case '\r': case '\f':
- newline = true;
- // fall through
-
- case ' ': case '\t':
- nextChar();
- break;
-
- case '&':
- entity(null);
- break;
-
- case '<':
- newline = false;
- html();
- break;
-
- case '{':
- newline = false;
- depth++;
- nextChar();
- break;
-
- case '}':
- newline = false;
- if (--depth == 0) {
- nextChar();
- return;
- }
- nextChar();
- break;
-
- case '@':
- if (newline)
- break loop;
- // fallthrough
-
- default:
- nextChar();
- break;
- }
- }
-
- }
-
- protected void entity(Void list) {
- newline = false;
- entity();
- }
-
- /**
- * Read an HTML entity.
- * {@literal &identifier; } or {@literal &#digits; } or {@literal &#xhex-digits; }
- */
- protected void entity() {
- nextChar();
- String name = null;
- if (ch == '#') {
- int namep = bp;
- nextChar();
- if (isDecimalDigit(ch)) {
- nextChar();
- while (isDecimalDigit(ch))
- nextChar();
- name = new String(buf, namep, bp - namep);
- } else if (ch == 'x' || ch == 'X') {
- nextChar();
- if (isHexDigit(ch)) {
- nextChar();
- while (isHexDigit(ch))
- nextChar();
- name = new String(buf, namep, bp - namep);
- }
- }
- } else if (isIdentifierStart(ch)) {
- name = readIdentifier();
- }
-
- if (name != null) {
- if (ch != ';')
- return;
- nextChar();
- }
- }
-
- /**
- * Read the start or end of an HTML tag, or an HTML comment
- * {@literal <identifier attrs> } or {@literal </identifier> }
- */
- protected void html() {
- int p = bp;
- nextChar();
- if (isIdentifierStart(ch)) {
- String name = readIdentifier();
- checkHtmlTag(name);
- htmlAttrs();
- if (ch == '/') {
- nextChar();
- }
- if (ch == '>') {
- nextChar();
- return;
- }
- } else if (ch == '/') {
- nextChar();
- if (isIdentifierStart(ch)) {
- readIdentifier();
- skipWhitespace();
- if (ch == '>') {
- nextChar();
- return;
- }
- }
- } else if (ch == '!') {
- nextChar();
- if (ch == '-') {
- nextChar();
- if (ch == '-') {
- nextChar();
- while (bp < buflen) {
- int dash = 0;
- while (ch == '-') {
- dash++;
- nextChar();
- }
- // Strictly speaking, a comment should not contain "--"
- // so dash > 2 is an error, dash == 2 implies ch == '>'
- // See http://www.w3.org/TR/html-markup/syntax.html#syntax-comments
- // for more details.
- if (dash >= 2 && ch == '>') {
- nextChar();
- return;
- }
-
- nextChar();
- }
- }
- }
- }
-
- bp = p + 1;
- ch = buf[bp];
- }
-
- /**
- * Read a series of HTML attributes, terminated by {@literal > }.
- * Each attribute is of the form {@literal identifier[=value] }.
- * "value" may be unquoted, single-quoted, or double-quoted.
- */
- protected void htmlAttrs() {
- skipWhitespace();
-
- loop:
- while (isIdentifierStart(ch)) {
- int namePos = bp;
- String name = readAttributeName();
- skipWhitespace();
- StringBuilder value = new StringBuilder();
- if (ch == '=') {
- nextChar();
- skipWhitespace();
- if (ch == '\'' || ch == '"') {
- char quote = ch;
- nextChar();
- while (bp < buflen && ch != quote) {
- if (newline && ch == '@') {
- // No point trying to read more.
- // In fact, all attrs get discarded by the caller
- // and superseded by a malformed.html node because
- // the html tag itself is not terminated correctly.
- break loop;
- }
- value.append(ch);
- nextChar();
- }
- nextChar();
- } else {
- while (bp < buflen && !isUnquotedAttrValueTerminator(ch)) {
- value.append(ch);
- nextChar();
- }
- }
- skipWhitespace();
- }
- checkHtmlAttr(name, value.toString());
- }
- }
-
- protected void attrValueChar(Void list) {
- switch (ch) {
- case '&':
- entity(list);
- break;
-
- case '{':
- inlineTag(list);
- break;
-
- default:
- nextChar();
- }
- }
-
- protected boolean isIdentifierStart(char ch) {
- return Character.isUnicodeIdentifierStart(ch);
- }
-
- protected String readIdentifier() {
- int start = bp;
- nextChar();
- while (bp < buflen && Character.isUnicodeIdentifierPart(ch))
- nextChar();
- return new String(buf, start, bp - start);
- }
-
- protected String readAttributeName() {
- int start = bp;
- nextChar();
- while (bp < buflen && (Character.isUnicodeIdentifierPart(ch) || ch == '-'))
- nextChar();
- return new String(buf, start, bp - start);
- }
-
- protected String readTagName() {
- int start = bp;
- nextChar();
- while (bp < buflen
- && (Character.isUnicodeIdentifierPart(ch) || ch == '.'
- || ch == '-' || ch == ':')) {
- nextChar();
- }
- return new String(buf, start, bp - start);
- }
-
- protected boolean isJavaIdentifierStart(char ch) {
- return Character.isJavaIdentifierStart(ch);
- }
-
- protected String readJavaIdentifier() {
- int start = bp;
- nextChar();
- while (bp < buflen && Character.isJavaIdentifierPart(ch))
- nextChar();
- return new String(buf, start, bp - start);
- }
-
- protected boolean isDecimalDigit(char ch) {
- return ('0' <= ch && ch <= '9');
- }
-
- protected boolean isHexDigit(char ch) {
- return ('0' <= ch && ch <= '9')
- || ('a' <= ch && ch <= 'f')
- || ('A' <= ch && ch <= 'F');
- }
-
- protected boolean isUnquotedAttrValueTerminator(char ch) {
- switch (ch) {
- case '\f': case '\n': case '\r': case '\t':
- case ' ':
- case '"': case '\'': case '`':
- case '=': case '<': case '>':
- return true;
- default:
- return false;
- }
- }
-
- protected boolean isWhitespace(char ch) {
- return Character.isWhitespace(ch);
- }
-
- protected void skipWhitespace() {
- while (isWhitespace(ch)) {
- nextChar();
- }
- }
-
- /**
- * @param start position of first character of string
- * @param end position of character beyond last character to be included
- */
- String newString(int start, int end) {
- return new String(buf, start, end - start);
- }
-
- static abstract class TagParser {
- enum Kind { INLINE, BLOCK }
-
- final Kind kind;
- final String name;
-
-
- TagParser(Kind k, String tk) {
- kind = k;
- name = tk;
- }
-
- TagParser(Kind k, String tk, boolean retainWhiteSpace) {
- this(k, tk);
- }
-
- Kind getKind() {
- return kind;
- }
-
- String getName() {
- return name;
- }
-
- abstract void parse(int pos) throws ParseException;
- }
-
- /**
- * @see <a href="http://docs.oracle.com/javase/8/docs/technotes/tools/unix/javadoc.html#CHDJGIJB">Javadoc Tags</a>
- */
- @SuppressWarnings("deprecation")
- private void initTagParsers() {
- TagParser[] parsers = {
- // @author name-text
- new TagParser(Kind.BLOCK, "author") {
- @Override
- public void parse(int pos) {
- blockContent();
- }
- },
-
- // {@code text}
- new TagParser(Kind.INLINE, "code", true) {
- @Override
- public void parse(int pos) throws ParseException {
- inlineText(WhitespaceRetentionPolicy.REMOVE_FIRST_SPACE);
- nextChar();
- }
- },
-
- // @deprecated deprecated-text
- new TagParser(Kind.BLOCK, "deprecated") {
- @Override
- public void parse(int pos) {
- blockContent();
- }
- },
-
- // {@docRoot}
- new TagParser(Kind.INLINE, "docRoot") {
- @Override
- public void parse(int pos) throws ParseException {
- if (ch == '}') {
- nextChar();
- return;
- }
- inlineText(WhitespaceRetentionPolicy.REMOVE_ALL); // skip unexpected content
- nextChar();
- throw new ParseException("dc.unexpected.content");
- }
- },
-
- // @exception class-name description
- new TagParser(Kind.BLOCK, "exception") {
- @Override
- public void parse(int pos) throws ParseException {
- skipWhitespace();
- reference(false);
- blockContent();
- }
- },
-
- // @hidden hidden-text
- new TagParser(Kind.BLOCK, "hidden") {
- @Override
- public void parse(int pos) {
- blockContent();
- }
- },
-
- // @index search-term options-description
- new TagParser(Kind.INLINE, "index") {
- @Override
- public void parse(int pos) throws ParseException {
- skipWhitespace();
- if (ch == '}') {
- throw new ParseException("dc.no.content");
- }
- if (ch == '"') quotedString(); else inlineWord();
- skipWhitespace();
- if (ch != '}') {
- inlineContent();
- } else {
- nextChar();
- }
- }
- },
-
- // {@inheritDoc}
- new TagParser(Kind.INLINE, "inheritDoc") {
- @Override
- public void parse(int pos) throws ParseException {
- if (ch == '}') {
- nextChar();
- return;
- }
- inlineText(WhitespaceRetentionPolicy.REMOVE_ALL); // skip unexpected content
- nextChar();
- throw new ParseException("dc.unexpected.content");
- }
- },
-
- // {@link package.class#member label}
- new TagParser(Kind.INLINE, "link") {
- @Override
- public void parse(int pos) throws ParseException {
- reference(true);
- inlineContent();
- }
- },
-
- // {@linkplain package.class#member label}
- new TagParser(Kind.INLINE, "linkplain") {
- @Override
- public void parse(int pos) throws ParseException {
- reference(true);
- inlineContent();
- }
- },
-
- // {@literal text}
- new TagParser(Kind.INLINE, "literal", true) {
- @Override
- public void parse(int pos) throws ParseException {
- inlineText(WhitespaceRetentionPolicy.REMOVE_FIRST_SPACE);
- nextChar();
- }
- },
-
- // @param parameter-name description
- new TagParser(Kind.BLOCK, "param") {
- @Override
- public void parse(int pos) throws ParseException {
- skipWhitespace();
-
- boolean typaram = false;
- if (ch == '<') {
- typaram = true;
- nextChar();
- }
-
- identifier();
-
- if (typaram) {
- if (ch != '>')
- throw new ParseException("dc.gt.expected");
- nextChar();
- }
-
- skipWhitespace();
- blockContent();
- }
- },
-
- // @return description
- new TagParser(Kind.BLOCK, "return") {
- @Override
- public void parse(int pos) {
- blockContent();
- }
- },
-
- // @see reference | quoted-string | HTML
- new TagParser(Kind.BLOCK, "see") {
- @Override
- public void parse(int pos) throws ParseException {
- skipWhitespace();
- switch (ch) {
- case '"':
- quotedString();
- skipWhitespace();
- if (ch == '@'
- || ch == EOI && bp == buf.length - 1) {
- return;
- }
- break;
-
- case '<':
- blockContent();
- return;
-
- case '@':
- if (newline)
- throw new ParseException("dc.no.content");
- break;
-
- case EOI:
- if (bp == buf.length - 1)
- throw new ParseException("dc.no.content");
- break;
-
- default:
- if (isJavaIdentifierStart(ch) || ch == '#') {
- reference(true);
- blockContent();
- }
- }
- throw new ParseException("dc.unexpected.content");
- }
- },
-
- // @serialData data-description
- new TagParser(Kind.BLOCK, "@serialData") {
- @Override
- public void parse(int pos) {
- blockContent();
- }
- },
-
- // @serialField field-name field-type description
- new TagParser(Kind.BLOCK, "serialField") {
- @Override
- public void parse(int pos) throws ParseException {
- skipWhitespace();
- identifier();
- skipWhitespace();
- reference(false);
- if (isWhitespace(ch)) {
- skipWhitespace();
- blockContent();
- }
- }
- },
-
- // @serial field-description | include | exclude
- new TagParser(Kind.BLOCK, "serial") {
- @Override
- public void parse(int pos) {
- blockContent();
- }
- },
-
- // @since since-text
- new TagParser(Kind.BLOCK, "since") {
- @Override
- public void parse(int pos) {
- blockContent();
- }
- },
-
- // @throws class-name description
- new TagParser(Kind.BLOCK, "throws") {
- @Override
- public void parse(int pos) throws ParseException {
- skipWhitespace();
- reference(false);
- blockContent();
- }
- },
-
- // {@value package.class#field}
- new TagParser(Kind.INLINE, "value") {
- @Override
- public void parse(int pos) throws ParseException {
- reference(true);
- skipWhitespace();
- if (ch == '}') {
- nextChar();
- return;
- }
- nextChar();
- throw new ParseException("dc.unexpected.content");
- }
- },
-
- // @version version-text
- new TagParser(Kind.BLOCK, "version") {
- @Override
- public void parse(int pos) {
- blockContent();
- }
- },
- };
-
- tagParsers = new HashMap<>();
- for (TagParser p: parsers)
- tagParsers.put(p.getName(), p);
-
- }
-
- private void initEventAttrs() {
- eventAttrs = new HashSet<>(Arrays.asList(
- // See https://www.w3.org/TR/html-markup/global-attributes.html#common.attrs.event-handler
- "onabort", "onblur", "oncanplay", "oncanplaythrough",
- "onchange", "onclick", "oncontextmenu", "ondblclick",
- "ondrag", "ondragend", "ondragenter", "ondragleave",
- "ondragover", "ondragstart", "ondrop", "ondurationchange",
- "onemptied", "onended", "onerror", "onfocus", "oninput",
- "oninvalid", "onkeydown", "onkeypress", "onkeyup",
- "onload", "onloadeddata", "onloadedmetadata", "onloadstart",
- "onmousedown", "onmousemove", "onmouseout", "onmouseover",
- "onmouseup", "onmousewheel", "onpause", "onplay",
- "onplaying", "onprogress", "onratechange", "onreadystatechange",
- "onreset", "onscroll", "onseeked", "onseeking",
- "onselect", "onshow", "onstalled", "onsubmit", "onsuspend",
- "ontimeupdate", "onvolumechange", "onwaiting",
-
- // See https://www.w3.org/TR/html4/sgml/dtd.html
- // Most of the attributes that take a %Script are also defined as event handlers
- // in HTML 5. The one exception is onunload.
- // "onchange", "onclick", "ondblclick", "onfocus",
- // "onkeydown", "onkeypress", "onkeyup", "onload",
- // "onmousedown", "onmousemove", "onmouseout", "onmouseover",
- // "onmouseup", "onreset", "onselect", "onsubmit",
- "onunload"
- ));
- }
-
- private void initURIAttrs() {
- uriAttrs = new HashSet<>(Arrays.asList(
- // See https://www.w3.org/TR/html4/sgml/dtd.html
- // https://www.w3.org/TR/html5/
- // These are all the attributes that take a %URI or a valid URL potentially surrounded
- // by spaces
- "action", "cite", "classid", "codebase", "data",
- "datasrc", "for", "href", "longdesc", "profile",
- "src", "usemap"
- ));
- }
-
-}
--- a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/JavadocClassFinder.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,89 +0,0 @@
-/*
- * Copyright (c) 2001, 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.
- */
-
-package com.sun.tools.javadoc.main;
-
-import java.util.EnumSet;
-import javax.tools.JavaFileObject;
-
-import com.sun.tools.javac.code.Symbol.PackageSymbol;
-import com.sun.tools.javac.code.ClassFinder;
-import com.sun.tools.javac.util.Context;
-import com.sun.tools.javac.util.Context.Factory;
-
-/** Javadoc uses an extended class finder that records package.html entries
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- *
- * @author Neal Gafter
- */
-@Deprecated(since="9", forRemoval=true)
-@SuppressWarnings("removal")
-public class JavadocClassFinder extends ClassFinder {
-
- public static JavadocClassFinder instance(Context context) {
- ClassFinder instance = context.get(classFinderKey);
- if (instance == null)
- instance = new JavadocClassFinder(context);
- return (JavadocClassFinder)instance;
- }
-
- public static void preRegister(Context context) {
- context.put(classFinderKey, (Factory<ClassFinder>)JavadocClassFinder::new);
- }
-
- private DocEnv docenv;
- private EnumSet<JavaFileObject.Kind> all = EnumSet.of(JavaFileObject.Kind.CLASS,
- JavaFileObject.Kind.SOURCE,
- JavaFileObject.Kind.HTML);
- private EnumSet<JavaFileObject.Kind> noSource = EnumSet.of(JavaFileObject.Kind.CLASS,
- JavaFileObject.Kind.HTML);
-
- public JavadocClassFinder(Context context) {
- super(context);
- docenv = DocEnv.instance(context);
- preferSource = true;
- }
-
- /**
- * Override getPackageFileKinds to include search for package.html
- */
- @Override
- protected EnumSet<JavaFileObject.Kind> getPackageFileKinds() {
- return docenv.docClasses ? noSource : all;
- }
-
- /**
- * Override extraFileActions to check for package documentation
- */
- @Override
- protected void extraFileActions(PackageSymbol pack, JavaFileObject fo) {
- if (fo.isNameCompatible("package", JavaFileObject.Kind.HTML))
- docenv.getPackageDoc(pack).setDocPath(fo);
- }
-}
--- a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/JavadocEnter.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,111 +0,0 @@
-/*
- * Copyright (c) 2001, 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.
- */
-
-package com.sun.tools.javadoc.main;
-
-import javax.tools.JavaFileObject;
-
-import com.sun.source.util.TreePath;
-import com.sun.tools.javac.code.Symbol.*;
-import com.sun.tools.javac.comp.Enter;
-import com.sun.tools.javac.tree.JCTree.*;
-import com.sun.tools.javac.util.Context;
-import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
-import com.sun.tools.javac.util.List;
-
-import static com.sun.tools.javac.code.Kinds.Kind.*;
-import com.sun.tools.javac.main.JavaCompiler;
-
-/**
- * Javadoc's own enter phase does a few things above and beyond that
- * done by javac.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- *
- * @author Neal Gafter
- */
-@Deprecated(since="9", forRemoval=true)
-@SuppressWarnings("removal")
-public class JavadocEnter extends Enter {
- public static JavadocEnter instance(Context context) {
- Enter instance = context.get(enterKey);
- if (instance == null)
- instance = new JavadocEnter(context);
- return (JavadocEnter)instance;
- }
-
- public static void preRegister(Context context) {
- context.put(enterKey, (Context.Factory<Enter>)JavadocEnter::new);
- }
-
- protected JavadocEnter(Context context) {
- super(context);
- messager = Messager.instance0(context);
- docenv = DocEnv.instance(context);
- compiler = JavaCompiler.instance(context);
- }
-
- final Messager messager;
- final DocEnv docenv;
- final JavaCompiler compiler;
-
- @Override
- public void main(List<JCCompilationUnit> trees) {
- // count all Enter errors as warnings.
- int nerrors = messager.nerrors;
- super.main(trees);
- compiler.enterDone();
- messager.nwarnings += (messager.nerrors - nerrors);
- messager.nerrors = nerrors;
- }
-
- @Override
- public void visitTopLevel(JCCompilationUnit tree) {
- super.visitTopLevel(tree);
- if (tree.sourcefile.isNameCompatible("package-info", JavaFileObject.Kind.SOURCE)) {
- JCPackageDecl pd = tree.getPackage();
- TreePath tp = pd == null ? docenv.getTreePath(tree) : docenv.getTreePath(tree, pd);
- docenv.makePackageDoc(tree.packge, tp);
- }
- }
-
- @Override
- public void visitClassDef(JCClassDecl tree) {
- super.visitClassDef(tree);
- if (tree.sym == null) return;
- if (tree.sym.kind == TYP || tree.sym.kind == ERR) {
- ClassSymbol c = tree.sym;
- docenv.makeClassDoc(c, docenv.getTreePath(env.toplevel, tree));
- }
- }
-
- /** Don't complain about a duplicate class. */
- @Override
- protected void duplicateClass(DiagnosticPosition pos, ClassSymbol c) {}
-
-}
--- a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/JavadocMemberEnter.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,207 +0,0 @@
-/*
- * Copyright (c) 2003, 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.
- */
-
-package com.sun.tools.javadoc.main;
-
-import com.sun.source.util.TreePath;
-import com.sun.tools.javac.code.Flags;
-import com.sun.tools.javac.code.Symbol.*;
-import com.sun.tools.javac.comp.MemberEnter;
-import com.sun.tools.javac.tree.JCTree;
-import com.sun.tools.javac.tree.JCTree.*;
-import com.sun.tools.javac.util.Context;
-
-import static com.sun.tools.javac.code.Flags.*;
-import static com.sun.tools.javac.code.Kinds.Kind.*;
-
-/**
- * Javadoc's own memberEnter phase does a few things above and beyond that
- * done by javac.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- *
- * @author Neal Gafter
- */
-@Deprecated(since="9", forRemoval=true)
-@SuppressWarnings("removal")
-public class JavadocMemberEnter extends MemberEnter {
- public static JavadocMemberEnter instance0(Context context) {
- MemberEnter instance = context.get(memberEnterKey);
- if (instance == null)
- instance = new JavadocMemberEnter(context);
- return (JavadocMemberEnter)instance;
- }
-
- public static void preRegister(Context context) {
- context.put(memberEnterKey, (Context.Factory<MemberEnter>)JavadocMemberEnter::new);
- }
-
- final DocEnv docenv;
-
- protected JavadocMemberEnter(Context context) {
- super(context);
- docenv = DocEnv.instance(context);
- }
-
- @Override
- public void visitMethodDef(JCMethodDecl tree) {
- super.visitMethodDef(tree);
- MethodSymbol meth = tree.sym;
- if (meth == null || meth.kind != MTH) return;
- TreePath treePath = docenv.getTreePath(env.toplevel, env.enclClass, tree);
- if (meth.isConstructor())
- docenv.makeConstructorDoc(meth, treePath);
- else if (isAnnotationTypeElement(meth))
- docenv.makeAnnotationTypeElementDoc(meth, treePath);
- else
- docenv.makeMethodDoc(meth, treePath);
-
- // release resources
- tree.body = null;
- }
-
- @Override
- public void visitVarDef(JCVariableDecl tree) {
- if (tree.init != null) {
- boolean isFinal = (tree.mods.flags & FINAL) != 0
- || (env.enclClass.mods.flags & INTERFACE) != 0;
- if (!isFinal || containsNonConstantExpression(tree.init)) {
- // Avoid unnecessary analysis and release resources.
- // In particular, remove non-constant expressions
- // which may trigger Attr.attribClass, since
- // method bodies are also removed, in visitMethodDef.
- tree.init = null;
- }
- }
- super.visitVarDef(tree);
- if (tree.sym != null &&
- tree.sym.kind == VAR &&
- !isParameter(tree.sym)) {
- docenv.makeFieldDoc(tree.sym, docenv.getTreePath(env.toplevel, env.enclClass, tree));
- }
- }
-
- private static boolean isAnnotationTypeElement(MethodSymbol meth) {
- return ClassDocImpl.isAnnotationType(meth.enclClass());
- }
-
- private static boolean isParameter(VarSymbol var) {
- return (var.flags() & Flags.PARAMETER) != 0;
- }
-
- /**
- * Simple analysis of an expression tree to see if it contains tree nodes
- * for any non-constant expression. This does not include checking references
- * to other fields which may or may not be constant.
- */
- private static boolean containsNonConstantExpression(JCExpression tree) {
- return new MaybeConstantExpressionScanner().containsNonConstantExpression(tree);
- }
-
- /**
- * See JLS 15.18, Constant Expression
- */
- private static class MaybeConstantExpressionScanner extends JCTree.Visitor {
- boolean maybeConstantExpr = true;
-
- public boolean containsNonConstantExpression(JCExpression tree) {
- scan(tree);
- return !maybeConstantExpr;
- }
-
- public void scan(JCTree tree) {
- // short circuit scan when end result is definitely false
- if (maybeConstantExpr && tree != null)
- tree.accept(this);
- }
-
- @Override
- /** default for any non-overridden visit method. */
- public void visitTree(JCTree tree) {
- maybeConstantExpr = false;
- }
-
- @Override
- public void visitBinary(JCBinary tree) {
- switch (tree.getTag()) {
- case MUL: case DIV: case MOD:
- case PLUS: case MINUS:
- case SL: case SR: case USR:
- case LT: case LE: case GT: case GE:
- case EQ: case NE:
- case BITAND: case BITXOR: case BITOR:
- case AND: case OR:
- break;
- default:
- maybeConstantExpr = false;
- }
- }
-
- @Override
- public void visitConditional(JCConditional tree) {
- scan(tree.cond);
- scan(tree.truepart);
- scan(tree.falsepart);
- }
-
- @Override
- public void visitIdent(JCIdent tree) { }
-
- @Override
- public void visitLiteral(JCLiteral tree) { }
-
- @Override
- public void visitParens(JCParens tree) {
- scan(tree.expr);
- }
-
- @Override
- public void visitSelect(JCTree.JCFieldAccess tree) {
- scan(tree.selected);
- }
-
- @Override
- public void visitTypeCast(JCTypeCast tree) {
- scan(tree.clazz);
- scan(tree.expr);
- }
-
- @Override
- public void visitTypeIdent(JCPrimitiveTypeTree tree) { }
-
- @Override
- public void visitUnary(JCUnary tree) {
- switch (tree.getTag()) {
- case POS: case NEG: case COMPL: case NOT:
- break;
- default:
- maybeConstantExpr = false;
- }
- }
- }
-}
--- a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/JavadocTodo.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,63 +0,0 @@
-/*
- * Copyright (c) 2003, 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.
- */
-
-package com.sun.tools.javadoc.main;
-
-import com.sun.tools.javac.comp.*;
-import com.sun.tools.javac.util.*;
-import com.sun.tools.javac.util.Context.Factory;
-
-/**
- * Javadoc's own todo queue doesn't queue its inputs, as javadoc
- * doesn't perform attribution of method bodies or semantic checking.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- *
- * @author Neal Gafter
- */
-@Deprecated(since="9", forRemoval=true)
-@SuppressWarnings("removal")
-public class JavadocTodo extends Todo {
- public static void preRegister(Context context) {
- context.put(todoKey, (Factory<Todo>)JavadocTodo::new);
- }
-
- protected JavadocTodo(Context context) {
- super(context);
- }
-
- @Override
- public void append(Env<AttrContext> e) {
- // do nothing; Javadoc doesn't perform attribution.
- }
-
- @Override
- public boolean offer(Env<AttrContext> e) {
- return false;
- }
-}
--- a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/JavadocTool.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,440 +0,0 @@
-/*
- * Copyright (c) 2001, 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.
- */
-
-package com.sun.tools.javadoc.main;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.EnumSet;
-import java.util.HashSet;
-import java.util.LinkedHashMap;
-import java.util.LinkedHashSet;
-import java.util.Map;
-import java.util.Set;
-
-import javax.tools.JavaFileManager;
-import javax.tools.JavaFileManager.Location;
-import javax.tools.JavaFileObject;
-import javax.tools.StandardJavaFileManager;
-import javax.tools.StandardLocation;
-
-import com.sun.tools.javac.code.ClassFinder;
-import com.sun.tools.javac.code.Symbol.Completer;
-import com.sun.tools.javac.code.Symbol.ModuleSymbol;
-import com.sun.tools.javac.code.Symbol.PackageSymbol;
-import com.sun.tools.javac.comp.Enter;
-import com.sun.tools.javac.tree.JCTree;
-import com.sun.tools.javac.tree.JCTree.JCClassDecl;
-import com.sun.tools.javac.tree.JCTree.JCCompilationUnit;
-import com.sun.tools.javac.util.Abort;
-import com.sun.tools.javac.util.Context;
-import com.sun.tools.javac.util.List;
-import com.sun.tools.javac.util.ListBuffer;
-import com.sun.tools.javac.util.Name;
-
-
-/**
- * This class could be the main entry point for Javadoc when Javadoc is used as a
- * component in a larger software system. It provides operations to
- * construct a new javadoc processor, and to run it on a set of source
- * files.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- *
- * @author Neal Gafter
- */
-@Deprecated(since="9", forRemoval=true)
-@SuppressWarnings("removal")
-public class JavadocTool extends com.sun.tools.javac.main.JavaCompiler {
- DocEnv docenv;
-
- final Messager messager;
- final ClassFinder javadocFinder;
- final Enter javadocEnter;
- final Set<JavaFileObject> uniquefiles;
-
- /**
- * Construct a new JavaCompiler processor, using appropriately
- * extended phases of the underlying compiler.
- */
- protected JavadocTool(Context context) {
- super(context);
- messager = Messager.instance0(context);
- javadocFinder = JavadocClassFinder.instance(context);
- javadocEnter = JavadocEnter.instance(context);
- uniquefiles = new HashSet<>();
- }
-
- /**
- * For javadoc, the parser needs to keep comments. Overrides method from JavaCompiler.
- */
- @Override
- protected boolean keepComments() {
- return true;
- }
-
- /**
- * Construct a new javadoc tool.
- */
- public static JavadocTool make0(Context context) {
- // force the use of Javadoc's class finder
- JavadocClassFinder.preRegister(context);
-
- // force the use of Javadoc's own enter phase
- JavadocEnter.preRegister(context);
-
- // force the use of Javadoc's own member enter phase
- JavadocMemberEnter.preRegister(context);
-
- // force the use of Javadoc's own todo phase
- JavadocTodo.preRegister(context);
-
- // force the use of Messager as a Log
- Messager.instance0(context);
-
- return new JavadocTool(context);
- }
-
- public RootDocImpl getRootDocImpl(String doclocale,
- String encoding,
- ModifierFilter filter,
- List<String> args,
- List<String[]> options,
- Iterable<? extends JavaFileObject> fileObjects,
- boolean breakiterator,
- List<String> subPackages,
- List<String> excludedPackages,
- boolean docClasses,
- boolean legacyDoclet,
- boolean quiet) throws IOException {
- docenv = DocEnv.instance(context);
- docenv.showAccess = filter;
- docenv.quiet = quiet;
- docenv.breakiterator = breakiterator;
- docenv.setLocale(doclocale);
- docenv.setEncoding(encoding);
- docenv.docClasses = docClasses;
- docenv.legacyDoclet = legacyDoclet;
-
- javadocFinder.sourceCompleter = docClasses ? Completer.NULL_COMPLETER : sourceCompleter;
-
- if (docClasses) {
- // If -Xclasses is set, the args should be a series of class names
- for (String arg: args) {
- if (!isValidPackageName(arg)) // checks
- docenv.error(null, "main.illegal_class_name", arg);
- }
- if (messager.nerrors() != 0) {
- return null;
- }
- return new RootDocImpl(docenv, args, options);
- }
-
- ListBuffer<JCCompilationUnit> classTrees = new ListBuffer<>();
- Set<String> includedPackages = new LinkedHashSet<>();
-
- try {
- StandardJavaFileManager fm = docenv.fileManager instanceof StandardJavaFileManager
- ? (StandardJavaFileManager) docenv.fileManager : null;
- Set<String> packageNames = new LinkedHashSet<>();
- // Normally, the args should be a series of package names or file names.
- // Parse the files and collect the package names.
- for (String arg: args) {
- if (fm != null && arg.endsWith(".java") && new File(arg).exists()) {
- if (new File(arg).getName().equals("module-info.java")) {
- docenv.warning(null, "main.file_ignored", arg);
- } else {
- parse(fm.getJavaFileObjects(arg), classTrees, true);
- }
- } else if (isValidPackageName(arg)) {
- packageNames.add(arg);
- } else if (arg.endsWith(".java")) {
- if (fm == null)
- throw new IllegalArgumentException();
- else
- docenv.error(null, "main.file_not_found", arg);
- } else {
- docenv.error(null, "main.illegal_package_name", arg);
- }
- }
-
- // Parse file objects provide via the DocumentationTool API
- parse(fileObjects, classTrees, true);
-
- modules.initModules(classTrees.toList());
-
- // Build up the complete list of any packages to be documented
- Location location = modules.multiModuleMode ? StandardLocation.MODULE_SOURCE_PATH
- : docenv.fileManager.hasLocation(StandardLocation.SOURCE_PATH) ? StandardLocation.SOURCE_PATH
- : StandardLocation.CLASS_PATH;
-
- PackageTable t = new PackageTable(docenv.fileManager, location)
- .packages(packageNames)
- .subpackages(subPackages, excludedPackages);
-
- includedPackages = t.getIncludedPackages();
-
- // Parse the files in the packages to be documented
- ListBuffer<JCCompilationUnit> packageTrees = new ListBuffer<>();
- for (String packageName: includedPackages) {
- List<JavaFileObject> files = t.getFiles(packageName);
- docenv.notice("main.Loading_source_files_for_package", packageName);
-
- if (files.isEmpty())
- messager.warning(Messager.NOPOS, "main.no_source_files_for_package", packageName);
- parse(files, packageTrees, false);
- }
- modules.enter(packageTrees.toList(), null);
-
- if (messager.nerrors() != 0) {
- return null;
- }
-
- // Enter symbols for all files
- docenv.notice("main.Building_tree");
- javadocEnter.main(classTrees.toList().appendList(packageTrees.toList()));
- } catch (Abort ex) {}
-
- if (messager.nerrors() != 0)
- return null;
-
- return new RootDocImpl(docenv, listClasses(classTrees.toList()), List.from(includedPackages), options);
- }
-
- /** Is the given string a valid package name? */
- boolean isValidPackageName(String s) {
- int index;
- while ((index = s.indexOf('.')) != -1) {
- if (!isValidClassName(s.substring(0, index))) return false;
- s = s.substring(index+1);
- }
- return isValidClassName(s);
- }
-
- private void parse(Iterable<? extends JavaFileObject> files, ListBuffer<JCCompilationUnit> trees,
- boolean trace) {
- for (JavaFileObject fo: files) {
- if (uniquefiles.add(fo)) { // ignore duplicates
- if (trace)
- docenv.notice("main.Loading_source_file", fo.getName());
- trees.append(parse(fo));
- }
- }
- }
-
- /** Are surrogates supported?
- */
- final static boolean surrogatesSupported = surrogatesSupported();
- private static boolean surrogatesSupported() {
- try {
- boolean b = Character.isHighSurrogate('a');
- return true;
- } catch (NoSuchMethodError ex) {
- return false;
- }
- }
-
- /**
- * Return true if given file name is a valid class name
- * (including "package-info").
- * @param s the name of the class to check.
- * @return true if given class name is a valid class name
- * and false otherwise.
- */
- public static boolean isValidClassName(String s) {
- if (s.length() < 1) return false;
- if (s.equals("package-info")) return true;
- if (surrogatesSupported) {
- int cp = s.codePointAt(0);
- if (!Character.isJavaIdentifierStart(cp))
- return false;
- for (int j=Character.charCount(cp); j<s.length(); j+=Character.charCount(cp)) {
- cp = s.codePointAt(j);
- if (!Character.isJavaIdentifierPart(cp))
- return false;
- }
- } else {
- if (!Character.isJavaIdentifierStart(s.charAt(0)))
- return false;
- for (int j=1; j<s.length(); j++)
- if (!Character.isJavaIdentifierPart(s.charAt(j)))
- return false;
- }
- return true;
- }
-
- /**
- * From a list of top level trees, return the list of contained class definitions
- */
- List<JCClassDecl> listClasses(List<JCCompilationUnit> trees) {
- ListBuffer<JCClassDecl> result = new ListBuffer<>();
- for (JCCompilationUnit t : trees) {
- for (JCTree def : t.defs) {
- if (def.hasTag(JCTree.Tag.CLASSDEF))
- result.append((JCClassDecl)def);
- }
- }
- return result.toList();
- }
-
- /**
- * A table to manage included and excluded packages.
- */
- class PackageTable {
- private final Map<String, Entry> entries = new LinkedHashMap<>();
- private final Set<String> includedPackages = new LinkedHashSet<>();
- private final JavaFileManager fm;
- private final Location location;
- private final Set<JavaFileObject.Kind> sourceKinds = EnumSet.of(JavaFileObject.Kind.SOURCE);
-
- /**
- * Creates a table to manage included and excluded packages.
- * @param fm The file manager used to locate source files
- * @param locn the location used to locate source files
- */
- PackageTable(JavaFileManager fm, Location locn) {
- this.fm = fm;
- this.location = locn;
- getEntry("").excluded = false;
- }
-
- PackageTable packages(Collection<String> packageNames) {
- includedPackages.addAll(packageNames);
- return this;
- }
-
- PackageTable subpackages(Collection<String> packageNames, Collection<String> excludePackageNames)
- throws IOException {
- for (String p: excludePackageNames) {
- getEntry(p).excluded = true;
- }
-
- for (String packageName: packageNames) {
- Location packageLocn = getLocation(packageName);
- for (JavaFileObject fo: fm.list(packageLocn, packageName, sourceKinds, true)) {
- String binaryName = fm.inferBinaryName(packageLocn, fo);
- String pn = getPackageName(binaryName);
- String simpleName = getSimpleName(binaryName);
- Entry e = getEntry(pn);
- if (!e.isExcluded() && isValidClassName(simpleName)) {
- includedPackages.add(pn);
- e.files = (e.files == null ? List.of(fo) : e.files.prepend(fo));
- }
- }
- }
- return this;
- }
-
- /**
- * Returns the aggregate set of included packages.
- * @return the aggregate set of included packages
- */
- Set<String> getIncludedPackages() {
- return includedPackages;
- }
-
- /**
- * Returns the set of source files for a package.
- * @param packageName the specified package
- * @return the set of file objects for the specified package
- * @throws IOException if an error occurs while accessing the files
- */
- List<JavaFileObject> getFiles(String packageName) throws IOException {
- Entry e = getEntry(packageName);
- // The files may have been found as a side effect of searching for subpackages
- if (e.files != null)
- return e.files;
-
- ListBuffer<JavaFileObject> lb = new ListBuffer<>();
- Location packageLocn = getLocation(packageName);
- for (JavaFileObject fo: fm.list(packageLocn, packageName, sourceKinds, false)) {
- String binaryName = fm.inferBinaryName(packageLocn, fo);
- String simpleName = getSimpleName(binaryName);
- if (isValidClassName(simpleName)) {
- lb.append(fo);
- }
- }
-
- return lb.toList();
- }
-
- private Location getLocation(String packageName) throws IOException {
- if (location == StandardLocation.MODULE_SOURCE_PATH) {
- // TODO: handle invalid results
- Name pack = names.fromString(packageName);
-
- for (ModuleSymbol msym : modules.allModules()) {
- PackageSymbol p = syms.getPackage(msym, pack);
- if (p != null && !p.members().isEmpty()) {
- return fm.getLocationForModule(location, msym.name.toString());
- }
- }
-
- return null;
- } else {
- return location;
- }
- }
-
- private Entry getEntry(String name) {
- Entry e = entries.get(name);
- if (e == null)
- entries.put(name, e = new Entry(name));
- return e;
- }
-
- private String getPackageName(String name) {
- int lastDot = name.lastIndexOf(".");
- return (lastDot == -1 ? "" : name.substring(0, lastDot));
- }
-
- private String getSimpleName(String name) {
- int lastDot = name.lastIndexOf(".");
- return (lastDot == -1 ? name : name.substring(lastDot + 1));
- }
-
- class Entry {
- final String name;
- Boolean excluded;
- List<JavaFileObject> files;
-
- Entry(String name) {
- this.name = name;
- }
-
- boolean isExcluded() {
- if (excluded == null)
- excluded = getEntry(getPackageName(name)).isExcluded();
- return excluded;
- }
- }
- }
-
-}
--- a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/MemberDocImpl.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,69 +0,0 @@
-/*
- * Copyright (c) 1997, 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.
- */
-
-package com.sun.tools.javadoc.main;
-
-import com.sun.javadoc.*;
-
-import com.sun.source.util.TreePath;
-import com.sun.tools.javac.code.Symbol;
-
-/**
- * Represents a member of a java class: field, constructor, or method.
- * This is an abstract class dealing with information common to
- * method, constructor and field members. Class members of a class
- * (nested classes) are represented instead by ClassDocImpl.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- *
- * @see MethodDocImpl
- * @see FieldDocImpl
- * @see ClassDocImpl
- *
- * @author Robert Field
- * @author Neal Gafter
- */
-
-@Deprecated(since="9", forRemoval=true)
-@SuppressWarnings("removal")
-public abstract class MemberDocImpl
- extends ProgramElementDocImpl
- implements MemberDoc {
-
- /**
- * constructor.
- */
- public MemberDocImpl(DocEnv env, Symbol sym, TreePath treePath) {
- super(env, sym, treePath);
- }
-
- /**
- * Returns true if this field was synthesized by the compiler.
- */
- public abstract boolean isSynthetic();
-}
--- a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/Messager.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,320 +0,0 @@
-/*
- * Copyright (c) 1997, 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.
- */
-
-package com.sun.tools.javadoc.main;
-
-import java.io.PrintWriter;
-import java.util.Locale;
-import java.util.ResourceBundle;
-
-import com.sun.javadoc.*;
-import com.sun.tools.javac.util.Context;
-import com.sun.tools.javac.util.Context.Factory;
-import com.sun.tools.javac.util.JCDiagnostic;
-import com.sun.tools.javac.util.JCDiagnostic.DiagnosticType;
-import com.sun.tools.javac.util.JavacMessages;
-import com.sun.tools.javac.util.Log;
-
-/**
- * Utility for integrating with javadoc tools and for localization.
- * Handle Resources. Access to error and warning counts.
- * Message formatting.
- * <br>
- * Also provides implementation for DocErrorReporter.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- *
- * @see java.util.ResourceBundle
- * @see java.text.MessageFormat
- * @author Neal Gafter (rewrite)
- */
-@Deprecated(since="9", forRemoval=true)
-@SuppressWarnings("removal")
-public class Messager extends Log implements DocErrorReporter {
- public static final SourcePosition NOPOS = null;
-
- /** Get the current messager, which is also the compiler log. */
- public static Messager instance0(Context context) {
- Log instance = context.get(logKey);
- if (instance == null || !(instance instanceof Messager))
- throw new InternalError("no messager instance!");
- return (Messager)instance;
- }
-
- public static void preRegister(Context context,
- final String programName) {
- context.put(logKey, (Factory<Log>)c -> new Messager(c, programName));
- }
- public static void preRegister(Context context,
- final String programName,
- final PrintWriter errWriter,
- final PrintWriter warnWriter,
- final PrintWriter noticeWriter) {
- context.put(logKey, (Factory<Log>)c -> new Messager(c,
- programName,
- errWriter,
- warnWriter,
- noticeWriter));
- }
-
- public class ExitJavadoc extends Error {
- private static final long serialVersionUID = 0;
- }
-
- final String programName;
-
- private Locale locale;
- private final JavacMessages messages;
- private final JCDiagnostic.Factory javadocDiags;
-
- /** The default writer for diagnostics
- */
- static final PrintWriter defaultErrWriter = new PrintWriter(System.err);
- static final PrintWriter defaultWarnWriter = new PrintWriter(System.err);
- static final PrintWriter defaultNoticeWriter = new PrintWriter(System.out);
-
- /**
- * Constructor
- * @param programName Name of the program (for error messages).
- */
- protected Messager(Context context, String programName) {
- this(context, programName, defaultErrWriter, defaultWarnWriter, defaultNoticeWriter);
- }
-
- /**
- * Constructor
- * @param programName Name of the program (for error messages).
- * @param errWriter Stream for error messages
- * @param warnWriter Stream for warnings
- * @param noticeWriter Stream for other messages
- */
- @SuppressWarnings("deprecation")
- protected Messager(Context context,
- String programName,
- PrintWriter errWriter,
- PrintWriter warnWriter,
- PrintWriter noticeWriter) {
- super(context, errWriter, warnWriter, noticeWriter);
- messages = JavacMessages.instance(context);
- messages.add(locale -> ResourceBundle.getBundle("com.sun.tools.javadoc.resources.javadoc",
- locale));
- javadocDiags = new JCDiagnostic.Factory(messages, "javadoc");
- this.programName = programName;
-
- }
-
- public void setLocale(Locale locale) {
- this.locale = locale;
- }
-
- /**
- * get and format message string from resource
- *
- * @param key selects message from resource
- * @param args arguments for the message
- */
- String getText(String key, Object... args) {
- return messages.getLocalizedString(locale, key, args);
- }
-
- /**
- * Print error message, increment error count.
- * Part of DocErrorReporter.
- *
- * @param msg message to print
- */
- public void printError(String msg) {
- printError(null, msg);
- }
-
- /**
- * Print error message, increment error count.
- * Part of DocErrorReporter.
- *
- * @param pos the position where the error occurs
- * @param msg message to print
- */
- public void printError(SourcePosition pos, String msg) {
- if (diagListener != null) {
- report(DiagnosticType.ERROR, pos, msg);
- return;
- }
-
- if (nerrors < MaxErrors) {
- String prefix = (pos == null) ? programName : pos.toString();
- PrintWriter errWriter = getWriter(WriterKind.ERROR);
- errWriter.println(prefix + ": " + getText("javadoc.error") + " - " + msg);
- errWriter.flush();
- prompt();
- nerrors++;
- }
- }
-
- /**
- * Print warning message, increment warning count.
- * Part of DocErrorReporter.
- *
- * @param msg message to print
- */
- public void printWarning(String msg) {
- printWarning(null, msg);
- }
-
- /**
- * Print warning message, increment warning count.
- * Part of DocErrorReporter.
- *
- * @param pos the position where the error occurs
- * @param msg message to print
- */
- public void printWarning(SourcePosition pos, String msg) {
- if (diagListener != null) {
- report(DiagnosticType.WARNING, pos, msg);
- return;
- }
-
- if (nwarnings < MaxWarnings) {
- String prefix = (pos == null) ? programName : pos.toString();
- PrintWriter warnWriter = getWriter(WriterKind.WARNING);
- warnWriter.println(prefix + ": " + getText("javadoc.warning") +" - " + msg);
- warnWriter.flush();
- nwarnings++;
- }
- }
-
- /**
- * Print a message.
- * Part of DocErrorReporter.
- *
- * @param msg message to print
- */
- public void printNotice(String msg) {
- printNotice(null, msg);
- }
-
- /**
- * Print a message.
- * Part of DocErrorReporter.
- *
- * @param pos the position where the error occurs
- * @param msg message to print
- */
- public void printNotice(SourcePosition pos, String msg) {
- if (diagListener != null) {
- report(DiagnosticType.NOTE, pos, msg);
- return;
- }
-
- PrintWriter noticeWriter = getWriter(WriterKind.NOTICE);
- if (pos == null)
- noticeWriter.println(msg);
- else
- noticeWriter.println(pos + ": " + msg);
- noticeWriter.flush();
- }
-
- /**
- * Print error message, increment error count.
- *
- * @param key selects message from resource
- */
- public void error(SourcePosition pos, String key, Object... args) {
- printError(pos, getText(key, args));
- }
-
- /**
- * Print warning message, increment warning count.
- *
- * @param key selects message from resource
- */
- public void warning(SourcePosition pos, String key, Object... args) {
- printWarning(pos, getText(key, args));
- }
-
- /**
- * Print a message.
- *
- * @param key selects message from resource
- */
- public void notice(String key, Object... args) {
- printNotice(getText(key, args));
- }
-
- /**
- * Return total number of errors, including those recorded
- * in the compilation log.
- */
- public int nerrors() { return nerrors; }
-
- /**
- * Return total number of warnings, including those recorded
- * in the compilation log.
- */
- public int nwarnings() { return nwarnings; }
-
- /**
- * Print exit message.
- */
- public void exitNotice() {
- if (nerrors > 0) {
- notice((nerrors > 1) ? "main.errors" : "main.error",
- "" + nerrors);
- }
- if (nwarnings > 0) {
- notice((nwarnings > 1) ? "main.warnings" : "main.warning",
- "" + nwarnings);
- }
- }
-
- /**
- * Force program exit, e.g., from a fatal error.
- * <p>
- * TODO: This method does not really belong here.
- */
- public void exit() {
- throw new ExitJavadoc();
- }
-
- private void report(DiagnosticType type, SourcePosition pos, String msg) {
- switch (type) {
- case ERROR:
- case WARNING:
- Object prefix = (pos == null) ? programName : pos;
- report(javadocDiags.create(type, null, null, "msg", prefix, msg));
- break;
-
- case NOTE:
- String key = (pos == null) ? "msg" : "pos.msg";
- report(javadocDiags.create(type, null, null, key, pos, msg));
- break;
-
- default:
- throw new IllegalArgumentException(type.toString());
- }
- }
-}
--- a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/MethodDocImpl.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,248 +0,0 @@
-/*
- * Copyright (c) 1997, 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.
- */
-
-package com.sun.tools.javadoc.main;
-
-import java.lang.reflect.Modifier;
-
-import com.sun.javadoc.*;
-import com.sun.source.util.TreePath;
-import com.sun.tools.javac.code.*;
-import com.sun.tools.javac.code.Symbol.*;
-import com.sun.tools.javac.code.Type;
-import static com.sun.tools.javac.code.TypeTag.CLASS;
-
-/**
- * Represents a method of a java class.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- *
- * @since 1.2
- * @author Robert Field
- * @author Neal Gafter (rewrite)
- */
-
-@Deprecated(since="9", forRemoval=true)
-@SuppressWarnings("removal")
-public class MethodDocImpl
- extends ExecutableMemberDocImpl implements MethodDoc {
-
- /**
- * constructor.
- */
- public MethodDocImpl(DocEnv env, MethodSymbol sym) {
- super(env, sym);
- }
-
- /**
- * constructor.
- */
- public MethodDocImpl(DocEnv env, MethodSymbol sym, TreePath treePath) {
- super(env, sym, treePath);
- }
-
- /**
- * Return true if it is a method, which it is.
- * Note: constructors are not methods.
- * This method is overridden by AnnotationTypeElementDocImpl.
- *
- * @return true
- */
- public boolean isMethod() {
- return true;
- }
-
- /**
- * Return true if this method is default
- */
- public boolean isDefault() {
- return (sym.flags() & Flags.DEFAULT) != 0;
- }
-
- /**
- * Return true if this method is abstract
- */
- public boolean isAbstract() {
- return (Modifier.isAbstract(getModifiers()) && !isDefault());
- }
-
- /**
- * Get return type.
- *
- * @return the return type of this method, null if it
- * is a constructor.
- */
- public com.sun.javadoc.Type returnType() {
- return TypeMaker.getType(env, sym.type.getReturnType(), false);
- }
-
- /**
- * Return the class that originally defined the method that
- * is overridden by the current definition, or null if no
- * such class exists.
- *
- * @return a ClassDocImpl representing the superclass that
- * originally defined this method, null if this method does
- * not override a definition in a superclass.
- */
- public ClassDoc overriddenClass() {
- com.sun.javadoc.Type t = overriddenType();
- return (t != null) ? t.asClassDoc() : null;
- }
-
- /**
- * Return the type containing the method that this method overrides.
- * It may be a <code>ClassDoc</code> or a <code>ParameterizedType</code>.
- */
- public com.sun.javadoc.Type overriddenType() {
-
- if ((sym.flags() & Flags.STATIC) != 0) {
- return null;
- }
-
- ClassSymbol origin = (ClassSymbol)sym.owner;
- for (Type t = env.types.supertype(origin.type);
- t.hasTag(CLASS);
- t = env.types.supertype(t)) {
- ClassSymbol c = (ClassSymbol)t.tsym;
- for (Symbol sym2 : membersOf(c).getSymbolsByName(sym.name)) {
- if (sym.overrides(sym2, origin, env.types, true)) {
- return TypeMaker.getType(env, t);
- }
- }
- }
- return null;
- }
-
- /**
- * Return the method that this method overrides.
- *
- * @return a MethodDoc representing a method definition
- * in a superclass this method overrides, null if
- * this method does not override.
- */
- public MethodDoc overriddenMethod() {
-
- // Real overriding only. Static members are simply hidden.
- // Likewise for constructors, but the MethodSymbol.overrides
- // method takes this into account.
- if ((sym.flags() & Flags.STATIC) != 0) {
- return null;
- }
-
- // Derived from com.sun.tools.javac.comp.Check.checkOverride .
-
- ClassSymbol origin = (ClassSymbol)sym.owner;
- for (Type t = env.types.supertype(origin.type);
- t.hasTag(CLASS);
- t = env.types.supertype(t)) {
- ClassSymbol c = (ClassSymbol)t.tsym;
- for (Symbol sym2 : membersOf(c).getSymbolsByName(sym.name)) {
- if (sym.overrides(sym2, origin, env.types, true)) {
- return env.getMethodDoc((MethodSymbol)sym2);
- }
- }
- }
- return null;
- }
-
- /**Retrieve members of c, ignoring any CompletionFailures that occur. */
- private Scope membersOf(ClassSymbol c) {
- try {
- return c.members();
- } catch (CompletionFailure cf) {
- /* Quietly ignore completion failures and try again - the type
- * for which the CompletionFailure was thrown shouldn't be completed
- * again by the completer that threw the CompletionFailure.
- */
- return membersOf(c);
- }
- }
-
- /**
- * Tests whether this method overrides another.
- * The overridden method may be one declared in a superclass or
- * a superinterface (unlike {@link #overriddenMethod()}).
- *
- * <p> When a non-abstract method overrides an abstract one, it is
- * also said to <i>implement</i> the other.
- *
- * @param meth the other method to examine
- * @return <tt>true</tt> if this method overrides the other
- */
- public boolean overrides(MethodDoc meth) {
- MethodSymbol overridee = ((MethodDocImpl) meth).sym;
- ClassSymbol origin = (ClassSymbol) sym.owner;
-
- return sym.name == overridee.name &&
-
- // not reflexive as per JLS
- sym != overridee &&
-
- // we don't care if overridee is static, though that wouldn't
- // compile
- !sym.isStatic() &&
-
- // sym, whose declaring type is the origin, must be
- // in a subtype of overridee's type
- env.types.asSuper(origin.type, overridee.owner) != null &&
-
- // check access and signatures; don't check return types
- sym.overrides(overridee, origin, env.types, false);
- }
-
-
- public String name() {
- if (name == null) {
- name = sym.name.toString();
- }
- return name;
- }
-
- private String name;
-
- public String qualifiedName() {
- if (qualifiedName == null) {
- qualifiedName = sym.enclClass().getQualifiedName() + "." + sym.name;
- }
- return qualifiedName;
- }
-
- private String qualifiedName;
-
- /**
- * Returns a string representation of this method. Includes the
- * qualified signature, the qualified method name, and any type
- * parameters. Type parameters follow the class name, as they do
- * in the syntax for invoking methods with explicit type parameters.
- */
- public String toString() {
- return sym.enclClass().getQualifiedName() +
- "." + typeParametersString() + name() + signature();
- }
-}
--- a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ModifierFilter.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,127 +0,0 @@
-/*
- * Copyright (c) 2000, 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.
- */
-
-package com.sun.tools.javadoc.main;
-
-import static com.sun.tools.javac.code.Flags.*;
-
-/**
- * A class whose instances are filters over Modifier bits.
- * Filtering is done by returning boolean values.
- * Classes, methods and fields can be filtered, or filtering
- * can be done directly on modifier bits.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- *
- * @see com.sun.tools.javac.code.Flags
- * @author Robert Field
- */
-
-@Deprecated(since="9", forRemoval=true)
-@SuppressWarnings("removal")
-public class ModifierFilter {
-
- /**
- * Package private access.
- * A "pseudo-" modifier bit that can be used in the
- * constructors of this class to specify package private
- * access. This is needed since there is no Modifier.PACKAGE.
- */
- public static final long PACKAGE = 0x8000000000000000L;
-
- /**
- * All access modifiers.
- * A short-hand set of modifier bits that can be used in the
- * constructors of this class to specify all access modifiers,
- * Same as PRIVATE | PROTECTED | PUBLIC | PACKAGE.
- */
- public static final long ALL_ACCESS =
- PRIVATE | PROTECTED | PUBLIC | PACKAGE;
-
- private long oneOf;
- private long must;
- private long cannot;
-
- private static final int ACCESS_BITS = PRIVATE | PROTECTED | PUBLIC;
-
- /**
- * Constructor - Specify a filter.
- *
- * @param oneOf If zero, everything passes the filter.
- * If non-zero, at least one of the specified
- * bits must be on in the modifier bits to
- * pass the filter.
- */
- public ModifierFilter(long oneOf) {
- this(oneOf, 0, 0);
- }
-
- /**
- * Constructor - Specify a filter.
- * For example, the filter below will only pass synchronized
- * methods that are private or package private access and are
- * not native or static.
- * <pre>
- * ModifierFilter( Modifier.PRIVATE | ModifierFilter.PACKAGE,
- * Modifier.SYNCHRONIZED,
- * Modifier.NATIVE | Modifier.STATIC)
- * </pre><p>
- * Each of the three arguments must either be
- * zero or the or'ed combination of the bits specified in the
- * class Modifier or this class. During filtering, these values
- * are compared against the modifier bits as follows:
- *
- * @param oneOf If zero, ignore this argument.
- * If non-zero, at least one of the bits must be on.
- * @param must All bits specified must be on.
- * @param cannot None of the bits specified can be on.
- */
- public ModifierFilter(long oneOf, long must, long cannot) {
- this.oneOf = oneOf;
- this.must = must;
- this.cannot = cannot;
- }
-
- /**
- * Filter on modifier bits.
- *
- * @param modifierBits Bits as specified in the Modifier class
- *
- * @return Whether the modifierBits pass this filter.
- */
- public boolean checkModifier(int modifierBits) {
- // Add in the "pseudo-" modifier bit PACKAGE, if needed
- long fmod = ((modifierBits & ACCESS_BITS) == 0) ?
- modifierBits | PACKAGE :
- modifierBits;
- return ((oneOf == 0) || ((oneOf & fmod) != 0)) &&
- ((must & fmod) == must) &&
- ((cannot & fmod) == 0);
- }
-
-} // end ModifierFilter
--- a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/PackageDocImpl.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,391 +0,0 @@
-/*
- * Copyright (c) 1997, 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.
- */
-
-package com.sun.tools.javadoc.main;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-import javax.tools.FileObject;
-
-import com.sun.javadoc.*;
-import com.sun.source.util.TreePath;
-import com.sun.tools.javac.code.Attribute;
-import com.sun.tools.javac.code.Symbol;
-import com.sun.tools.javac.code.Symbol.ClassSymbol;
-import com.sun.tools.javac.code.Symbol.PackageSymbol;
-import com.sun.tools.javac.tree.JCTree;
-import com.sun.tools.javac.tree.JCTree.JCCompilationUnit;
-import com.sun.tools.javac.util.List;
-import com.sun.tools.javac.util.ListBuffer;
-import com.sun.tools.javac.util.Name;
-import com.sun.tools.javac.util.Position;
-
-import static com.sun.tools.javac.code.Scope.LookupKind.NON_RECURSIVE;
-
-/**
- * Represents a java package. Provides access to information
- * about the package, the package's comment and tags, and the
- * classes in the package.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- *
- * @since 1.2
- * @author Kaiyang Liu (original)
- * @author Robert Field (rewrite)
- * @author Neal Gafter (rewrite)
- * @author Scott Seligman (package-info.java)
- */
-
-@Deprecated(since="9", forRemoval=true)
-@SuppressWarnings("removal")
-public class PackageDocImpl extends DocImpl implements PackageDoc {
-
- public final PackageSymbol sym;
- private JCCompilationUnit tree = null; // for source position
-
- public FileObject docPath = null;
- private boolean foundDoc; // found a doc comment in either
- // package.html or package-info.java
-
- boolean isIncluded = false; // Set in RootDocImpl.
- public boolean setDocPath = false; //Flag to avoid setting doc path multiple times.
-
- /**
- * Constructor
- */
- public PackageDocImpl(DocEnv env, PackageSymbol sym) {
- this(env, sym, null);
- }
-
- /**
- * Constructor
- */
- public PackageDocImpl(DocEnv env, PackageSymbol sym, TreePath treePath) {
- super(env, treePath);
- this.sym = sym;
- this.tree = (treePath == null) ? null : (JCCompilationUnit) treePath.getCompilationUnit();
- foundDoc = (documentation != null);
- }
-
- void setTree(JCTree tree) {
- this.tree = (JCCompilationUnit) tree;
- }
-
- public void setTreePath(TreePath treePath) {
- super.setTreePath(treePath);
- checkDoc();
- }
-
- /**
- * Do lazy initialization of "documentation" string.
- */
- protected String documentation() {
- if (documentation != null)
- return documentation;
- if (docPath != null) {
- // read from file
- try {
- InputStream s = docPath.openInputStream();
- documentation = readHTMLDocumentation(s, docPath);
- } catch (IOException exc) {
- documentation = "";
- env.error(null, "javadoc.File_Read_Error", docPath.getName());
- }
- } else {
- // no doc file to be had
- documentation = "";
- }
- return documentation;
- }
-
- /**
- * Cache of all classes contained in this package, including
- * member classes of those classes, and their member classes, etc.
- * Includes only those classes at the specified protection level
- * and weaker.
- */
- private List<ClassDocImpl> allClassesFiltered = null;
-
- /**
- * Cache of all classes contained in this package, including
- * member classes of those classes, and their member classes, etc.
- */
- private List<ClassDocImpl> allClasses = null;
-
- /**
- * Return a list of all classes contained in this package, including
- * member classes of those classes, and their member classes, etc.
- */
- private List<ClassDocImpl> getClasses(boolean filtered) {
- if (allClasses != null && !filtered) {
- return allClasses;
- }
- if (allClassesFiltered != null && filtered) {
- return allClassesFiltered;
- }
- ListBuffer<ClassDocImpl> classes = new ListBuffer<>();
- for (Symbol enumerated : sym.members().getSymbols(NON_RECURSIVE)) {
- if (enumerated != null) {
- ClassSymbol s = (ClassSymbol)enumerated;
- ClassDocImpl c = env.getClassDoc(s);
- if (c != null && !c.isSynthetic())
- c.addAllClasses(classes, filtered);
- }
- }
- if (filtered)
- return allClassesFiltered = classes.toList();
- else
- return allClasses = classes.toList();
- }
-
- /**
- * Add all included classes (including Exceptions and Errors)
- * and interfaces.
- */
- public void addAllClassesTo(ListBuffer<ClassDocImpl> list) {
- list.appendList(getClasses(true));
- }
-
- /**
- * Get all classes (including Exceptions and Errors)
- * and interfaces.
- * @since J2SE1.4.
- *
- * @return all classes and interfaces in this package, filtered to include
- * only the included classes if filter==true.
- */
- public ClassDoc[] allClasses(boolean filter) {
- List<ClassDocImpl> classes = getClasses(filter);
- return classes.toArray(new ClassDocImpl[classes.length()]);
- }
-
- /**
- * Get all included classes (including Exceptions and Errors)
- * and interfaces. Same as allClasses(true).
- *
- * @return all included classes and interfaces in this package.
- */
- public ClassDoc[] allClasses() {
- return allClasses(true);
- }
-
- /**
- * Get ordinary classes (that is, exclude exceptions, errors,
- * enums, interfaces, and annotation types) in this package.
- *
- * @return included ordinary classes in this package.
- */
- public ClassDoc[] ordinaryClasses() {
- ListBuffer<ClassDocImpl> ret = new ListBuffer<>();
- for (ClassDocImpl c : getClasses(true)) {
- if (c.isOrdinaryClass()) {
- ret.append(c);
- }
- }
- return ret.toArray(new ClassDocImpl[ret.length()]);
- }
-
- /**
- * Get Exception classes in this package.
- *
- * @return included Exceptions in this package.
- */
- public ClassDoc[] exceptions() {
- ListBuffer<ClassDocImpl> ret = new ListBuffer<>();
- for (ClassDocImpl c : getClasses(true)) {
- if (c.isException()) {
- ret.append(c);
- }
- }
- return ret.toArray(new ClassDocImpl[ret.length()]);
- }
-
- /**
- * Get Error classes in this package.
- *
- * @return included Errors in this package.
- */
- public ClassDoc[] errors() {
- ListBuffer<ClassDocImpl> ret = new ListBuffer<>();
- for (ClassDocImpl c : getClasses(true)) {
- if (c.isError()) {
- ret.append(c);
- }
- }
- return ret.toArray(new ClassDocImpl[ret.length()]);
- }
-
- /**
- * Get included enum types in this package.
- *
- * @return included enum types in this package.
- */
- public ClassDoc[] enums() {
- ListBuffer<ClassDocImpl> ret = new ListBuffer<>();
- for (ClassDocImpl c : getClasses(true)) {
- if (c.isEnum()) {
- ret.append(c);
- }
- }
- return ret.toArray(new ClassDocImpl[ret.length()]);
- }
-
- /**
- * Get included interfaces in this package, omitting annotation types.
- *
- * @return included interfaces in this package.
- */
- public ClassDoc[] interfaces() {
- ListBuffer<ClassDocImpl> ret = new ListBuffer<>();
- for (ClassDocImpl c : getClasses(true)) {
- if (c.isInterface()) {
- ret.append(c);
- }
- }
- return ret.toArray(new ClassDocImpl[ret.length()]);
- }
-
- /**
- * Get included annotation types in this package.
- *
- * @return included annotation types in this package.
- */
- public AnnotationTypeDoc[] annotationTypes() {
- ListBuffer<AnnotationTypeDocImpl> ret = new ListBuffer<>();
- for (ClassDocImpl c : getClasses(true)) {
- if (c.isAnnotationType()) {
- ret.append((AnnotationTypeDocImpl)c);
- }
- }
- return ret.toArray(new AnnotationTypeDocImpl[ret.length()]);
- }
-
- /**
- * Get the annotations of this package.
- * Return an empty array if there are none.
- */
- public AnnotationDesc[] annotations() {
- AnnotationDesc res[] = new AnnotationDesc[sym.getRawAttributes().length()];
- int i = 0;
- for (Attribute.Compound a : sym.getRawAttributes()) {
- res[i++] = new AnnotationDescImpl(env, a);
- }
- return res;
- }
-
-
- /**
- * Lookup for a class within this package.
- *
- * @return ClassDocImpl of found class, or null if not found.
- */
- public ClassDoc findClass(String className) {
- final boolean filtered = true;
- for (ClassDocImpl c : getClasses(filtered)) {
- if (c.name().equals(className)) {
- return c;
- }
- }
- return null;
- }
-
- /**
- * Return true if this package is included in the active set.
- */
- public boolean isIncluded() {
- return isIncluded;
- }
-
- /**
- * Get package name.
- *
- * Note that we do not provide a means of obtaining the simple
- * name of a package -- package names are always returned in their
- * uniquely qualified form.
- */
- public String name() {
- return qualifiedName();
- }
-
- /**
- * Get package name.
- */
- public String qualifiedName() {
- if (qualifiedName == null) {
- Name fullname = sym.getQualifiedName();
- // Some bogus tests depend on the interned "" being returned.
- // See 6457276.
- qualifiedName = fullname.isEmpty() ? "" : fullname.toString();
- }
- return qualifiedName;
- }
-
- private String qualifiedName;
-
- /**
- * set doc path for an unzipped directory
- */
- public void setDocPath(FileObject path) {
- setDocPath = true;
- if (path == null)
- return;
- if (!path.equals(docPath)) {
- docPath = path;
- checkDoc();
- }
- }
-
- // Has checkDoc() sounded off yet?
- private boolean checkDocWarningEmitted = false;
-
- /**
- * Invoked when a source of package doc comments is located.
- * Emits a diagnostic if this is the second one.
- */
- private void checkDoc() {
- if (foundDoc) {
- if (!checkDocWarningEmitted) {
- env.warning(null, "javadoc.Multiple_package_comments", name());
- checkDocWarningEmitted = true;
- }
- } else {
- foundDoc = true;
- }
- }
-
- /**
- * Return the source position of the entity, or null if
- * no position is available.
- */
- public SourcePosition position() {
- return (tree != null)
- ? SourcePositionImpl.make(tree.sourcefile, tree.pos, tree.lineMap)
- : SourcePositionImpl.make(docPath, Position.NOPOS, null);
- }
-}
--- a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ParamTagImpl.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,121 +0,0 @@
-/*
- * Copyright (c) 1997, 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.
- */
-
-package com.sun.tools.javadoc.main;
-
-import java.util.regex.*;
-
-import com.sun.javadoc.*;
-
-/**
- * Represents an @param documentation tag.
- * Parses and stores the name and comment parts of the parameter tag.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- *
- * @author Robert Field
- *
- */
-@Deprecated(since="9", forRemoval=true)
-@SuppressWarnings("removal")
-class ParamTagImpl extends TagImpl implements ParamTag {
-
- private static final Pattern typeParamRE = Pattern.compile("<([^<>]+)>");
-
- private final String parameterName;
- private final String parameterComment;
- private final boolean isTypeParameter;
-
- /**
- * Cached inline tags.
- */
- private Tag[] inlineTags;
-
- ParamTagImpl(DocImpl holder, String name, String text) {
- super(holder, name, text);
- String[] sa = divideAtWhite();
-
- Matcher m = typeParamRE.matcher(sa[0]);
- isTypeParameter = m.matches();
- parameterName = isTypeParameter ? m.group(1) : sa[0];
- parameterComment = sa[1];
- }
-
- /**
- * Return the parameter name.
- */
- public String parameterName() {
- return parameterName;
- }
-
- /**
- * Return the parameter comment.
- */
- public String parameterComment() {
- return parameterComment;
- }
-
- /**
- * Return the kind of this tag.
- */
- @Override
- public String kind() {
- return "@param";
- }
-
- /**
- * Return true if this ParamTag corresponds to a type parameter.
- */
- public boolean isTypeParameter() {
- return isTypeParameter;
- }
-
- /**
- * convert this object to a string.
- */
- @Override
- public String toString() {
- return name + ":" + text;
- }
-
- /**
- * For the parameter comment with embedded @link tags return the array of
- * TagImpls consisting of SeeTagImpl(s) and text containing TagImpl(s).
- *
- * @return TagImpl[] Array of tags with inline SeeTagImpls.
- * @see TagImpl#inlineTags()
- * @see ThrowsTagImpl#inlineTags()
- */
- @Override
- public Tag[] inlineTags() {
- if (inlineTags == null) {
- inlineTags = Comment.getInlineTags(holder, parameterComment);
- }
- return inlineTags;
- }
-}
--- a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ParameterImpl.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,111 +0,0 @@
-/*
- * Copyright (c) 1997, 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.
- */
-
-package com.sun.tools.javadoc.main;
-
-import com.sun.javadoc.*;
-
-import com.sun.tools.javac.code.Attribute;
-import com.sun.tools.javac.code.Symbol.VarSymbol;
-
-/**
- * ParameterImpl information.
- * This includes a parameter type and parameter name.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- *
- * @author Kaiyang Liu (original)
- * @author Robert Field (rewrite)
- * @author Scott Seligman (generics, annotations)
- */
-@Deprecated(since="9", forRemoval=true)
-@SuppressWarnings("removal")
-class ParameterImpl implements Parameter {
-
- private final DocEnv env;
- private final VarSymbol sym;
- private final com.sun.javadoc.Type type;
-
- /**
- * Constructor of parameter info class.
- */
- ParameterImpl(DocEnv env, VarSymbol sym) {
- this.env = env;
- this.sym = sym;
- this.type = TypeMaker.getType(env, sym.type, false);
- }
-
- /**
- * Get the type of this parameter.
- */
- public com.sun.javadoc.Type type() {
- return type;
- }
-
- /**
- * Get local name of this parameter.
- * For example if parameter is the short 'index', returns "index".
- */
- public String name() {
- return sym.toString();
- }
-
- /**
- * Get type name of this parameter.
- * For example if parameter is the short 'index', returns "short".
- */
- public String typeName() {
- return (type instanceof ClassDoc || type instanceof TypeVariable)
- ? type.typeName() // omit formal type params or bounds
- : type.toString();
- }
-
- /**
- * Returns a string representation of the parameter.
- * <p>
- * For example if parameter is the short 'index', returns "short index".
- *
- * @return type name and parameter name of this parameter.
- */
- public String toString() {
- return typeName() + " " + sym;
- }
-
- /**
- * Get the annotations of this parameter.
- * Return an empty array if there are none.
- */
- public AnnotationDesc[] annotations() {
- AnnotationDesc res[] = new AnnotationDesc[sym.getRawAttributes().length()];
- int i = 0;
- for (Attribute.Compound a : sym.getRawAttributes()) {
- res[i++] = new AnnotationDescImpl(env, a);
- }
- return res;
- }
-}
--- a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ParameterizedTypeImpl.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,150 +0,0 @@
-/*
- * Copyright (c) 2003, 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.
- */
-
-package com.sun.tools.javadoc.main;
-
-import com.sun.javadoc.*;
-
-import com.sun.tools.javac.code.Symbol.ClassSymbol;
-import com.sun.tools.javac.code.Type;
-import com.sun.tools.javac.code.Type.ClassType;
-
-import static com.sun.tools.javac.code.TypeTag.CLASS;
-
-
-/**
- * Implementation of <code>ParameterizedType</code>, which
- * represents an invocation of a generic class or interface.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- *
- * @author Scott Seligman
- * @since 1.5
- */
-@Deprecated(since="9", forRemoval=true)
-@SuppressWarnings("removal")
-public class ParameterizedTypeImpl
- extends AbstractTypeImpl implements ParameterizedType {
-
- ParameterizedTypeImpl(DocEnv env, Type type) {
- super(env, type);
- }
-
- /**
- * Return the generic class or interface that declared this type.
- */
- @Override
- public ClassDoc asClassDoc() {
- return env.getClassDoc((ClassSymbol)type.tsym);
- }
-
- /**
- * Return the actual type arguments of this type.
- */
- public com.sun.javadoc.Type[] typeArguments() {
- return TypeMaker.getTypes(env, type.getTypeArguments());
- }
-
- /**
- * Return the class type that is a direct supertype of this one.
- * Return null if this is an interface type.
- */
- public com.sun.javadoc.Type superclassType() {
- if (asClassDoc().isInterface()) {
- return null;
- }
- Type sup = env.types.supertype(type);
- return TypeMaker.getType(env,
- (sup != type) ? sup : env.syms.objectType);
- }
-
- /**
- * Return the interface types directly implemented by or extended by this
- * parameterized type.
- * Return an empty array if there are no interfaces.
- */
- public com.sun.javadoc.Type[] interfaceTypes() {
- return TypeMaker.getTypes(env, env.types.interfaces(type));
- }
-
- /**
- * Return the type that contains this type as a member.
- * Return null is this is a top-level type.
- */
- public com.sun.javadoc.Type containingType() {
- if (type.getEnclosingType().hasTag(CLASS)) {
- // This is the type of an inner class.
- return TypeMaker.getType(env, type.getEnclosingType());
- }
- ClassSymbol enclosing = type.tsym.owner.enclClass();
- if (enclosing != null) {
- // Nested but not inner. Return the ClassDoc of the enclosing
- // class or interface.
- // See java.lang.reflect.ParameterizedType.getOwnerType().
- return env.getClassDoc(enclosing);
- }
- return null;
- }
-
-
- // Asking for the "name" of a parameterized type doesn't exactly make
- // sense. It's a type expression. Return the name of its generic
- // type.
- @Override
- public String typeName() {
- return TypeMaker.getTypeName(type, false);
- }
-
- @Override
- public ParameterizedType asParameterizedType() {
- return this;
- }
-
- @Override
- public String toString() {
- return parameterizedTypeToString(env, (ClassType)type, true);
- }
-
- static String parameterizedTypeToString(DocEnv env, ClassType cl,
- boolean full) {
- if (env.legacyDoclet) {
- return TypeMaker.getTypeName(cl, full);
- }
- StringBuilder s = new StringBuilder();
- if (!(cl.getEnclosingType().hasTag(CLASS))) { // if not an inner class...
- s.append(TypeMaker.getTypeName(cl, full));
- } else {
- ClassType encl = (ClassType)cl.getEnclosingType();
- s.append(parameterizedTypeToString(env, encl, full))
- .append('.')
- .append(cl.tsym.name.toString());
- }
- s.append(TypeMaker.typeArgumentsString(env, cl, full));
- return s.toString();
- }
-}
--- a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/PrimitiveType.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,163 +0,0 @@
-/*
- * Copyright (c) 2001, 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.
- */
-
-package com.sun.tools.javadoc.main;
-
-import com.sun.javadoc.*;
-
-/**
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- */
-@Deprecated(since="9", forRemoval=true)
-@SuppressWarnings("removal")
-class PrimitiveType implements com.sun.javadoc.Type {
-
- private final String name;
-
- static final PrimitiveType voidType = new PrimitiveType("void");
- static final PrimitiveType booleanType = new PrimitiveType("boolean");
- static final PrimitiveType byteType = new PrimitiveType("byte");
- static final PrimitiveType charType = new PrimitiveType("char");
- static final PrimitiveType shortType = new PrimitiveType("short");
- static final PrimitiveType intType = new PrimitiveType("int");
- static final PrimitiveType longType = new PrimitiveType("long");
- static final PrimitiveType floatType = new PrimitiveType("float");
- static final PrimitiveType doubleType = new PrimitiveType("double");
-
- // error type, should never actually be used
- static final PrimitiveType errorType = new PrimitiveType("");
-
- PrimitiveType(String name) {
- this.name = name;
- }
-
- /**
- * Return unqualified name of type excluding any dimension information.
- * <p>
- * For example, a two dimensional array of String returns 'String'.
- */
- public String typeName() {
- return name;
- }
-
- public com.sun.javadoc.Type getElementType() {
- return null;
- }
-
- /**
- * Return qualified name of type excluding any dimension information.
- *<p>
- * For example, a two dimensional array of String
- * returns 'java.lang.String'.
- */
- public String qualifiedTypeName() {
- return name;
- }
-
- /**
- * Return the simple name of this type.
- */
- public String simpleTypeName() {
- return name;
- }
-
- /**
- * Return the type's dimension information, as a string.
- * <p>
- * For example, a two dimensional array of String returns '[][]'.
- */
- public String dimension() {
- return "";
- }
-
- /**
- * Return this type as a class. Array dimensions are ignored.
- *
- * @return a ClassDocImpl if the type is a Class.
- * Return null if it is a primitive type..
- */
- public ClassDoc asClassDoc() {
- return null;
- }
-
- /**
- * Return null, as this is not an annotation type.
- */
- public AnnotationTypeDoc asAnnotationTypeDoc() {
- return null;
- }
-
- /**
- * Return null, as this is not an instantiation.
- */
- public ParameterizedType asParameterizedType() {
- return null;
- }
-
- /**
- * Return null, as this is not a type variable.
- */
- public TypeVariable asTypeVariable() {
- return null;
- }
-
- /**
- * Return null, as this is not a wildcard type.
- */
- public WildcardType asWildcardType() {
- return null;
- }
-
- /**
- * Return null, as this is not an annotated type.
- */
- public AnnotatedType asAnnotatedType() {
- return null;
- }
-
- /**
- * Returns a string representation of the type.
- *
- * Return name of type including any dimension information.
- * <p>
- * For example, a two dimensional array of String returns
- * <code>String[][]</code>.
- *
- * @return name of type including any dimension information.
- */
- public String toString() {
- return qualifiedTypeName();
- }
-
- /**
- * Return true if this is a primitive type.
- */
- public boolean isPrimitive() {
- return true;
- }
-}
--- a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ProgramElementDocImpl.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,233 +0,0 @@
-/*
- * Copyright (c) 1997, 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.
- */
-
-package com.sun.tools.javadoc.main;
-
-import java.lang.reflect.Modifier;
-import java.text.CollationKey;
-
-import com.sun.javadoc.*;
-import com.sun.source.util.TreePath;
-import com.sun.tools.javac.code.Attribute;
-import com.sun.tools.javac.code.Symbol;
-import com.sun.tools.javac.code.Symbol.ClassSymbol;
-import com.sun.tools.javac.tree.JCTree;
-import com.sun.tools.javac.tree.JCTree.JCCompilationUnit;
-import com.sun.tools.javac.util.Position;
-
-/**
- * Represents a java program element: class, interface, field,
- * constructor, or method.
- * This is an abstract class dealing with information common to
- * these elements.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- *
- * @see MemberDocImpl
- * @see ClassDocImpl
- *
- * @author Robert Field
- * @author Neal Gafter (rewrite)
- * @author Scott Seligman (generics, enums, annotations)
- */
-@Deprecated(since="9", forRemoval=true)
-@SuppressWarnings("removal")
-public abstract class ProgramElementDocImpl
- extends DocImpl implements ProgramElementDoc {
-
- private final Symbol sym;
-
- // For source position information.
- JCTree tree = null;
- Position.LineMap lineMap = null;
-
-
- // Cache for getModifiers().
- private int modifiers = -1;
-
- protected ProgramElementDocImpl(DocEnv env, Symbol sym, TreePath treePath) {
- super(env, treePath);
- this.sym = sym;
- if (treePath != null) {
- tree = (JCTree) treePath.getLeaf();
- lineMap = ((JCCompilationUnit) treePath.getCompilationUnit()).lineMap;
- }
- }
-
- @Override
- void setTreePath(TreePath treePath) {
- super.setTreePath(treePath);
- this.tree = (JCTree) treePath.getLeaf();
- this.lineMap = ((JCCompilationUnit) treePath.getCompilationUnit()).lineMap;
- }
-
- /**
- * Subclasses override to identify the containing class
- */
- protected abstract ClassSymbol getContainingClass();
-
- /**
- * Returns the flags in terms of javac's flags
- */
- abstract protected long getFlags();
-
- /**
- * Returns the modifier flags in terms of java.lang.reflect.Modifier.
- */
- protected int getModifiers() {
- if (modifiers == -1) {
- modifiers = DocEnv.translateModifiers(getFlags());
- }
- return modifiers;
- }
-
- /**
- * Get the containing class of this program element.
- *
- * @return a ClassDocImpl for this element's containing class.
- * If this is a class with no outer class, return null.
- */
- public ClassDoc containingClass() {
- if (getContainingClass() == null) {
- return null;
- }
- return env.getClassDoc(getContainingClass());
- }
-
- /**
- * Return the package that this member is contained in.
- * Return "" if in unnamed package.
- */
- public PackageDoc containingPackage() {
- return env.getPackageDoc(getContainingClass().packge());
- }
-
- /**
- * Get the modifier specifier integer.
- *
- * @see java.lang.reflect.Modifier
- */
- public int modifierSpecifier() {
- int modifiers = getModifiers();
- if (isMethod() && containingClass().isInterface())
- // Remove the implicit abstract modifier.
- return modifiers & ~Modifier.ABSTRACT;
- return modifiers;
- }
-
- /**
- * Get modifiers string.
- * <pre>
- * Example, for:
- * public abstract int foo() { ... }
- * modifiers() would return:
- * 'public abstract'
- * </pre>
- * Annotations are not included.
- */
- public String modifiers() {
- int modifiers = getModifiers();
- if (isAnnotationTypeElement() ||
- (isMethod() && containingClass().isInterface())) {
- // Remove the implicit abstract modifier.
- return Modifier.toString(modifiers & ~Modifier.ABSTRACT);
- } else {
- return Modifier.toString(modifiers);
- }
- }
-
- /**
- * Get the annotations of this program element.
- * Return an empty array if there are none.
- */
- public AnnotationDesc[] annotations() {
- AnnotationDesc res[] = new AnnotationDesc[sym.getRawAttributes().length()];
- int i = 0;
- for (Attribute.Compound a : sym.getRawAttributes()) {
- res[i++] = new AnnotationDescImpl(env, a);
- }
- return res;
- }
-
- /**
- * Return true if this program element is public
- */
- public boolean isPublic() {
- int modifiers = getModifiers();
- return Modifier.isPublic(modifiers);
- }
-
- /**
- * Return true if this program element is protected
- */
- public boolean isProtected() {
- int modifiers = getModifiers();
- return Modifier.isProtected(modifiers);
- }
-
- /**
- * Return true if this program element is private
- */
- public boolean isPrivate() {
- int modifiers = getModifiers();
- return Modifier.isPrivate(modifiers);
- }
-
- /**
- * Return true if this program element is package private
- */
- public boolean isPackagePrivate() {
- return !(isPublic() || isPrivate() || isProtected());
- }
-
- /**
- * Return true if this program element is static
- */
- public boolean isStatic() {
- int modifiers = getModifiers();
- return Modifier.isStatic(modifiers);
- }
-
- /**
- * Return true if this program element is final
- */
- public boolean isFinal() {
- int modifiers = getModifiers();
- return Modifier.isFinal(modifiers);
- }
-
- /**
- * Generate a key for sorting.
- */
- CollationKey generateKey() {
- String k = name();
- // System.out.println("COLLATION KEY FOR " + this + " is \"" + k + "\"");
- return env.doclocale.collator.getCollationKey(k);
- }
-
-}
--- a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/RootDocImpl.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,401 +0,0 @@
-/*
- * Copyright (c) 1997, 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.
- */
-
-package com.sun.tools.javadoc.main;
-
-import java.io.IOException;
-import java.util.Collection;
-import java.util.Locale;
-
-import javax.tools.JavaFileManager;
-import javax.tools.JavaFileObject;
-import javax.tools.StandardJavaFileManager;
-
-import com.sun.javadoc.*;
-import com.sun.tools.javac.code.Source.Feature;
-import com.sun.tools.javac.tree.JCTree.JCClassDecl;
-import com.sun.tools.javac.util.List;
-import com.sun.tools.javac.util.ListBuffer;
-import com.sun.tools.javac.util.Position;
-
-/**
- * This class holds the information from one run of javadoc.
- * Particularly the packages, classes and options specified
- * by the user.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- *
- * @since 1.2
- * @author Robert Field
- * @author Atul M Dambalkar
- * @author Neal Gafter (rewrite)
- */
-@Deprecated(since="9", forRemoval=true)
-@SuppressWarnings("removal")
-public class RootDocImpl extends DocImpl implements RootDoc {
-
- /**
- * list of classes specified on the command line.
- */
- private List<ClassDocImpl> cmdLineClasses;
-
- /**
- * list of packages specified on the command line.
- */
- private List<PackageDocImpl> cmdLinePackages;
-
- /**
- * a collection of all options.
- */
- private List<String[]> options;
-
- /**
- * Constructor used when reading source files.
- *
- * @param env the documentation environment, state for this javadoc run
- * @param classes list of classes specified on the commandline
- * @param packages list of package names specified on the commandline
- * @param options list of options
- */
- public RootDocImpl(DocEnv env, List<JCClassDecl> classes, List<String> packages, List<String[]> options) {
- super(env, null);
- this.options = options;
- setPackages(env, packages);
- setClasses(env, classes);
- }
-
- /**
- * Constructor used when reading class files.
- *
- * @param env the documentation environment, state for this javadoc run
- * @param classes list of class names specified on the commandline
- * @param options list of options
- */
- public RootDocImpl(DocEnv env, List<String> classes, List<String[]> options) {
- super(env, null);
- this.options = options;
- cmdLinePackages = List.nil();
- ListBuffer<ClassDocImpl> classList = new ListBuffer<>();
- for (String className : classes) {
- ClassDocImpl c = env.loadClass(className);
- if (c == null)
- env.error(null, "javadoc.class_not_found", className);
- else
- classList = classList.append(c);
- }
- cmdLineClasses = classList.toList();
- }
-
- /**
- * Initialize classes information. Those classes are input from
- * command line.
- *
- * @param env the compilation environment
- * @param classes a list of ClassDeclaration
- */
- private void setClasses(DocEnv env, List<JCClassDecl> classes) {
- ListBuffer<ClassDocImpl> result = new ListBuffer<>();
- for (JCClassDecl def : classes) {
- //### Do we want modifier check here?
- if (env.shouldDocument(def.sym)) {
- ClassDocImpl cd = env.getClassDoc(def.sym);
- if (cd != null) {
- cd.isIncluded = true;
- result.append(cd);
- } //else System.out.println(" (classdoc is null)");//DEBUG
- } //else System.out.println(" (env.shouldDocument() returned false)");//DEBUG
- }
- cmdLineClasses = result.toList();
- }
-
- /**
- * Initialize packages information.
- *
- * @param env the compilation environment
- * @param packages a list of package names (String)
- */
- private void setPackages(DocEnv env, List<String> packages) {
- ListBuffer<PackageDocImpl> packlist = new ListBuffer<>();
- for (String name : packages) {
- PackageDocImpl pkg = env.lookupPackage(name);
- if (pkg != null) {
- pkg.isIncluded = true;
- packlist.append(pkg);
- } else {
- env.warning(null, "main.no_source_files_for_package", name);
- }
- }
- cmdLinePackages = packlist.toList();
- }
-
- /**
- * Command line options.
- *
- * <pre>
- * For example, given:
- * javadoc -foo this that -bar other ...
- *
- * This method will return:
- * options()[0][0] = "-foo"
- * options()[0][1] = "this"
- * options()[0][2] = "that"
- * options()[1][0] = "-bar"
- * options()[1][1] = "other"
- * </pre>
- *
- * @return an array of arrays of String.
- */
- public String[][] options() {
- return options.toArray(new String[options.length()][]);
- }
-
- /**
- * Packages specified on the command line.
- */
- public PackageDoc[] specifiedPackages() {
- return (PackageDoc[])cmdLinePackages
- .toArray(new PackageDocImpl[cmdLinePackages.length()]);
- }
-
- /**
- * Classes and interfaces specified on the command line.
- */
- public ClassDoc[] specifiedClasses() {
- ListBuffer<ClassDocImpl> classesToDocument = new ListBuffer<>();
- for (ClassDocImpl cd : cmdLineClasses) {
- cd.addAllClasses(classesToDocument, true);
- }
- return (ClassDoc[])classesToDocument.toArray(new ClassDocImpl[classesToDocument.length()]);
- }
-
- /**
- * Return all classes and interfaces (including those inside
- * packages) to be documented.
- */
- public ClassDoc[] classes() {
- ListBuffer<ClassDocImpl> classesToDocument = new ListBuffer<>();
- for (ClassDocImpl cd : cmdLineClasses) {
- cd.addAllClasses(classesToDocument, true);
- }
- for (PackageDocImpl pd : cmdLinePackages) {
- pd.addAllClassesTo(classesToDocument);
- }
- return classesToDocument.toArray(new ClassDocImpl[classesToDocument.length()]);
- }
-
- /**
- * Return a ClassDoc for the specified class/interface name
- *
- * @param qualifiedName qualified class name
- * (i.e. includes package name).
- *
- * @return a ClassDocImpl holding the specified class, null if
- * this class is not referenced.
- */
- public ClassDoc classNamed(String qualifiedName) {
- return env.lookupClass(qualifiedName);
- }
-
- /**
- * Return a PackageDoc for the specified package name
- *
- * @param name package name
- *
- * @return a PackageDoc holding the specified package, null if
- * this package is not referenced.
- */
- public PackageDoc packageNamed(String name) {
- return env.lookupPackage(name);
- }
-
- /**
- * Return the name of this Doc item.
- *
- * @return the string <code>"*RootDocImpl*"</code>.
- */
- public String name() {
- return "*RootDocImpl*";
- }
-
- /**
- * Return the name of this Doc item.
- *
- * @return the string <code>"*RootDocImpl*"</code>.
- */
- public String qualifiedName() {
- return "*RootDocImpl*";
- }
-
- /**
- * Return true if this Doc is include in the active set.
- * RootDocImpl isn't even a program entity so it is always false.
- */
- public boolean isIncluded() {
- return false;
- }
-
- /**
- * Print error message, increment error count.
- *
- * @param msg message to print
- */
- public void printError(String msg) {
- env.printError(msg);
- }
-
- /**
- * Print error message, increment error count.
- *
- * @param msg message to print
- */
- public void printError(SourcePosition pos, String msg) {
- env.printError(pos, msg);
- }
-
- /**
- * Print warning message, increment warning count.
- *
- * @param msg message to print
- */
- public void printWarning(String msg) {
- env.printWarning(msg);
- }
-
- /**
- * Print warning message, increment warning count.
- *
- * @param msg message to print
- */
- public void printWarning(SourcePosition pos, String msg) {
- env.printWarning(pos, msg);
- }
-
- /**
- * Print a message.
- *
- * @param msg message to print
- */
- public void printNotice(String msg) {
- env.printNotice(msg);
- }
-
- /**
- * Print a message.
- *
- * @param msg message to print
- */
- public void printNotice(SourcePosition pos, String msg) {
- env.printNotice(pos, msg);
- }
-
- /**
- * Return the path of the overview file and null if it does not exist.
- * @return the path of the overview file and null if it does not exist.
- */
- private JavaFileObject getOverviewPath() {
- for (String[] opt : options) {
- if (opt[0].equals("-overview")) {
- if (env.fileManager instanceof StandardJavaFileManager) {
- StandardJavaFileManager fm = (StandardJavaFileManager) env.fileManager;
- return fm.getJavaFileObjects(opt[1]).iterator().next();
- }
- }
- }
- return null;
- }
-
- /**
- * Do lazy initialization of "documentation" string.
- */
- @Override
- protected String documentation() {
- if (documentation == null) {
- JavaFileObject overviewPath = getOverviewPath();
- if (overviewPath == null) {
- // no doc file to be had
- documentation = "";
- } else {
- // read from file
- try {
- documentation = readHTMLDocumentation(
- overviewPath.openInputStream(),
- overviewPath);
- } catch (IOException exc) {
- documentation = "";
- env.error(null, "javadoc.File_Read_Error", overviewPath.getName());
- }
- }
- }
- return documentation;
- }
-
- /**
- * Return the source position of the entity, or null if
- * no position is available.
- */
- @Override
- public SourcePosition position() {
- JavaFileObject path;
- return ((path = getOverviewPath()) == null) ?
- null :
- SourcePositionImpl.make(path, Position.NOPOS, null);
- }
-
- /**
- * Return the locale provided by the user or the default locale value.
- */
- public Locale getLocale() {
- return env.doclocale.locale;
- }
-
- /**
- * Return the current file manager.
- */
- public JavaFileManager getFileManager() {
- return env.fileManager;
- }
-
- public void initDocLint(Collection<String> opts, Collection<String> customTagNames,
- String htmlVersion) {
- env.initDoclint(opts, customTagNames, htmlVersion);
- }
-
- public JavaScriptScanner initJavaScriptScanner(boolean allowScriptInComments) {
- return env.initJavaScriptScanner(allowScriptInComments);
- }
-
- public boolean isFunctionalInterface(AnnotationDesc annotationDesc) {
- return Feature.LAMBDA.allowedInSource(env.source)
- && annotationDesc.annotationType().qualifiedName().equals(
- env.syms.functionalInterfaceType.toString());
- }
-
- public boolean showTagMessages() {
- return env.showTagMessages();
- }
-}
--- a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/SeeTagImpl.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,544 +0,0 @@
-/*
- * Copyright (c) 1997, 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.
- */
-
-package com.sun.tools.javadoc.main;
-
-import java.io.File;
-import java.util.Locale;
-
-import com.sun.javadoc.*;
-import com.sun.tools.javac.code.Printer;
-import com.sun.tools.javac.code.Symbol;
-import com.sun.tools.javac.code.Type.CapturedType;
-import com.sun.tools.javac.util.*;
-
-import static com.sun.tools.javac.code.Kinds.Kind.*;
-
-/**
- * Represents a see also documentation tag.
- * The @see tag can be plain text, or reference a class or member.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- *
- * @author Kaiyang Liu (original)
- * @author Robert Field (rewrite)
- * @author Atul M Dambalkar
- *
- */
-@Deprecated(since="9", forRemoval=true)
-@SuppressWarnings("removal")
-class SeeTagImpl extends TagImpl implements SeeTag, LayoutCharacters {
-
- //### TODO: Searching for classes, fields, and methods
- //### should follow the normal rules applied by the compiler.
-
- /**
- * where of where#what - i.e. the class name (may be empty)
- */
- private String where;
-
- /**
- * what of where#what - i.e. the member (may be null)
- */
- private String what;
-
- private PackageDoc referencedPackage;
- private ClassDoc referencedClass;
- private MemberDoc referencedMember;
-
- String label = "";
-
- SeeTagImpl(DocImpl holder, String name, String text) {
- super(holder, name, text);
- parseSeeString();
- if (where != null) {
- ClassDocImpl container = null;
- if (holder instanceof MemberDoc) {
- container =
- (ClassDocImpl)((ProgramElementDoc)holder).containingClass();
- } else if (holder instanceof ClassDoc) {
- container = (ClassDocImpl)holder;
- }
- findReferenced(container);
- if (showRef) showRef();
- }
- }
-
- private static final boolean showRef = false;
-
- private void showRef() {
- Symbol sym;
- if (referencedMember != null) {
- if (referencedMember instanceof MethodDocImpl)
- sym = ((MethodDocImpl) referencedMember).sym;
- else if (referencedMember instanceof FieldDocImpl)
- sym = ((FieldDocImpl) referencedMember).sym;
- else
- sym = ((ConstructorDocImpl) referencedMember).sym;
- } else if (referencedClass != null) {
- sym = ((ClassDocImpl) referencedClass).tsym;
- } else if (referencedPackage != null) {
- sym = ((PackageDocImpl) referencedPackage).sym;
- } else
- return;
-
- final JavacMessages messages = JavacMessages.instance(docenv().context);
- Locale locale = Locale.getDefault();
- Printer printer = new Printer() {
- int count;
- @Override
- protected String localize(Locale locale, String key, Object... args) {
- return messages.getLocalizedString(locale, key, args);
- }
- @Override
- protected String capturedVarId(CapturedType t, Locale locale) {
- return "CAP#" + (++count);
- }
- };
-
- String s = text.replaceAll("\\s+", " "); // normalize white space
- int sp = s.indexOf(" ");
- int lparen = s.indexOf("(");
- int rparen = s.indexOf(")");
- String seetext = (sp == -1) ? s
- : (lparen == -1 || sp < lparen) ? s.substring(0, sp)
- : s.substring(0, rparen + 1);
-
- File file = new File(holder.position().file().getAbsoluteFile().toURI().normalize());
-
- StringBuilder sb = new StringBuilder();
- sb.append("+++ ").append(file).append(": ")
- .append(name()).append(" ").append(seetext).append(": ");
- sb.append(sym.getKind()).append(" ");
- if (sym.kind == MTH || sym.kind == VAR)
- sb.append(printer.visit(sym.owner, locale)).append(".");
- sb.append(printer.visit(sym, locale));
-
- System.err.println(sb);
- }
-
- /**
- * get the class name part of @see, For instance,
- * if the comment is @see String#startsWith(java.lang.String) .
- * This function returns String.
- * Returns null if format was not that of java reference.
- * Return empty string if class name was not specified..
- */
- public String referencedClassName() {
- return where;
- }
-
- /**
- * get the package referenced by @see. For instance,
- * if the comment is @see java.lang
- * This function returns a PackageDocImpl for java.lang
- * Returns null if no known package found.
- */
- public PackageDoc referencedPackage() {
- return referencedPackage;
- }
-
- /**
- * get the class referenced by the class name part of @see, For instance,
- * if the comment is @see String#startsWith(java.lang.String) .
- * This function returns a ClassDocImpl for java.lang.String.
- * Returns null if class is not a class specified on the javadoc command line..
- */
- public ClassDoc referencedClass() {
- return referencedClass;
- }
-
- /**
- * get the name of the member referenced by the prototype part of @see,
- * For instance,
- * if the comment is @see String#startsWith(java.lang.String) .
- * This function returns "startsWith(java.lang.String)"
- * Returns null if format was not that of java reference.
- * Return empty string if member name was not specified..
- */
- public String referencedMemberName() {
- return what;
- }
-
- /**
- * get the member referenced by the prototype part of @see,
- * For instance,
- * if the comment is @see String#startsWith(java.lang.String) .
- * This function returns a MethodDocImpl for startsWith.
- * Returns null if member could not be determined.
- */
- public MemberDoc referencedMember() {
- return referencedMember;
- }
-
-
- /**
- * parse @see part of comment. Determine 'where' and 'what'
- */
- private void parseSeeString() {
- int len = text.length();
- if (len == 0) {
- return;
- }
- switch (text.charAt(0)) {
- case '<':
- if (text.charAt(len-1) != '>') {
- docenv().warning(holder,
- "tag.see.no_close_bracket_on_url",
- name, text);
- }
- return;
- case '"':
- if (len == 1 || text.charAt(len-1) != '"') {
- docenv().warning(holder,
- "tag.see.no_close_quote",
- name, text);
- } else {
-// text = text.substring(1,len-1); // strip quotes
- }
- return;
- }
-
- // check that the text is one word, with possible parentheses
- // this part of code doesn't allow
- // @see <a href=.....>asfd</a>
- // comment it.
-
- // the code assumes that there is no initial white space.
- int parens = 0;
- int commentstart = 0;
- int start = 0;
- int cp;
- for (int i = start; i < len ; i += Character.charCount(cp)) {
- cp = text.codePointAt(i);
- switch (cp) {
- case '(': parens++; break;
- case ')': parens--; break;
- case '[': case ']': case '.': case '#': break;
- case ',':
- if (parens <= 0) {
- docenv().warning(holder,
- "tag.see.malformed_see_tag",
- name, text);
- return;
- }
- break;
- case ' ': case '\t': case '\n': case CR:
- if (parens == 0) { //here onwards the comment starts.
- commentstart = i;
- i = len;
- }
- break;
- default:
- if (!Character.isJavaIdentifierPart(cp)) {
- docenv().warning(holder,
- "tag.see.illegal_character",
- name, ""+cp, text);
- }
- break;
- }
- }
- if (parens != 0) {
- docenv().warning(holder,
- "tag.see.malformed_see_tag",
- name, text);
- return;
- }
-
- String seetext = "";
- String labeltext = "";
-
- if (commentstart > 0) {
- seetext = text.substring(start, commentstart);
- labeltext = text.substring(commentstart + 1);
- // strip off the white space which can be between seetext and the
- // actual label.
- for (int i = 0; i < labeltext.length(); i++) {
- char ch2 = labeltext.charAt(i);
- if (!(ch2 == ' ' || ch2 == '\t' || ch2 == '\n')) {
- label = labeltext.substring(i);
- break;
- }
- }
- } else {
- seetext = text;
- label = "";
- }
-
- int sharp = seetext.indexOf('#');
- if (sharp >= 0) {
- // class#member
- where = seetext.substring(0, sharp);
- what = seetext.substring(sharp + 1);
- } else {
- if (seetext.indexOf('(') >= 0) {
- docenv().warning(holder,
- "tag.see.missing_sharp",
- name, text);
- where = "";
- what = seetext;
- }
- else {
- // no member specified, text names class
- where = seetext;
- what = null;
- }
- }
- }
-
- /**
- * Find what is referenced by the see also. If possible, sets
- * referencedClass and referencedMember.
- *
- * @param containingClass the class containing the comment containing
- * the tag. May be null, if, for example, it is a package comment.
- */
- private void findReferenced(ClassDocImpl containingClass) {
- if (where.length() > 0) {
- if (containingClass != null) {
- referencedClass = containingClass.findClass(where);
- } else {
- referencedClass = docenv().lookupClass(where);
- }
- if (referencedClass == null && holder() instanceof ProgramElementDoc) {
- referencedClass = docenv().lookupClass(
- ((ProgramElementDoc) holder()).containingPackage().name() + "." + where);
- }
-
- if (referencedClass == null) { /* may just not be in this run */
- // check if it's a package name
- referencedPackage = docenv().lookupPackage(where);
- return;
- }
- } else {
- if (containingClass == null) {
- docenv().warning(holder,
- "tag.see.class_not_specified",
- name, text);
- return;
- } else {
- referencedClass = containingClass;
- }
- }
- where = referencedClass.qualifiedName();
-
- if (what == null) {
- return;
- } else {
- int paren = what.indexOf('(');
- String memName = (paren >= 0 ? what.substring(0, paren) : what);
- String[] paramarr;
- if (paren > 0) {
- // has parameter list -- should be method or constructor
- paramarr = new ParameterParseMachine(what.
- substring(paren, what.length())).parseParameters();
- if (paramarr != null) {
- referencedMember = findExecutableMember(memName, paramarr,
- referencedClass);
- } else {
- referencedMember = null;
- }
- } else {
- // no parameter list -- should be field
- referencedMember = findExecutableMember(memName, null,
- referencedClass);
- FieldDoc fd = ((ClassDocImpl)referencedClass).
- findField(memName);
- // when no args given, prefer fields over methods
- if (referencedMember == null ||
- (fd != null &&
- fd.containingClass()
- .subclassOf(referencedMember.containingClass()))) {
- referencedMember = fd;
- }
- }
- if (referencedMember == null) {
- docenv().warning(holder,
- "tag.see.can_not_find_member",
- name, what, where);
- }
- }
- }
-
- private MemberDoc findReferencedMethod(String memName, String[] paramarr,
- ClassDoc referencedClass) {
- MemberDoc meth = findExecutableMember(memName, paramarr, referencedClass);
- if (meth == null) {
- for (ClassDoc nestedClass : referencedClass.innerClasses()) {
- meth = findReferencedMethod(memName, paramarr, nestedClass);
- if (meth != null) {
- return meth;
- }
- }
- }
- return null;
- }
-
- private MemberDoc findExecutableMember(String memName, String[] paramarr,
- ClassDoc referencedClass) {
- String className = referencedClass.name();
- if (memName.equals(className.substring(className.lastIndexOf(".") + 1))) {
- return ((ClassDocImpl)referencedClass).findConstructor(memName,
- paramarr);
- } else { // it's a method.
- return ((ClassDocImpl)referencedClass).findMethod(memName,
- paramarr);
- }
- }
-
- // separate "int, String" from "(int, String)"
- // (int i, String s) ==> [0] = "int", [1] = String
- // (int[][], String[]) ==> [0] = "int[][]" // [1] = "String[]"
- class ParameterParseMachine {
- static final int START = 0;
- static final int TYPE = 1;
- static final int NAME = 2;
- static final int TNSPACE = 3; // space between type and name
- static final int ARRAYDECORATION = 4;
- static final int ARRAYSPACE = 5;
-
- String parameters;
-
- StringBuilder typeId;
-
- ListBuffer<String> paramList;
-
- ParameterParseMachine(String parameters) {
- this.parameters = parameters;
- this.paramList = new ListBuffer<>();
- typeId = new StringBuilder();
- }
-
- public String[] parseParameters() {
- if (parameters.equals("()")) {
- return new String[0];
- } // now strip off '(' and ')'
- int state = START;
- int prevstate = START;
- parameters = parameters.substring(1, parameters.length() - 1);
- int cp;
- for (int index = 0; index < parameters.length(); index += Character.charCount(cp)) {
- cp = parameters.codePointAt(index);
- switch (state) {
- case START:
- if (Character.isJavaIdentifierStart(cp)) {
- typeId.append(Character.toChars(cp));
- state = TYPE;
- }
- prevstate = START;
- break;
- case TYPE:
- if (Character.isJavaIdentifierPart(cp) || cp == '.') {
- typeId.append(Character.toChars(cp));
- } else if (cp == '[') {
- typeId.append('[');
- state = ARRAYDECORATION;
- } else if (Character.isWhitespace(cp)) {
- state = TNSPACE;
- } else if (cp == ',') { // no name, just type
- addTypeToParamList();
- state = START;
- }
- prevstate = TYPE;
- break;
- case TNSPACE:
- if (Character.isJavaIdentifierStart(cp)) { // name
- if (prevstate == ARRAYDECORATION) {
- docenv().warning(holder,
- "tag.missing_comma_space",
- name,
- "(" + parameters + ")");
- return (String[])null;
- }
- addTypeToParamList();
- state = NAME;
- } else if (cp == '[') {
- typeId.append('[');
- state = ARRAYDECORATION;
- } else if (cp == ',') { // just the type
- addTypeToParamList();
- state = START;
- } // consume rest all
- prevstate = TNSPACE;
- break;
- case ARRAYDECORATION:
- if (cp == ']') {
- typeId.append(']');
- state = TNSPACE;
- } else if (!Character.isWhitespace(cp)) {
- docenv().warning(holder,
- "tag.illegal_char_in_arr_dim",
- name,
- "(" + parameters + ")");
- return (String[])null;
- }
- prevstate = ARRAYDECORATION;
- break;
- case NAME:
- if (cp == ',') { // just consume everything till ','
- state = START;
- }
- prevstate = NAME;
- break;
- }
- }
- if (state == ARRAYDECORATION ||
- (state == START && prevstate == TNSPACE)) {
- docenv().warning(holder,
- "tag.illegal_see_tag",
- "(" + parameters + ")");
- }
- if (typeId.length() > 0) {
- paramList.append(typeId.toString());
- }
- return paramList.toArray(new String[paramList.length()]);
- }
-
- void addTypeToParamList() {
- if (typeId.length() > 0) {
- paramList.append(typeId.toString());
- typeId.setLength(0);
- }
- }
- }
-
- /**
- * Return the kind of this tag.
- */
- @Override
- public String kind() {
- return "@see";
- }
-
- /**
- * Return the label of the see tag.
- */
- public String label() {
- return label;
- }
-}
--- a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/SerialFieldTagImpl.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,269 +0,0 @@
-/*
- * Copyright (c) 1998, 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.
- */
-
-package com.sun.tools.javadoc.main;
-
-import com.sun.javadoc.*;
-
-/**
- * Documents a Serializable field defined by an ObjectStreamField.
- * <pre>
- * The class parses and stores the three serialField tag parameters:
- *
- * - field name
- * - field type name
- * (fully-qualified or visible from the current import context)
- * - description of the valid values for the field
-
- * </pre>
- * This tag is only allowed in the javadoc for the special member
- * serialPersistentFields.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- *
- * @author Joe Fialli
- * @author Neal Gafter
- *
- * @see java.io.ObjectStreamField
- */
-@Deprecated(since="9", forRemoval=true)
-@SuppressWarnings("removal")
-class SerialFieldTagImpl
- extends TagImpl
- implements SerialFieldTag, Comparable<Object>
-{
- //### These could be final, except that the constructor
- //### does not set them directly.
-
- private String fieldName; // Required Argument 1 of serialField
- private String fieldType; // Required Argument 2 of serialField
- private String description; // Optional Remaining Arguments of serialField
-
- private ClassDoc containingClass; // Class containing serialPersistentField member
- private ClassDoc fieldTypeDoc; // ClassDocImpl of fieldType
- private FieldDocImpl matchingField; // FieldDocImpl with same name as fieldName
-
- /* Constructor. */
- SerialFieldTagImpl(DocImpl holder, String name, String text) {
- super(holder, name, text);
- parseSerialFieldString();
- if (holder instanceof MemberDoc) {
- containingClass = ((MemberDocImpl)holder).containingClass();
- }
- }
-
- /*
- * The serialField tag is composed of three entities.
- *
- * serialField serializableFieldName serisliableFieldType
- * description of field.
- *
- * The fieldName and fieldType must be legal Java Identifiers.
- */
- private void parseSerialFieldString() {
- int len = text.length();
- if (len == 0) {
- return;
- }
-
- // if no white space found
- /* Skip white space. */
- int inx = 0;
- int cp;
- for (; inx < len; inx += Character.charCount(cp)) {
- cp = text.codePointAt(inx);
- if (!Character.isWhitespace(cp)) {
- break;
- }
- }
-
- /* find first word. */
- int first = inx;
- int last = inx;
- cp = text.codePointAt(inx);
- if (! Character.isJavaIdentifierStart(cp)) {
- docenv().warning(holder,
- "tag.serialField.illegal_character",
- new String(Character.toChars(cp)), text);
- return;
- }
-
- for (inx += Character.charCount(cp); inx < len; inx += Character.charCount(cp)) {
- cp = text.codePointAt(inx);
- if (!Character.isJavaIdentifierPart(cp)) {
- break;
- }
- }
-
- if (inx < len && ! Character.isWhitespace(cp = text.codePointAt(inx))) {
- docenv().warning(holder,
- "tag.serialField.illegal_character",
- new String(Character.toChars(cp)), text);
- return;
- }
-
- last = inx;
- fieldName = text.substring(first, last);
-
- /* Skip white space. */
- for (; inx < len; inx += Character.charCount(cp)) {
- cp = text.codePointAt(inx);
- if (!Character.isWhitespace(cp)) {
- break;
- }
- }
-
- /* find second word. */
- first = inx;
- last = inx;
-
- for (; inx < len; inx += Character.charCount(cp)) {
- cp = text.codePointAt(inx);
- if (Character.isWhitespace(cp)) {
- break;
- }
- }
- if (inx < len && ! Character.isWhitespace(cp = text.codePointAt(inx))) {
- docenv().warning(holder,
- "tag.serialField.illegal_character",
- new String(Character.toChars(cp)), text);
- return;
- }
- last = inx;
- fieldType = text.substring(first, last);
-
- /* Skip leading white space. Rest of string is description for serialField.*/
- for (; inx < len; inx += Character.charCount(cp)) {
- cp = text.codePointAt(inx);
- if (!Character.isWhitespace(cp)) {
- break;
- }
- }
- description = text.substring(inx);
- }
-
- /**
- * return a key for sorting.
- */
- String key() {
- return fieldName;
- }
-
- /*
- * Optional. Link this serialField tag to its corrsponding
- * field in the class. Note: there is no requirement that
- * there be a field in the class that matches serialField tag.
- */
- void mapToFieldDocImpl(FieldDocImpl fd) {
- matchingField = fd;
- }
-
- /**
- * Return the serialziable field name.
- */
- public String fieldName() {
- return fieldName;
- }
-
- /**
- * Return the field type string.
- */
- public String fieldType() {
- return fieldType;
- }
-
- /**
- * Return the ClassDocImpl for field type.
- *
- * @returns null if no ClassDocImpl for field type is visible from
- * containingClass context.
- */
- public ClassDoc fieldTypeDoc() {
- if (fieldTypeDoc == null && containingClass != null) {
- fieldTypeDoc = containingClass.findClass(fieldType);
- }
- return fieldTypeDoc;
- }
-
- /**
- * Return the corresponding FieldDocImpl for this SerialFieldTagImpl.
- *
- * @returns null if no matching FieldDocImpl.
- */
- FieldDocImpl getMatchingField() {
- return matchingField;
- }
-
- /**
- * Return the field comment. If there is no serialField comment, return
- * javadoc comment of corresponding FieldDocImpl.
- */
- public String description() {
- if (description.length() == 0 && matchingField != null) {
-
- //check for javadoc comment of corresponding field.
- Comment comment = matchingField.comment();
- if (comment != null) {
- return comment.commentText();
- }
- }
- return description;
- }
-
- /**
- * Return the kind of this tag.
- */
- public String kind() {
- return "@serialField";
- }
-
- /**
- * Convert this object to a string.
- */
- public String toString() {
- return name + ":" + text;
- }
-
- /**
- * Compares this Object with the specified Object for order. Returns a
- * negative integer, zero, or a positive integer as this Object is less
- * than, equal to, or greater than the given Object.
- * <p>
- * Included to make SerialFieldTagImpl items java.lang.Comparable.
- *
- * @param obj the <code>Object</code> to be compared.
- * @return a negative integer, zero, or a positive integer as this Object
- * is less than, equal to, or greater than the given Object.
- * @exception ClassCastException the specified Object's type prevents it
- * from being compared to this Object.
- * @since 1.2
- */
- public int compareTo(Object obj) {
- return key().compareTo(((SerialFieldTagImpl)obj).key());
- }
-}
--- a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/SerializedForm.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,289 +0,0 @@
-/*
- * Copyright (c) 1998, 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.
- */
-
-package com.sun.tools.javadoc.main;
-
-import com.sun.javadoc.*;
-import com.sun.tools.javac.code.*;
-import com.sun.tools.javac.code.Symbol.ClassSymbol;
-import com.sun.tools.javac.code.Symbol.MethodSymbol;
-import com.sun.tools.javac.code.Symbol.VarSymbol;
-import com.sun.tools.javac.util.*;
-
-import static com.sun.tools.javac.code.Kinds.Kind.*;
-import static com.sun.tools.javac.code.Scope.LookupKind.NON_RECURSIVE;
-
-/**
- * The serialized form is the specification of a class' serialization
- * state. <p>
- *
- * It consists of the following information:<p>
- *
- * <pre>
- * 1. Whether class is Serializable or Externalizable.
- * 2. Javadoc for serialization methods.
- * a. For Serializable, the optional readObject, writeObject,
- * readResolve and writeReplace.
- * serialData tag describes, in prose, the sequence and type
- * of optional data written by writeObject.
- * b. For Externalizable, writeExternal and readExternal.
- * serialData tag describes, in prose, the sequence and type
- * of optional data written by writeExternal.
- * 3. Javadoc for serialization data layout.
- * a. For Serializable, the name,type and description
- * of each Serializable fields.
- * b. For Externalizable, data layout is described by 2(b).
- * </pre>
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- *
- * @since 1.2
- * @author Joe Fialli
- * @author Neal Gafter (rewrite but not too proud)
- */
-@Deprecated(since="9", forRemoval=true)
-@SuppressWarnings("removal")
-class SerializedForm {
- ListBuffer<MethodDoc> methods = new ListBuffer<>();
-
- /* List of FieldDocImpl - Serializable fields.
- * Singleton list if class defines Serializable fields explicitly.
- * Otherwise, list of default serializable fields.
- * 0 length list for Externalizable.
- */
- private final ListBuffer<FieldDocImpl> fields = new ListBuffer<>();
-
- /* True if class specifies serializable fields explicitly.
- * using special static member, serialPersistentFields.
- */
- private boolean definesSerializableFields = false;
-
- // Specially treated field/method names defined by Serialization.
- private static final String SERIALIZABLE_FIELDS = "serialPersistentFields";
- private static final String READOBJECT = "readObject";
- private static final String WRITEOBJECT = "writeObject";
- private static final String READRESOLVE = "readResolve";
- private static final String WRITEREPLACE = "writeReplace";
- private static final String READOBJECTNODATA = "readObjectNoData";
-
- /**
- * Constructor.
- *
- * Catalog Serializable fields for Serializable class.
- * Catalog serialization methods for Serializable and
- * Externalizable classes.
- */
- SerializedForm(DocEnv env, ClassSymbol def, ClassDocImpl cd) {
- if (cd.isExternalizable()) {
- /* look up required public accessible methods,
- * writeExternal and readExternal.
- */
- String[] readExternalParamArr = { "java.io.ObjectInput" };
- String[] writeExternalParamArr = { "java.io.ObjectOutput" };
- MethodDoc md = cd.findMethod("readExternal", readExternalParamArr);
- if (md != null) {
- methods.append(md);
- }
- md = cd.findMethod("writeExternal", writeExternalParamArr);
- if (md != null) {
- methods.append(md);
- Tag tag[] = md.tags("serialData");
- }
- // } else { // isSerializable() //### ???
- } else if (cd.isSerializable()) {
-
- VarSymbol dsf = getDefinedSerializableFields(def);
- if (dsf != null) {
-
- /* Define serializable fields with array of ObjectStreamField.
- * Each ObjectStreamField should be documented by a
- * serialField tag.
- */
- definesSerializableFields = true;
- //### No modifier filtering applied here.
- FieldDocImpl dsfDoc = env.getFieldDoc(dsf);
- fields.append(dsfDoc);
- mapSerialFieldTagImplsToFieldDocImpls(dsfDoc, env, def);
- } else {
-
- /* Calculate default Serializable fields as all
- * non-transient, non-static fields.
- * Fields should be documented by serial tag.
- */
- computeDefaultSerializableFields(env, def, cd);
- }
-
- /* Check for optional customized readObject, writeObject,
- * readResolve and writeReplace, which can all contain
- * the serialData tag. */
- addMethodIfExist(env, def, READOBJECT);
- addMethodIfExist(env, def, WRITEOBJECT);
- addMethodIfExist(env, def, READRESOLVE);
- addMethodIfExist(env, def, WRITEREPLACE);
- addMethodIfExist(env, def, READOBJECTNODATA);
- }
- }
-
- /*
- * Check for explicit Serializable fields.
- * Check for a private static array of ObjectStreamField with
- * name SERIALIZABLE_FIELDS.
- */
- private VarSymbol getDefinedSerializableFields(ClassSymbol def) {
- Names names = def.name.table.names;
-
- /* SERIALIZABLE_FIELDS can be private,
- * so must lookup by ClassSymbol, not by ClassDocImpl.
- */
- for (Symbol sym : def.members().getSymbolsByName(names.fromString(SERIALIZABLE_FIELDS))) {
- if (sym.kind == VAR) {
- VarSymbol f = (VarSymbol)sym;
- if ((f.flags() & Flags.STATIC) != 0 &&
- (f.flags() & Flags.PRIVATE) != 0) {
- return f;
- }
- }
- }
- return null;
- }
-
- /*
- * Compute default Serializable fields from all members of ClassSymbol.
- *
- * Since the fields of ClassDocImpl might not contain private or
- * package accessible fields, must walk over all members of ClassSymbol.
- */
- private void computeDefaultSerializableFields(DocEnv env,
- ClassSymbol def,
- ClassDocImpl cd) {
- for (Symbol sym : def.members().getSymbols(NON_RECURSIVE)) {
- if (sym != null && sym.kind == VAR) {
- VarSymbol f = (VarSymbol)sym;
- if ((f.flags() & Flags.STATIC) == 0 &&
- (f.flags() & Flags.TRANSIENT) == 0) {
- //### No modifier filtering applied here.
- FieldDocImpl fd = env.getFieldDoc(f);
- //### Add to beginning.
- //### Preserve order used by old 'javadoc'.
- fields.prepend(fd);
- }
- }
- }
- }
-
- /*
- * Catalog Serializable method if it exists in current ClassSymbol.
- * Do not look for method in superclasses.
- *
- * Serialization requires these methods to be non-static.
- *
- * @param method should be an unqualified Serializable method
- * name either READOBJECT, WRITEOBJECT, READRESOLVE
- * or WRITEREPLACE.
- * @param visibility the visibility flag for the given method.
- */
- private void addMethodIfExist(DocEnv env, ClassSymbol def, String methodName) {
- Names names = def.name.table.names;
-
- for (Symbol sym : def.members().getSymbolsByName(names.fromString(methodName))) {
- if (sym.kind == MTH) {
- MethodSymbol md = (MethodSymbol)sym;
- if ((md.flags() & Flags.STATIC) == 0) {
- /*
- * WARNING: not robust if unqualifiedMethodName is overloaded
- * method. Signature checking could make more robust.
- * READOBJECT takes a single parameter, java.io.ObjectInputStream.
- * WRITEOBJECT takes a single parameter, java.io.ObjectOutputStream.
- */
- methods.append(env.getMethodDoc(md));
- }
- }
- }
- }
-
- /*
- * Associate serialField tag fieldName with FieldDocImpl member.
- * Note: A serialField tag does not have to map an existing field
- * of a class.
- */
- private void mapSerialFieldTagImplsToFieldDocImpls(FieldDocImpl spfDoc,
- DocEnv env,
- ClassSymbol def) {
- Names names = def.name.table.names;
- for (SerialFieldTag tag : spfDoc.serialFieldTags()) {
- if (tag.fieldName() == null || tag.fieldType() == null) // ignore malformed @serialField tags
- continue;
-
- Name fieldName = names.fromString(tag.fieldName());
-
- // Look for a FieldDocImpl that is documented by serialFieldTagImpl.
- for (Symbol sym : def.members().getSymbolsByName(fieldName)) {
- if (sym.kind == VAR) {
- VarSymbol f = (VarSymbol) sym;
- FieldDocImpl fdi = env.getFieldDoc(f);
- ((SerialFieldTagImpl) (tag)).mapToFieldDocImpl(fdi);
- break;
- }
- }
- }
- }
-
- /**
- * Return serializable fields in class. <p>
- *
- * Returns either a list of default fields documented by serial tag comment or
- * javadoc comment<p>
- * Or Returns a single FieldDocImpl for serialPersistentField. There is a
- * serialField tag for each serializable field.<p>
- *
- * @return an array of FieldDocImpl for representing the visible
- * fields in this class.
- */
- FieldDoc[] fields() {
- return (FieldDoc[])fields.toArray(new FieldDocImpl[fields.length()]);
- }
-
- /**
- * Return serialization methods in class.
- *
- * @return an array of MethodDocImpl for serialization methods in this class.
- */
- MethodDoc[] methods() {
- return methods.toArray(new MethodDoc[methods.length()]);
- }
-
- /**
- * Returns true if Serializable fields are defined explicitly using
- * member, serialPersistentFields.
- *
- * @see #fields()
- */
- boolean definesSerializableFields() {
- return definesSerializableFields;
- }
-}
--- a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/SourcePositionImpl.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,124 +0,0 @@
-/*
- * Copyright (c) 2001, 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.
- */
-
-package com.sun.tools.javadoc.main;
-
-import java.io.File;
-import javax.tools.FileObject;
-
-import com.sun.javadoc.SourcePosition;
-import com.sun.tools.javac.util.Position;
-
-
-/**
- * A source position: filename, line number, and column number.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- *
- * @since J2SE1.4
- * @author Neal M Gafter
- * @author Michael Van De Vanter (position representation changed to char offsets)
- */
-@Deprecated(since="9", forRemoval=true)
-@SuppressWarnings("removal")
-public class SourcePositionImpl implements SourcePosition {
- FileObject filename;
- int position;
- Position.LineMap lineMap;
-
- /** The source file. Returns null if no file information is
- * available. */
- public File file() {
- return (filename == null) ? null : new File(filename.getName());
- }
-
- /** The source file. Returns null if no file information is
- * available. */
- public FileObject fileObject() {
- return filename;
- }
-
- /** The line in the source file. The first line is numbered 1;
- * 0 means no line number information is available. */
- public int line() {
- if (lineMap == null) {
- return 0;
- } else {
- return lineMap.getLineNumber(position);
- }
- }
-
- /** The column in the source file. The first column is
- * numbered 1; 0 means no column information is available.
- * Columns count characters in the input stream; a tab
- * advances the column number to the next 8-column tab stop.
- */
- public int column() {
- if (lineMap == null) {
- return 0;
- }else {
- return lineMap.getColumnNumber(position);
- }
- }
-
- private SourcePositionImpl(FileObject file, int position,
- Position.LineMap lineMap) {
- super();
- this.filename = file;
- this.position = position;
- this.lineMap = lineMap;
- }
-
- public static SourcePosition make(FileObject file, int pos,
- Position.LineMap lineMap) {
- if (file == null) return null;
- return new SourcePositionImpl(file, pos, lineMap);
- }
-
- public String toString() {
- // Backwards compatibility hack. ZipFileObjects use the format
- // zipfile(zipentry) but javadoc has been using zipfile/zipentry
- String fn = filename.getName();
- if (fn.endsWith(")")) {
- int paren = fn.lastIndexOf("(");
- if (paren != -1) {
- int i = paren+1;
- if (fn.charAt(i) == '/')
- i++;
- fn = fn.substring(0, paren)
- + File.separatorChar
- + fn.substring(i, fn.length() - 1);
- }
- }
-
- if (position == Position.NOPOS)
- return fn;
- else
- return fn + ":" + line();
- }
-}
--- a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/Start.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,578 +0,0 @@
-/*
- * Copyright (c) 1997, 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.
- */
-
-package com.sun.tools.javadoc.main;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.nio.file.Path;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Objects;
-
-import javax.tools.JavaFileManager;
-import javax.tools.JavaFileObject;
-
-import com.sun.javadoc.*;
-import com.sun.tools.javac.file.JavacFileManager;
-import com.sun.tools.javac.file.BaseFileManager;
-import com.sun.tools.javac.main.Arguments;
-import com.sun.tools.javac.main.CommandLine;
-import com.sun.tools.javac.main.DelegatingJavaFileManager;
-import com.sun.tools.javac.main.Option;
-import com.sun.tools.javac.main.OptionHelper;
-import com.sun.tools.javac.main.OptionHelper.GrumpyHelper;
-import com.sun.tools.javac.platform.PlatformDescription;
-import com.sun.tools.javac.platform.PlatformUtils;
-import com.sun.tools.javac.util.ClientCodeException;
-import com.sun.tools.javac.util.Context;
-import com.sun.tools.javac.util.List;
-import com.sun.tools.javac.util.ListBuffer;
-import com.sun.tools.javac.util.Log;
-import com.sun.tools.javac.util.Options;
-
-import static com.sun.tools.javac.code.Flags.*;
-
-/**
- * Main program of Javadoc.
- * Previously named "Main".
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- *
- * @since 1.2
- * @author Robert Field
- * @author Neal Gafter (rewrite)
- */
-@Deprecated(since="9", forRemoval=true)
-@SuppressWarnings("removal")
-public class Start extends ToolOption.Helper {
- /** Context for this invocation. */
- private final Context context;
-
- private final String defaultDocletClassName;
- private final ClassLoader docletParentClassLoader;
-
- private static final String javadocName = "javadoc";
-
- private static final String standardDocletClassName =
- "com.sun.tools.doclets.standard.Standard";
-
- private final long defaultFilter = PUBLIC | PROTECTED;
-
- private final Messager messager;
-
- private DocletInvoker docletInvoker;
-
- /**
- * In API mode, exceptions thrown while calling the doclet are
- * propagated using ClientCodeException.
- */
- private boolean apiMode;
-
- private JavaFileManager fileManager;
-
- public Start(String programName,
- PrintWriter errWriter,
- PrintWriter warnWriter,
- PrintWriter noticeWriter,
- String defaultDocletClassName) {
- this(programName, errWriter, warnWriter, noticeWriter, defaultDocletClassName, null);
- }
-
- public Start(PrintWriter pw) {
- this(javadocName, pw, pw, pw, standardDocletClassName);
- }
-
- public Start(String programName,
- PrintWriter errWriter,
- PrintWriter warnWriter,
- PrintWriter noticeWriter,
- String defaultDocletClassName,
- ClassLoader docletParentClassLoader) {
- context = new Context();
- messager = new Messager(context, programName, errWriter, warnWriter, noticeWriter);
- this.defaultDocletClassName = defaultDocletClassName;
- this.docletParentClassLoader = docletParentClassLoader;
- }
-
- public Start(String programName, String defaultDocletClassName) {
- this(programName, defaultDocletClassName, null);
- }
-
- public Start(String programName, String defaultDocletClassName,
- ClassLoader docletParentClassLoader) {
- context = new Context();
- messager = new Messager(context, programName);
- this.defaultDocletClassName = defaultDocletClassName;
- this.docletParentClassLoader = docletParentClassLoader;
- }
-
- public Start(String programName, ClassLoader docletParentClassLoader) {
- this(programName, standardDocletClassName, docletParentClassLoader);
- }
-
- public Start(String programName) {
- this(programName, standardDocletClassName);
- }
-
- public Start(ClassLoader docletParentClassLoader) {
- this(javadocName, docletParentClassLoader);
- }
-
- public Start() {
- this(javadocName);
- }
-
- public Start(Context context) {
- this.context = Objects.requireNonNull(context);
- apiMode = true;
- defaultDocletClassName = standardDocletClassName;
- docletParentClassLoader = null;
-
- Log log = context.get(Log.logKey);
- if (log instanceof Messager)
- messager = (Messager) log;
- else {
- PrintWriter out = context.get(Log.errKey);
- messager = (out == null) ? new Messager(context, javadocName)
- : new Messager(context, javadocName, out, out, out);
- }
- }
-
- /**
- * Usage
- */
- @Override
- void usage() {
- usage(true);
- }
-
- void usage(boolean exit) {
- usage("main.usage", "-help", "main.usage.foot", exit);
- }
-
- @Override
- void Xusage() {
- Xusage(true);
- }
-
- void Xusage(boolean exit) {
- usage("main.Xusage", "-X", "main.Xusage.foot", exit);
- }
-
- private void usage(String main, String doclet, String foot, boolean exit) {
- // RFE: it would be better to replace the following with code to
- // write a header, then help for each option, then a footer.
- messager.notice(main);
-
- // let doclet print usage information (does nothing on error)
- if (docletInvoker != null) {
- // RFE: this is a pretty bad way to get the doclet to show
- // help info. Moreover, the output appears on stdout,
- // and <i>not</i> on any of the standard streams passed
- // to javadoc, and in particular, not to the noticeWriter
- // But, to fix this, we need to fix the Doclet API.
- docletInvoker.optionLength(doclet);
- }
-
- if (foot != null)
- messager.notice(foot);
-
- if (exit) exit();
- }
-
- /**
- * Exit
- */
- private void exit() {
- messager.exit();
- }
-
-
- /**
- * Main program - external wrapper
- */
- public int begin(String... argv) {
- boolean ok = begin(null, argv, Collections.emptySet());
- return ok ? 0 : 1;
- }
-
- public boolean begin(Class<?> docletClass, Iterable<String> options, Iterable<? extends JavaFileObject> fileObjects) {
- Collection<String> opts = new ArrayList<>();
- for (String opt: options) opts.add(opt);
- return begin(docletClass, opts.toArray(new String[opts.size()]), fileObjects);
- }
-
- private boolean begin(Class<?> docletClass, String[] options, Iterable<? extends JavaFileObject> fileObjects) {
- boolean failed = false;
-
- try {
- failed = !parseAndExecute(docletClass, options, fileObjects);
- } catch (Messager.ExitJavadoc exc) {
- // ignore, we just exit this way
- } catch (OutOfMemoryError ee) {
- messager.error(Messager.NOPOS, "main.out.of.memory");
- failed = true;
- } catch (ClientCodeException e) {
- // simply rethrow these exceptions, to be caught and handled by JavadocTaskImpl
- throw e;
- } catch (Error ee) {
- ee.printStackTrace(System.err);
- messager.error(Messager.NOPOS, "main.fatal.error");
- failed = true;
- } catch (Exception ee) {
- ee.printStackTrace(System.err);
- messager.error(Messager.NOPOS, "main.fatal.exception");
- failed = true;
- } finally {
- if (fileManager != null
- && fileManager instanceof BaseFileManager
- && ((BaseFileManager) fileManager).autoClose) {
- try {
- fileManager.close();
- } catch (IOException ignore) {
- }
- }
- messager.exitNotice();
- messager.flush();
- }
- failed |= messager.nerrors() > 0;
- failed |= rejectWarnings && messager.nwarnings() > 0;
- return !failed;
- }
-
- /**
- * Main program - internal
- */
- private boolean parseAndExecute(
- Class<?> docletClass,
- String[] argv,
- Iterable<? extends JavaFileObject> fileObjects) throws IOException {
- long tm = System.currentTimeMillis();
-
- ListBuffer<String> javaNames = new ListBuffer<>();
-
- // Preprocess @file arguments
- try {
- argv = CommandLine.parse(argv);
- } catch (FileNotFoundException e) {
- messager.error(Messager.NOPOS, "main.cant.read", e.getMessage());
- exit();
- } catch (IOException e) {
- e.printStackTrace(System.err);
- exit();
- }
-
-
- fileManager = context.get(JavaFileManager.class);
-
- setDocletInvoker(docletClass, fileManager, argv);
-
- compOpts = Options.instance(context);
- // Make sure no obsolete source/target messages are reported
- compOpts.put("-Xlint:-options", "-Xlint:-options");
-
- // Parse arguments
- for (int i = 0 ; i < argv.length ; i++) {
- String arg = argv[i];
-
- ToolOption o = ToolOption.get(arg);
- if (o != null) {
- // hack: this restriction should be removed
- if (o == ToolOption.LOCALE && i > 0)
- usageError("main.locale_first");
-
- try {
- if (o.hasArg) {
- oneArg(argv, i++);
- o.process(this, argv[i]);
- } else {
- setOption(arg);
- o.process(this);
- }
- } catch (Option.InvalidValueException e) {
- usageError("main.option.invalid.value", e.getMessage());
- }
- } else if (arg.equals("-XDaccessInternalAPI")) {
- // pass this hidden option down to the doclet, if it wants it
- if (docletInvoker.optionLength("-XDaccessInternalAPI") == 1) {
- setOption(arg);
- }
- } else if (arg.startsWith("-XD")) {
- // hidden javac options
- String s = arg.substring("-XD".length());
- int eq = s.indexOf('=');
- String key = (eq < 0) ? s : s.substring(0, eq);
- String value = (eq < 0) ? s : s.substring(eq+1);
- compOpts.put(key, value);
- }
- // call doclet for its options
- // other arg starts with - is invalid
- else if (arg.startsWith("-")) {
- int optionLength;
- optionLength = docletInvoker.optionLength(arg);
- if (optionLength < 0) {
- // error already displayed
- exit();
- } else if (optionLength == 0) {
- // option not found
- usageError("main.invalid_flag", arg);
- } else {
- // doclet added option
- if ((i + optionLength) > argv.length) {
- usageError("main.requires_argument", arg);
- }
- ListBuffer<String> args = new ListBuffer<>();
- for (int j = 0; j < optionLength-1; ++j) {
- args.append(argv[++i]);
- }
- setOption(arg, args.toList());
- }
- } else {
- javaNames.append(arg);
- }
- }
-
- if (fileManager == null) {
- JavacFileManager.preRegister(context);
- fileManager = context.get(JavaFileManager.class);
- if (fileManager instanceof BaseFileManager) {
- ((BaseFileManager) fileManager).autoClose = true;
- }
- }
- if (fileManager instanceof BaseFileManager) {
- ((BaseFileManager) fileManager).handleOptions(fileManagerOpts);
- }
-
- Arguments arguments = Arguments.instance(context);
- arguments.init(messager.programName);
- arguments.allowEmpty();
- arguments.validate();
-
- String platformString = compOpts.get("--release");
-
- if (platformString != null) {
- if (compOpts.isSet(Option.SOURCE.primaryName)) {
- usageError("main.release.bootclasspath.conflict", Option.SOURCE.primaryName);
- }
- if (fileManagerOpts.containsKey(Option.BOOT_CLASS_PATH)) {
- usageError("main.release.bootclasspath.conflict", Option.BOOT_CLASS_PATH.getPrimaryName());
- }
-
- PlatformDescription platformDescription =
- PlatformUtils.lookupPlatformDescription(platformString);
-
- if (platformDescription == null) {
- usageError("main.unsupported.release.version", platformString);
- }
-
- compOpts.put(Option.SOURCE, platformDescription.getSourceVersion());
-
- context.put(PlatformDescription.class, platformDescription);
-
- JavaFileManager platformFM = platformDescription.getFileManager();
- DelegatingJavaFileManager.installReleaseFileManager(context,
- platformFM,
- fileManager);
- }
-
- compOpts.notifyListeners();
-
- if (javaNames.isEmpty() && subPackages.isEmpty() && isEmpty(fileObjects)) {
- usageError("main.No_packages_or_classes_specified");
- }
-
- if (!docletInvoker.validOptions(options.toList())) {
- // error message already displayed
- exit();
- }
-
- JavadocTool comp = JavadocTool.make0(context);
- if (comp == null) return false;
-
- if (showAccess == null) {
- setFilter(defaultFilter);
- }
-
- LanguageVersion languageVersion = docletInvoker.languageVersion();
- RootDocImpl root = comp.getRootDocImpl(
- docLocale,
- encoding,
- showAccess,
- javaNames.toList(),
- options.toList(),
- fileObjects,
- breakiterator,
- subPackages.toList(),
- excludedPackages.toList(),
- docClasses,
- // legacy?
- languageVersion == null || languageVersion == LanguageVersion.JAVA_1_1,
- quiet);
-
- // release resources
- comp = null;
-
- // pass off control to the doclet
- boolean ok = root != null;
- if (ok) ok = docletInvoker.start(root);
-
- // We're done.
- if (compOpts.get("-verbose") != null) {
- tm = System.currentTimeMillis() - tm;
- messager.notice("main.done_in", Long.toString(tm));
- }
-
- return ok;
- }
-
- private <T> boolean isEmpty(Iterable<T> iter) {
- return !iter.iterator().hasNext();
- }
-
- /**
- * Init the doclet invoker.
- * The doclet class may be given explicitly, or via the -doclet option in
- * argv.
- * If the doclet class is not given explicitly, it will be loaded from
- * the file manager's DOCLET_PATH location, if available, or via the
- * -doclet path option in argv.
- * @param docletClass The doclet class. May be null.
- * @param fileManager The file manager used to get the class loader to load
- * the doclet class if required. May be null.
- * @param argv Args containing -doclet and -docletpath, in case they are required.
- */
- private void setDocletInvoker(Class<?> docletClass, JavaFileManager fileManager, String[] argv) {
- boolean exportInternalAPI = false;
- String docletClassName = null;
- String docletPath = null;
-
- // Parse doclet specifying arguments
- for (int i = 0 ; i < argv.length ; i++) {
- String arg = argv[i];
- if (arg.equals(ToolOption.DOCLET.opt)) {
- oneArg(argv, i++);
- if (docletClassName != null) {
- usageError("main.more_than_one_doclet_specified_0_and_1",
- docletClassName, argv[i]);
- }
- docletClassName = argv[i];
- } else if (arg.equals(ToolOption.DOCLETPATH.opt)) {
- oneArg(argv, i++);
- if (docletPath == null) {
- docletPath = argv[i];
- } else {
- docletPath += File.pathSeparator + argv[i];
- }
- } else if (arg.equals("-XDaccessInternalAPI")) {
- exportInternalAPI = true;
- }
- }
-
- if (docletClass != null) {
- // TODO, check no -doclet, -docletpath
- docletInvoker = new DocletInvoker(messager, docletClass, apiMode, exportInternalAPI);
- } else {
- if (docletClassName == null) {
- docletClassName = defaultDocletClassName;
- }
-
- // attempt to find doclet
- docletInvoker = new DocletInvoker(messager, fileManager,
- docletClassName, docletPath,
- docletParentClassLoader,
- apiMode,
- exportInternalAPI);
- }
- }
-
- /**
- * Set one arg option.
- * Error and exit if one argument is not provided.
- */
- private void oneArg(String[] args, int index) {
- if ((index + 1) < args.length) {
- setOption(args[index], args[index+1]);
- } else {
- usageError("main.requires_argument", args[index]);
- }
- }
-
- @Override
- void usageError(String key, Object... args) {
- messager.error(Messager.NOPOS, key, args);
- usage(true);
- }
-
- /**
- * indicate an option with no arguments was given.
- */
- private void setOption(String opt) {
- String[] option = { opt };
- options.append(option);
- }
-
- /**
- * indicate an option with one argument was given.
- */
- private void setOption(String opt, String argument) {
- String[] option = { opt, argument };
- options.append(option);
- }
-
- /**
- * indicate an option with the specified list of arguments was given.
- */
- private void setOption(String opt, List<String> arguments) {
- String[] args = new String[arguments.length() + 1];
- int k = 0;
- args[k++] = opt;
- for (List<String> i = arguments; i.nonEmpty(); i=i.tail) {
- args[k++] = i.head;
- }
- options.append(args);
- }
-
- @Override
- OptionHelper getOptionHelper() {
- return new GrumpyHelper(messager) {
- @Override
- public String get(com.sun.tools.javac.main.Option option) {
- return compOpts.get(option);
- }
-
- @Override
- public void put(String name, String value) {
- compOpts.put(name, value);
- }
- };
- }
-}
--- a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/TagImpl.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,190 +0,0 @@
-/*
- * Copyright (c) 1997, 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.
- */
-
-package com.sun.tools.javadoc.main;
-
-import com.sun.javadoc.*;
-
-/**
- * Represents a documentation tag, e.g. @since, @author, @version.
- * Given a tag (e.g. "@since 1.2"), holds tag name (e.g. "@since")
- * and tag text (e.g. "1.2"). TagImpls with structure or which require
- * special processing are handled by subclasses (ParamTagImpl, SeeTagImpl,
- * and ThrowsTagImpl
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- *
- * @author Robert Field
- * @author Atul M Dambalkar
- * @author Neal M Gafter
- * @see SeeTagImpl
- * @see ParamTagImpl
- * @see ThrowsTagImpl
- * @see Doc#tags()
- *
- */
-@Deprecated(since="9", forRemoval=true)
-@SuppressWarnings("removal")
-class TagImpl implements Tag {
-
- protected final String text;
- protected final String name;
- protected final DocImpl holder;
-
- /**
- * Cached first sentence.
- */
- private Tag[] firstSentence;
-
- /**
- * Cached inline tags.
- */
- private Tag[] inlineTags;
-
- /**
- * Constructor
- */
- TagImpl(DocImpl holder, String name, String text) {
- this.holder = holder;
- this.name = name;
- this.text = text;
- }
-
- /**
- * Return the name of this tag.
- */
- public String name() {
- return name;
- }
-
- /**
- * Return the containing {@link Doc} of this Tag element.
- */
- public Doc holder() {
- return holder;
- }
-
- /**
- * Return the kind of this tag.
- */
- public String kind() {
- return name;
- }
-
- /**
- * Return the text of this tag, that is, portion beyond tag name.
- */
- public String text() {
- return text;
- }
-
- DocEnv docenv() {
- return holder.env;
- }
-
- /**
- * for use by subclasses which have two part tag text.
- */
- String[] divideAtWhite() {
- String[] sa = new String[2];
- int len = text.length();
- // if no white space found
- sa[0] = text;
- sa[1] = "";
- for (int inx = 0; inx < len; ++inx) {
- char ch = text.charAt(inx);
- if (Character.isWhitespace(ch)) {
- sa[0] = text.substring(0, inx);
- for (; inx < len; ++inx) {
- ch = text.charAt(inx);
- if (!Character.isWhitespace(ch)) {
- sa[1] = text.substring(inx, len);
- break;
- }
- }
- break;
- }
- }
- return sa;
- }
-
- /**
- * convert this object to a string.
- */
- public String toString() {
- return name + ":" + text;
- }
-
- /**
- * For documentation comment with embedded @link tags, return the array of
- * TagImpls consisting of SeeTagImpl(s) and text containing TagImpl(s).
- * Within a comment string "This is an example of inline tags for a
- * documentation comment {@link Doc {@link Doc commentlabel}}",
- * where inside the inner braces, the first "Doc" carries exctly the same
- * syntax as a SeeTagImpl and the second "commentlabel" is label for the Html
- * Link, will return an array of TagImpl(s) with first element as TagImpl with
- * comment text "This is an example of inline tags for a documentation
- * comment" and second element as SeeTagImpl with referenced class as "Doc"
- * and the label for the Html Link as "commentlabel".
- *
- * @return TagImpl[] Array of tags with inline SeeTagImpls.
- * @see ParamTagImpl
- * @see ThrowsTagImpl
- */
- public Tag[] inlineTags() {
- if (inlineTags == null) {
- inlineTags = Comment.getInlineTags(holder, text);
- }
- return inlineTags;
- }
-
- /**
- * Return array of tags for the first sentence in the doc comment text.
- */
- public Tag[] firstSentenceTags() {
- if (firstSentence == null) {
- //Parse all sentences first to avoid duplicate warnings.
- inlineTags();
- try {
- docenv().setSilent(true);
- firstSentence = Comment.firstSentenceTags(holder, text);
- } finally {
- docenv().setSilent(false);
- }
- }
- return firstSentence;
- }
-
- /**
- * Return the doc item to which this tag is attached.
- * @return the doc item to which this tag is attached.
- */
- public SourcePosition position() {
- return holder.position();
- }
-}
--- a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ThrowsTagImpl.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,128 +0,0 @@
-/*
- * Copyright (c) 1997, 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.
- */
-
-package com.sun.tools.javadoc.main;
-
-import com.sun.javadoc.*;
-
-/**
- * Represents a @throws or @exception documentation tag.
- * Parses and holds the exception name and exception comment.
- * The exception name my be the name of a type variable.
- * Note: @exception is a backwards compatible synonymy for @throws.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- *
- * @author Robert Field
- * @author Atul M Dambalkar
- * @see ExecutableMemberDocImpl#throwsTags()
- *
- */
-@Deprecated(since="9", forRemoval=true)
-@SuppressWarnings("removal")
-class ThrowsTagImpl extends TagImpl implements ThrowsTag {
-
- private final String exceptionName;
- private final String exceptionComment;
-
- /**
- * Cached inline tags.
- */
- private Tag[] inlineTags;
-
- ThrowsTagImpl(DocImpl holder, String name, String text) {
- super(holder, name, text);
- String[] sa = divideAtWhite();
- exceptionName = sa[0];
- exceptionComment = sa[1];
- }
-
- /**
- * Return the exception name.
- */
- public String exceptionName() {
- return exceptionName;
- }
-
- /**
- * Return the exception comment.
- */
- public String exceptionComment() {
- return exceptionComment;
- }
-
- /**
- * Return the exception as a ClassDocImpl.
- */
- public ClassDoc exception() {
- ClassDocImpl exceptionClass;
- if (!(holder instanceof ExecutableMemberDoc)) {
- exceptionClass = null;
- } else {
- ExecutableMemberDocImpl emd = (ExecutableMemberDocImpl)holder;
- ClassDocImpl con = (ClassDocImpl)emd.containingClass();
- exceptionClass = (ClassDocImpl)con.findClass(exceptionName);
- }
- return exceptionClass;
- }
-
- /**
- * Return the type that represents the exception.
- * This may be a <code>ClassDoc</code> or a <code>TypeVariable</code>.
- */
- public Type exceptionType() {
- //###(gj) TypeVariable not yet supported.
- return exception();
- }
-
-
- /**
- * Return the kind of this tag. Always "@throws" for instances
- * of ThrowsTagImpl.
- */
- @Override
- public String kind() {
- return "@throws";
- }
-
- /**
- * For the exception comment with embedded @link tags return the array of
- * TagImpls consisting of SeeTagImpl(s) and text containing TagImpl(s).
- *
- * @return TagImpl[] Array of tags with inline SeeTagImpls.
- * @see TagImpl#inlineTags()
- * @see ParamTagImpl#inlineTags()
- */
- @Override
- public Tag[] inlineTags() {
- if (inlineTags == null) {
- inlineTags = Comment.getInlineTags(holder, exceptionComment());
- }
- return inlineTags;
- }
-}
--- a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ToolOption.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,454 +0,0 @@
-/*
- * 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.
- */
-
-package com.sun.tools.javadoc.main;
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.StringTokenizer;
-
-import com.sun.tools.javac.code.Flags;
-import com.sun.tools.javac.main.Option;
-import com.sun.tools.javac.main.Option.InvalidValueException;
-import com.sun.tools.javac.main.OptionHelper;
-import com.sun.tools.javac.util.ListBuffer;
-import com.sun.tools.javac.util.Options;
-
-
-/**
- * javadoc tool options.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- */
-@Deprecated(since="9", forRemoval=true)
-@SuppressWarnings("removal")
-public enum ToolOption {
- // ----- options for underlying compiler -----
-
- BOOTCLASSPATH("-bootclasspath", true) {
- @Override
- public void process(Helper helper, String arg) {
- helper.setFileManagerOpt(Option.BOOT_CLASS_PATH, arg);
- }
- },
-
- CLASSPATH("-classpath", true) {
- @Override
- public void process(Helper helper, String arg) {
- helper.setFileManagerOpt(Option.CLASS_PATH, arg);
- }
- },
-
- CP("-cp", true) {
- @Override
- public void process(Helper helper, String arg) {
- helper.setFileManagerOpt(Option.CLASS_PATH, arg);
- }
- },
-
- CLASS_PATH("--class-path", true) {
- @Override
- public void process(Helper helper, String arg) {
- helper.setFileManagerOpt(Option.CLASS_PATH, arg);
- }
- },
-
- EXTDIRS("-extdirs", true) {
- @Override
- public void process(Helper helper, String arg) {
- helper.setFileManagerOpt(Option.EXTDIRS, arg);
- }
- },
-
- SOURCEPATH("-sourcepath", true) {
- @Override
- public void process(Helper helper, String arg) {
- helper.setFileManagerOpt(Option.SOURCE_PATH, arg);
- }
- },
-
- SOURCE_PATH("--source-path", true) {
- @Override
- public void process(Helper helper, String arg) {
- helper.setFileManagerOpt(Option.SOURCE_PATH, arg);
- }
- },
-
- SYSCLASSPATH("-sysclasspath", true) {
- @Override
- public void process(Helper helper, String arg) {
- helper.setFileManagerOpt(Option.BOOT_CLASS_PATH, arg);
- }
- },
-
- MODULE_SOURCE_PATH("--module-source-path", true) {
- @Override
- public void process(Helper helper, String arg) {
- helper.setFileManagerOpt(Option.MODULE_SOURCE_PATH, arg);
- }
- },
-
- UPGRADE_MODULE_PATH("--upgrade-module-path", true) {
- @Override
- public void process(Helper helper, String arg) {
- helper.setFileManagerOpt(Option.UPGRADE_MODULE_PATH, arg);
- }
- },
-
- SYSTEM_("--system", true) {
- @Override
- public void process(Helper helper, String arg) {
- helper.setFileManagerOpt(Option.SYSTEM, arg);
- }
- },
-
- MODULE_PATH("--module-path", true) {
- @Override
- public void process(Helper helper, String arg) {
- helper.setFileManagerOpt(Option.MODULE_PATH, arg);
- }
- },
-
- P("-p", true) {
- @Override
- public void process(Helper helper, String arg) {
- helper.setFileManagerOpt(Option.MODULE_PATH, arg);
- }
- },
-
- ADD_MODULES("--add-modules", true) {
- @Override
- public void process(Helper helper, String arg) throws InvalidValueException {
- Option.ADD_MODULES.process(helper.getOptionHelper(), opt, arg);
- }
- },
-
- LIMIT_MODULES("--limit-modules", true) {
- @Override
- public void process(Helper helper, String arg) throws InvalidValueException {
- Option.LIMIT_MODULES.process(helper.getOptionHelper(), opt, arg);
- }
- },
-
- ENCODING("-encoding", true) {
- @Override
- public void process(Helper helper, String arg) {
- helper.encoding = arg;
- helper.setCompilerOpt(opt, arg);
- helper.setFileManagerOpt(Option.ENCODING, arg);
- }
- },
-
- RELEASE("--release", true) {
- @Override
- public void process(Helper helper, String arg) {
- helper.setCompilerOpt(opt, arg);
- }
- },
-
- SOURCE("-source", true) {
- @Override
- public void process(Helper helper, String arg) {
- helper.setCompilerOpt("--source", arg);
- }
- },
-
- SOURCE2("--source", true) {
- @Override
- public void process(Helper helper, String arg) {
- helper.setCompilerOpt(opt, arg);
- }
- },
-
- XMAXERRS("-Xmaxerrs", true) {
- @Override
- public void process(Helper helper, String arg) {
- helper.setCompilerOpt(opt, arg);
- }
- },
-
- XMAXWARNS("-Xmaxwarns", true) {
- @Override
- public void process(Helper helper, String arg) {
- helper.setCompilerOpt(opt, arg);
- }
- },
-
- ADD_READS("--add-reads", true) {
- @Override
- public void process(Helper helper, String arg) throws InvalidValueException {
- Option.ADD_READS.process(helper.getOptionHelper(), opt, arg);
- }
- },
-
- ADD_EXPORTS("--add-exports", true) {
- @Override
- public void process(Helper helper, String arg) throws InvalidValueException {
- Option.ADD_EXPORTS.process(helper.getOptionHelper(), opt, arg);
- }
- },
-
- PATCH_MODULE("--patch-module", true) {
- @Override
- public void process(Helper helper, String arg) throws InvalidValueException {
- Option.PATCH_MODULE.process(helper.getOptionHelper(), opt, arg);
- }
- },
-
- ADD_OPENS("--add-opens", true) {
- @Override
- public void process(Helper helper, String arg) throws InvalidValueException {
- Option.ADD_OPENS.process(helper.getOptionHelper(), opt, arg);
- }
- },
-
- // ----- doclet options -----
-
- DOCLET("-doclet", true), // handled in setDocletInvoker
-
- DOCLETPATH("-docletpath", true), // handled in setDocletInvoker
-
- // ----- selection options -----
-
- SUBPACKAGES("-subpackages", true) {
- @Override
- public void process(Helper helper, String arg) {
- helper.addToList(helper.subPackages, arg);
- }
- },
-
- EXCLUDE("-exclude", true) {
- @Override
- public void process(Helper helper, String arg) {
- helper.addToList(helper.excludedPackages, arg);
- }
- },
-
- // ----- filtering options -----
-
- PACKAGE("-package") {
- @Override
- public void process(Helper helper) {
- helper.setFilter(
- Flags.PUBLIC | Flags.PROTECTED | ModifierFilter.PACKAGE);
- }
- },
-
- PRIVATE("-private") {
- @Override
- public void process(Helper helper) {
- helper.setFilter(ModifierFilter.ALL_ACCESS);
- }
- },
-
- PROTECTED("-protected") {
- @Override
- public void process(Helper helper) {
- helper.setFilter(Flags.PUBLIC | Flags.PROTECTED);
- }
- },
-
- PUBLIC("-public") {
- @Override
- public void process(Helper helper) {
- helper.setFilter(Flags.PUBLIC);
- }
- },
-
- // ----- output control options -----
-
- PROMPT("-prompt") {
- @Override
- public void process(Helper helper) {
- helper.compOpts.put("-prompt", "-prompt");
- helper.promptOnError = true;
- }
- },
-
- QUIET("-quiet") {
- @Override
- public void process(Helper helper) {
- helper.quiet = true;
- }
- },
-
- VERBOSE("-verbose") {
- @Override
- public void process(Helper helper) {
- helper.compOpts.put("-verbose", "");
- }
- },
-
- XWERROR("-Xwerror") {
- @Override
- public void process(Helper helper) {
- helper.rejectWarnings = true;
-
- }
- },
-
- // ----- other options -----
-
- BREAKITERATOR("-breakiterator") {
- @Override
- public void process(Helper helper) {
- helper.breakiterator = true;
- }
- },
-
- LOCALE("-locale", true) {
- @Override
- public void process(Helper helper, String arg) {
- helper.docLocale = arg;
- }
- },
-
- OVERVIEW("-overview", true),
-
- XCLASSES("-Xclasses") {
- @Override
- public void process(Helper helper) {
- helper.docClasses = true;
-
- }
- },
-
- // ----- help options -----
-
- HELP("-help") {
- @Override
- public void process(Helper helper) {
- helper.usage();
- }
- },
-
- X("-X") {
- @Override
- public void process(Helper helper) {
- helper.Xusage();
- }
- };
-
- public final String opt;
- public final boolean hasArg;
-
- ToolOption(String opt) {
- this(opt, false);
- }
-
- ToolOption(String opt, boolean hasArg) {
- this.opt = opt;
- this.hasArg = hasArg;
- }
-
- void process(Helper helper, String arg) throws Option.InvalidValueException { }
-
- void process(Helper helper) { }
-
- static ToolOption get(String name) {
- for (ToolOption o: values()) {
- if (name.equals(o.opt))
- return o;
- }
- return null;
- }
-
- static abstract class Helper {
- /** List of decoded options. */
- final ListBuffer<String[]> options = new ListBuffer<>();
-
- /** Selected packages, from -subpackages. */
- final ListBuffer<String> subPackages = new ListBuffer<>();
-
- /** Excluded packages, from -exclude. */
- final ListBuffer<String> excludedPackages = new ListBuffer<>();
-
- // File manager options
- final Map<Option, String> fileManagerOpts = new LinkedHashMap<>();
-
- /** javac options, set by various options. */
- Options compOpts; // = Options.instance(context)
-
- /* Encoding for javac, and files written? set by -encoding. */
- String encoding = null;
-
- /** Set by -breakiterator. */
- boolean breakiterator = false;
-
- /** Set by -quiet. */
- boolean quiet = false;
-
- /** Set by -Xclasses. */
- boolean docClasses = false;
-
- /** Set by -Xwerror. */
- boolean rejectWarnings = false;
-
- /** Set by -prompt. */
- boolean promptOnError;
-
- /** Set by -locale. */
- String docLocale = "";
-
- /** Set by -public, private, -protected, -package. */
- ModifierFilter showAccess = null;
-
- abstract void usage();
- abstract void Xusage();
-
- abstract void usageError(String msg, Object... args);
- abstract OptionHelper getOptionHelper();
-
- void addToList(ListBuffer<String> list, String str){
- StringTokenizer st = new StringTokenizer(str, ":");
- String current;
- while(st.hasMoreTokens()){
- current = st.nextToken();
- list.append(current);
- }
- }
-
- void setFilter(long filterBits) {
- if (showAccess != null) {
- usageError("main.incompatible.access.flags");
- }
- showAccess = new ModifierFilter(filterBits);
- }
-
- void setCompilerOpt(String opt, String arg) {
- if (compOpts.get(opt) != null) {
- usageError("main.option.already.seen", opt);
- }
- compOpts.put(opt, arg);
- }
-
- void setFileManagerOpt(Option opt, String arg) {
- fileManagerOpts.put(opt, arg);
- }
- }
-}
--- a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/TypeMaker.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,352 +0,0 @@
-/*
- * Copyright (c) 1997, 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.
- */
-
-package com.sun.tools.javadoc.main;
-
-import com.sun.javadoc.*;
-import com.sun.tools.javac.code.Symbol;
-import com.sun.tools.javac.code.Symbol.ClassSymbol;
-import com.sun.tools.javac.code.Symbol.CompletionFailure;
-import com.sun.tools.javac.code.Type;
-import com.sun.tools.javac.code.Type.ArrayType;
-import com.sun.tools.javac.code.Type.ClassType;
-import com.sun.tools.javac.code.Type.TypeVar;
-import com.sun.tools.javac.util.List;
-import static com.sun.tools.javac.code.TypeTag.ARRAY;
-
-/**
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- */
-@Deprecated(since="9", forRemoval=true)
-@SuppressWarnings("removal")
-public class TypeMaker {
-
- public static com.sun.javadoc.Type getType(DocEnv env, Type t) {
- return getType(env, t, true);
- }
-
- /**
- * @param errToClassDoc if true, ERROR type results in a ClassDoc;
- * false preserves legacy behavior
- */
- public static com.sun.javadoc.Type getType(DocEnv env, Type t,
- boolean errorToClassDoc) {
- return getType(env, t, errorToClassDoc, true);
- }
-
- public static com.sun.javadoc.Type getType(DocEnv env, Type t,
- boolean errToClassDoc, boolean considerAnnotations) {
- try {
- return getTypeImpl(env, t, errToClassDoc, considerAnnotations);
- } catch (CompletionFailure cf) {
- /* Quietly ignore completion failures and try again - the type
- * for which the CompletionFailure was thrown shouldn't be completed
- * again by the completer that threw the CompletionFailure.
- */
- return getType(env, t, errToClassDoc, considerAnnotations);
- }
- }
-
- @SuppressWarnings("fallthrough")
- private static com.sun.javadoc.Type getTypeImpl(DocEnv env, Type t,
- boolean errToClassDoc, boolean considerAnnotations) {
- if (env.legacyDoclet) {
- t = env.types.erasure(t);
- }
-
- if (considerAnnotations && t.isAnnotated()) {
- return new AnnotatedTypeImpl(env, t);
- }
-
- switch (t.getTag()) {
- case CLASS:
- if (ClassDocImpl.isGeneric((ClassSymbol)t.tsym)) {
- return env.getParameterizedType((ClassType)t);
- } else {
- return env.getClassDoc((ClassSymbol)t.tsym);
- }
- case WILDCARD:
- Type.WildcardType a = (Type.WildcardType)t;
- return new WildcardTypeImpl(env, a);
- case TYPEVAR: return new TypeVariableImpl(env, (TypeVar)t);
- case ARRAY: return new ArrayTypeImpl(env, t);
- case BYTE: return PrimitiveType.byteType;
- case CHAR: return PrimitiveType.charType;
- case SHORT: return PrimitiveType.shortType;
- case INT: return PrimitiveType.intType;
- case LONG: return PrimitiveType.longType;
- case FLOAT: return PrimitiveType.floatType;
- case DOUBLE: return PrimitiveType.doubleType;
- case BOOLEAN: return PrimitiveType.booleanType;
- case VOID: return PrimitiveType.voidType;
- case ERROR:
- if (errToClassDoc)
- return env.getClassDoc((ClassSymbol)t.tsym);
- // FALLTHRU
- default:
- return new PrimitiveType(t.tsym.getQualifiedName().toString());
- }
- }
-
- /**
- * Convert a list of javac types into an array of javadoc types.
- */
- public static com.sun.javadoc.Type[] getTypes(DocEnv env, List<Type> ts) {
- return getTypes(env, ts, new com.sun.javadoc.Type[ts.length()]);
- }
-
- /**
- * Like the above version, but use and return the array given.
- */
- public static com.sun.javadoc.Type[] getTypes(DocEnv env, List<Type> ts,
- com.sun.javadoc.Type res[]) {
- int i = 0;
- for (Type t : ts) {
- res[i++] = getType(env, t);
- }
- return res;
- }
-
- public static String getTypeName(Type t, boolean full) {
- switch (t.getTag()) {
- case ARRAY:
- StringBuilder s = new StringBuilder();
- while (t.hasTag(ARRAY)) {
- s.append("[]");
- t = ((ArrayType)t).elemtype;
- }
- s.insert(0, getTypeName(t, full));
- return s.toString();
- case CLASS:
- return ClassDocImpl.getClassName((ClassSymbol)t.tsym, full);
- default:
- return t.tsym.getQualifiedName().toString();
- }
- }
-
- /**
- * Return the string representation of a type use. Bounds of type
- * variables are not included; bounds of wildcard types are.
- * Class names are qualified if "full" is true.
- */
- static String getTypeString(DocEnv env, Type t, boolean full) {
- // TODO: should annotations be included here?
- switch (t.getTag()) {
- case ARRAY:
- StringBuilder s = new StringBuilder();
- while (t.hasTag(ARRAY)) {
- s.append("[]");
- t = env.types.elemtype(t);
- }
- s.insert(0, getTypeString(env, t, full));
- return s.toString();
- case CLASS:
- return ParameterizedTypeImpl.
- parameterizedTypeToString(env, (ClassType)t, full);
- case WILDCARD:
- Type.WildcardType a = (Type.WildcardType)t;
- return WildcardTypeImpl.wildcardTypeToString(env, a, full);
- default:
- return t.tsym.getQualifiedName().toString();
- }
- }
-
- /**
- * Return the formal type parameters of a class or method as an
- * angle-bracketed string. Each parameter is a type variable with
- * optional bounds. Class names are qualified if "full" is true.
- * Return "" if there are no type parameters or we're hiding generics.
- */
- static String typeParametersString(DocEnv env, Symbol sym, boolean full) {
- if (env.legacyDoclet || sym.type.getTypeArguments().isEmpty()) {
- return "";
- }
- StringBuilder s = new StringBuilder();
- for (Type t : sym.type.getTypeArguments()) {
- s.append(s.length() == 0 ? "<" : ", ");
- s.append(TypeVariableImpl.typeVarToString(env, (TypeVar)t, full));
- }
- s.append(">");
- return s.toString();
- }
-
- /**
- * Return the actual type arguments of a parameterized type as an
- * angle-bracketed string. Class name are qualified if "full" is true.
- * Return "" if there are no type arguments or we're hiding generics.
- */
- static String typeArgumentsString(DocEnv env, ClassType cl, boolean full) {
- if (env.legacyDoclet || cl.getTypeArguments().isEmpty()) {
- return "";
- }
- StringBuilder s = new StringBuilder();
- for (Type t : cl.getTypeArguments()) {
- s.append(s.length() == 0 ? "<" : ", ");
- s.append(getTypeString(env, t, full));
- }
- s.append(">");
- return s.toString();
- }
-
-
- private static class ArrayTypeImpl implements com.sun.javadoc.Type {
-
- Type arrayType;
-
- DocEnv env;
-
- ArrayTypeImpl(DocEnv env, Type arrayType) {
- this.env = env;
- this.arrayType = arrayType;
- }
-
- private com.sun.javadoc.Type skipArraysCache = null;
-
- public com.sun.javadoc.Type getElementType() {
- return TypeMaker.getType(env, env.types.elemtype(arrayType));
- }
-
- private com.sun.javadoc.Type skipArrays() {
- if (skipArraysCache == null) {
- Type t;
- for (t = arrayType; t.hasTag(ARRAY); t = env.types.elemtype(t)) { }
- skipArraysCache = TypeMaker.getType(env, t);
- }
- return skipArraysCache;
- }
-
- /**
- * Return the type's dimension information, as a string.
- * <p>
- * For example, a two dimensional array of String returns '[][]'.
- */
- public String dimension() {
- StringBuilder dimension = new StringBuilder();
- for (Type t = arrayType; t.hasTag(ARRAY); t = env.types.elemtype(t)) {
- dimension.append("[]");
- }
- return dimension.toString();
- }
-
- /**
- * Return unqualified name of type excluding any dimension information.
- * <p>
- * For example, a two dimensional array of String returns 'String'.
- */
- public String typeName() {
- return skipArrays().typeName();
- }
-
- /**
- * Return qualified name of type excluding any dimension information.
- *<p>
- * For example, a two dimensional array of String
- * returns 'java.lang.String'.
- */
- public String qualifiedTypeName() {
- return skipArrays().qualifiedTypeName();
- }
-
- /**
- * Return the simple name of this type excluding any dimension information.
- */
- public String simpleTypeName() {
- return skipArrays().simpleTypeName();
- }
-
- /**
- * Return this type as a class. Array dimensions are ignored.
- *
- * @return a ClassDocImpl if the type is a Class.
- * Return null if it is a primitive type..
- */
- public ClassDoc asClassDoc() {
- return skipArrays().asClassDoc();
- }
-
- /**
- * Return this type as a <code>ParameterizedType</code> if it
- * represents a parameterized type. Array dimensions are ignored.
- */
- public ParameterizedType asParameterizedType() {
- return skipArrays().asParameterizedType();
- }
-
- /**
- * Return this type as a <code>TypeVariable</code> if it represents
- * a type variable. Array dimensions are ignored.
- */
- public TypeVariable asTypeVariable() {
- return skipArrays().asTypeVariable();
- }
-
- /**
- * Return null, as there are no arrays of wildcard types.
- */
- public WildcardType asWildcardType() {
- return null;
- }
-
- /**
- * Return null, as there are no annotations of the type
- */
- public AnnotatedType asAnnotatedType() {
- return null;
- }
-
- /**
- * Return this type as an <code>AnnotationTypeDoc</code> if it
- * represents an annotation type. Array dimensions are ignored.
- */
- public AnnotationTypeDoc asAnnotationTypeDoc() {
- return skipArrays().asAnnotationTypeDoc();
- }
-
- /**
- * Return true if this is an array of a primitive type.
- */
- public boolean isPrimitive() {
- return skipArrays().isPrimitive();
- }
-
- /**
- * Return a string representation of the type.
- *
- * Return name of type including any dimension information.
- * <p>
- * For example, a two dimensional array of String returns
- * <code>String[][]</code>.
- *
- * @return name of type including any dimension information.
- */
- @Override
- public String toString() {
- return qualifiedTypeName() + dimension();
- }
- }
-}
--- a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/TypeVariableImpl.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,154 +0,0 @@
-/*
- * Copyright (c) 2003, 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.
- */
-
-package com.sun.tools.javadoc.main;
-
-import com.sun.javadoc.*;
-
-import com.sun.tools.javac.code.Attribute;
-import com.sun.tools.javac.code.Attribute.TypeCompound;
-import com.sun.tools.javac.code.Kinds;
-import com.sun.tools.javac.code.Kinds.KindSelector;
-import com.sun.tools.javac.code.Symbol;
-import com.sun.tools.javac.code.Symbol.ClassSymbol;
-import com.sun.tools.javac.code.Symbol.MethodSymbol;
-import com.sun.tools.javac.code.Type;
-import com.sun.tools.javac.code.Type.TypeVar;
-import com.sun.tools.javac.util.List;
-import com.sun.tools.javac.util.Name;
-import com.sun.tools.javac.util.Names;
-
-/**
- * Implementation of <code>TypeVariable</code>, which
- * represents a type variable.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- *
- * @author Scott Seligman
- * @since 1.5
- */
-@Deprecated(since="9", forRemoval=true)
-@SuppressWarnings("removal")
-public class TypeVariableImpl extends AbstractTypeImpl implements TypeVariable {
-
- TypeVariableImpl(DocEnv env, TypeVar type) {
- super(env, type);
- }
-
- /**
- * Return the bounds of this type variable.
- */
- public com.sun.javadoc.Type[] bounds() {
- return TypeMaker.getTypes(env, getBounds((TypeVar)type, env));
- }
-
- /**
- * Return the class, interface, method, or constructor within
- * which this type variable is declared.
- */
- public ProgramElementDoc owner() {
- Symbol osym = type.tsym.owner;
- if (osym.kind.matches(KindSelector.TYP)) {
- return env.getClassDoc((ClassSymbol)osym);
- }
- Names names = osym.name.table.names;
- if (osym.name == names.init) {
- return env.getConstructorDoc((MethodSymbol)osym);
- } else {
- return env.getMethodDoc((MethodSymbol)osym);
- }
- }
-
- /**
- * Return the ClassDoc of the erasure of this type variable.
- */
- @Override
- public ClassDoc asClassDoc() {
- return env.getClassDoc((ClassSymbol)env.types.erasure(type).tsym);
- }
-
- @Override
- public TypeVariable asTypeVariable() {
- return this;
- }
-
- @Override
- public String toString() {
- return typeVarToString(env, (TypeVar)type, true);
- }
-
-
- /**
- * Return the string form of a type variable along with any
- * "extends" clause. Class names are qualified if "full" is true.
- */
- static String typeVarToString(DocEnv env, TypeVar v, boolean full) {
- StringBuilder s = new StringBuilder(v.toString());
- List<Type> bounds = getBounds(v, env);
- if (bounds.nonEmpty()) {
- boolean first = true;
- for (Type b : bounds) {
- s.append(first ? " extends " : " & ");
- s.append(TypeMaker.getTypeString(env, b, full));
- first = false;
- }
- }
- return s.toString();
- }
-
- /**
- * Get the bounds of a type variable as listed in the "extends" clause.
- */
- private static List<Type> getBounds(TypeVar v, DocEnv env) {
- final Type upperBound = v.getUpperBound();
- Name boundname = upperBound.tsym.getQualifiedName();
- if (boundname == boundname.table.names.java_lang_Object
- && !upperBound.isAnnotated()) {
- return List.nil();
- } else {
- return env.types.getBounds(v);
- }
- }
-
- /**
- * Get the annotations of this program element.
- * Return an empty array if there are none.
- */
- public AnnotationDesc[] annotations() {
- if (!type.isAnnotated()) {
- return new AnnotationDesc[0];
- }
- List<? extends TypeCompound> tas = type.getAnnotationMirrors();
- AnnotationDesc res[] = new AnnotationDesc[tas.length()];
- int i = 0;
- for (Attribute.Compound a : tas) {
- res[i++] = new AnnotationDescImpl(env, a);
- }
- return res;
- }
-}
--- a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/WildcardTypeImpl.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,141 +0,0 @@
-/*
- * Copyright (c) 2003, 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.
- */
-
-package com.sun.tools.javadoc.main;
-
-import com.sun.javadoc.*;
-
-import com.sun.tools.javac.code.Symbol.ClassSymbol;
-import com.sun.tools.javac.code.Type;
-import com.sun.tools.javac.util.List;
-
-
-/**
- * Implementation of <code>WildcardType</code>, which
- * represents a wildcard type.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- *
- * @author Scott Seligman
- * @since 1.5
- */
-@Deprecated(since="9", forRemoval=true)
-@SuppressWarnings("removal")
-public class WildcardTypeImpl extends AbstractTypeImpl implements WildcardType {
-
- WildcardTypeImpl(DocEnv env, Type.WildcardType type) {
- super(env, type);
- }
-
- /**
- * Return the upper bounds of this wildcard type argument
- * as given by the <i>extends</i> clause.
- * Return an empty array if no such bounds are explicitly given.
- */
- public com.sun.javadoc.Type[] extendsBounds() {
- return TypeMaker.getTypes(env, getExtendsBounds((Type.WildcardType)type));
- }
-
- /**
- * Return the lower bounds of this wildcard type argument
- * as given by the <i>super</i> clause.
- * Return an empty array if no such bounds are explicitly given.
- */
- public com.sun.javadoc.Type[] superBounds() {
- return TypeMaker.getTypes(env, getSuperBounds((Type.WildcardType)type));
- }
-
- /**
- * Return the ClassDoc of the erasure of this wildcard type.
- */
- @Override
- public ClassDoc asClassDoc() {
- return env.getClassDoc((ClassSymbol)env.types.erasure(type).tsym);
- }
-
- @Override
- public WildcardType asWildcardType() {
- return this;
- }
-
- @Override
- public String typeName() { return "?"; }
- @Override
- public String qualifiedTypeName() { return "?"; }
- @Override
- public String simpleTypeName() { return "?"; }
-
- @Override
- public String toString() {
- return wildcardTypeToString(env, (Type.WildcardType)type, true);
- }
-
-
- /**
- * Return the string form of a wildcard type ("?") along with any
- * "extends" or "super" clause. Delimiting brackets are not
- * included. Class names are qualified if "full" is true.
- */
- static String wildcardTypeToString(DocEnv env,
- Type.WildcardType wildThing, boolean full) {
- if (env.legacyDoclet) {
- return TypeMaker.getTypeName(env.types.erasure(wildThing), full);
- }
- StringBuilder s = new StringBuilder("?");
- List<Type> bounds = getExtendsBounds(wildThing);
- if (bounds.nonEmpty()) {
- s.append(" extends ");
- } else {
- bounds = getSuperBounds(wildThing);
- if (bounds.nonEmpty()) {
- s.append(" super ");
- }
- }
- boolean first = true; // currently only one bound is allowed
- for (Type b : bounds) {
- if (!first) {
- s.append(" & ");
- }
- s.append(TypeMaker.getTypeString(env, b, full));
- first = false;
- }
- return s.toString();
- }
-
- private static List<Type> getExtendsBounds(Type.WildcardType wild) {
- return wild.isSuperBound()
- ? List.nil()
- : List.of(wild.type);
- }
-
- private static List<Type> getSuperBounds(Type.WildcardType wild) {
- return wild.isExtendsBound()
- ? List.nil()
- : List.of(wild.type);
- }
-}
--- a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/package-info.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/**
- * This package and its contents are deprecated and
- * may be removed in a future release.
- * See
- * {@code javax.tools.ToolProvider.getSystemDocumentationTool}
- * and
- * {@code javax.tools.DocumentationTool}
- * for replacement functionality.
- */
-package com.sun.tools.javadoc;
--- a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/resources/javadoc.properties Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,155 +0,0 @@
-#
-# Copyright (c) 1997, 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.
-#
-
-main.errors={0} errors
-main.error={0} error
-main.warnings={0} warnings
-main.warning={0} warning
-
-main.usage=Usage: javadoc [options] [packagenames] [sourcefiles] [@files]\n\
-\ -overview <file> Read overview documentation from HTML file\n\
-\ -public Show only public classes and members\n\
-\ -protected Show protected/public classes and members (default)\n\
-\ -package Show package/protected/public classes and members\n\
-\ -private Show all classes and members\n\
-\ --help Display command line options and exit\n\
-\ -doclet <class> Generate output via alternate doclet\n\
-\ -docletpath <path> Specify where to find doclet class files\n\
-\ --module-source-path <path> Specify where to find input source files for multiple modules\n\
-\ --upgrade-module-path <path> Override location of upgradeable modules\n\
-\ --module-path <path>, -p <path> Specify where to find application modules\n\
-\ --add-modules <module>(,<module>)*\n\
-\ Root modules to resolve in addition to the initial modules,\n\
-\ or all modules on the module path if <module> is ALL-MODULE-PATH.\n\
-\ --limit-modules <module>(,<module>)*\n\
-\ Limit the universe of observable modules\n\
-\ --source-path <path> Specify where to find source files\n\
-\ -sourcepath <path> Specify where to find source files\n\
-\ --class-path <path> Specify where to find user class files\n\
-\ -classpath <path> Specify where to find user class files\n\
-\ -cp <path> Specify where to find user class files\n\
-\ -exclude <pkglist> Specify a list of packages to exclude\n\
-\ -subpackages <subpkglist> Specify subpackages to recursively load\n\
-\ -breakiterator Compute first sentence with BreakIterator\n\
-\ -bootclasspath <path> Override location of platform class files\n\
-\ used for non-modular releases\n\
-\ --system <jdk> Override location of system modules used\n\
-\ for modular releases.\n\
-\ -source <release> Provide source compatibility with specified release\n\
-\ --release <release> Provide source compatibility with specified release\n\
-\ -extdirs <dirlist> Override location of installed extensions\n\
-\ -verbose Output messages about what Javadoc is doing\n\
-\ -locale <name> Locale to be used, e.g. en_US or en_US_WIN\n\
-\ -encoding <name> Source file encoding name\n\
-\ -quiet Do not display status messages\n\
-\ -J<flag> Pass <flag> directly to the runtime system\n\
-\ -X Print a synopsis of nonstandard options and exit\n
-
-main.usage.foot=\n\
-GNU-style options may use '=' instead whitespace to separate the name of an option\n\
-from its value.\n
-
-main.Xusage=\
-\ -Xmaxerrs <number> Set the maximum number of errors to print\n\
-\ -Xmaxwarns <number> Set the maximum number of warnings to print\n\
-\ --add-exports <module>/<package>=<other-module>(,<other-module>)*\n\
-\ Specify a package to be considered as exported from its \n\
-\ defining module to additional modules, or to all unnamed \n\
-\ modules if <other-module> is ALL-UNNAMED.\n\
-\ --add-reads <module>=<other-module>(,<other-module>)*\n\
-\ Specify additional modules to be considered as required by a\n\
-\ given module. <other-module> may be ALL-UNNAMED to require\n\
-\ the unnamed module.\n\
-\ --patch-module <module>=<file>(:<file>)*\n\
-\ Override or augment a module with classes and resources\n\
-\ in JAR files or directories\n
-
-main.Xusage.foot=\
-These options are non-standard and subject to change without notice.
-
-main.option.already.seen=The {0} option may be specified no more than once.
-main.requires_argument=option {0} requires an argument.
-main.locale_first=option -locale must be first on the command line.
-main.invalid_flag=invalid flag: {0}
-main.No_packages_or_classes_specified=No packages or classes specified.
-main.incompatible.access.flags=More than one of -public, -private, -package, or -protected specified.
-main.cant.read=cannot read {0}
-main.Loading_source_files_for_package=Loading source files for package {0}...
-main.Loading_source_file=Loading source file {0}...
-main.Building_tree=Constructing Javadoc information...
-main.no_source_files_for_package=No source files for package {0}
-main.fatal.error=fatal error
-main.fatal.exception=fatal exception
-main.out.of.memory=java.lang.OutOfMemoryError: Please increase memory.\n\
-For example, on the JDK Classic or HotSpot VMs, add the option -J-Xmx\n\
-such as -J-Xmx32m.
-main.done_in=[done in {0} ms]
-main.doclet_method_must_be_static=In doclet class {0}, method {1} must be static.
-main.must_return_int=In doclet class {0}, method {1} must return int.
-main.must_return_boolean=In doclet class {0}, method {1} must return boolean.
-main.must_return_languageversion=In doclet class {0}, method {1} must return LanguageVersion.
-main.more_than_one_doclet_specified_0_and_1=More than one doclet specified ({0} and {1}).
-main.doclet_class_not_found=Cannot find doclet class {0}
-main.doclet_method_not_found=Doclet class {0} does not contain a {1} method
-main.doclet_method_not_accessible=In doclet class {0}, method {1} not accessible
-main.internal_error_exception_thrown=Internal error: In doclet class {0}, method {1} has thrown an exception {2}
-main.exception_thrown=In doclet class {0}, method {1} has thrown an exception {2}
-main.illegal_locale_name=Locale not available: {0}
-main.malformed_locale_name=Malformed locale name: {0}
-main.file_not_found=File not found: "{0}"
-main.file_ignored=File ignored: "{0}" (not yet supported)
-main.illegal_class_name=Illegal class name: "{0}"
-main.illegal_package_name=Illegal package name: "{0}"
-main.release.bootclasspath.conflict=option {0} cannot be used together with -release
-main.unsupported.release.version=release version {0} not supported
-main.option.invalid.value={0}
-tag.illegal_char_in_arr_dim=Tag {0}: Syntax Error in array dimension, method parameters: {1}
-tag.illegal_see_tag=Tag {0}: Syntax Error in method parameters: {1}
-tag.missing_comma_space=Tag {0}: Missing comma or space in method parameters: {1}
-tag.tag_has_no_arguments={0} tag has no arguments.
-tag.see.missing_sharp=Tag {0}: missing ''#'': "{1}"
-tag.see.can_not_find_member=Tag {0}: can''t find {1} in {2}
-tag.see.no_close_bracket_on_url=Tag {0}: missing final ''>'': "{1}"
-tag.see.no_close_quote=Tag {0}: no final close quote: "{1}"
-tag.see.class_not_specified=Tag {0}: class not specified: "{1}"
-tag.see.illegal_character=Tag {0}:illegal character: "{1}" in "{2}"
-tag.see.malformed_see_tag=Tag {0}: malformed: "{1}"
-tag.End_delimiter_missing_for_possible_SeeTag=End Delimiter } missing for possible See Tag in comment string: "{0}"
-tag.Improper_Use_Of_Link_Tag=Missing closing ''}'' character for inline tag: "{0}"
-tag.serialField.illegal_character=illegal character {0} in @serialField tag: {1}.
-javadoc.File_Read_Error=Error while reading file {0}
-javadoc.Body_missing_from_html_file=Body tag missing from HTML file
-javadoc.End_body_missing_from_html_file=Close body tag missing from HTML file
-javadoc.Multiple_package_comments=Multiple sources of package comments found for package "{0}"
-javadoc.JavaScript_in_comment=JavaScript found in documentation comment.\n\
- Use --allow-script-in-comments to allow use of JavaScript.
-javadoc.class_not_found=Class {0} not found.
-javadoc.error=error
-javadoc.warning=warning
-
-javadoc.error.msg={0}: error - {1}
-javadoc.warning.msg={0}: warning - {1}
-javadoc.note.msg = {1}
-javadoc.note.pos.msg= {0}: {1}
--- a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/resources/javadoc_ja.properties Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,100 +0,0 @@
-#
-# Copyright (c) 1997, 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.
-#
-
-main.errors=\u30A8\u30E9\u30FC{0}\u500B
-main.error=\u30A8\u30E9\u30FC{0}\u500B
-main.warnings=\u8B66\u544A{0}\u500B
-main.warning=\u8B66\u544A{0}\u500B
-
-main.usage=\u4F7F\u7528\u65B9\u6CD5: javadoc [options] [packagenames] [sourcefiles] [@files]\n -overview <file> HTML\u30D5\u30A1\u30A4\u30EB\u304B\u3089\u6982\u8981\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u3092\u8AAD\u307F\u8FBC\u3080\n -public public\u30AF\u30E9\u30B9\u3068\u30E1\u30F3\u30D0\u30FC\u306E\u307F\u3092\u793A\u3059\n -protected protected/public\u30AF\u30E9\u30B9\u3068\u30E1\u30F3\u30D0\u30FC\u3092\u793A\u3059(\u30C7\u30D5\u30A9\u30EB\u30C8)\n -package package/protected/public\u30AF\u30E9\u30B9\u3068\u30E1\u30F3\u30D0\u30FC\u3092\u793A\u3059\n -private \u3059\u3079\u3066\u306E\u30AF\u30E9\u30B9\u3068\u30E1\u30F3\u30D0\u30FC\u3092\u793A\u3059\n --help \u30B3\u30DE\u30F3\u30C9\u884C\u30AA\u30D7\u30B7\u30E7\u30F3\u3092\u8868\u793A\u3057\u3066\u7D42\u4E86\u3059\u308B\n -doclet <class> \u4EE3\u66FFdoclet\u3092\u4ECB\u3057\u3066\u51FA\u529B\u3092\u751F\u6210\u3059\u308B\n -docletpath <path> doclet\u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u306E\u3042\u308B\u5834\u6240\u3092\u6307\u5B9A\u3059\u308B\n --module-source-path <path> \u8907\u6570\u306E\u30E2\u30B8\u30E5\u30FC\u30EB\u306E\u5165\u529B\u30BD\u30FC\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u306E\u3042\u308B\u5834\u6240\u3092\u6307\u5B9A\u3059\u308B\n --upgrade-module-path <path> \u30A2\u30C3\u30D7\u30B0\u30EC\u30FC\u30C9\u53EF\u80FD\u306A\u30E2\u30B8\u30E5\u30FC\u30EB\u306E\u5834\u6240\u3092\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9\u3059\u308B\n --module-path <path>\u3001-p <path> \u30A2\u30D7\u30EA\u30B1\u30FC\u30B7\u30E7\u30F3\u30FB\u30E2\u30B8\u30E5\u30FC\u30EB\u306E\u3042\u308B\u5834\u6240\u3092\u6307\u5B9A\u3059\u308B\n --add-modules <module>(,<module>)*\n \u521D\u671F\u30E2\u30B8\u30E5\u30FC\u30EB\u306B\u52A0\u3048\u3066\u89E3\u6C7A\u3059\u308B\u30EB\u30FC\u30C8\u30FB\u30E2\u30B8\u30E5\u30FC\u30EB\u3001\u307E\u305F\u306F\n <module>\u304CALL-MODULE-PATH\u3067\u3042\u308B\u5834\u5408\u306F\u30E2\u30B8\u30E5\u30FC\u30EB\u30FB\u30D1\u30B9\u306E\u3059\u3079\u3066\u306E\u30E2\u30B8\u30E5\u30FC\u30EB\u3002\n --limit-modules <module>(,<module>)*\n \u53C2\u7167\u53EF\u80FD\u306A\u30E2\u30B8\u30E5\u30FC\u30EB\u306E\u9818\u57DF\u3092\u5236\u9650\u3059\u308B\n --source-path <path> \u30BD\u30FC\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u306E\u3042\u308B\u5834\u6240\u3092\u6307\u5B9A\u3059\u308B\n -sourcepath <path> \u30BD\u30FC\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u306E\u3042\u308B\u5834\u6240\u3092\u6307\u5B9A\u3059\u308B\n --class-path <path> \u30E6\u30FC\u30B6\u30FC\u30FB\u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u306E\u3042\u308B\u5834\u6240\u3092\u6307\u5B9A\u3059\u308B\n -classpath <path> \u30E6\u30FC\u30B6\u30FC\u30FB\u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u306E\u3042\u308B\u5834\u6240\u3092\u6307\u5B9A\u3059\u308B\n -cp <path> \u30E6\u30FC\u30B6\u30FC\u30FB\u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u306E\u3042\u308B\u5834\u6240\u3092\u6307\u5B9A\u3059\u308B\n -exclude <pkglist> \u9664\u5916\u3059\u308B\u30D1\u30C3\u30B1\u30FC\u30B8\u30FB\u30EA\u30B9\u30C8\u3092\u6307\u5B9A\u3059\u308B\n -subpackages <subpkglist> \u518D\u5E30\u7684\u306B\u30ED\u30FC\u30C9\u3059\u308B\u30B5\u30D6\u30D1\u30C3\u30B1\u30FC\u30B8\u3092\u6307\u5B9A\u3059\u308B\n -breakiterator BreakIterator\u3067\u6700\u521D\u306E\u6587\u3092\u8A08\u7B97\u3059\u308B\n -bootclasspath <path> \u975E\u30E2\u30B8\u30E5\u30E9\u30FB\u30EA\u30EA\u30FC\u30B9\u3067\u4F7F\u7528\u3055\u308C\u308B\u30D7\u30E9\u30C3\u30C8\u30D5\u30A9\u30FC\u30E0\u30FB\u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\n \
-\u306E\u5834\u6240\u3092\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9\u3059\u308B\n --system <jdk> \u30E2\u30B8\u30E5\u30E9\u30FB\u30EA\u30EA\u30FC\u30B9\u3067\u4F7F\u7528\u3055\u308C\u308B\u30B7\u30B9\u30C6\u30E0\u30FB\u30E2\u30B8\u30E5\u30FC\u30EB\n \u306E\u5834\u6240\u3092\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9\u3059\u308B\u3002\n -source <release> \u6307\u5B9A\u3055\u308C\u305F\u30EA\u30EA\u30FC\u30B9\u3068\u30BD\u30FC\u30B9\u306E\u4E92\u63DB\u6027\u3092\u63D0\u4F9B\u3059\u308B\n --release <release> \u6307\u5B9A\u3055\u308C\u305F\u30EA\u30EA\u30FC\u30B9\u3068\u30BD\u30FC\u30B9\u306E\u4E92\u63DB\u6027\u3092\u63D0\u4F9B\u3059\u308B\n -extdirs <dirlist> \u30A4\u30F3\u30B9\u30C8\u30FC\u30EB\u3055\u308C\u305F\u62E1\u5F35\u6A5F\u80FD\u306E\u5834\u6240\u3092\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9\u3059\u308B\n -verbose Javadoc\u306E\u52D5\u4F5C\u306B\u3064\u3044\u3066\u30E1\u30C3\u30BB\u30FC\u30B8\u3092\u51FA\u529B\u3059\u308B\n -locale <name> en_US\u3084en_US_WIN\u306A\u3069\u306E\u4F7F\u7528\u3059\u308B\u30ED\u30B1\u30FC\u30EB\n -encoding <name> \u30BD\u30FC\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u306E\u30A8\u30F3\u30B3\u30FC\u30C7\u30A3\u30F3\u30B0\u540D\n -quiet \u72B6\u614B\u30E1\u30C3\u30BB\u30FC\u30B8\u3092\u8868\u793A\u3057\u306A\u3044\n -J<flag> <flag>\u3092\u5B9F\u884C\u6642\u30B7\u30B9\u30C6\u30E0\u306B\u76F4\u63A5\u6E21\u3059\n -X \u975E\u6A19\u6E96\u30AA\u30D7\u30B7\u30E7\u30F3\u306E\u6982\u8981\u3092\u51FA\u529B\u3057\u7D42\u4E86\u3059\u308B\n
-
-main.usage.foot=\nGNU\u30B9\u30BF\u30A4\u30EB\u30FB\u30AA\u30D7\u30B7\u30E7\u30F3\u3067\u306F\u3001\u30AA\u30D7\u30B7\u30E7\u30F3\u306E\u540D\u524D\u3068\u305D\u306E\u5024\u3092\u533A\u5207\u308B\u305F\u3081\u306B\u7A7A\u767D\u3067\u306F\u306A\u304F'='\u3092\n\u4F7F\u7528\u3067\u304D\u307E\u3059\u3002\n
-
-main.Xusage=\ -Xmaxerrs <number> \u51FA\u529B\u3059\u308B\u6700\u5927\u30A8\u30E9\u30FC\u6570\u3092\u8A2D\u5B9A\u3057\u307E\u3059\n -Xmaxwarns <number> \u51FA\u529B\u3059\u308B\u6700\u5927\u8B66\u544A\u6570\u3092\u8A2D\u5B9A\u3057\u307E\u3059\n --add-exports <module>/<package>=<other-module>(,<other-module>)*\n \u305D\u306E\u5B9A\u7FA9\u30E2\u30B8\u30E5\u30FC\u30EB\u304B\u3089\u3001\u8FFD\u52A0\u306E\u30E2\u30B8\u30E5\u30FC\u30EB\u3001\u307E\u305F\u306F<other-module>\u304C \n ALL-UNNAMED\u3067\u3042\u308B\u5834\u5408\u306F\u3059\u3079\u3066\u306E\u540D\u524D\u306E\u306A\u3044\u30E2\u30B8\u30E5\u30FC\u30EB\u306B \n \u30A8\u30AF\u30B9\u30DD\u30FC\u30C8\u6E08\u3068\u307F\u306A\u3055\u308C\u308B\u3088\u3046\u306B\u30D1\u30C3\u30B1\u30FC\u30B8\u3092\u6307\u5B9A\u3057\u307E\u3059\u3002\n --add-reads <module>=<other-module>(,<other-module>)*\n \u6307\u5B9A\u306E\u30E2\u30B8\u30E5\u30FC\u30EB\u3067\u5FC5\u9808\u3068\u307F\u306A\u3055\u308C\u308B\u3088\u3046\u306B\u8FFD\u52A0\u30E2\u30B8\u30E5\u30FC\u30EB\u3092\u6307\u5B9A\u3057\u307E\u3059\u3002\n \u540D\u524D\u306E\u306A\u3044\u30E2\u30B8\u30E5\u30FC\u30EB\u3092\u5FC5\u8981\u3068\u3059\u308B\u5834\u5408\u3001<other-module>\u306FALL-UNNAMED\n \u306B\u3057\u307E\u3059\u3002\n --patch-module <module>=<file>(:<file>)*\n JAR\u30D5\u30A1\u30A4\u30EB\u307E\u305F\u306F\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306E\u30AF\u30E9\u30B9\u304A\u3088\u3073\u30EA\u30BD\u30FC\u30B9\u3067\u30E2\u30B8\u30E5\u30FC\u30EB\u3092\n \u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9\u307E\u305F\u306F\u62E1\u5F35\u3057\u307E\u3059\n
-
-main.Xusage.foot=\u3053\u308C\u3089\u306F\u975E\u6A19\u6E96\u30AA\u30D7\u30B7\u30E7\u30F3\u3067\u3042\u308A\u4E88\u544A\u306A\u3057\u306B\u5909\u66F4\u3055\u308C\u308B\u3053\u3068\u304C\u3042\u308A\u307E\u3059\u3002
-
-main.option.already.seen={0}\u30AA\u30D7\u30B7\u30E7\u30F3\u304C\u8907\u6570\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u3059\u3002
-main.requires_argument=\u30AA\u30D7\u30B7\u30E7\u30F3{0}\u306B\u306F\u5F15\u6570\u304C\u5FC5\u8981\u3067\u3059\u3002
-main.locale_first=\u30AA\u30D7\u30B7\u30E7\u30F3-locale\u306F\u3001\u30B3\u30DE\u30F3\u30C9\u30E9\u30A4\u30F3\u306E\u6700\u521D\u306B\u6307\u5B9A\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002
-main.invalid_flag={0}\u306F\u7121\u52B9\u306A\u30D5\u30E9\u30B0\u3067\u3059
-main.No_packages_or_classes_specified=\u30D1\u30C3\u30B1\u30FC\u30B8\u307E\u305F\u306F\u30AF\u30E9\u30B9\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002
-main.incompatible.access.flags=-public\u3001-private\u3001-package\u307E\u305F\u306F-protected\u306E\u3046\u3061\u306E2\u3064\u4EE5\u4E0A\u3092\u6307\u5B9A\u3057\u307E\u3057\u305F\u3002
-main.cant.read={0}\u3092\u8AAD\u307F\u8FBC\u3081\u307E\u305B\u3093
-main.Loading_source_files_for_package=\u30D1\u30C3\u30B1\u30FC\u30B8{0}\u306E\u30BD\u30FC\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u8AAD\u307F\u8FBC\u3093\u3067\u3044\u307E\u3059...
-main.Loading_source_file=\u30BD\u30FC\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB{0}\u3092\u8AAD\u307F\u8FBC\u3093\u3067\u3044\u307E\u3059...
-main.Building_tree=Javadoc\u60C5\u5831\u3092\u69CB\u7BC9\u3057\u3066\u3044\u307E\u3059...
-main.no_source_files_for_package=\u30D1\u30C3\u30B1\u30FC\u30B8{0}\u306E\u30BD\u30FC\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u304C\u3042\u308A\u307E\u305B\u3093
-main.fatal.error=\u81F4\u547D\u7684\u30A8\u30E9\u30FC
-main.fatal.exception=\u81F4\u547D\u7684\u4F8B\u5916
-main.out.of.memory=java.lang.OutOfMemoryError: \u30E1\u30E2\u30EA\u30FC\u3092\u5897\u3084\u3057\u3066\u304F\u3060\u3055\u3044\u3002\n\u305F\u3068\u3048\u3070\u3001JDK\u306Eclassic\u3082\u3057\u304F\u306Fhotspot VM\u3067\u306F\u3001-J-Xmx32m\u306E\u3088\u3046\u306B\n-J-Xmx\u30AA\u30D7\u30B7\u30E7\u30F3\u3092\u4F7F\u7528\u3057\u307E\u3059\u3002
-main.done_in=[{0}\u30DF\u30EA\u79D2\u3067\u5B8C\u4E86]
-main.doclet_method_must_be_static=doclet\u30AF\u30E9\u30B9{0}\u3067\u306F\u3001\u30E1\u30BD\u30C3\u30C9{1}\u306Fstatic\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002
-main.must_return_int=doclet\u30AF\u30E9\u30B9{0}\u3067\u306F\u3001\u30E1\u30BD\u30C3\u30C9{1}\u306Fint\u3092\u8FD4\u3059\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002
-main.must_return_boolean=doclet\u30AF\u30E9\u30B9{0}\u3067\u306F\u3001\u30E1\u30BD\u30C3\u30C9{1}\u306Fboolean\u3092\u8FD4\u3059\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002
-main.must_return_languageversion=doclet\u30AF\u30E9\u30B9{0}\u3067\u306F\u3001\u30E1\u30BD\u30C3\u30C9{1}\u306FLanguageVersion\u3092\u8FD4\u3059\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002
-main.more_than_one_doclet_specified_0_and_1=\u8907\u6570\u306Edoclet({0}\u3068{1})\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u3059\u3002
-main.doclet_class_not_found=doclet\u30AF\u30E9\u30B9{0}\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093
-main.doclet_method_not_found=doclet\u30AF\u30E9\u30B9{0}\u306B\u306F\u30E1\u30BD\u30C3\u30C9{1}\u304C\u3042\u308A\u307E\u305B\u3093
-main.doclet_method_not_accessible=doclet\u30AF\u30E9\u30B9{0}\u3067\u306F\u3001\u30E1\u30BD\u30C3\u30C9{1}\u306B\u30A2\u30AF\u30BB\u30B9\u3067\u304D\u307E\u305B\u3093
-main.internal_error_exception_thrown=doclet\u30AF\u30E9\u30B9{0}\u306E\u5185\u90E8\u30A8\u30E9\u30FC\u3067\u3059\u3002\u30E1\u30BD\u30C3\u30C9{1}\u306F\u4F8B\u5916{2}\u3092\u30B9\u30ED\u30FC\u3057\u307E\u3057\u305F
-main.exception_thrown=doclet\u30AF\u30E9\u30B9{0}\u3067\u306F\u3001\u30E1\u30BD\u30C3\u30C9{1}\u306F\u4F8B\u5916{2}\u3092\u30B9\u30ED\u30FC\u3057\u307E\u3057\u305F
-main.illegal_locale_name=\u30ED\u30B1\u30FC\u30EB{0}\u304C\u7121\u52B9\u3067\u3059
-main.malformed_locale_name=\u30ED\u30B1\u30FC\u30EB\u540D{0}\u306E\u66F8\u5F0F\u304C\u6B63\u3057\u304F\u3042\u308A\u307E\u305B\u3093
-main.file_not_found=\u30D5\u30A1\u30A4\u30EB"{0}"\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093
-main.file_ignored=\u30D5\u30A1\u30A4\u30EB\u306F\u7121\u8996\u3055\u308C\u307E\u3057\u305F: "{0}" (\u307E\u3060\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u307E\u305B\u3093)
-main.illegal_class_name=\u30AF\u30E9\u30B9\u540D\u304C\u4E0D\u6B63\u3067\u3059: "{0}"
-main.illegal_package_name=\u30D1\u30C3\u30B1\u30FC\u30B8\u540D"{0}"\u306F\u4E0D\u6B63\u3067\u3059
-main.release.bootclasspath.conflict=\u30AA\u30D7\u30B7\u30E7\u30F3{0}\u306F-release\u3068\u4E00\u7DD2\u306B\u4F7F\u7528\u3067\u304D\u307E\u305B\u3093
-main.unsupported.release.version=\u30EA\u30EA\u30FC\u30B9\u30FB\u30D0\u30FC\u30B8\u30E7\u30F3{0}\u306F\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u307E\u305B\u3093
-main.option.invalid.value={0}
-tag.illegal_char_in_arr_dim=\u30BF\u30B0{0}: \u914D\u5217\u306E\u5927\u304D\u3055\u3001\u30E1\u30BD\u30C3\u30C9\u30FB\u30D1\u30E9\u30E1\u30FC\u30BF{1}\u306B\u69CB\u6587\u30A8\u30E9\u30FC\u304C\u3042\u308A\u307E\u3059
-tag.illegal_see_tag=\u30BF\u30B0{0}: \u30E1\u30BD\u30C3\u30C9\u30FB\u30D1\u30E9\u30E1\u30FC\u30BF{1}\u306B\u69CB\u6587\u30A8\u30E9\u30FC\u304C\u3042\u308A\u307E\u3059
-tag.missing_comma_space=\u30BF\u30B0{0}: \u30E1\u30BD\u30C3\u30C9\u30FB\u30D1\u30E9\u30E1\u30FC\u30BF{1}\u306B\u30AB\u30F3\u30DE\u307E\u305F\u306F\u7A7A\u767D\u6587\u5B57\u304C\u3042\u308A\u307E\u305B\u3093
-tag.tag_has_no_arguments={0}\u30BF\u30B0\u306B\u5F15\u6570\u304C\u3042\u308A\u307E\u305B\u3093\u3002
-tag.see.missing_sharp=\u30BF\u30B0{0}: ''#''\u304C\u3042\u308A\u307E\u305B\u3093: "{1}"
-tag.see.can_not_find_member=\u30BF\u30B0{0}: {2}\u3067{1}\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093
-tag.see.no_close_bracket_on_url=\u30BF\u30B0{0}: \u9589\u3058\u30BF\u30B0''>''\u304C\u3042\u308A\u307E\u305B\u3093: "{1}"
-tag.see.no_close_quote=\u30BF\u30B0{0}: \u9589\u3058\u5F15\u7528\u7B26\u304C\u3042\u308A\u307E\u305B\u3093: "{1}"
-tag.see.class_not_specified=\u30BF\u30B0{0}: \u30AF\u30E9\u30B9\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093: "{1}"
-tag.see.illegal_character=\u30BF\u30B0{0}: "{2}"\u306B\u4E0D\u6B63\u306A\u6587\u5B57"{1}"\u304C\u3042\u308A\u307E\u3059
-tag.see.malformed_see_tag=\u30BF\u30B0{0}: \u66F8\u5F0F\u304C\u6B63\u3057\u304F\u3042\u308A\u307E\u305B\u3093: "{1}"
-tag.End_delimiter_missing_for_possible_SeeTag=\u30B3\u30E1\u30F3\u30C8\u6587\u5B57\u5217"{0}"\u3067\u3001\u6709\u52B9\u306Asee\u30BF\u30B0\u306B\u7D42\u7AEF\u30C7\u30EA\u30DF\u30BF}\u304C\u3042\u308A\u307E\u305B\u3093
-tag.Improper_Use_Of_Link_Tag=\u30A4\u30F3\u30E9\u30A4\u30F3\u30FB\u30BF\u30B0"{0}"\u306B\u7D42\u4E86\u6587\u5B57''}''\u304C\u3042\u308A\u307E\u305B\u3093
-tag.serialField.illegal_character=@serialField\u30BF\u30B0\u306B\u4E0D\u6B63\u306A\u6587\u5B57{0}\u304C\u3042\u308A\u307E\u3059: {1}\u3002
-javadoc.File_Read_Error=\u30D5\u30A1\u30A4\u30EB{0}\u306E\u8AAD\u8FBC\u307F\u4E2D\u306B\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F
-javadoc.Body_missing_from_html_file=HTML\u306Bbody\u30BF\u30B0\u304C\u3042\u308A\u307E\u305B\u3093
-javadoc.End_body_missing_from_html_file=HTML\u30D5\u30A1\u30A4\u30EB\u306Bbody\u306E\u9589\u3058\u30BF\u30B0\u304C\u3042\u308A\u307E\u305B\u3093
-javadoc.Multiple_package_comments=\u30D1\u30C3\u30B1\u30FC\u30B8"{0}"\u306B\u8907\u6570\u306E\u30D1\u30C3\u30B1\u30FC\u30B8\u30FB\u30B3\u30E1\u30F3\u30C8\u306E\u30BD\u30FC\u30B9\u304C\u691C\u51FA\u3055\u308C\u307E\u3057\u305F
-javadoc.JavaScript_in_comment=\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u30FB\u30B3\u30E1\u30F3\u30C8\u306BJavaScript\u304C\u898B\u3064\u304B\u308A\u307E\u3057\u305F\u3002\n--allow-script-in-comments\u3092\u4F7F\u7528\u3057\u3066\u3001JavaScript\u306E\u4F7F\u7528\u3092\u8A31\u53EF\u3057\u3066\u304F\u3060\u3055\u3044\u3002
-javadoc.class_not_found=\u30AF\u30E9\u30B9{0}\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3002
-javadoc.error=\u30A8\u30E9\u30FC
-javadoc.warning=\u8B66\u544A
-
-javadoc.error.msg={0}: \u30A8\u30E9\u30FC - {1}
-javadoc.warning.msg={0}: \u8B66\u544A - {1}
-javadoc.note.msg = {1}
-javadoc.note.pos.msg= {0}: {1}
--- a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/resources/javadoc_zh_CN.properties Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,100 +0,0 @@
-#
-# Copyright (c) 1997, 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.
-#
-
-main.errors={0} \u4E2A\u9519\u8BEF
-main.error={0} \u4E2A\u9519\u8BEF
-main.warnings={0} \u4E2A\u8B66\u544A
-main.warning={0} \u4E2A\u8B66\u544A
-
-main.usage=\u7528\u6CD5\uFF1Ajavadoc [\u9009\u9879] [\u7A0B\u5E8F\u5305\u540D\u79F0] [\u6E90\u6587\u4EF6] [@files]\n -overview <\u6587\u4EF6> \u4ECE HTML \u6587\u4EF6\u8BFB\u53D6\u6982\u89C8\u6587\u6863\n -public \u4EC5\u663E\u793A\u516C\u5171\u7C7B\u548C\u6210\u5458\n -protected \u663E\u793A\u53D7\u4FDD\u62A4/\u516C\u5171\u7C7B\u548C\u6210\u5458\uFF08\u9ED8\u8BA4\u503C\uFF09\n -package \u663E\u793A\u7A0B\u5E8F\u5305/\u53D7\u4FDD\u62A4/\u516C\u5171\u7C7B\u548C\u6210\u5458\n -private \u663E\u793A\u6240\u6709\u7C7B\u548C\u6210\u5458\n --help \u663E\u793A\u547D\u4EE4\u884C\u9009\u9879\u5E76\u9000\u51FA\n -doclet <\u7C7B> \u901A\u8FC7\u66FF\u4EE3 doclet \u751F\u6210\u8F93\u51FA\n -docletpath <\u8DEF\u5F84> \u6307\u5B9A\u67E5\u627E doclet \u7C7B\u6587\u4EF6\u7684\u4F4D\u7F6E\n --module-source-path <\u8DEF\u5F84> \u6307\u5B9A\u67E5\u627E\u591A\u4E2A\u6A21\u5757\u7684\u8F93\u5165\u6E90\u6587\u4EF6\u7684\u4F4D\u7F6E\n --upgrade-module-path <\u8DEF\u5F84> \u8986\u76D6\u53EF\u5347\u7EA7\u6A21\u5757\u4F4D\u7F6E\n --module-path <\u8DEF\u5F84>, -p <\u8DEF\u5F84> \u6307\u5B9A\u67E5\u627E\u5E94\u7528\u7A0B\u5E8F\u6A21\u5757\u7684\u4F4D\u7F6E\n --add-modules <\u6A21\u5757>(,<\u6A21\u5757>)*\n \u9664\u4E86\u521D\u59CB\u6A21\u5757\u4E4B\u5916\u8981\u89E3\u6790\u7684\u6839\u6A21\u5757\uFF0C\n \u5982\u679C <\u6A21\u5757>\u4E3A ALL-MODULE-PATH\uFF0C\u5219\u4E3A\u6A21\u5757\u8DEF\u5F84\u4E2D\u7684\u6240\u6709\u6A21\u5757\u3002\n --limit-modules <\u6A21\u5757>(,<\u6A21\u5757>)*\n \u9650\u5236\u53EF\u89C2\u5BDF\u6A21\u5757\u7684\u9886\u57DF\n --source-path <\u8DEF\u5F84> \u6307\u5B9A\u67E5\u627E\u6E90\u6587\u4EF6\u7684\u4F4D\u7F6E\n -sourcepath <\u8DEF\u5F84> \u6307\u5B9A\u67E5\u627E\u6E90\u6587\u4EF6\u7684\u4F4D\u7F6E\n --class-path <\u8DEF\u5F84> \u6307\u5B9A\u67E5\u627E\u7528\u6237\u7C7B\u6587\u4EF6\u7684\u4F4D\u7F6E\n -classpath <\u8DEF\u5F84> \u6307\u5B9A\u67E5\u627E\u7528\u6237\u7C7B\u6587\u4EF6\u7684\u4F4D\u7F6E\n -cp <\u8DEF\u5F84> \u6307\u5B9A\u67E5\u627E\u7528\u6237\u7C7B\u6587\u4EF6\u7684\u4F4D\u7F6E\n -exclude <\u7A0B\u5E8F\u5305\u5217\u8868> \u6307\u5B9A\u8981\u6392\u9664\u7684\u7A0B\u5E8F\u5305\u5217\u8868\n -subpackages <\u7A0B\u5E8F\u5305\u5217\u8868> \u6307\u5B9A\u8981\u9012\u5F52\u52A0\u8F7D\u7684\u5B50\u7A0B\u5E8F\u5305\n -breakiterator \u8BA1\u7B97\u5E26\u6709 BreakIterator \u7684\u7B2C\u4E00\u4E2A\u8BED\u53E5\n -bootclasspath <\u8DEF\u5F84> \u8986\u76D6\u7528\u4E8E\u975E\u6A21\u5757\u5316\u53D1\u884C\u7248\u7684\n \u5E73\u53F0\u7C7B\u6587\u4EF6\u7684\u4F4D\u7F6E\n --system <jdk> \u8986\u76D6\u7528\u4E8E\u6A21\u5757\u5316\u53D1\u884C\u7248\u7684\n \u7CFB\u7EDF\u6A21\u5757\u7684\u4F4D\u7F6E\u3002\n -source <\u53D1\u884C\u7248> \u63D0\u4F9B\u4E0E\u6307\u5B9A\u53D1\u884C\u7248\u7684\u6E90\u517C\u5BB9\u6027\n --release <\u53D1\u884C\u7248> \u63D0\u4F9B\u4E0E\u6307\u5B9A\u53D1\u884C\u7248\u7684\u6E90\u517C\u5BB9\u6027\n -extdirs <\u76EE\u5F55\u5217\u8868> \u8986\u76D6\u6240\u5B89\u88C5\u6269\u5C55\u7684\u4F4D\u7F6E\n -verbose \u8F93\u51FA\u6709\u5173 Javadoc \u6B63\u5728\u6267\u884C\u7684\u64CD\u4F5C\u7684\u6D88\u606F\n -locale <\u540D\u79F0> \u8981\u4F7F\u7528\u7684\u533A\u57DF\u8BBE\u7F6E\uFF0C\u4F8B\u5982 en_US \u6216 en_US_WIN\n -encoding <\u540D\u79F0> \u6E90\u6587\u4EF6\u7F16\u7801\u540D\u79F0\n -quiet \u4E0D\u663E\u793A\u72B6\u6001\u6D88\u606F\n -J<\u6807\u8BB0> \
-\u76F4\u63A5\u5C06 <\u6807\u8BB0> \u4F20\u9012\u5230\u8FD0\u884C\u65F6\u7CFB\u7EDF\n -X \u8F93\u51FA\u975E\u6807\u51C6\u9009\u9879\u7684\u63D0\u8981\u5E76\u9000\u51FA\n
-
-main.usage.foot=\nGNU \u6837\u5F0F\u7684\u9009\u9879\u53EF\u4F7F\u7528 '=' (\u800C\u975E\u7A7A\u767D) \u6765\u5206\u9694\u9009\u9879\u540D\u79F0\n\u53CA\u5176\u503C\u3002\n
-
-main.Xusage=\ -Xmaxerrs <\u6570\u5B57> \u8BBE\u7F6E\u8981\u8F93\u51FA\u7684\u9519\u8BEF\u7684\u6700\u5927\u6570\u76EE\n -Xmaxwarns <\u6570\u5B57> \u8BBE\u7F6E\u8981\u8F93\u51FA\u7684\u8B66\u544A\u7684\u6700\u5927\u6570\u76EE\n --add-exports <\u6A21\u5757>/<\u7A0B\u5E8F\u5305>=<\u5176\u4ED6\u6A21\u5757>(,<\u5176\u4ED6\u6A21\u5757>)*\n \u6307\u5B9A\u5C06\u7A0B\u5E8F\u5305\u89C6\u4E3A\u4ECE\u5176\u5B9A\u4E49\u6A21\u5757\u5BFC\u51FA\u5230\u5176\u4ED6\u6A21\u5757, \n \u5982\u679C <\u5176\u4ED6\u6A21\u5757> \u4E3A ALL-UNNAMED, \u5219\u89C6\u4E3A \n \u5BFC\u51FA\u5230\u6240\u6709\u672A\u547D\u540D\u6A21\u5757\u3002\n --add-reads <\u6A21\u5757>=<\u5176\u4ED6\u6A21\u5757>(,<\u5176\u4ED6\u6A21\u5757>)*\n \u6307\u5B9A\u88AB\u89C6\u4E3A\u7ED9\u5B9A\u6A21\u5757\u9700\u8981\u7684\u5176\u4ED6\u6A21\u5757\u3002\n <\u5176\u4ED6\u6A21\u5757> \u53EF\u4EE5\u4E3A ALL-UNNAMED \u4EE5\u4FBF\u8981\u6C42\n \u672A\u547D\u540D\u6A21\u5757\u3002\n --patch-module <\u6A21\u5757>=<\u6587\u4EF6>(:<\u6587\u4EF6>)*\n \u4F7F\u7528 JAR \u6587\u4EF6\u6216\u76EE\u5F55\u4E2D\u7684\u7C7B\u548C\u8D44\u6E90\n \u8986\u76D6\u6216\u589E\u5F3A\u6A21\u5757\n
-
-main.Xusage.foot=\u8FD9\u4E9B\u9009\u9879\u90FD\u662F\u975E\u6807\u51C6\u9009\u9879, \u5982\u6709\u66F4\u6539, \u6055\u4E0D\u53E6\u884C\u901A\u77E5\u3002
-
-main.option.already.seen={0}\u9009\u9879\u53EA\u80FD\u6307\u5B9A\u4E00\u6B21\u3002
-main.requires_argument=\u9009\u9879{0}\u9700\u8981\u53C2\u6570\u3002
-main.locale_first=\u5728\u547D\u4EE4\u884C\u4E2D, \u9009\u9879 -locale \u5FC5\u987B\u4E3A\u7B2C\u4E00\u4E2A\u9009\u9879\u3002
-main.invalid_flag=\u65E0\u6548\u7684\u6807\u8BB0: {0}
-main.No_packages_or_classes_specified=\u672A\u6307\u5B9A\u7A0B\u5E8F\u5305\u6216\u7C7B\u3002
-main.incompatible.access.flags=\u6307\u5B9A\u4E86\u591A\u4E2A -public, -private, -package \u6216 -protected\u3002
-main.cant.read=\u65E0\u6CD5\u8BFB\u53D6{0}
-main.Loading_source_files_for_package=\u6B63\u5728\u52A0\u8F7D\u7A0B\u5E8F\u5305{0}\u7684\u6E90\u6587\u4EF6...
-main.Loading_source_file=\u6B63\u5728\u52A0\u8F7D\u6E90\u6587\u4EF6{0}...
-main.Building_tree=\u6B63\u5728\u6784\u9020 Javadoc \u4FE1\u606F...
-main.no_source_files_for_package=\u6CA1\u6709\u7A0B\u5E8F\u5305{0}\u7684\u6E90\u6587\u4EF6
-main.fatal.error=\u81F4\u547D\u9519\u8BEF
-main.fatal.exception=\u81F4\u547D\u5F02\u5E38\u9519\u8BEF
-main.out.of.memory=java.lang.OutOfMemoryError: \u8BF7\u589E\u5927\u5185\u5B58\u3002\n\u4F8B\u5982, \u5BF9\u4E8E JDK \u7ECF\u5178\u6216 HotSpot VM, \u8BF7\u589E\u5927\u9009\u9879 -J-Xmx,\n\u4F8B\u5982 -J-Xmx32m\u3002
-main.done_in=[\u5728 {0} \u6BEB\u79D2\u5185\u5B8C\u6210]
-main.doclet_method_must_be_static=\u5728 doclet \u7C7B{0}\u4E2D, \u65B9\u6CD5{1}\u5FC5\u987B\u4E3A\u9759\u6001\u3002
-main.must_return_int=\u5728 doclet \u7C7B{0}\u4E2D, \u65B9\u6CD5{1}\u5FC5\u987B\u8FD4\u56DE\u6574\u578B\u503C\u3002
-main.must_return_boolean=\u5728 doclet \u7C7B{0}\u4E2D, \u65B9\u6CD5{1}\u5FC5\u987B\u8FD4\u56DE\u5E03\u5C14\u503C\u3002
-main.must_return_languageversion=\u5728 doclet \u7C7B{0}\u4E2D, \u65B9\u6CD5{1}\u5FC5\u987B\u8FD4\u56DE\u8BED\u8A00\u7248\u672C\u3002
-main.more_than_one_doclet_specified_0_and_1=\u6307\u5B9A\u4E86\u591A\u4E2A doclet ({0}\u548C{1})\u3002
-main.doclet_class_not_found=\u627E\u4E0D\u5230 doclet \u7C7B{0}
-main.doclet_method_not_found=doclet \u7C7B{0}\u4E0D\u5305\u542B{1}\u65B9\u6CD5
-main.doclet_method_not_accessible=\u5728 doclet \u7C7B{0}\u4E2D, \u65E0\u6CD5\u8BBF\u95EE\u65B9\u6CD5{1}
-main.internal_error_exception_thrown=\u5185\u90E8\u9519\u8BEF: \u5728 doclet \u7C7B{0}\u4E2D, \u65B9\u6CD5{1}\u5DF2\u629B\u51FA\u5F02\u5E38\u9519\u8BEF{2}
-main.exception_thrown=\u5728 doclet \u7C7B{0}\u4E2D, \u65B9\u6CD5{1}\u5DF2\u629B\u51FA\u5F02\u5E38\u9519\u8BEF{2}
-main.illegal_locale_name=\u8BED\u8A00\u73AF\u5883\u4E0D\u53EF\u7528: {0}
-main.malformed_locale_name=\u683C\u5F0F\u9519\u8BEF\u7684\u8BED\u8A00\u73AF\u5883\u540D\u79F0: {0}
-main.file_not_found=\u627E\u4E0D\u5230\u6587\u4EF6: "{0}"
-main.file_ignored=\u5DF2\u5FFD\u7565\u6587\u4EF6: "{0}" (\u5C1A\u4E0D\u652F\u6301)
-main.illegal_class_name=\u975E\u6CD5\u7C7B\u540D: "{0}"
-main.illegal_package_name=\u975E\u6CD5\u7684\u7A0B\u5E8F\u5305\u540D\u79F0: "{0}"
-main.release.bootclasspath.conflict=\u9009\u9879{0}\u65E0\u6CD5\u4E0E -release \u4E00\u8D77\u4F7F\u7528
-main.unsupported.release.version=\u4E0D\u652F\u6301\u53D1\u884C\u7248\u672C {0}
-main.option.invalid.value={0}
-tag.illegal_char_in_arr_dim=\u6807\u8BB0{0}: \u6570\u7EC4\u7EF4\u4E2D\u6709\u8BED\u6CD5\u9519\u8BEF, \u65B9\u6CD5\u53C2\u6570: {1}
-tag.illegal_see_tag=\u6807\u8BB0{0}: \u65B9\u6CD5\u53C2\u6570\u4E2D\u6709\u8BED\u6CD5\u9519\u8BEF: {1}
-tag.missing_comma_space=\u6807\u8BB0{0}: \u65B9\u6CD5\u53C2\u6570\u4E2D\u7F3A\u5C11\u9017\u53F7\u6216\u7A7A\u683C: {1}
-tag.tag_has_no_arguments={0} \u6807\u8BB0\u6CA1\u6709\u53C2\u6570\u3002
-tag.see.missing_sharp=\u6807\u8BB0{0}: \u7F3A\u5C11 ''#'': "{1}"
-tag.see.can_not_find_member=\u6807\u8BB0{0}: \u5728{2}\u4E2D\u627E\u4E0D\u5230{1}
-tag.see.no_close_bracket_on_url=\u6807\u8BB0{0}: \u7F3A\u5C11\u6700\u540E\u7684 ''>'': "{1}"
-tag.see.no_close_quote=\u6807\u8BB0{0}: \u65E0\u53F3\u5F15\u53F7: "{1}"
-tag.see.class_not_specified=\u6807\u8BB0{0}: \u672A\u6307\u5B9A\u7C7B: "{1}"
-tag.see.illegal_character=\u6807\u8BB0{0}: "{2}" \u4E2D\u7684 "{1}" \u4E3A\u975E\u6CD5\u5B57\u7B26
-tag.see.malformed_see_tag=\u6807\u8BB0{0}: \u683C\u5F0F\u9519\u8BEF: "{1}"
-tag.End_delimiter_missing_for_possible_SeeTag=\u6CE8\u91CA\u5B57\u7B26\u4E32\u4E2D\u53EF\u80FD\u51FA\u73B0\u7684 See \u6807\u8BB0\u7F3A\u5C11\u7ED3\u675F\u5206\u9694\u7B26 }: "{0}"
-tag.Improper_Use_Of_Link_Tag=\u5185\u5D4C\u6807\u8BB0\u7F3A\u5C11\u7ED3\u675F ''}'' \u5B57\u7B26: "{0}"
-tag.serialField.illegal_character=@serialField \u6807\u8BB0\u4E2D\u7684\u975E\u6CD5\u5B57\u7B26 {0}: {1}\u3002
-javadoc.File_Read_Error=\u8BFB\u53D6\u6587\u4EF6{0}\u65F6\u51FA\u9519
-javadoc.Body_missing_from_html_file=HTML \u6587\u4EF6\u4E2D\u7F3A\u5C11\u4E3B\u4F53\u6807\u8BB0
-javadoc.End_body_missing_from_html_file=HTML \u6587\u4EF6\u4E2D\u7F3A\u5C11\u4E3B\u4F53\u7ED3\u675F\u6807\u8BB0
-javadoc.Multiple_package_comments=\u627E\u5230\u7A0B\u5E8F\u5305 "{0}" \u7684\u591A\u4E2A\u7A0B\u5E8F\u5305\u6CE8\u91CA\u6E90
-javadoc.JavaScript_in_comment=\u6587\u6863\u6CE8\u91CA\u4E2D\u53D1\u73B0 JavaScript\u3002\n\u4F7F\u7528 --allow-script-in-comments \u53EF\u5141\u8BB8\u4F7F\u7528 JavaScript\u3002
-javadoc.class_not_found=\u627E\u4E0D\u5230\u7C7B{0}\u3002
-javadoc.error=\u9519\u8BEF
-javadoc.warning=\u8B66\u544A
-
-javadoc.error.msg={0}: \u9519\u8BEF - {1}
-javadoc.warning.msg={0}: \u8B66\u544A - {1}
-javadoc.note.msg = {1}
-javadoc.note.pos.msg= {0}: {1}
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractModuleIndexWriter.java Tue Feb 26 12:08:20 2019 -0500
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractModuleIndexWriter.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, 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
@@ -33,7 +33,6 @@
import javax.lang.model.element.ModuleElement;
import javax.lang.model.element.PackageElement;
-import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
@@ -124,11 +123,13 @@
* methods from the sub-class in order to generate Frame or Non
* Frame format.
*
- * @param title the title of the window.
+ * @param title the title of the window
+ * @param description the content for the description META tag
* @param includeScript boolean set true if windowtitle script is to be included
* @throws DocFileIOException if there is a problem building the module index file
*/
- protected void buildModuleIndexFile(String title, boolean includeScript) throws DocFileIOException {
+ protected void buildModuleIndexFile(String title, String description, boolean includeScript)
+ throws DocFileIOException {
String windowOverview = resources.getText(title);
Content body = getBody(includeScript, getWindowTitle(windowOverview));
Content header = HtmlTree.HEADER();
@@ -142,8 +143,10 @@
body.addContent(header);
body.addContent(main);
body.addContent(footer);
- printHtmlDocument(configuration.metakeywords.getOverviewMetaKeywords(title,
- configuration.doctitle), includeScript, body);
+ printHtmlDocument(
+ configuration.metakeywords.getOverviewMetaKeywords(title, configuration.doctitle),
+ description,
+ body);
}
/**
@@ -152,11 +155,12 @@
* Frame format.
*
* @param title the title of the window.
+ * @param description the content for the description META tag
* @param includeScript boolean set true if windowtitle script is to be included
* @param mdle the name of the module being documented
* @throws DocFileIOException if there is an exception building the module packages index file
*/
- protected void buildModulePackagesIndexFile(String title,
+ protected void buildModulePackagesIndexFile(String title, String description,
boolean includeScript, ModuleElement mdle) throws DocFileIOException {
String windowOverview = resources.getText(title);
Content body = getBody(includeScript, getWindowTitle(windowOverview));
@@ -171,8 +175,10 @@
body.addContent(header);
body.addContent(main);
body.addContent(footer);
- printHtmlDocument(configuration.metakeywords.getOverviewMetaKeywords(title,
- configuration.doctitle), includeScript, body);
+ printHtmlDocument(
+ configuration.metakeywords.getOverviewMetaKeywords(title, configuration.doctitle),
+ description,
+ body);
}
/**
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractPackageIndexWriter.java Tue Feb 26 12:08:20 2019 -0500
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractPackageIndexWriter.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -29,7 +29,6 @@
import javax.lang.model.element.PackageElement;
-import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
@@ -109,11 +108,13 @@
* methods from the sub-class in order to generate Frame or Non
* Frame format.
*
- * @param title the title of the window.
+ * @param title the title of the window
+ * @param description the content for the description META tag
* @param includeScript boolean set true if windowtitle script is to be included
* @throws DocFileIOException if there is a problem building the package index file
*/
- protected void buildPackageIndexFile(String title, boolean includeScript) throws DocFileIOException {
+ protected void buildPackageIndexFile(String title, String description, boolean includeScript)
+ throws DocFileIOException {
String windowOverview = resources.getText(title);
Content body = getBody(includeScript, getWindowTitle(windowOverview));
Content header = HtmlTree.HEADER();
@@ -127,8 +128,9 @@
body.addContent(header);
body.addContent(main);
body.addContent(footer);
- printHtmlDocument(configuration.metakeywords.getOverviewMetaKeywords(title,
- configuration.doctitle), includeScript, body);
+ printHtmlDocument(
+ configuration.metakeywords.getOverviewMetaKeywords(title, configuration.doctitle),
+ description, body);
}
/**
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllClassesFrameWriter.java Tue Feb 26 12:08:20 2019 -0500
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllClassesFrameWriter.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -29,7 +29,6 @@
import javax.lang.model.element.Element;
import javax.lang.model.element.TypeElement;
-import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
@@ -122,7 +121,7 @@
HtmlTree div = HtmlTree.DIV(HtmlStyle.indexContainer, ul);
htmlTree.addContent(div);
body.addContent(htmlTree);
- printHtmlDocument(null, false, body);
+ printHtmlDocument(null, "all classes (frame)", body);
}
/**
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllClassesIndexWriter.java Tue Feb 26 12:08:20 2019 -0500
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllClassesIndexWriter.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, 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
@@ -117,7 +117,7 @@
footer.addContent(navBar.getContent(false));
addBottom(footer);
bodyTree.addContent(footer);
- printHtmlDocument(null, true, bodyTree);
+ printHtmlDocument(null, "class index", bodyTree);
}
/**
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllPackagesIndexWriter.java Tue Feb 26 12:08:20 2019 -0500
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllPackagesIndexWriter.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, 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
@@ -105,7 +105,7 @@
footer.addContent(navBar.getContent(false));
addBottom(footer);
bodyTree.addContent(footer);
- printHtmlDocument(null, true, bodyTree);
+ printHtmlDocument(null, "package index", bodyTree);
}
/**
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeWriterImpl.java Tue Feb 26 12:08:20 2019 -0500
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeWriterImpl.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2019, 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
@@ -152,8 +152,11 @@
*/
@Override
public void printDocument(Content contentTree) throws DocFileIOException {
+ String description = getDescription("declaration", annotationType);
+ PackageElement pkg = utils.containingPackage(this.annotationType);
+ Content stylesheetContent = getLocalStylesheetContent(pkg);
printHtmlDocument(configuration.metakeywords.getMetaKeywords(annotationType),
- true, contentTree);
+ description, stylesheetContent, contentTree);
}
/**
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassUseWriter.java Tue Feb 26 12:08:20 2019 -0500
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassUseWriter.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2019, 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
@@ -27,7 +27,6 @@
import jdk.javadoc.internal.doclets.formats.html.markup.Table;
-import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
@@ -241,7 +240,8 @@
footer.addContent(navBar.getContent(false));
addBottom(footer);
body.addContent(footer);
- printHtmlDocument(null, true, body);
+ String description = getDescription("use", typeElement);
+ printHtmlDocument(null, description, body);
}
/**
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassWriterImpl.java Tue Feb 26 12:08:20 2019 -0500
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassWriterImpl.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2019, 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
@@ -177,8 +177,11 @@
*/
@Override
public void printDocument(Content contentTree) throws DocFileIOException {
+ String description = getDescription("declaration", typeElement);
+ PackageElement pkg = utils.containingPackage(typeElement);
+ Content stylesheetContent = getLocalStylesheetContent(pkg);
printHtmlDocument(configuration.metakeywords.getMetaKeywords(typeElement),
- true, contentTree);
+ description, stylesheetContent, contentTree);
}
/**
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConstantsSummaryWriterImpl.java Tue Feb 26 12:08:20 2019 -0500
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConstantsSummaryWriterImpl.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -328,6 +328,6 @@
*/
@Override
public void printDocument(Content contentTree) throws DocFileIOException {
- printHtmlDocument(null, true, contentTree);
+ printHtmlDocument(null, "summary of constants", contentTree);
}
}
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/DeprecatedListWriter.java Tue Feb 26 12:08:20 2019 -0500
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/DeprecatedListWriter.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2019, 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
@@ -308,7 +308,8 @@
htmlTree.addContent(navBar.getContent(false));
addBottom(htmlTree);
body.addContent(htmlTree);
- printHtmlDocument(null, true, body);
+ String description = "deprecated elements";
+ printHtmlDocument(null, description, body);
}
/**
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/DocFilesHandlerImpl.java Tue Feb 26 12:08:20 2019 -0500
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/DocFilesHandlerImpl.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, 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
@@ -31,7 +31,6 @@
import com.sun.source.doctree.TextTree;
import com.sun.source.util.DocTreeFactory;
import com.sun.tools.doclint.HtmlTag;
-import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
import jdk.javadoc.internal.doclets.formats.html.markup.Navigation;
import jdk.javadoc.internal.doclets.toolkit.Content;
@@ -125,6 +124,16 @@
}
}
+ public List<DocPath> getStylesheets() throws DocFileIOException {
+ List<DocPath> stylesheets = new ArrayList<DocPath>();
+ for (DocFile srcdir : DocFile.list(configuration, location, source)) {
+ for (DocFile srcFile : srcdir.list()) {
+ if (srcFile.getName().endsWith(".css"))
+ stylesheets.add(DocPaths.DOC_FILES.resolve(srcFile.getName()));
+ }
+ }
+ return stylesheets;
+ }
private void copyDirectory(DocFile srcdir, final DocPath dstDocPath,
boolean first) throws DocFileIOException {
@@ -197,7 +206,7 @@
footer.addContent(navBar.getContent(false));
docletWriter.addBottom(footer);
htmlContent.addContent(footer);
- docletWriter.printHtmlDocument(Collections.emptyList(), false, localTagsContent, htmlContent);
+ docletWriter.printHtmlDocument(Collections.emptyList(), null, localTagsContent, htmlContent);
}
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/FrameOutputWriter.java Tue Feb 26 12:08:20 2019 -0500
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/FrameOutputWriter.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2019, 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
@@ -128,6 +128,8 @@
Head head = new Head(path, configuration.docletVersion)
.setTimestamp(!configuration.notimestamp)
.setTitle(title)
+ .setDescription("frames")
+ .setGenerator(getGenerator(getClass()))
.setCharset(configuration.charset)
.setStylesheets(configuration.getMainStylesheet(), configuration.getAdditionalStylesheets())
.addDefaultScript(false)
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HelpWriter.java Tue Feb 26 12:08:20 2019 -0500
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HelpWriter.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2019, 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
@@ -100,7 +100,7 @@
htmlTree.addContent(navBar.getContent(false));
addBottom(htmlTree);
body.addContent(htmlTree);
- printHtmlDocument(null, true, body);
+ printHtmlDocument(null, "help", body);
}
/**
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlConfiguration.java Tue Feb 26 12:08:20 2019 -0500
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlConfiguration.java Tue Feb 26 12:11:29 2019 -0500
@@ -240,6 +240,8 @@
public DocPaths docPaths;
+ public Map<Element, List<DocPath>> localStylesheetMap = new HashMap<>();
+
/**
* Creates an object to hold the configuration for a doclet.
*
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java Tue Feb 26 12:08:20 2019 -0500
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2019, 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
@@ -41,6 +41,7 @@
import javax.lang.model.element.ModuleElement;
import javax.lang.model.element.Name;
import javax.lang.model.element.PackageElement;
+import javax.lang.model.element.QualifiedNameable;
import javax.lang.model.element.TypeElement;
import javax.lang.model.element.VariableElement;
import javax.lang.model.type.DeclaredType;
@@ -421,14 +422,15 @@
* @param metakeywords Array of String keywords for META tag. Each element
* of the array is assigned to a separate META tag.
* Pass in null for no array
- * @param includeScript true if printing windowtitle script
- * false for files that appear in the left-hand frames
+ * @param description the content for the description META tag.
* @param body the body htmltree to be included in the document
* @throws DocFileIOException if there is a problem writing the file
*/
- public void printHtmlDocument(List<String> metakeywords, boolean includeScript,
- Content body) throws DocFileIOException {
- printHtmlDocument(metakeywords, includeScript, new ContentBuilder(), body);
+ public void printHtmlDocument(List<String> metakeywords,
+ String description,
+ Content body)
+ throws DocFileIOException {
+ printHtmlDocument(metakeywords, description, new ContentBuilder(), body);
}
/**
@@ -437,24 +439,28 @@
* @param metakeywords Array of String keywords for META tag. Each element
* of the array is assigned to a separate META tag.
* Pass in null for no array
- * @param includeScript true if printing windowtitle script
- * false for files that appear in the left-hand frames
- * @param extraContent any additional content to be included in the HEAD element
+ * @param description the content for the description META tag.
+ * @param extraHeadContent any additional content to be included in the HEAD element
* @param body the body htmltree to be included in the document
* @throws DocFileIOException if there is a problem writing the file
*/
- public void printHtmlDocument(List<String> metakeywords, boolean includeScript, Content extraContent,
- Content body) throws DocFileIOException {
+ public void printHtmlDocument(List<String> metakeywords,
+ String description,
+ Content extraHeadContent,
+ Content body)
+ throws DocFileIOException {
Content htmlComment = contents.newPage;
Head head = new Head(path, configuration.docletVersion)
.setTimestamp(!configuration.notimestamp)
+ .setDescription(description)
+ .setGenerator(getGenerator(getClass()))
.setTitle(winTitle)
.setCharset(configuration.charset)
.addKeywords(metakeywords)
.setStylesheets(configuration.getMainStylesheet(), configuration.getAdditionalStylesheets())
.setUseModuleDirectories(configuration.useModuleDirectories)
.setIndex(configuration.createindex, mainBodyScript)
- .addContent(extraContent);
+ .addContent(extraHeadContent);
Content htmlTree = HtmlTree.HTML(configuration.getLocale().getLanguage(), head.toContent(), body);
HtmlDocument htmlDocument = new HtmlDocument(htmlComment, htmlTree);
@@ -1646,7 +1652,7 @@
* If this link appeared in the index, we would redirect
* the link like this:
*
- * {@literal <a href="./com/sun/javadoc/package-summary.html">The package Page</a>}
+ * {@literal <a href="./jdk/javadoc/doclet/package-summary.html">The package Page</a>}
*
* @param element the Element object whose documentation is being written.
* @param tt the text being written.
@@ -2111,6 +2117,55 @@
}
/**
+ * Generates a string for use in a description meta element,
+ * based on an element and its enclosing elements
+ * @param prefix a prefix for the string
+ * @param elem the element
+ * @return the description
+ */
+ static String getDescription(String prefix, Element elem) {
+ LinkedList<Element> chain = new LinkedList<>();
+ for (Element e = elem; e != null; e = e.getEnclosingElement()) {
+ // ignore unnamed enclosing elements
+ if (e.getSimpleName().length() == 0 && e != elem) {
+ break;
+ }
+ chain.addFirst(e);
+ }
+ StringBuilder sb = new StringBuilder();
+ for (Element e: chain) {
+ CharSequence name;
+ switch (e.getKind()) {
+ case MODULE:
+ case PACKAGE:
+ name = ((QualifiedNameable) e).getQualifiedName();
+ if (name.length() == 0) {
+ name = "<unnamed>";
+ }
+ break;
+
+ default:
+ name = e.getSimpleName();
+ break;
+ }
+
+ if (sb.length() == 0) {
+ sb.append(prefix).append(": ");
+ } else {
+ sb.append(", ");
+ }
+ sb.append(e.getKind().toString().toLowerCase(Locale.US).replace("_", " "))
+ .append(": ")
+ .append(name);
+ }
+ return sb.toString();
+ }
+
+ static String getGenerator(Class<?> clazz) {
+ return "javadoc/" + clazz.getSimpleName();
+ }
+
+ /**
* Returns an HtmlTree for the SCRIPT tag.
*
* @return an HtmlTree for the SCRIPT tag
@@ -2158,4 +2213,21 @@
Script getMainBodyScript() {
return mainBodyScript;
}
+
+ Content getLocalStylesheetContent(Element element) throws DocFileIOException {
+ Content stylesheetContent = new ContentBuilder();
+ List<DocPath> localStylesheets = configuration.localStylesheetMap.get(element);
+ if (localStylesheets == null) {
+ DocFilesHandlerImpl docFilesHandler = (DocFilesHandlerImpl)configuration
+ .getWriterFactory().getDocFilesHandler(element);
+ localStylesheets = docFilesHandler.getStylesheets();
+ configuration.localStylesheetMap.put(element, localStylesheets);
+ }
+ for (DocPath stylesheet : localStylesheets) {
+ stylesheetContent.addContent(HtmlTree.LINK("stylesheet",
+ "text/css", stylesheet.getPath(), "Style"));
+ }
+ return stylesheetContent;
+ }
+
}
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/IndexRedirectWriter.java Tue Feb 26 12:08:20 2019 -0500
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/IndexRedirectWriter.java Tue Feb 26 12:11:29 2019 -0500
@@ -79,6 +79,8 @@
Content htmlComment = contents.newPage;
Head head = new Head(path, configuration.docletVersion)
.setTimestamp(true)
+ .setDescription("index redirect")
+ .setGenerator(getGenerator(getClass()))
.setStylesheets(configuration.getMainStylesheet(), Collections.emptyList()) // avoid reference to default stylesheet
.addDefaultScript(false);
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleFrameWriter.java Tue Feb 26 12:08:20 2019 -0500
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleFrameWriter.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2019, 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
@@ -36,7 +36,6 @@
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
-import jdk.javadoc.internal.doclets.formats.html.markup.Links;
import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
import jdk.javadoc.internal.doclets.toolkit.Content;
import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
@@ -111,7 +110,9 @@
htmlTree.addContent(div);
body.addContent(htmlTree);
mdlgen.printHtmlDocument(
- configuration.metakeywords.getMetaKeywordsForModule(moduleElement), false, body);
+ configuration.metakeywords.getMetaKeywordsForModule(moduleElement),
+ "module summary (frame)",
+ body);
}
/**
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleIndexFrameWriter.java Tue Feb 26 12:08:20 2019 -0500
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleIndexFrameWriter.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, 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
@@ -77,7 +77,7 @@
public static void generate(HtmlConfiguration configuration) throws DocFileIOException {
DocPath filename = DocPaths.MODULE_OVERVIEW_FRAME;
ModuleIndexFrameWriter modulegen = new ModuleIndexFrameWriter(configuration, filename);
- modulegen.buildModuleIndexFile("doclet.Window_Overview", false);
+ modulegen.buildModuleIndexFile("doclet.Window_Overview", "module overview (frame)", false);
}
/**
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleIndexWriter.java Tue Feb 26 12:08:20 2019 -0500
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleIndexWriter.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2019, 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
@@ -74,7 +74,7 @@
public static void generate(HtmlConfiguration configuration) throws DocFileIOException {
DocPath filename = DocPaths.overviewSummary(configuration.frames);
ModuleIndexWriter mdlgen = new ModuleIndexWriter(configuration, filename);
- mdlgen.buildModuleIndexFile("doclet.Window_Overview_Summary", true);
+ mdlgen.buildModuleIndexFile("doclet.Window_Overview_Summary", "module index", true);
}
/**
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModulePackageIndexFrameWriter.java Tue Feb 26 12:08:20 2019 -0500
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModulePackageIndexFrameWriter.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, 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
@@ -77,7 +77,10 @@
public static void generate(HtmlConfiguration configuration, ModuleElement mdle) throws DocFileIOException {
DocPath filename = configuration.docPaths.moduleFrame(mdle);
ModulePackageIndexFrameWriter modpackgen = new ModulePackageIndexFrameWriter(configuration, filename);
- modpackgen.buildModulePackagesIndexFile("doclet.Window_Overview", false, mdle);
+ modpackgen.buildModulePackagesIndexFile("doclet.Window_Overview",
+ getDescription("module package index", mdle) + " (frame)",
+ false,
+ mdle);
}
/**
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleWriterImpl.java Tue Feb 26 12:08:20 2019 -0500
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleWriterImpl.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2019, 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
@@ -915,7 +915,8 @@
@Override
public void printDocument(Content contentTree) throws DocFileIOException {
printHtmlDocument(configuration.metakeywords.getMetaKeywordsForModule(mdle),
- true, contentTree);
+ getDescription("declaration", mdle),
+ contentTree);
}
/**
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageFrameWriter.java Tue Feb 26 12:08:20 2019 -0500
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageFrameWriter.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2019, 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
@@ -89,7 +89,7 @@
/**
* Generate a package summary page for the left-hand bottom frame. Construct
- * the PackageFrameWriter object and then uses it generate the file.
+ * the PackageFrameWriter object and then use it generate the file.
*
* @param configuration the current configuration of the doclet.
* @param packageElement The package for which "pacakge-frame.html" is to be generated.
@@ -111,7 +111,9 @@
htmlTree.addContent(div);
body.addContent(htmlTree);
packgen.printHtmlDocument(
- configuration.metakeywords.getMetaKeywords(packageElement), false, body);
+ configuration.metakeywords.getMetaKeywords(packageElement),
+ getDescription("package summary (frame)", packageElement),
+ body);
}
/**
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageIndexFrameWriter.java Tue Feb 26 12:08:20 2019 -0500
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageIndexFrameWriter.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2019, 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
@@ -31,7 +31,6 @@
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
-import jdk.javadoc.internal.doclets.formats.html.markup.Links;
import jdk.javadoc.internal.doclets.formats.html.markup.RawHtml;
import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
import jdk.javadoc.internal.doclets.toolkit.Content;
@@ -70,7 +69,9 @@
public static void generate(HtmlConfiguration configuration) throws DocFileIOException {
DocPath filename = DocPaths.OVERVIEW_FRAME;
PackageIndexFrameWriter packgen = new PackageIndexFrameWriter(configuration, filename);
- packgen.buildPackageIndexFile("doclet.Window_Overview", false);
+ packgen.buildPackageIndexFile("doclet.Window_Overview",
+ "package index (frame)",
+ false);
}
/**
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageIndexWriter.java Tue Feb 26 12:08:20 2019 -0500
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageIndexWriter.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2019, 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
@@ -78,7 +78,7 @@
public static void generate(HtmlConfiguration configuration) throws DocFileIOException {
DocPath filename = DocPaths.overviewSummary(configuration.frames);
PackageIndexWriter packgen = new PackageIndexWriter(configuration, filename);
- packgen.buildPackageIndexFile("doclet.Window_Overview_Summary", true);
+ packgen.buildPackageIndexFile("doclet.Window_Overview_Summary", "package index", true);
}
/**
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageTreeWriter.java Tue Feb 26 12:08:20 2019 -0500
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageTreeWriter.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2019, 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
@@ -121,7 +121,7 @@
footer.addContent(navBar.getContent(false));
addBottom(footer);
body.addContent(footer);
- printHtmlDocument(null, true, body);
+ printHtmlDocument(null, getDescription("tree", packageElement), body);
}
/**
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageUseWriter.java Tue Feb 26 12:08:20 2019 -0500
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageUseWriter.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2019, 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
@@ -141,7 +141,9 @@
footer.addContent(navBar.getContent(false));
addBottom(footer);
body.addContent(footer);
- printHtmlDocument(null, true, body);
+ printHtmlDocument(null,
+ getDescription("use", packageElement),
+ body);
}
/**
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageWriterImpl.java Tue Feb 26 12:08:20 2019 -0500
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageWriterImpl.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2019, 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
@@ -316,7 +316,9 @@
*/
@Override
public void printDocument(Content contentTree) throws DocFileIOException {
+ String description = getDescription("declaration", packageElement);
+ Content stylesheetContent = getLocalStylesheetContent(packageElement);
printHtmlDocument(configuration.metakeywords.getMetaKeywords(packageElement),
- true, contentTree);
+ description, stylesheetContent, contentTree);
}
}
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SerializedFormWriterImpl.java Tue Feb 26 12:08:20 2019 -0500
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SerializedFormWriterImpl.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2019, 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
@@ -255,7 +255,7 @@
*/
@Override
public void printDocument(Content serializedTree) throws DocFileIOException {
- printHtmlDocument(null, true, serializedTree);
+ printHtmlDocument(null, "serialized forms", serializedTree);
}
/**
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SingleIndexWriter.java Tue Feb 26 12:08:20 2019 -0500
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SingleIndexWriter.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2019, 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
@@ -121,7 +121,7 @@
addBottom(htmlTree);
body.addContent(htmlTree);
createSearchIndexFiles();
- printHtmlDocument(null, true, body);
+ printHtmlDocument(null, "index", body);
}
/**
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SourceToHTMLConverter.java Tue Feb 26 12:08:20 2019 -0500
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SourceToHTMLConverter.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -196,7 +196,7 @@
addBlankLines(pre);
Content div = HtmlTree.DIV(HtmlStyle.sourceContainer, pre);
body.addContent(HtmlTree.MAIN(div));
- writeToFile(body, outputdir.resolve(configuration.docPaths.forClass(te)));
+ writeToFile(body, outputdir.resolve(configuration.docPaths.forClass(te)), te);
} catch (IOException e) {
String message = resources.getText("doclet.exception.read.file", fo.getName());
throw new SimpleDocletException(message, e);
@@ -209,11 +209,13 @@
* @param body the documentation content to be written to the file.
* @param path the path for the file.
*/
- private void writeToFile(Content body, DocPath path) throws DocFileIOException {
+ private void writeToFile(Content body, DocPath path, TypeElement te) throws DocFileIOException {
Head head = new Head(path, configuration.docletVersion)
// .setTimestamp(!configuration.notimestamp) // temporary: compatibility!
.setTitle(resources.getText("doclet.Window_Source_title"))
// .setCharset(configuration.charset) // temporary: compatibility!
+ .setDescription(HtmlDocletWriter.getDescription("source", te))
+ .setGenerator(HtmlDocletWriter.getGenerator(getClass()))
.addDefaultScript(false)
.setStylesheets(configuration.getMainStylesheet(), configuration.getAdditionalStylesheets());
Content htmlTree = HtmlTree.HTML(configuration.getLocale().getLanguage(),
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SplitIndexWriter.java Tue Feb 26 12:08:20 2019 -0500
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SplitIndexWriter.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2019, 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
@@ -144,7 +144,8 @@
footer.addContent(navBar.getContent(false));
addBottom(footer);
body.addContent(footer);
- printHtmlDocument(null, true, body);
+ String description = "index: " + unicode;
+ printHtmlDocument(null, description, body);
}
/**
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TreeWriter.java Tue Feb 26 12:08:20 2019 -0500
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TreeWriter.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2019, 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
@@ -127,7 +127,7 @@
htmlTree.addContent(navBar.getContent(false));
addBottom(htmlTree);
body.addContent(htmlTree);
- printHtmlDocument(null, true, body);
+ printHtmlDocument(null, "class tree", body);
}
/**
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/Head.java Tue Feb 26 12:08:20 2019 -0500
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/Head.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2019, 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
@@ -56,6 +56,8 @@
private String title;
private String charset;
private final List<String> keywords;
+ private String description;
+ private String generator;
private boolean showTimestamp;
private boolean useModuleDirectories;
private DocFile mainStylesheetFile;
@@ -111,6 +113,22 @@
}
/**
+ * Sets the content for the description META element.
+ */
+ public Head setDescription(String description) {
+ this.description = description;
+ return this;
+ }
+
+ /**
+ * Sets the content for the generator META element.
+ */
+ public Head setGenerator(String generator) {
+ this.generator = generator;
+ return this;
+ }
+
+ /**
* Adds a list of keywords to appear in META [@code keywords} elements.
*
* @param keywords the list of keywords, or null if none need to be added
@@ -245,6 +263,14 @@
tree.addContent(HtmlTree.META("dc.created", dateFormat.format(now)));
}
+ if (description != null) {
+ tree.addContent(HtmlTree.META("description", description));
+ }
+
+ if (generator != null) {
+ tree.addContent(HtmlTree.META("generator", generator));
+ }
+
for (String k : keywords) {
tree.addContent(HtmlTree.META("keywords", k));
}
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/DocFilesHandler.java Tue Feb 26 12:08:20 2019 -0500
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/DocFilesHandler.java Tue Feb 26 12:11:29 2019 -0500
@@ -26,6 +26,9 @@
package jdk.javadoc.internal.doclets.toolkit;
+import java.util.List;
+
+import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
/**
* The interface for copying doc-files to the output.
*
@@ -37,4 +40,5 @@
public interface DocFilesHandler {
void copyDocFiles() throws DocletException;
+ List<DocPath> getStylesheets() throws DocletException;
}
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/package-info.java Tue Feb 26 12:08:20 2019 -0500
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/package-info.java Tue Feb 26 12:11:29 2019 -0500
@@ -35,16 +35,6 @@
* while doclets provide a user-selectable backend for determining
* how to process the documentation comments.
*
- * <p><em>Historical Note:</em> Prior to the introduction of the
- * {@link javax.lang.model Language Model API} in JDK 6, it was
- * not unusual to use the {@link com.sun.javadoc} API as a
- * modeling API. But the Language Model API, and associated
- * {@link javax.annotation.processing Annotation Processing API}
- * provided a better way to model programs, and in JDK 9,
- * javadoc itself was converted to using the Language Model API,
- * with the {@code com.sun.javadoc API} being deprecated for
- * eventual removal.
- * </p>
*
* <p><b>This is NOT part of any supported API.
* If you write code that depends on this, you do so at your own risk.
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/JavadocTool.java Tue Feb 26 12:08:20 2019 -0500
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/JavadocTool.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,8 +25,9 @@
package jdk.javadoc.internal.tool;
-
-import java.io.File;
+import java.nio.file.Files;
+import java.nio.file.InvalidPathException;
+import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.LinkedHashSet;
@@ -165,7 +166,7 @@
// Normally, the args should be a series of package names or file names.
// Parse the files and collect the package names.
for (String arg: javaNames) {
- if (fm != null && arg.endsWith(".java") && new File(arg).exists()) {
+ if (fm != null && arg.endsWith(".java") && isRegularFile(arg)) {
parse(fm.getJavaFileObjects(arg), classTrees, true);
} else if (isValidPackageName(arg)) {
packageNames.add(arg);
@@ -247,6 +248,14 @@
return toolEnv.docEnv;
}
+ private boolean isRegularFile(String s) {
+ try {
+ return Files.isRegularFile(Paths.get(s));
+ } catch (InvalidPathException e) {
+ return false;
+ }
+ }
+
/** Is the given string a valid package name? */
boolean isValidPackageName(String s) {
if (s.contains("/")) {
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/Start.java Tue Feb 26 12:08:20 2019 -0500
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/Start.java Tue Feb 26 12:11:29 2019 -0500
@@ -408,23 +408,8 @@
return ERROR;
}
} else {
- if (apiMode) {
- com.sun.tools.javadoc.main.Start ostart
- = new com.sun.tools.javadoc.main.Start(context);
- return ostart.begin(docletClass, options, fileObjects)
- ? OK
- : ERROR;
- }
- warn("main.legacy_api");
- String[] array = options.toArray(new String[options.size()]);
- int rc = com.sun.tools.javadoc.Main.execute(
- messager.programName,
- messager.getWriter(WriterKind.ERROR),
- messager.getWriter(WriterKind.WARNING),
- messager.getWriter(WriterKind.NOTICE),
- docletClass.getName(),
- array);
- return (rc == 0) ? OK : ERROR;
+ error("main.not_a_doclet", docletClass.getName());
+ return ERROR;
}
Result result = OK;
@@ -771,6 +756,13 @@
}
String text = messager.getText("main.doclet_class_not_found", userDocletName);
throw new ToolException(CMDERR, text, cnfe);
+ } catch (NoClassDefFoundError ncfe) {
+ if (ncfe.getMessage().contains("com/sun/javadoc/Doclet")) {
+ String text = messager.getText("main.not_a_doclet", userDocletName);
+ throw new ToolException(ERROR, text, ncfe);
+ } else {
+ throw ncfe;
+ }
}
}
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/resources/javadoc.properties Tue Feb 26 12:08:20 2019 -0500
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/resources/javadoc.properties Tue Feb 26 12:11:29 2019 -0500
@@ -299,12 +299,9 @@
Please file a bug against the javadoc tool via the Java bug reporting page\n\
(http://bugreport.java.com) after checking the Bug Database (http://bugs.java.com)\n\
for duplicates. Include error messages and the following diagnostic in your report. Thank you.
-main.legacy_api=The old Doclet and Taglet APIs in the packages\n\
- com.sun.javadoc, com.sun.tools.doclets and their implementations\n\
- are planned to be removed in a future JDK release. These\n\
- components have been superseded by the new APIs in jdk.javadoc.doclet.\n\
- Users are strongly recommended to migrate to the new APIs.\n
-
+main.not_a_doclet=\
+ Class {0} is not a valid doclet.\n\
+ Note: As of JDK 13, the com.sun.javadoc API is no longer supported.
javadoc.class_not_found=Class {0} not found.
javadoc.error=error
javadoc.warning=warning
--- a/src/jdk.javadoc/share/classes/module-info.java Tue Feb 26 12:08:20 2019 -0500
+++ b/src/jdk.javadoc/share/classes/module-info.java Tue Feb 26 12:11:29 2019 -0500
@@ -63,9 +63,6 @@
requires transitive java.compiler;
requires transitive jdk.compiler;
- exports com.sun.javadoc;
- exports com.sun.tools.javadoc;
-
exports jdk.javadoc.doclet;
provides java.util.spi.ToolProvider with
--- a/src/jdk.jcmd/share/classes/sun/tools/jmap/JMap.java Tue Feb 26 12:08:20 2019 -0500
+++ b/src/jdk.jcmd/share/classes/sun/tools/jmap/JMap.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2019, 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
@@ -145,22 +145,52 @@
vm.detach();
}
+ private static String parseFileName(String opt) {
+ // opt starts with "file="
+ if (opt.length() > 5) {
+ // pass whole "file=" string
+ String filename = opt.substring(5);
+ try {
+ // Get the canonical path - important to avoid just
+ // passing a "heap.bin" and having the dump created
+ // in the target VM working directory rather than the
+ // directory where jmap is executed.
+ return new File(filename).getCanonicalPath();
+ } catch (IOException ioe) {
+ return null;
+ }
+ }
+ // no filename
+ return null;
+ }
+
private static void histo(String pid, String options)
throws AttachNotSupportedException, IOException,
UnsupportedEncodingException {
String liveopt = "-all";
- if (options.isEmpty() || options.equals("all")) {
- // pass
- }
- else if (options.equals("live")) {
- liveopt = "-live";
- }
- else {
- usage(1);
+ String filename = null;
+ String subopts[] = options.split(",");
+
+ for (int i = 0; i < subopts.length; i++) {
+ String subopt = subopts[i];
+ if (subopt.equals("") || subopt.equals("all")) {
+ // pass
+ } else if (subopt.equals("live")) {
+ liveopt = "-live";
+ } else if (subopt.startsWith("file=")) {
+ filename = parseFileName(subopt);
+ if (filename == null) {
+ usage(1); // invalid options or no filename
+ }
+ } else {
+ usage(1);
+ }
}
+ System.out.flush();
+
// inspectHeap is not the same as jcmd GC.class_histogram
- executeCommandForPid(pid, "inspectheap", liveopt);
+ executeCommandForPid(pid, "inspectheap", filename, liveopt);
}
private static void dump(String pid, String options)
@@ -176,10 +206,7 @@
if (subopt.equals("live")) {
liveopt = "-live";
} else if (subopt.startsWith("file=")) {
- // file=<file> - check that <file> is specified
- if (subopt.length() > 5) {
- filename = subopt.substring(5);
- }
+ filename = parseFileName(subopt);
}
}
@@ -187,11 +214,6 @@
usage(1); // invalid options or no filename
}
- // get the canonical path - important to avoid just passing
- // a "heap.bin" and having the dump created in the target VM
- // working directory rather than the directory where jmap
- // is executed.
- filename = new File(filename).getCanonicalPath();
// dumpHeap is not the same as jcmd GC.heap_dump
executeCommandForPid(pid, "dumpheap", filename, liveopt);
}
@@ -246,21 +268,27 @@
System.err.println(" to connect to running process and print class loader statistics");
System.err.println(" jmap -finalizerinfo <pid>");
System.err.println(" to connect to running process and print information on objects awaiting finalization");
- System.err.println(" jmap -histo[:live] <pid>");
+ System.err.println(" jmap -histo[:[<histo-options>]] <pid>");
System.err.println(" to connect to running process and print histogram of java object heap");
- System.err.println(" if the \"live\" suboption is specified, only count live objects");
System.err.println(" jmap -dump:<dump-options> <pid>");
System.err.println(" to connect to running process and dump java heap");
System.err.println(" jmap -? -h --help");
System.err.println(" to print this help message");
System.err.println("");
System.err.println(" dump-options:");
- System.err.println(" live dump only live objects; if not specified,");
- System.err.println(" all objects in the heap are dumped.");
+ System.err.println(" live dump only live objects");
+ System.err.println(" all dump all objects in the heap (default if one of \"live\" or \"all\" is not specified");
System.err.println(" format=b binary format");
System.err.println(" file=<file> dump heap to <file>");
System.err.println("");
System.err.println(" Example: jmap -dump:live,format=b,file=heap.bin <pid>");
+ System.err.println("");
+ System.err.println(" histo-options:");
+ System.err.println(" live count only live objects");
+ System.err.println(" all count all objects in the heap (default if one of \"live\" or \"all\" is not specified)");
+ System.err.println(" file=<file> dump data to <file>");
+ System.err.println("");
+ System.err.println(" Example: jmap -histo:live,file=/tmp/histo.data <pid>");
System.exit(exit);
}
}
--- a/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/Main.java Tue Feb 26 12:08:20 2019 -0500
+++ b/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/Main.java Tue Feb 26 12:11:29 2019 -0500
@@ -45,6 +45,8 @@
import java.util.NoSuchElementException;
import java.util.Set;
import java.util.Queue;
+import java.util.stream.Collectors;
+import java.util.stream.IntStream;
import java.util.stream.Stream;
import java.util.stream.StreamSupport;
import java.util.jar.JarEntry;
@@ -106,7 +108,10 @@
// Keep these updated manually until there's a compiler API
// that allows querying of supported releases.
final Set<String> releasesWithoutForRemoval = Set.of("6", "7", "8");
- final Set<String> releasesWithForRemoval = Set.of("9", "10", "11", "12", "13");
+ final Set<String> releasesWithForRemoval = // "9", "10", "11", ...
+ IntStream.rangeClosed(9, Runtime.version().feature())
+ .mapToObj(Integer::toString)
+ .collect(Collectors.toUnmodifiableSet());
final Set<String> validReleases;
{
--- a/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/BreakpointSpec.java Tue Feb 26 12:08:20 2019 -0500
+++ b/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/BreakpointSpec.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2019, 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
@@ -44,20 +44,24 @@
String methodId;
List<String> methodArgs;
int lineNumber;
+ ThreadReference threadFilter; /* Thread to break in. null if global breakpoint. */
+ public static final String locationTokenDelimiter = ":( \t\n\r";
- BreakpointSpec(ReferenceTypeSpec refSpec, int lineNumber) {
+ BreakpointSpec(ReferenceTypeSpec refSpec, int lineNumber, ThreadReference threadFilter) {
super(refSpec);
this.methodId = null;
this.methodArgs = null;
this.lineNumber = lineNumber;
+ this.threadFilter = threadFilter;
}
- BreakpointSpec(ReferenceTypeSpec refSpec, String methodId,
+ BreakpointSpec(ReferenceTypeSpec refSpec, String methodId, ThreadReference threadFilter,
List<String> methodArgs) throws MalformedMemberNameException {
super(refSpec);
this.methodId = methodId;
this.methodArgs = methodArgs;
this.lineNumber = 0;
+ this.threadFilter = threadFilter;
if (!isValidMethodName(methodId)) {
throw new MalformedMemberNameException(methodId);
}
@@ -78,8 +82,11 @@
throw new InvalidTypeException();
}
EventRequestManager em = refType.virtualMachine().eventRequestManager();
- EventRequest bp = em.createBreakpointRequest(location);
+ BreakpointRequest bp = em.createBreakpointRequest(location);
bp.setSuspendPolicy(suspendPolicy);
+ if (threadFilter != null) {
+ bp.addThreadFilter(threadFilter);
+ }
bp.enable();
return bp;
}
@@ -104,7 +111,8 @@
public int hashCode() {
return refSpec.hashCode() + lineNumber +
((methodId != null) ? methodId.hashCode() : 0) +
- ((methodArgs != null) ? methodArgs.hashCode() : 0);
+ ((methodArgs != null) ? methodArgs.hashCode() : 0) +
+ ((threadFilter != null) ? threadFilter.hashCode() : 0);
}
@Override
@@ -118,6 +126,9 @@
((methodArgs != null) ?
methodArgs.equals(breakpoint.methodArgs)
: methodArgs == breakpoint.methodArgs) &&
+ ((threadFilter != null) ?
+ threadFilter.equals(breakpoint.threadFilter)
+ : threadFilter == breakpoint.threadFilter) &&
refSpec.equals(breakpoint.refSpec) &&
(lineNumber == breakpoint.lineNumber);
} else {
--- a/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/Commands.java Tue Feb 26 12:08:20 2019 -0500
+++ b/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/Commands.java Tue Feb 26 12:11:29 2019 -0500
@@ -1037,16 +1037,16 @@
}
- private void printBreakpointCommandUsage(String atForm, String inForm) {
- MessageOutput.println("printbreakpointcommandusage",
- new Object [] {atForm, inForm});
+ private void printBreakpointCommandUsage(String usageMessage) {
+ MessageOutput.println(usageMessage);
}
- protected BreakpointSpec parseBreakpointSpec(StringTokenizer t,
- String atForm, String inForm) {
+ protected BreakpointSpec parseBreakpointSpec(StringTokenizer t, String next_token,
+ ThreadReference threadFilter,
+ String usageMessage) {
BreakpointSpec breakpoint = null;
try {
- String token = t.nextToken(":( \t\n\r");
+ String token = next_token;
// We can't use hasMoreTokens here because it will cause any leading
// paren to be lost.
@@ -1064,16 +1064,24 @@
NumberFormat nf = NumberFormat.getNumberInstance();
nf.setParseIntegerOnly(true);
- Number n = nf.parse(lineToken);
+ Number n;
+ try {
+ n = nf.parse(lineToken);
+ } catch (java.text.ParseException pe) {
+ MessageOutput.println("Invalid line number specified");
+ printBreakpointCommandUsage(usageMessage);
+ return null;
+ }
int lineNumber = n.intValue();
if (t.hasMoreTokens()) {
- printBreakpointCommandUsage(atForm, inForm);
+ MessageOutput.println("Extra tokens after breakpoint location");
+ printBreakpointCommandUsage(usageMessage);
return null;
}
try {
breakpoint = Env.specList.createBreakpoint(classId,
- lineNumber);
+ lineNumber, threadFilter);
} catch (ClassNotFoundException exc) {
MessageOutput.println("is not a valid class name", classId);
}
@@ -1082,7 +1090,8 @@
int idot = token.lastIndexOf('.');
if ( (idot <= 0) || /* No dot or dot in first char */
(idot >= token.length() - 1) ) { /* dot in last char */
- printBreakpointCommandUsage(atForm, inForm);
+ MessageOutput.println("Invalid <class>.<method_name> specification");
+ printBreakpointCommandUsage(usageMessage);
return null;
}
String methodName = token.substring(idot + 1);
@@ -1090,9 +1099,9 @@
List<String> argumentList = null;
if (rest != null) {
if (!rest.startsWith("(") || !rest.endsWith(")")) {
- MessageOutput.println("Invalid method specification:",
+ MessageOutput.println("Invalid <method_name> specification:",
methodName + rest);
- printBreakpointCommandUsage(atForm, inForm);
+ printBreakpointCommandUsage(usageMessage);
return null;
}
// Trim the parens
@@ -1107,6 +1116,7 @@
try {
breakpoint = Env.specList.createBreakpoint(classId,
methodName,
+ threadFilter,
argumentList);
} catch (MalformedMemberNameException exc) {
MessageOutput.println("is not a valid method name", methodName);
@@ -1115,7 +1125,7 @@
}
}
} catch (Exception e) {
- printBreakpointCommandUsage(atForm, inForm);
+ printBreakpointCommandUsage(usageMessage);
return null;
}
return breakpoint;
@@ -1145,33 +1155,74 @@
}
void commandStop(StringTokenizer t) {
- String atIn;
byte suspendPolicy = EventRequest.SUSPEND_ALL;
+ ThreadReference threadFilter = null;
- if (t.hasMoreTokens()) {
- atIn = t.nextToken();
- if (atIn.equals("go") && t.hasMoreTokens()) {
- suspendPolicy = EventRequest.SUSPEND_NONE;
- atIn = t.nextToken();
- } else if (atIn.equals("thread") && t.hasMoreTokens()) {
- suspendPolicy = EventRequest.SUSPEND_EVENT_THREAD;
- atIn = t.nextToken();
- }
- } else {
+ /*
+ * Allowed syntax:
+ * stop [go|thread] [<thread_id>] <at|in> <location>
+ * If no options are given, the current list of breakpoints is printed.
+ * If "go" is specified, then immediately resume after stopping. No threads are suspended.
+ * If "thread" is specified, then only suspend the thread we stop in.
+ * If neither "go" nor "thread" are specified, then suspend all threads.
+ * If an integer <thread_id> is specified, then only stop in the specified thread.
+ * <location> can either be a line number or a method:
+ * - <class id>:<line>
+ * - <class id>.<method>[(argument_type,...)]
+ */
+
+ if (!t.hasMoreTokens()) {
listBreakpoints();
return;
}
- BreakpointSpec spec = parseBreakpointSpec(t, "stop at", "stop in");
- if (spec != null) {
- // Enforcement of "at" vs. "in". The distinction is really
- // unnecessary and we should consider not checking for this
- // (and making "at" and "in" optional).
- if (atIn.equals("at") && spec.isMethodBreakpoint()) {
- MessageOutput.println("Use stop at to set a breakpoint at a line number");
- printBreakpointCommandUsage("stop at", "stop in");
+ String token = t.nextToken();
+
+ /* Check for "go" or "thread" modifiers. */
+ if (token.equals("go") && t.hasMoreTokens()) {
+ suspendPolicy = EventRequest.SUSPEND_NONE;
+ token = t.nextToken();
+ } else if (token.equals("thread") && t.hasMoreTokens()) {
+ suspendPolicy = EventRequest.SUSPEND_EVENT_THREAD;
+ token = t.nextToken();
+ }
+
+ /* Handle <thread_id> modifier. */
+ if (!token.equals("at") && !token.equals("in")) {
+ Long threadid;
+ try {
+ threadid = Long.decode(token);
+ } catch (NumberFormatException nfe) {
+ MessageOutput.println("Expected at, in, or an integer <thread_id>:", token);
+ printBreakpointCommandUsage("printstopcommandusage");
return;
}
+ try {
+ ThreadInfo threadInfo = ThreadInfo.getThreadInfo(token);
+ if (threadInfo == null) {
+ MessageOutput.println("Invalid <thread_id>:", token);
+ return;
+ }
+ threadFilter = threadInfo.getThread();
+ token = t.nextToken(BreakpointSpec.locationTokenDelimiter);
+ } catch (VMNotConnectedException vmnce) {
+ MessageOutput.println("<thread_id> option not valid until the VM is started with the run command");
+ return;
+ }
+
+ }
+
+ /* Make sure "at" or "in" comes next. */
+ if (!token.equals("at") && !token.equals("in")) {
+ MessageOutput.println("Missing at or in");
+ printBreakpointCommandUsage("printstopcommandusage");
+ return;
+ }
+
+ token = t.nextToken(BreakpointSpec.locationTokenDelimiter);
+
+ BreakpointSpec spec = parseBreakpointSpec(t, token, threadFilter, "printstopcommandusage");
+ if (spec != null) {
spec.suspendPolicy = suspendPolicy;
resolveNow(spec);
}
@@ -1183,7 +1234,8 @@
return;
}
- BreakpointSpec spec = parseBreakpointSpec(t, "clear", "clear");
+ String token = t.nextToken(BreakpointSpec.locationTokenDelimiter);
+ BreakpointSpec spec = parseBreakpointSpec(t, token, null, "printclearcommandusage");
if (spec != null) {
if (Env.specList.delete(spec)) {
MessageOutput.println("Removed:", spec.toString());
--- a/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/EventRequestSpecList.java Tue Feb 26 12:08:20 2019 -0500
+++ b/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/EventRequestSpecList.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2019, 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
@@ -36,6 +36,7 @@
import com.sun.jdi.request.EventRequest;
import com.sun.jdi.event.ClassPrepareEvent;
+import com.sun.jdi.ThreadReference;
import java.util.ArrayList;
import java.util.Collections;
@@ -108,21 +109,21 @@
}
}
- BreakpointSpec createBreakpoint(String classPattern, int line)
+ BreakpointSpec createBreakpoint(String classPattern, int line, ThreadReference threadFilter)
throws ClassNotFoundException {
ReferenceTypeSpec refSpec =
new PatternReferenceTypeSpec(classPattern);
- return new BreakpointSpec(refSpec, line);
+ return new BreakpointSpec(refSpec, line, threadFilter);
}
BreakpointSpec createBreakpoint(String classPattern,
- String methodId,
+ String methodId, ThreadReference threadFilter,
List<String> methodArgs)
throws MalformedMemberNameException,
ClassNotFoundException {
ReferenceTypeSpec refSpec =
new PatternReferenceTypeSpec(classPattern);
- return new BreakpointSpec(refSpec, methodId, methodArgs);
+ return new BreakpointSpec(refSpec, methodId, threadFilter, methodArgs);
}
EventRequestSpec createExceptionCatch(String classPattern,
--- a/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTYResources.java Tue Feb 26 12:08:20 2019 -0500
+++ b/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTYResources.java Tue Feb 26 12:11:29 2019 -0500
@@ -120,12 +120,14 @@
{"Exception occurred caught", "Exception occurred: {0} (to be caught at: {1})"},
{"Exception occurred uncaught", "Exception occurred: {0} (uncaught)"},
{"Exceptions caught:", "Break when these exceptions occur:"},
+ {"Expected at, in, or an integer <thread_id>:", "Expected \"at\", \"in\", or an integer <thread_id>: {0}"},
{"expr is null", "{0} = null"},
{"expr is value", "{0} = {1}"},
{"expr is value <collected>", " {0} = {1} <collected>"},
{"Expression cannot be void", "Expression cannot be void"},
{"Expression must evaluate to an object", "Expression must evaluate to an object"},
{"extends:", "extends: {0}"},
+ {"Extra tokens after breakpoint location", "Extra tokens after breakpoint location"},
{"Failed reading output", "Failed reading output of child java interpreter."},
{"Fatal error", "Fatal error:"},
{"Field access encountered before after", "Field ({0}) is {1}, will be {2}: "},
@@ -154,11 +156,14 @@
{"Invalid connect type", "Invalid connect type"},
{"Invalid consecutive invocations", "Invalid consecutive invocations"},
{"Invalid exception object", "Invalid exception object"},
- {"Invalid method specification:", "Invalid method specification: {0}"},
+ {"Invalid line number specified", "Invalid line number specified"},
+ {"Invalid <method_name> specification:", "Invalid <method_name> specification: {0}"},
{"Invalid option on class command", "Invalid option on class command"},
{"invalid option", "invalid option: {0}"},
{"Invalid thread status.", "Invalid thread status."},
+ {"Invalid <thread_id>:", "Invalid <thread_id>: {0}"},
{"Invalid transport name:", "Invalid transport name: {0}"},
+ {"Invalid <class>.<method_name> specification", "Invalid <class>.<method_name> specification"},
{"I/O exception occurred:", "I/O Exception occurred: {0}"},
{"is an ambiguous method name in", "\"{0}\" is an ambiguous method name in \"{1}\""},
{"is an invalid line number for", "{0,number,integer} is an invalid line number for {1}"},
@@ -191,6 +196,7 @@
{"Method exitedValue:", "Method exited: return value = {0}, "},
{"Method is overloaded; specify arguments", "Method {0} is overloaded; specify arguments"},
{"minus version", "This is {0} version {1,number,integer}.{2,number,integer} (Java SE version {3})"},
+ {"Missing at or in", "Missing \"at\" or \"in\""},
{"Monitor information for thread", "Monitor information for thread {0}:"},
{"Monitor information for expr", "Monitor information for {0} ({1}):"},
{"More than one class named", "More than one class named: ''{0}''"},
@@ -241,7 +247,18 @@
{"Owned by:", " Owned by: {0}, entry count: {1,number,integer}"},
{"Owned monitor:", " Owned monitor: {0}"},
{"Parse exception:", "Parse Exception: {0}"},
- {"printbreakpointcommandusage", "Usage: {0} <class>:<line_number> or\n {1} <class>.<method_name>[(argument_type,...)]"},
+ {"printclearcommandusage", "Usage clear <class>:<line_number> or\n clear <class>.<method_name>[(argument_type,...)]"},
+ {"printstopcommandusage",
+ "Usage: stop [go|thread] [<thread_id>] <at|in> <location>\n" +
+ " If \"go\" is specified, immediately resume after stopping\n" +
+ " If \"thread\" is specified, only suspend the thread we stop in\n" +
+ " If neither \"go\" nor \"thread\" are specified, suspend all threads\n" +
+ " If an integer <thread_id> is specified, only stop in the specified thread\n" +
+ " \"at\" and \"in\" have the same meaning\n" +
+ " <location> can either be a line number or a method:\n" +
+ " <class_id>:<line_number>\n" +
+ " <class_id>.<method>[(argument_type,...)]"
+ },
{"Removed:", "Removed: {0}"},
{"Requested stack frame is no longer active:", "Requested stack frame is no longer active: {0,number,integer}"},
{"run <args> command is valid only with launched VMs", "'run <args>' command is valid only with launched VMs"},
@@ -292,6 +309,8 @@
{"Thread not suspended", "Thread not suspended"},
{"thread group number description name", "{0,number,integer}. {1} {2}"},
{"Threadgroup name not specified.", "Threadgroup name not specified."},
+ {"<thread_id> option not valid until the VM is started with the run command",
+ "<thread_id> option not valid until the VM is started with the run command"},
{"Threads must be suspended", "Threads must be suspended"},
{"trace method exit in effect for", "trace method exit in effect for {0}"},
{"trace method exits in effect", "trace method exits in effect"},
@@ -318,7 +337,6 @@
{"Usage: unmonitor <monitor#>", "Usage: unmonitor <monitor#>"},
{"Usage: up [n frames]", "Usage: up [n frames]"},
{"Use java minus X to see", "Use 'java -X' to see the available non-standard options"},
- {"Use stop at to set a breakpoint at a line number", "Use 'stop at' to set a breakpoint at a line number"},
{"VM already running. use cont to continue after events.", "VM already running. Use 'cont' to continue after events."},
{"VM Started:", "VM Started: "},
{"vmstartexception", "VM start exception: {0}"},
@@ -357,9 +375,17 @@
"threadgroups -- list threadgroups\n" +
"threadgroup <name> -- set current threadgroup\n" +
"\n" +
- "stop in <class id>.<method>[(argument_type,...)]\n" +
- " -- set a breakpoint in a method\n" +
- "stop at <class id>:<line> -- set a breakpoint at a line\n" +
+ "stop [go|thread] [<thread_id>] <at|in> <location>\n" +
+ " -- set a breakpoint\n" +
+ " -- if no options are given, the current list of breakpoints is printed\n" +
+ " -- if \"go\" is specified, immediately resume after stopping\n" +
+ " -- if \"thread\" is specified, only suspend the thread we stop in\n" +
+ " -- if neither \"go\" nor \"thread\" are specified, suspend all threads\n" +
+ " -- if an integer <thread_id> is specified, only stop in the specified thread\n" +
+ " -- \"at\" and \"in\" have the same meaning\n" +
+ " -- <location> can either be a line number or a method:\n" +
+ " -- <class_id>:<line_number>\n" +
+ " -- <class_id>.<method>[(argument_type,...)]\n" +
"clear <class id>.<method>[(argument_type,...)]\n" +
" -- clear a breakpoint in a method\n" +
"clear <class id>:<line> -- clear a breakpoint at a line\n" +
@@ -412,7 +438,7 @@
"<n> <command> -- repeat command n times\n" +
"# <command> -- discard (no-op)\n" +
"help (or ?) -- list commands\n" +
- "dbgtrace [flag] -- same as dbgtrace command line option" +
+ "dbgtrace [flag] -- same as dbgtrace command line option\n" +
"version -- print version information\n" +
"exit (or quit) -- exit debugger\n" +
"\n" +
--- a/src/jdk.jfr/share/conf/jfr/default.jfc Tue Feb 26 12:08:20 2019 -0500
+++ b/src/jdk.jfr/share/conf/jfr/default.jfc Tue Feb 26 12:11:29 2019 -0500
@@ -133,11 +133,6 @@
<setting name="threshold">10 ms</setting>
</event>
- <event name="jdk.SafepointWaitBlocked">
- <setting name="enabled">false</setting>
- <setting name="threshold">10 ms</setting>
- </event>
-
<event name="jdk.SafepointCleanup">
<setting name="enabled">false</setting>
<setting name="threshold">10 ms</setting>
--- a/src/jdk.jfr/share/conf/jfr/profile.jfc Tue Feb 26 12:08:20 2019 -0500
+++ b/src/jdk.jfr/share/conf/jfr/profile.jfc Tue Feb 26 12:11:29 2019 -0500
@@ -133,11 +133,6 @@
<setting name="threshold">0 ms</setting>
</event>
- <event name="jdk.SafepointWaitBlocked">
- <setting name="enabled">false</setting>
- <setting name="threshold">0 ms</setting>
- </event>
-
<event name="jdk.SafepointCleanup">
<setting name="enabled">false</setting>
<setting name="threshold">0 ms</setting>
--- a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/TaskHelper.java Tue Feb 26 12:08:20 2019 -0500
+++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/TaskHelper.java Tue Feb 26 12:11:29 2019 -0500
@@ -49,9 +49,9 @@
import jdk.tools.jlink.builder.ImageBuilder;
import jdk.tools.jlink.internal.Jlink.PluginsConfiguration;
import jdk.tools.jlink.internal.plugins.DefaultCompressPlugin;
+import jdk.tools.jlink.internal.plugins.DefaultStripDebugPlugin;
import jdk.tools.jlink.internal.plugins.ExcludeJmodSectionPlugin;
import jdk.tools.jlink.internal.plugins.PluginsResourceBundle;
-import jdk.tools.jlink.internal.plugins.StripDebugPlugin;
import jdk.tools.jlink.plugin.Plugin;
import jdk.tools.jlink.plugin.Plugin.Category;
import jdk.tools.jlink.plugin.PluginException;
@@ -375,7 +375,7 @@
m.put(DefaultCompressPlugin.NAME, DefaultCompressPlugin.LEVEL_2);
}, false, "--compress", "-c");
mainOptions.add(plugOption);
- } else if (plugin instanceof StripDebugPlugin) {
+ } else if (plugin instanceof DefaultStripDebugPlugin) {
plugOption
= new PluginOption(false,
(task, opt, arg) -> {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/DefaultStripDebugPlugin.java Tue Feb 26 12:11:29 2019 -0500
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2019, Red Hat, Inc.
+ * 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 jdk.tools.jlink.internal.plugins;
+
+import jdk.tools.jlink.plugin.Plugin;
+import jdk.tools.jlink.plugin.ResourcePool;
+import jdk.tools.jlink.plugin.ResourcePoolBuilder;
+
+/**
+ * Combined debug stripping plugin: Java debug attributes and native debug
+ * symbols.
+ *
+ */
+public final class DefaultStripDebugPlugin implements Plugin {
+
+ public static final String NAME = "strip-debug";
+
+ private final Plugin javaStripPlugin = new StripJavaDebugAttributesPlugin();
+
+ @Override
+ public String getName() {
+ return NAME;
+ }
+
+ @Override
+ public String getDescription() {
+ return PluginsResourceBundle.getDescription(NAME);
+ }
+
+ @Override
+ public ResourcePool transform(ResourcePool in, ResourcePoolBuilder out) {
+ return javaStripPlugin.transform(in, out);
+ }
+
+}
--- a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/StripDebugPlugin.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,87 +0,0 @@
-/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * 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 jdk.tools.jlink.internal.plugins;
-
-import java.util.function.Predicate;
-import jdk.internal.org.objectweb.asm.ClassReader;
-import jdk.internal.org.objectweb.asm.ClassWriter;
-import jdk.tools.jlink.plugin.ResourcePool;
-import jdk.tools.jlink.plugin.ResourcePoolBuilder;
-import jdk.tools.jlink.plugin.ResourcePoolEntry;
-import jdk.tools.jlink.plugin.Plugin;
-
-/**
- *
- * Strip debug attributes plugin
- */
-public final class StripDebugPlugin implements Plugin {
- public static final String NAME = "strip-debug";
- private final Predicate<String> predicate;
-
- public StripDebugPlugin() {
- this((path) -> false);
- }
-
- StripDebugPlugin(Predicate<String> predicate) {
- this.predicate = predicate;
- }
-
- @Override
- public String getName() {
- return NAME;
- }
-
- @Override
- public String getDescription() {
- return PluginsResourceBundle.getDescription(NAME);
- }
-
- @Override
- public ResourcePool transform(ResourcePool in, ResourcePoolBuilder out) {
- //remove *.diz files as well as debug attributes.
- in.transformAndCopy((resource) -> {
- ResourcePoolEntry res = resource;
- if (resource.type().equals(ResourcePoolEntry.Type.CLASS_OR_RESOURCE)) {
- String path = resource.path();
- if (path.endsWith(".class")) {
- if (path.endsWith("module-info.class")) {
- // XXX. Do we have debug info? Is Asm ready for module-info?
- } else {
- ClassReader reader = new ClassReader(resource.contentBytes());
- ClassWriter writer = new ClassWriter(ClassWriter.COMPUTE_MAXS);
- reader.accept(writer, ClassReader.SKIP_DEBUG);
- byte[] content = writer.toByteArray();
- res = resource.copyWithContent(content);
- }
- }
- } else if (predicate.test(res.path())) {
- res = null;
- }
- return res;
- }, out);
-
- return out.build();
- }
-}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/StripJavaDebugAttributesPlugin.java Tue Feb 26 12:11:29 2019 -0500
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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 jdk.tools.jlink.internal.plugins;
+
+import java.util.function.Predicate;
+
+import jdk.internal.org.objectweb.asm.ClassReader;
+import jdk.internal.org.objectweb.asm.ClassWriter;
+import jdk.tools.jlink.plugin.Plugin;
+import jdk.tools.jlink.plugin.ResourcePool;
+import jdk.tools.jlink.plugin.ResourcePoolBuilder;
+import jdk.tools.jlink.plugin.ResourcePoolEntry;
+
+/**
+ *
+ * Strip java debug attributes plugin
+ */
+public final class StripJavaDebugAttributesPlugin implements Plugin {
+ public static final String NAME = "strip-java-debug-attributes";
+ private final Predicate<String> predicate;
+
+ public StripJavaDebugAttributesPlugin() {
+ this((path) -> false);
+ }
+
+ StripJavaDebugAttributesPlugin(Predicate<String> predicate) {
+ this.predicate = predicate;
+ }
+
+ @Override
+ public String getName() {
+ return NAME;
+ }
+
+ @Override
+ public String getDescription() {
+ return PluginsResourceBundle.getDescription(NAME);
+ }
+
+ @Override
+ public ResourcePool transform(ResourcePool in, ResourcePoolBuilder out) {
+ //remove *.diz files as well as debug attributes.
+ in.transformAndCopy((resource) -> {
+ ResourcePoolEntry res = resource;
+ if (resource.type().equals(ResourcePoolEntry.Type.CLASS_OR_RESOURCE)) {
+ String path = resource.path();
+ if (path.endsWith(".class")) {
+ if (path.endsWith("module-info.class")) {
+ // XXX. Do we have debug info? Is Asm ready for module-info?
+ } else {
+ ClassReader reader = new ClassReader(resource.contentBytes());
+ ClassWriter writer = new ClassWriter(ClassWriter.COMPUTE_MAXS);
+ reader.accept(writer, ClassReader.SKIP_DEBUG);
+ byte[] content = writer.toByteArray();
+ res = resource.copyWithContent(content);
+ }
+ }
+ } else if (predicate.test(res.path())) {
+ res = null;
+ }
+ return res;
+ }, out);
+
+ return out.build();
+ }
+}
--- a/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/plugins.properties Tue Feb 26 12:08:20 2019 -0500
+++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/plugins.properties Tue Feb 26 12:11:29 2019 -0500
@@ -99,6 +99,9 @@
strip-debug.description=\
Strip debug information from the output image
+strip-java-debug-attributes.description=\
+Strip Java debug attributes from classes in the output image
+
strip-native-commands.description=\
Exclude native commands (such as java/java.exe) from the image
--- a/src/jdk.jlink/share/classes/module-info.java Tue Feb 26 12:08:20 2019 -0500
+++ b/src/jdk.jlink/share/classes/module-info.java Tue Feb 26 12:11:29 2019 -0500
@@ -63,7 +63,8 @@
jdk.tools.jlink.internal.Main.JlinkToolProvider;
provides jdk.tools.jlink.plugin.Plugin with
- jdk.tools.jlink.internal.plugins.StripDebugPlugin,
+ jdk.tools.jlink.internal.plugins.DefaultStripDebugPlugin,
+ jdk.tools.jlink.internal.plugins.StripJavaDebugAttributesPlugin,
jdk.tools.jlink.internal.plugins.ExcludePlugin,
jdk.tools.jlink.internal.plugins.ExcludeFilesPlugin,
jdk.tools.jlink.internal.plugins.ExcludeJmodSectionPlugin,
--- a/src/utils/LogCompilation/src/main/java/com/sun/hotspot/tools/compiler/LogParser.java Tue Feb 26 12:08:20 2019 -0500
+++ b/src/utils/LogCompilation/src/main/java/com/sun/hotspot/tools/compiler/LogParser.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2019, 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
@@ -1279,6 +1279,7 @@
types.clear();
methods.clear();
site = null;
+ lateInlining = false;
}
} catch (Exception e) {
reportInternalError("exception while processing end element", e);
--- a/test/hotspot/jtreg/ProblemList-graal.txt Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/ProblemList-graal.txt Tue Feb 26 12:11:29 2019 -0500
@@ -226,4 +226,4 @@
org.graalvm.compiler.hotspot.test.ReservedStackAccessTest 8213567 windows-all
-org.graalvm.compiler.hotspot.test.CheckGraalIntrinsics 8218698
+org.graalvm.compiler.hotspot.test.CheckGraalIntrinsics 8218074
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/ProblemList-zgc.txt Tue Feb 26 12:11:29 2019 -0500
@@ -0,0 +1,30 @@
+#
+# Copyright (c) 2019, 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.
+#
+
+#############################################################################
+#
+# List of quarantined tests for testing with ZGC.
+#
+#############################################################################
+
+serviceability/sa/TestJmapCoreMetaspace.java 8219443 generic-all
--- a/test/hotspot/jtreg/ProblemList.txt Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/ProblemList.txt Tue Feb 26 12:11:29 2019 -0500
@@ -57,9 +57,9 @@
compiler/runtime/Test8168712.java 8211769,8211771 generic-ppc64,generic-ppc64le,linux-s390x
-applications/ctw/modules/java_desktop.java 8189604 windows-all
-applications/ctw/modules/java_desktop_2.java 8189604 windows-all
-applications/ctw/modules/jdk_jconsole.java 8189604 windows-all
+applications/ctw/modules/java_desktop.java 8205016 windows-all
+applications/ctw/modules/java_desktop_2.java 8205016 windows-all
+applications/ctw/modules/jdk_jconsole.java 8205016 windows-all
#############################################################################
@@ -189,7 +189,6 @@
vmTestbase/vm/mlvm/meth/stress/gc/callSequencesDuringGC/Test.java 8058176 generic-all
vmTestbase/vm/mlvm/meth/stress/java/sequences/Test.java 8058176 generic-all
vmTestbase/vm/mlvm/meth/stress/jdi/breakpointInCompiledCode/Test.java 8058176 generic-all
-vmTestbase/vm/mlvm/mixed/stress/java/findDeadlock/TestDescription.java 8208278 macosx-all
vmTestbase/vm/mlvm/indy/func/jvmti/mergeCP_indy2none_a/TestDescription.java 8013267 generic-all
vmTestbase/vm/mlvm/indy/func/jvmti/mergeCP_indy2manyDiff_b/TestDescription.java 8013267 generic-all
vmTestbase/vm/mlvm/indy/func/jvmti/mergeCP_indy2manySame_b/TestDescription.java 8013267 generic-all
--- a/test/hotspot/jtreg/TEST.ROOT Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/TEST.ROOT Tue Feb 26 12:11:29 2019 -0500
@@ -70,7 +70,7 @@
test.vm.gc.nvdimm
# Minimum jtreg version
-requiredVersion=4.2 b13
+requiredVersion=4.2 b14
# Path to libraries in the topmost test directory. This is needed so @library
# does not need ../../../ notation to reach them
@@ -81,3 +81,6 @@
# Use --patch-module instead of -Xmodule:
useNewPatchModule=true
+
+# disabled till JDK-8219140 is fixed
+allowSmartActionArgs=false
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/unsafe/MaybeOffHeapUnsafeAccessToNewObject.java Tue Feb 26 12:11:29 2019 -0500
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2019, Red Hat, Inc. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact 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 8219335
+ * @summary "failed: unexpected type" assert failure in ConnectionGraph::split_unique_types() with unsafe accesses
+ *
+ * @modules java.base/jdk.internal.misc
+ * @run main/othervm -XX:-UseOnStackReplacement -XX:-BackgroundCompilation -XX:-TieredCompilation -Xcomp -XX:CompileOnly=MaybeOffHeapUnsafeAccessToNewObject::test1 -XX:+IgnoreUnrecognizedVMOptions -XX:+AlwaysIncrementalInline MaybeOffHeapUnsafeAccessToNewObject
+ */
+
+import java.lang.reflect.Field;
+import jdk.internal.misc.Unsafe;
+
+public class MaybeOffHeapUnsafeAccessToNewObject {
+ public volatile int f_int = -1;
+
+
+ public static Unsafe unsafe = Unsafe.getUnsafe();
+ public static final long f_int_off;
+
+ static {
+ Field f_int_field = null;
+ try {
+ f_int_field = MaybeOffHeapUnsafeAccessToNewObject.class.getField("f_int");
+ } catch (Exception e) {
+ System.out.println("reflection failed " + e);
+ e.printStackTrace();
+ }
+ f_int_off = unsafe.objectFieldOffset(f_int_field);
+ }
+
+ static public void main(String[] args) {
+ MaybeOffHeapUnsafeAccessToNewObject o = new MaybeOffHeapUnsafeAccessToNewObject();
+ test1();
+ }
+
+ static Object test1_helper1(Object t) {
+ return t;
+ }
+
+ static long test1_helper2(long off) {
+ return off;
+ }
+
+ static int test1() {
+ MaybeOffHeapUnsafeAccessToNewObject t = new MaybeOffHeapUnsafeAccessToNewObject();
+ Object o = test1_helper1(t);
+ long off = test1_helper2(f_int_off);
+ return unsafe.getInt(o, off);
+ }
+
+}
--- a/test/hotspot/jtreg/gc/shenandoah/mxbeans/TestMemoryMXBeans.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/gc/shenandoah/mxbeans/TestMemoryMXBeans.java Tue Feb 26 12:11:29 2019 -0500
@@ -52,8 +52,10 @@
public static void testMemoryBean(long initSize, long maxSize) {
MemoryMXBean memoryMXBean = ManagementFactory.getMemoryMXBean();
long heapInit = memoryMXBean.getHeapMemoryUsage().getInit();
+ long heapCommitted = memoryMXBean.getHeapMemoryUsage().getCommitted();
long heapMax = memoryMXBean.getHeapMemoryUsage().getMax();
long nonHeapInit = memoryMXBean.getNonHeapMemoryUsage().getInit();
+ long nonHeapCommitted = memoryMXBean.getNonHeapMemoryUsage().getCommitted();
long nonHeapMax = memoryMXBean.getNonHeapMemoryUsage().getMax();
if (initSize > 0 && heapInit != initSize) {
@@ -62,5 +64,9 @@
if (maxSize > 0 && heapMax != maxSize) {
throw new IllegalStateException("Max heap size is wrong: " + heapMax + " vs " + maxSize);
}
+ if (initSize > 0 && maxSize > 0 && initSize != maxSize && heapCommitted == heapMax) {
+ throw new IllegalStateException("Init committed heap size is wrong: " + heapCommitted +
+ " (init: " + initSize + ", max: " + maxSize + ")");
+ }
}
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/RedefineTests/RedefineDeleteJmethod.java Tue Feb 26 12:11:29 2019 -0500
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 2019, 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 8181171
+ * @summary Test deleting static method pointing to by a jmethod
+ * @library /test/lib
+ * @modules java.base/jdk.internal.misc
+ * @modules java.compiler
+ * java.instrument
+ * jdk.jartool/sun.tools.jar
+ * @run main RedefineClassHelper
+ * @run main/native/othervm -javaagent:redefineagent.jar -Xlog:redefine+class*=trace RedefineDeleteJmethod
+ */
+
+class B {
+ private static int deleteMe() { System.out.println("deleteMe called"); return 5; }
+ public static int callDeleteMe() { return deleteMe(); }
+}
+
+public class RedefineDeleteJmethod {
+
+ public static String newB =
+ "class B {" +
+ "public static int callDeleteMe() { return 6; }" +
+ "}";
+
+ public static String newerB =
+ "class B {" +
+ "private static int deleteMe() { System.out.println(\"deleteMe (2) called\"); return 7; }" +
+ "public static int callDeleteMe() { return deleteMe(); }" +
+ "}";
+
+
+ static {
+ System.loadLibrary("RedefineDeleteJmethod");
+ }
+
+ static native int jniCallDeleteMe();
+
+ static void test(int expected, boolean nsme_expected) throws Exception {
+ // Call through static method
+ int res = B.callDeleteMe();
+ System.out.println("Result = " + res);
+ if (res != expected) {
+ throw new Error("returned " + res + " expected " + expected);
+ }
+
+ // Call through jmethodID, saved from first call.
+ try {
+ res = jniCallDeleteMe();
+ if (nsme_expected) {
+ throw new RuntimeException("Failed, NoSuchMethodError expected");
+ }
+ if (res != expected) {
+ throw new Error("returned " + res + " expected " + expected);
+ }
+ } catch (NoSuchMethodError ex) {
+ if (!nsme_expected) {
+ throw new RuntimeException("Failed, NoSuchMethodError not expected");
+ }
+ System.out.println("Passed, NoSuchMethodError expected");
+ }
+ }
+
+ public static void main(String[] args) throws Exception {
+ test(5, false);
+ RedefineClassHelper.redefineClass(B.class, newB);
+ test(6, true);
+ RedefineClassHelper.redefineClass(B.class, newerB);
+ test(7, true);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/RedefineTests/libRedefineDeleteJmethod.c Tue Feb 26 12:11:29 2019 -0500
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2019, 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.
+ */
+
+#include <jni.h>
+
+jmethodID mid;
+jclass cls;
+static int count = 0;
+
+JNIEXPORT jint JNICALL
+Java_RedefineDeleteJmethod_jniCallDeleteMe(JNIEnv* env, jobject obj) {
+
+ if (count == 0) {
+ count++;
+ cls = (*env)->FindClass(env, "B");
+ if (NULL == cls) {
+ (*env)->FatalError(env, "could not find class");
+ }
+
+ mid = (*env)->GetStaticMethodID(env, cls, "deleteMe", "()I");
+ if (NULL == mid) {
+ (*env)->FatalError(env, "could not find method");
+ }
+ }
+
+ return (*env)->CallStaticIntMethod(env, cls, mid);
+}
--- a/test/hotspot/jtreg/runtime/SharedArchiveFile/SpaceUtilizationCheck.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/SpaceUtilizationCheck.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2019, 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
@@ -102,8 +102,8 @@
}
}
}
- if (checked.size() != 5) {
- throw new RuntimeException("Must have 5 consecutive, fully utilized regions");
+ if (checked.size() != 4) {
+ throw new RuntimeException("Must have 4 consecutive, fully utilized regions");
}
}
}
--- a/test/hotspot/jtreg/runtime/logging/SafepointTest.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/runtime/logging/SafepointTest.java Tue Feb 26 12:11:29 2019 -0500
@@ -41,8 +41,6 @@
InnerClass.class.getName());
OutputAnalyzer output = new OutputAnalyzer(pb.start());
output.shouldContain("Safepoint synchronization initiated");
- output.shouldContain("Entering safepoint region: ");
- output.shouldContain("Leaving safepoint region");
output.shouldHaveExitValue(0);
}
--- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/GenClassesBuilder.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/GenClassesBuilder.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, 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
@@ -35,12 +35,13 @@
*/
public class GenClassesBuilder {
public static void main(String[] args) {
- Path template = testRoot().resolve("vmTestbase")
- .resolve("gc")
- .resolve("g1")
- .resolve("unloading")
- .resolve("ClassNNN.java.template")
- .toAbsolutePath();
+ Path template = Paths.get(Utils.TEST_ROOT)
+ .resolve("vmTestbase")
+ .resolve("gc")
+ .resolve("g1")
+ .resolve("unloading")
+ .resolve("ClassNNN.java.template")
+ .toAbsolutePath();
Path dir = Paths.get(".").toAbsolutePath();
String count = "1000";
if (Files.notExists(template)) {
@@ -52,14 +53,6 @@
throw new Error("can't generate classPool.jar", e);
}
}
-
- private static Path testRoot() {
- Path p = Paths.get(Utils.TEST_SRC);
- while (!Files.exists(p.resolve("TEST.ROOT"))) {
- p = p.getParent();
- }
- return p;
- }
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod001.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod001.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -159,7 +159,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("location001a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance001.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance001.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -170,7 +170,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance002.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance002.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -167,7 +167,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/setValue/setvalue001.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/setValue/setvalue001.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -139,7 +139,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/setValue/setvalue002.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/setValue/setvalue002.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -150,7 +150,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/setValue/setvalue003.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/setValue/setvalue003.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -143,7 +143,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/setValue/setvalue004.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/setValue/setvalue004.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -135,7 +135,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/setValue/setvalue005.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/setValue/setvalue005.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -132,7 +132,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/isVisible/isvisible001.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/isVisible/isvisible001.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -159,7 +159,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("setvalue003a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Locatable/location/location001.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Locatable/location/location001.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -133,7 +133,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("location001a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Locatable/location/location004.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Locatable/location/location004.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -148,7 +148,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("setvalue003a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Locatable/location/location005.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Locatable/location/location005.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -148,7 +148,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("setvalue003a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/codeIndex/codeindex001.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/codeIndex/codeindex001.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -131,7 +131,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/declaringType/declaringtype001.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/declaringType/declaringtype001.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -137,7 +137,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/equals/equals001.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/equals/equals001.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -136,7 +136,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/hashCode/hashcode001.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/hashCode/hashcode001.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -136,7 +136,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/lineNumber/linenumber001.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/lineNumber/linenumber001.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -129,7 +129,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/lineNumber_s/linenumber_s001.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/lineNumber_s/linenumber_s001.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -124,7 +124,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/sourceName/sourcename001.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/sourceName/sourcename001.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -135,7 +135,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/sourceName_s/sourcename_s001.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/sourceName_s/sourcename_s001.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -130,7 +130,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/sourcePath/sourcepath001.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/sourcePath/sourcepath001.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -128,7 +128,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/sourcePath_s/sourcepath_s001.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/sourcePath_s/sourcepath_s001.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -128,7 +128,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/allLineLocations/alllinelocations001.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/allLineLocations/alllinelocations001.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -125,7 +125,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/allLineLocations/alllinelocations002.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/allLineLocations/alllinelocations002.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -127,7 +127,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/allLineLocations_ss/alllinelocations_ss001.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/allLineLocations_ss/alllinelocations_ss001.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -127,7 +127,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/locationOfCodeIndex/locationofcodeindex001.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/locationOfCodeIndex/locationofcodeindex001.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -139,7 +139,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/locationsOfLine/locationsofline001.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/locationsOfLine/locationsofline001.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -132,7 +132,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/locationsOfLine_ssi/locationsofline_ssi001.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/locationsOfLine_ssi/locationsofline_ssi001.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -130,7 +130,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Mirror/toString/tostring001.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Mirror/toString/tostring001.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -133,7 +133,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Mirror/virtualMachine/virtualmachine001.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Mirror/virtualMachine/virtualmachine001.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -133,7 +133,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/disableCollection/disablecollection001.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/disableCollection/disablecollection001.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -133,7 +133,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/entryCount/entrycount001.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/entryCount/entrycount001.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -134,7 +134,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/equals/equals001.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/equals/equals001.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -142,7 +142,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValue/getvalue001.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValue/getvalue001.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -154,7 +154,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValue/getvalue002.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValue/getvalue002.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -158,7 +158,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValue/getvalue003.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValue/getvalue003.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -135,7 +135,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValue/getvalue004.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValue/getvalue004.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -135,7 +135,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValues/getvalues001.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValues/getvalues001.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -139,7 +139,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValues/getvalues002.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValues/getvalues002.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -139,7 +139,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValues/getvalues003.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValues/getvalues003.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -142,7 +142,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/hashCode/hashcode001.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/hashCode/hashcode001.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -142,7 +142,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod001.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod001.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -162,7 +162,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/isCollected/iscollected001.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/isCollected/iscollected001.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -132,7 +132,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/owningThread/owningthread001.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/owningThread/owningthread001.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -136,7 +136,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype001.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype001.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -139,7 +139,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype002.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype002.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -137,7 +137,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype003.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype003.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -137,7 +137,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype004.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype004.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -138,7 +138,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype005.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype005.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -139,7 +139,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype006.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype006.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -139,7 +139,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype007.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype007.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -138,7 +138,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/setValue/setvalue001.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/setValue/setvalue001.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -130,7 +130,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/uniqueID/uniqueid001.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/uniqueID/uniqueid001.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -131,7 +131,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PathSearchingVirtualMachine/baseDirectory/directory001.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PathSearchingVirtualMachine/baseDirectory/directory001.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -124,7 +124,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PathSearchingVirtualMachine/bootClassPath/bootpath001.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PathSearchingVirtualMachine/bootClassPath/bootpath001.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -125,7 +125,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PrimitiveValue/doubleValue/doublevalue002.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PrimitiveValue/doubleValue/doublevalue002.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -139,7 +139,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allLineLocations/alllinelocations001.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allLineLocations/alllinelocations001.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -125,7 +125,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allLineLocations_ss/alllinelocations_ss001.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allLineLocations_ss/alllinelocations_ss001.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -124,7 +124,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/availableStrata/availablestrata001.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/availableStrata/availablestrata001.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -131,7 +131,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/defaultStratum/defaultstratum001.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/defaultStratum/defaultstratum001.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -128,7 +128,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/locationsOfLine_i/locationsofline_i001.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/locationsOfLine_i/locationsofline_i001.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -127,7 +127,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/locationsOfLine_ssi/locationsofline_ssi001.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/locationsOfLine_ssi/locationsofline_ssi001.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -128,7 +128,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/sourceNames/sourcenames001.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/sourceNames/sourcenames001.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -130,7 +130,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/sourcePaths/sourcepaths001.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/sourcePaths/sourcepaths001.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -131,7 +131,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/location/location001.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/location/location001.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -160,7 +160,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("location001a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/setValue/setvalue003/setvalue003.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/setValue/setvalue003/setvalue003.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -247,7 +247,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("setvalue003a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/thisObject/thisobject001.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/thisObject/thisobject001.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -156,7 +156,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("setvalue003a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/thisObject/thisobject002.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/thisObject/thisobject002.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -155,7 +155,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("setvalue003a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/thread/thread001.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/thread/thread001.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -153,7 +153,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("location001a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/visibleVariableByName/visiblevarbyname001.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/visibleVariableByName/visiblevarbyname001.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -158,7 +158,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("setvalue003a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/visibleVariableByName/visiblevarbyname002.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/visibleVariableByName/visiblevarbyname002.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -149,7 +149,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("setvalue003a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/visibleVariables/visiblevariables001.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/visibleVariables/visiblevariables001.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -153,7 +153,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("setvalue003a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/visibleVariables/visiblevariables002.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/visibleVariables/visiblevariables002.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -150,7 +150,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("setvalue003a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadGroupReference/name/name001.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadGroupReference/name/name001.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -154,7 +154,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadGroupReference/parent/parent001.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadGroupReference/parent/parent001.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -156,7 +156,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadGroupReference/resume/resume001.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadGroupReference/resume/resume001.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -153,7 +153,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadGroupReference/suspend/suspend001.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadGroupReference/suspend/suspend001.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -152,7 +152,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadGroupReference/threadGroups/threadgroups001.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadGroupReference/threadGroups/threadgroups001.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -151,7 +151,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadGroupReference/threads/threads001.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadGroupReference/threads/threads001.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -151,7 +151,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/currentContendedMonitor/currentcm001.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/currentContendedMonitor/currentcm001.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -144,7 +144,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frame/frame001.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frame/frame001.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -170,7 +170,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frameCount/framecount001.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frameCount/framecount001.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -161,7 +161,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frames/frames001.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frames/frames001.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -175,7 +175,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frames_ii/frames_ii001.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frames_ii/frames_ii001.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -176,7 +176,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frames_ii/frames_ii002.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frames_ii/frames_ii002.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -159,7 +159,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/interrupt/interrupt001.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/interrupt/interrupt001.java Tue Feb 26 12:11:29 2019 -0500
@@ -153,7 +153,7 @@
pipe = debuggee.createIOPipe();
debuggee.redirectStderr(out);
- log2("interrupt002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
try {
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/isAtBreakpoint/isatbreakpoint001.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/isAtBreakpoint/isatbreakpoint001.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -153,7 +153,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/isSuspended/issuspended002.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/isSuspended/issuspended002.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -159,7 +159,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/name/name001.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/name/name001.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -148,7 +148,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/resume/resume001.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/resume/resume001.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -153,7 +153,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/stop/stop001.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/stop/stop001.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -154,7 +154,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/suspend/suspend001.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/suspend/suspend001.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -152,7 +152,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/suspendCount/suspendcount001.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/suspendCount/suspendcount001.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -152,7 +152,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/threadGroup/threadgroup001.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/threadGroup/threadgroup001.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -161,7 +161,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Value/_itself_/value001.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Value/_itself_/value001.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -146,7 +146,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Value/type/type002/type002.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Value/type/type002/type002.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -196,7 +196,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("setvalue003a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/allThreads/allthreads001.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/allThreads/allthreads001.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -155,7 +155,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("location001a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canGetBytecodes/cangetbytecodes001.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canGetBytecodes/cangetbytecodes001.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -140,7 +140,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canGetCurrentContendedMonitor/cangccm001.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canGetCurrentContendedMonitor/cangccm001.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -151,7 +151,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canGetMonitorInfo/cangetmonitorinfo001.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canGetMonitorInfo/cangetmonitorinfo001.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -159,7 +159,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canGetOwnedMonitorInfo/cangetinfo001.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canGetOwnedMonitorInfo/cangetinfo001.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -151,7 +151,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canGetSourceDebugExtension/cangetsde001.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canGetSourceDebugExtension/cangetsde001.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -123,7 +123,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canGetSyntheticAttribute/cangetattr001.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canGetSyntheticAttribute/cangetattr001.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -140,7 +140,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/description/description001.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/description/description001.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -124,7 +124,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/dispose/dispose001.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/dispose/dispose001.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -134,7 +134,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/dispose/dispose002.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/dispose/dispose002.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -150,7 +150,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/dispose/dispose003.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/dispose/dispose003.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -143,7 +143,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/dispose/dispose004.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/dispose/dispose004.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -144,7 +144,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/dispose/dispose005.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/dispose/dispose005.java Tue Feb 26 12:11:29 2019 -0500
@@ -192,7 +192,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/eventQueue/eventqueue001.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/eventQueue/eventqueue001.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -133,7 +133,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/eventRequestManager/eventrmanager001.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/eventRequestManager/eventrmanager001.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -134,7 +134,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/exit/exit001.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/exit/exit001.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -136,7 +136,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/exit/exit002.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/exit/exit002.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -135,7 +135,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/getDefaultStratum/getdefaultstratum001.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/getDefaultStratum/getdefaultstratum001.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -128,7 +128,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/name/name001.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/name/name001.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -124,7 +124,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/process/process001.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/process/process001.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -128,7 +128,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/setDefaultStratum/setdefaultstratum001.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/setDefaultStratum/setdefaultstratum001.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -128,7 +128,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/suspend/suspend001.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/suspend/suspend001.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -155,7 +155,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/topLevelThreadGroups/toplevelgroups001.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/topLevelThreadGroups/toplevelgroups001.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -128,7 +128,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/version/version001.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/version/version001.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -124,7 +124,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/connectedVirtualMachines/convm001.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/connectedVirtualMachines/convm001.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -143,7 +143,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/connectedVirtualMachines/convm002.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/connectedVirtualMachines/convm002.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -145,7 +145,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/connectedVirtualMachines/convm003.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/connectedVirtualMachines/convm003.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -142,7 +142,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("issuspended002a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VoidValue/equals/equals001/equals001.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VoidValue/equals/equals001/equals001.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -204,7 +204,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("setvalue003a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VoidValue/hashCode/hashcode001/hashcode001.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VoidValue/hashCode/hashcode001/hashcode001.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -204,7 +204,7 @@
IOPipe pipe = new IOPipe(debuggee);
debuggee.redirectStderr(out);
- log2("setvalue003a debuggee launched");
+ log2(debuggeeName + " debuggee launched");
debuggee.resume();
String line = pipe.readln();
--- a/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/GenClassesBuilder.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/GenClassesBuilder.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, 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
@@ -79,12 +79,13 @@
} catch (IOException e) {
throw new Error("can't create dirs for" + dir, e);
}
- Path pattern = testRoot().resolve("vmTestbase")
- .resolve("nsk")
- .resolve("monitoring")
- .resolve("share")
- .resolve("LoadableClass.pattern")
- .toAbsolutePath();
+ Path pattern = Paths.get(Utils.TEST_ROOT)
+ .resolve("vmTestbase")
+ .resolve("nsk")
+ .resolve("monitoring")
+ .resolve("share")
+ .resolve("LoadableClass.pattern")
+ .toAbsolutePath();
if (Files.notExists(pattern)) {
throw new Error("can't find pattern file: " + pattern);
}
@@ -94,13 +95,5 @@
throw new Error("can't generate classes", e);
}
}
-
- private static Path testRoot() {
- Path p = Paths.get(Utils.TEST_SRC);
- while (!Files.exists(p.resolve("TEST.ROOT"))) {
- p = p.getParent();
- }
- return p;
- }
}
--- a/test/hotspot/jtreg/vmTestbase/vm/mlvm/mixed/stress/java/findDeadlock/INDIFY_Test.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/vm/mlvm/mixed/stress/java/findDeadlock/INDIFY_Test.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, 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
@@ -33,6 +33,7 @@
import java.lang.management.ManagementFactory;
import java.lang.management.ThreadMXBean;
import java.lang.reflect.Method;
+import java.util.concurrent.CountDownLatch;
import java.util.concurrent.CyclicBarrier;
import java.util.concurrent.locks.ReentrantLock;
@@ -53,6 +54,7 @@
static MutableCallSite[] _cs = new MutableCallSite[THREAD_NUM];
static CyclicBarrier _threadRaceStartBarrier;
+ static CountDownLatch _threadsRunningLatch;
static volatile boolean _testFailed;
static volatile boolean _testDone;
static volatile int _iteration;
@@ -63,22 +65,22 @@
boolean locked = false;
place = Thread.currentThread().getName() + ": " + place;
if ( ! lockInterruptible ) {
- Env.traceVerbose(place + ": Locking " + n);
+ Env.traceVerbose("Iteration " + _iteration + " " + place + ": Locking " + n);
_locks[n].lock();
locked = true;
} else {
try {
- Env.traceVerbose(place + ": Locking interruptibly " + n);
+ Env.traceVerbose("Iteration " + _iteration + " " + place + ": Locking interruptibly " + n);
_locks[n].lockInterruptibly();
locked = true;
if ( ! _testDone )
throw new Exception(place + ": LOCKED " + n);
else
- Env.traceVerbose(place + ": LOCKED " + n);
+ Env.traceVerbose("Iteration " + _iteration + " " + place + ": LOCKED " + n);
} catch ( InterruptedException swallow ) {
- Env.traceVerbose(place + ": interrupted while locking " + n);
+ Env.traceVerbose("Iteration " + _iteration + " " + place + ": interrupted while locking " + n);
}
}
@@ -87,9 +89,9 @@
private static boolean unlock(String place, int n) throws Throwable {
place = Thread.currentThread().getName() + ": " + place;
- Env.traceVerbose(place + ": Unlocking " + n);
+ Env.traceVerbose("Iteration " + _iteration + " " + place + ": Unlocking " + n);
_locks[n].unlock();
- Env.traceVerbose(place + ": UNLOCKED " + n);
+ Env.traceVerbose("Iteration " + _iteration + " " + place + ": UNLOCKED " + n);
return false;
}
@@ -98,7 +100,7 @@
if ( l instanceof MethodHandles.Lookup ) {
// Method is used as BSM
- Env.traceVerbose(thread.getName() + ": Entered BSM. Lock=" + lockNum);
+ Env.traceVerbose("Iteration " + _iteration + " " + thread.getName() + ": Entered BSM. Lock=" + lockNum);
if ( _iteration > 0 )
throw new Exception("BSM called twice!");
@@ -107,6 +109,7 @@
case 0:
thread._lockedCurrent = lock("BSM", lockNum, false);
_threadRaceStartBarrier.await();
+ _threadsRunningLatch.countDown();
thread._lockedNext = lock("BSM", nextLock(lockNum), true);
break;
@@ -123,7 +126,7 @@
} else {
// Method is used as target
- Env.traceVerbose(thread.getName() + ": Entered target method. Lock=" + lockNum);
+ Env.traceVerbose("Iteration " + _iteration + " " + thread.getName() + ": Entered target method. Lock=" + lockNum);
try {
if ( _iteration > 0 ) {
@@ -132,26 +135,29 @@
case 0:
thread._lockedCurrent = lock("Target", lockNum, false);
_threadRaceStartBarrier.await();
+ _threadsRunningLatch.countDown();
thread._lockedNext = lock("Target", nextLock(lockNum), true);
break;
case 1:
thread._lockedCurrent = lock("Target", lockNum, false);
_threadRaceStartBarrier.await();
- Env.traceVerbose(thread.getName() + ": Entering synchronize ( " + lockNum + " )");
+ _threadsRunningLatch.countDown();
+ Env.traceVerbose("Iteration " + _iteration + " " + thread.getName() + ": Entering synchronize ( " + lockNum + " )");
synchronized ( _locks[nextLock(lockNum)] ) {
}
- Env.traceVerbose(thread.getName() + ": Exited synchronize ( " + lockNum + " )");
+ Env.traceVerbose("Iteration " + _iteration + " " + thread.getName() + ": Exited synchronize ( " + lockNum + " )");
break;
case 2:
- Env.traceVerbose(thread.getName() + ": Entering synchronize ( " + lockNum + " )");
+ Env.traceVerbose("Iteration " + _iteration + " " + thread.getName() + ": Entering synchronize ( " + lockNum + " )");
synchronized ( _locks[lockNum] ) {
_threadRaceStartBarrier.await();
+ _threadsRunningLatch.countDown();
thread._lockedNext = lock("Target", nextLock(lockNum), true);
thread._lockedNext = unlock("Target", nextLock(lockNum));
}
- Env.traceVerbose(thread.getName() + ": Exited synchronize ( " + lockNum + " )");
+ Env.traceVerbose("Iteration " + _iteration + " " + thread.getName() + ": Exited synchronize ( " + lockNum + " )");
break;
}
@@ -163,12 +169,14 @@
case 1:
_threadRaceStartBarrier.await();
+ _threadsRunningLatch.countDown();
thread._lockedNext = lock("Target", nextLock(lockNum), true);
break;
case 2:
thread._lockedCurrent = lock("Target", lockNum, false);
_threadRaceStartBarrier.await();
+ _threadsRunningLatch.countDown();
thread._lockedNext = lock("Target", nextLock(lockNum), true);
break;
}
@@ -18205,8 +18213,9 @@
}
boolean test() throws Throwable {
- Env.traceNormal("Starting test...");
-
+ Env.traceNormal("Iteration " + _iteration + " Starting test...");
+
+ // Sanity check that all the locks are available.
for ( int i = 0; i < THREAD_NUM; i++ ) {
if ( _locks[i].isLocked() ) {
Env.getLog().complain("Lock " + i + " is still locked!");
@@ -18217,60 +18226,87 @@
if ( _testFailed )
throw new Exception("Some locks are still locked");
+ // Threads generally wait on this after claiming their first lock,
+ // and then when released will try to claim the second, which leads
+ // to deadlock.
_threadRaceStartBarrier = new CyclicBarrier(THREAD_NUM + 1);
+
+ // Threads signal this latch after being released from the startbarrier
+ // so that they are closer to triggering deadlock before the main thread
+ // starts to check for it.
+ _threadsRunningLatch = new CountDownLatch(THREAD_NUM);
+
_testDone = false;
_testFailed = false;
- for ( int i = 0; i < THREAD_NUM; i++ )
+ // Start the new batch of threads.
+ for ( int i = 0; i < THREAD_NUM; i++ ) {
(_threads[i] = new DeadlockedThread(i)).start();
+ }
try {
+ // If a thread encounters an error before it reaches the start barrier
+ // then we will hang here until the test times out. So we do a token
+ // check for such failure.
+ if (_testFailed) {
+ Env.complain("Unexpected thread failure before startBarrier was reached");
+ return false;
+ }
+
_threadRaceStartBarrier.await();
- Env.traceVerbose("Start race...");
-
- //
- // Wait for the deadlock and detect it using ThreadMXBean
- //
-
- boolean resultsReady = false;
- for ( int i = 0; i < 10 && ! resultsReady && ! _testFailed; i++ ) {
- Env.traceNormal("Waiting for threads to lock up...");
- Thread.sleep(100);
-
- resultsReady = true;
- for ( int t = 0; t < THREAD_NUM; t++ ) {
- if ( _iteration == 0 && t % 3 != 2 && ! _locks[t].hasQueuedThreads() ) {
- Env.traceVerbose("Lock " + t + ": no waiters");
- resultsReady = false;
- } else {
- Env.traceVerbose("Lock " + t + ": has waiters");
- }
- }
+ Env.traceVerbose("Iteration " + _iteration + " Start race...");
+
+ // Wait till all threads poised to deadlock. Again we may hang here
+ // if unexpected errors are encountered, so again a token check.
+ if (_testFailed) {
+ Env.complain("Unexpected thread failure after startBarrier was reached");
+ return false;
}
- if ( ! resultsReady )
- Env.traceImportant("Warning: threads are still not deadlocked?");
-
- long[] deadlockedThreads = _threadMXBean.findDeadlockedThreads();
- if ( deadlockedThreads == null ) {
- Env.complain("Found no deadlocked threads. Expected to find " + THREAD_NUM);
+ _threadsRunningLatch.await();
+
+ // There is a race now between checking for a deadlock and the threads
+ // actually engaging in that deadlock. We can't query all of the "locks"
+ // involved to see if they are owned and have waiters (no API for built-in
+ // monitors). Nor can we check the thread states because they could be blocked
+ // on incidental synchronization (like I/O monitors when logging is enabled).
+ // So we simply loop checking for a deadlock until we find it, or else the
+ // overall test times out.
+
+ long[] deadlockedThreads = null;
+ do {
+ deadlockedThreads = _threadMXBean.findDeadlockedThreads();
+ } while (deadlockedThreads == null && !_testFailed);
+
+ if (_testFailed) {
+ Env.complain("Unexpected thread failure while checking for deadlock");
return false;
- } else if ( deadlockedThreads.length != THREAD_NUM ) {
+ }
+
+ if (deadlockedThreads.length != THREAD_NUM) {
Env.complain("Found " + deadlockedThreads.length + " deadlocked threads. Expected to find " + THREAD_NUM);
return false;
} else {
Env.traceNormal("Found " + deadlockedThreads.length + " deadlocked threads as expected");
- return ! _testFailed;
+ return true;
}
} finally {
+ // Tells the locking threads the interrupt was expected.
_testDone = true;
+ // Break the deadlock by dropping the attempt to lock
+ // the interruptible locks, which then causes all other
+ // locks to be released and allow threads acquiring
+ // non-interruptible locks to proceed.
_threads[0].interrupt();
- for ( int i = 0; i < THREAD_NUM; i++ ) {
- _threads[i].join(1000);
- if ( _threads[i].isAlive() )
- Env.getLog().complain("Thread " + _threads[i].getName() + " is still alive");
+ // Wait for all threads to terminate before proceeding to next
+ // iteration. If we only join() for a limited time and its too short
+ // then we not only complain here, but will also find locks that are
+ // still locked. It is far simpler to only proceed when all threads
+ // are done and rely on the overall test timeout to detect problems.
+ for (int i = 0; i < THREAD_NUM; i++) {
+ _threads[i].join();
}
MutableCallSite.syncAll(_cs);
--- a/test/hotspot/jtreg/vmTestbase/vm/mlvm/mixed/stress/java/findDeadlock/INDIFY_Test.jmpp Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/vm/mlvm/mixed/stress/java/findDeadlock/INDIFY_Test.jmpp Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, 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
@@ -35,6 +35,7 @@
import java.lang.management.ManagementFactory;
import java.lang.management.ThreadMXBean;
import java.lang.reflect.Method;
+import java.util.concurrent.CountDownLatch;
import java.util.concurrent.CyclicBarrier;
import java.util.concurrent.locks.ReentrantLock;
@@ -55,6 +56,7 @@
static MutableCallSite[] _cs = new MutableCallSite[THREAD_NUM];
static CyclicBarrier _threadRaceStartBarrier;
+ static CountDownLatch _threadsRunningLatch;
static volatile boolean _testFailed;
static volatile boolean _testDone;
static volatile int _iteration;
@@ -65,22 +67,22 @@
boolean locked = false;
place = Thread.currentThread().getName() + ": " + place;
if ( ! lockInterruptible ) {
- Env.traceVerbose(place + ": Locking " + n);
+ Env.traceVerbose("Iteration " + _iteration + " " + place + ": Locking " + n);
_locks[n].lock();
locked = true;
} else {
try {
- Env.traceVerbose(place + ": Locking interruptibly " + n);
+ Env.traceVerbose("Iteration " + _iteration + " " + place + ": Locking interruptibly " + n);
_locks[n].lockInterruptibly();
locked = true;
if ( ! _testDone )
throw new Exception(place + ": LOCKED " + n);
else
- Env.traceVerbose(place + ": LOCKED " + n);
+ Env.traceVerbose("Iteration " + _iteration + " " + place + ": LOCKED " + n);
} catch ( InterruptedException swallow ) {
- Env.traceVerbose(place + ": interrupted while locking " + n);
+ Env.traceVerbose("Iteration " + _iteration + " " + place + ": interrupted while locking " + n);
}
}
@@ -89,9 +91,9 @@
private static boolean unlock(String place, int n) throws Throwable {
place = Thread.currentThread().getName() + ": " + place;
- Env.traceVerbose(place + ": Unlocking " + n);
+ Env.traceVerbose("Iteration " + _iteration + " " + place + ": Unlocking " + n);
_locks[n].unlock();
- Env.traceVerbose(place + ": UNLOCKED " + n);
+ Env.traceVerbose("Iteration " + _iteration + " " + place + ": UNLOCKED " + n);
return false;
}
@@ -100,7 +102,7 @@
if ( l instanceof MethodHandles.Lookup ) {
// Method is used as BSM
- Env.traceVerbose(thread.getName() + ": Entered BSM. Lock=" + lockNum);
+ Env.traceVerbose("Iteration " + _iteration + " " + thread.getName() + ": Entered BSM. Lock=" + lockNum);
if ( _iteration > 0 )
throw new Exception("BSM called twice!");
@@ -109,6 +111,7 @@
case 0:
thread._lockedCurrent = lock("BSM", lockNum, false);
_threadRaceStartBarrier.await();
+ _threadsRunningLatch.countDown();
thread._lockedNext = lock("BSM", nextLock(lockNum), true);
break;
@@ -125,7 +128,7 @@
} else {
// Method is used as target
- Env.traceVerbose(thread.getName() + ": Entered target method. Lock=" + lockNum);
+ Env.traceVerbose("Iteration " + _iteration + " " + thread.getName() + ": Entered target method. Lock=" + lockNum);
try {
if ( _iteration > 0 ) {
@@ -134,26 +137,29 @@
case 0:
thread._lockedCurrent = lock("Target", lockNum, false);
_threadRaceStartBarrier.await();
+ _threadsRunningLatch.countDown();
thread._lockedNext = lock("Target", nextLock(lockNum), true);
break;
case 1:
thread._lockedCurrent = lock("Target", lockNum, false);
_threadRaceStartBarrier.await();
- Env.traceVerbose(thread.getName() + ": Entering synchronize ( " + lockNum + " )");
+ _threadsRunningLatch.countDown();
+ Env.traceVerbose("Iteration " + _iteration + " " + thread.getName() + ": Entering synchronize ( " + lockNum + " )");
synchronized ( _locks[nextLock(lockNum)] ) {
}
- Env.traceVerbose(thread.getName() + ": Exited synchronize ( " + lockNum + " )");
+ Env.traceVerbose("Iteration " + _iteration + " " + thread.getName() + ": Exited synchronize ( " + lockNum + " )");
break;
case 2:
- Env.traceVerbose(thread.getName() + ": Entering synchronize ( " + lockNum + " )");
+ Env.traceVerbose("Iteration " + _iteration + " " + thread.getName() + ": Entering synchronize ( " + lockNum + " )");
synchronized ( _locks[lockNum] ) {
_threadRaceStartBarrier.await();
+ _threadsRunningLatch.countDown();
thread._lockedNext = lock("Target", nextLock(lockNum), true);
thread._lockedNext = unlock("Target", nextLock(lockNum));
}
- Env.traceVerbose(thread.getName() + ": Exited synchronize ( " + lockNum + " )");
+ Env.traceVerbose("Iteration " + _iteration + " " + thread.getName() + ": Exited synchronize ( " + lockNum + " )");
break;
}
@@ -165,12 +171,14 @@
case 1:
_threadRaceStartBarrier.await();
+ _threadsRunningLatch.countDown();
thread._lockedNext = lock("Target", nextLock(lockNum), true);
break;
case 2:
thread._lockedCurrent = lock("Target", lockNum, false);
_threadRaceStartBarrier.await();
+ _threadsRunningLatch.countDown();
thread._lockedNext = lock("Target", nextLock(lockNum), true);
break;
}
@@ -255,8 +263,9 @@
}
boolean test() throws Throwable {
- Env.traceNormal("Starting test...");
+ Env.traceNormal("Iteration " + _iteration + " Starting test...");
+ // Sanity check that all the locks are available.
for ( int i = 0; i < THREAD_NUM; i++ ) {
if ( _locks[i].isLocked() ) {
Env.getLog().complain("Lock " + i + " is still locked!");
@@ -267,60 +276,87 @@
if ( _testFailed )
throw new Exception("Some locks are still locked");
+ // Threads generally wait on this after claiming their first lock,
+ // and then when released will try to claim the second, which leads
+ // to deadlock.
_threadRaceStartBarrier = new CyclicBarrier(THREAD_NUM + 1);
+
+ // Threads signal this latch after being released from the startbarrier
+ // so that they are closer to triggering deadlock before the main thread
+ // starts to check for it.
+ _threadsRunningLatch = new CountDownLatch(THREAD_NUM);
+
_testDone = false;
_testFailed = false;
- for ( int i = 0; i < THREAD_NUM; i++ )
+ // Start the new batch of threads.
+ for ( int i = 0; i < THREAD_NUM; i++ ) {
(_threads[i] = new DeadlockedThread(i)).start();
+ }
try {
- _threadRaceStartBarrier.await();
- Env.traceVerbose("Start race...");
-
- //
- // Wait for the deadlock and detect it using ThreadMXBean
- //
+ // If a thread encounters an error before it reaches the start barrier
+ // then we will hang here until the test times out. So we do a token
+ // check for such failure.
+ if (_testFailed) {
+ Env.complain("Unexpected thread failure before startBarrier was reached");
+ return false;
+ }
- boolean resultsReady = false;
- for ( int i = 0; i < 10 && ! resultsReady && ! _testFailed; i++ ) {
- Env.traceNormal("Waiting for threads to lock up...");
- Thread.sleep(100);
+ _threadRaceStartBarrier.await();
+ Env.traceVerbose("Iteration " + _iteration + " Start race...");
- resultsReady = true;
- for ( int t = 0; t < THREAD_NUM; t++ ) {
- if ( _iteration == 0 && t % 3 != 2 && ! _locks[t].hasQueuedThreads() ) {
- Env.traceVerbose("Lock " + t + ": no waiters");
- resultsReady = false;
- } else {
- Env.traceVerbose("Lock " + t + ": has waiters");
- }
- }
+ // Wait till all threads poised to deadlock. Again we may hang here
+ // if unexpected errors are encountered, so again a token check.
+ if (_testFailed) {
+ Env.complain("Unexpected thread failure after startBarrier was reached");
+ return false;
}
- if ( ! resultsReady )
- Env.traceImportant("Warning: threads are still not deadlocked?");
+ _threadsRunningLatch.await();
+
+ // There is a race now between checking for a deadlock and the threads
+ // actually engaging in that deadlock. We can't query all of the "locks"
+ // involved to see if they are owned and have waiters (no API for built-in
+ // monitors). Nor can we check the thread states because they could be blocked
+ // on incidental synchronization (like I/O monitors when logging is enabled).
+ // So we simply loop checking for a deadlock until we find it, or else the
+ // overall test times out.
- long[] deadlockedThreads = _threadMXBean.findDeadlockedThreads();
- if ( deadlockedThreads == null ) {
- Env.complain("Found no deadlocked threads. Expected to find " + THREAD_NUM);
+ long[] deadlockedThreads = null;
+ do {
+ deadlockedThreads = _threadMXBean.findDeadlockedThreads();
+ } while (deadlockedThreads == null && !_testFailed);
+
+ if (_testFailed) {
+ Env.complain("Unexpected thread failure while checking for deadlock");
return false;
- } else if ( deadlockedThreads.length != THREAD_NUM ) {
+ }
+
+ if (deadlockedThreads.length != THREAD_NUM) {
Env.complain("Found " + deadlockedThreads.length + " deadlocked threads. Expected to find " + THREAD_NUM);
return false;
} else {
Env.traceNormal("Found " + deadlockedThreads.length + " deadlocked threads as expected");
- return ! _testFailed;
+ return true;
}
} finally {
+ // Tells the locking threads the interrupt was expected.
_testDone = true;
+ // Break the deadlock by dropping the attempt to lock
+ // the interruptible locks, which then causes all other
+ // locks to be released and allow threads acquiring
+ // non-interruptible locks to proceed.
_threads[0].interrupt();
- for ( int i = 0; i < THREAD_NUM; i++ ) {
- _threads[i].join(1000);
- if ( _threads[i].isAlive() )
- Env.getLog().complain("Thread " + _threads[i].getName() + " is still alive");
+ // Wait for all threads to terminate before proceeding to next
+ // iteration. If we only join() for a limited time and its too short
+ // then we not only complain here, but will also find locks that are
+ // still locked. It is far simpler to only proceed when all threads
+ // are done and rely on the overall test timeout to detect problems.
+ for (int i = 0; i < THREAD_NUM; i++) {
+ _threads[i].join();
}
MutableCallSite.syncAll(_cs);
--- a/test/hotspot/jtreg/vmTestbase/vm/mlvm/share/StratumClassesBuilder.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/vm/mlvm/share/StratumClassesBuilder.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, 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
@@ -38,7 +38,7 @@
public class StratumClassesBuilder {
public static void main(String[] args) {
- Path root = testRoot();
+ Path root = Paths.get(Utils.TEST_ROOT);
Arrays.stream(args)
.map(root::resolve)
.forEach(StratumClassesBuilder::build);
@@ -113,12 +113,4 @@
return file.getParent()
.resolve(filename.replaceFirst("\\.class$", ".smap"));
}
-
- private static Path testRoot() {
- Path p = Paths.get(Utils.TEST_SRC);
- while (!Files.exists(p.resolve("TEST.ROOT"))) {
- p = p.getParent();
- }
- return p;
- }
}
--- a/test/hotspot/jtreg/vmTestbase/vm/runtime/defmeth/shared/BuildJar.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/vm/runtime/defmeth/shared/BuildJar.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, 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
@@ -41,13 +41,14 @@
*/
public class BuildJar {
public static void main(String[] args) {
- Path manifest = testRoot().resolve("vmTestbase")
- .resolve("vm")
- .resolve("runtime")
- .resolve("defmeth")
- .resolve("shared")
- .resolve("retransform.mf")
- .toAbsolutePath();
+ Path manifest = Paths.get(Utils.TEST_ROOT)
+ .resolve("vmTestbase")
+ .resolve("vm")
+ .resolve("runtime")
+ .resolve("defmeth")
+ .resolve("shared")
+ .resolve("retransform.mf")
+ .toAbsolutePath();
if (Files.notExists(manifest)) {
throw new Error("can't find manifest file: " + manifest);
}
@@ -90,13 +91,5 @@
}
throw new Error("can't find " + file + " in " + Utils.TEST_CLASS_PATH);
}
-
- private static Path testRoot() {
- Path p = Paths.get(Utils.TEST_SRC);
- while (!Files.exists(p.resolve("TEST.ROOT"))) {
- p = p.getParent();
- }
- return p;
- }
}
--- a/test/jaxp/TEST.ROOT Tue Feb 26 12:08:20 2019 -0500
+++ b/test/jaxp/TEST.ROOT Tue Feb 26 12:11:29 2019 -0500
@@ -23,7 +23,7 @@
groups=TEST.groups
# Minimum jtreg version
-requiredVersion=4.2 b13
+requiredVersion=4.2 b14
# Path to libraries in the topmost test directory. This is needed so @library
# does not need ../../ notation to reach them
--- a/test/jdk/ProblemList-Xcomp.txt Tue Feb 26 12:08:20 2019 -0500
+++ b/test/jdk/ProblemList-Xcomp.txt Tue Feb 26 12:11:29 2019 -0500
@@ -28,5 +28,4 @@
#############################################################################
java/lang/invoke/MethodHandles/CatchExceptionTest.java 8146623 generic-all
-java/util/concurrent/CountDownLatch/Basic.java 8195057 generic-all
java/util/stream/test/org/openjdk/tests/java/util/stream/StreamLinkTest.java 8216317 solaris-all
--- a/test/jdk/ProblemList.txt Tue Feb 26 12:08:20 2019 -0500
+++ b/test/jdk/ProblemList.txt Tue Feb 26 12:11:29 2019 -0500
@@ -868,3 +868,4 @@
# jdk_jfr
jdk/jfr/event/io/TestInstrumentation.java 8202142 generic-all
+jdk/jfr/api/recording/event/TestPeriod.java 8215890 generic-all
--- a/test/jdk/TEST.ROOT Tue Feb 26 12:08:20 2019 -0500
+++ b/test/jdk/TEST.ROOT Tue Feb 26 12:11:29 2019 -0500
@@ -49,7 +49,7 @@
release.implementor
# Minimum jtreg version
-requiredVersion=4.2 b13
+requiredVersion=4.2 b14
# Path to libraries in the topmost test directory. This is needed so @library
# does not need ../../ notation to reach them
@@ -60,3 +60,6 @@
# Use --patch-module instead of -Xmodule:
useNewPatchModule=true
+
+# disabled till JDK-8219408 is fixed
+allowSmartActionArgs=false
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/com/sun/jdi/JdbStopThreadidTest.java Tue Feb 26 12:11:29 2019 -0500
@@ -0,0 +1,143 @@
+/*
+ * Copyright (c) 2019, 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 8219143
+ * @summary Tests that using the "stop in" threadid option will properly cause the
+ * breakpoint to only be triggered when hit in the specified thread.
+ *
+ * @library /test/lib
+ * @run compile -g JdbStopThreadidTest.java
+ * @run main/othervm JdbStopThreadidTest
+ */
+
+import lib.jdb.Jdb;
+import lib.jdb.JdbCommand;
+import lib.jdb.JdbTest;
+
+import java.util.regex.*;
+
+class JdbStopThreadidTestTarg {
+ static Object lockObj = new Object();
+
+ public static void main(String[] args) {
+ test();
+ }
+
+ private static void test() {
+ JdbStopThreadidTestTarg test = new JdbStopThreadidTestTarg();
+ MyThread myThread1 = test.new MyThread("MYTHREAD-1");
+ MyThread myThread2 = test.new MyThread("MYTHREAD-2");
+ MyThread myThread3 = test.new MyThread("MYTHREAD-3");
+
+ synchronized (lockObj) {
+ myThread1.start();
+ myThread2.start();
+ myThread3.start();
+ // Wait for all threads to have started. Note they all block on lockObj after starting.
+ while (!myThread1.started || !myThread2.started || !myThread3.started) {
+ try {
+ Thread.sleep(50);
+ } catch (InterruptedException e) {
+ }
+ }
+ // Stop here so the test can setup the breakpoint in MYTHREAD-2
+ brkMethod();
+ }
+
+ // Wait for all threads to finish before exiting
+ try {
+ myThread1.join();
+ myThread2.join();
+ myThread3.join();
+ } catch (InterruptedException e) {
+ }
+ }
+
+ static void brkMethod() {
+ }
+
+ public static void print(Object obj) {
+ System.out.println(obj);
+ }
+
+ class MyThread extends Thread {
+ volatile boolean started = false;
+
+ public MyThread(String name) {
+ super(name);
+ }
+
+ public void run() {
+ started = true;
+ synchronized (JdbStopThreadidTestTarg.lockObj) {
+ }
+ brkMethod();
+ }
+
+ void brkMethod() {
+ }
+ }
+}
+
+public class JdbStopThreadidTest extends JdbTest {
+ public static void main(String argv[]) {
+ new JdbStopThreadidTest().run();
+ }
+
+ private JdbStopThreadidTest() {
+ super(DEBUGGEE_CLASS);
+ }
+
+ private static final String DEBUGGEE_CLASS = JdbStopThreadidTestTarg.class.getName();
+ private static final String DEBUGGEE_THREAD_CLASS = JdbStopThreadidTestTarg.class.getName() + "$MyThread";
+ private static Pattern threadidPattern = Pattern.compile("MyThread\\)(\\S+)\\s+MYTHREAD-2");
+
+ @Override
+ protected void runCases() {
+ jdb.command(JdbCommand.stopIn(DEBUGGEE_CLASS, "brkMethod"));
+ jdb.command(JdbCommand.run().waitForPrompt("Breakpoint hit: \"thread=main\"", true));
+ jdb.command(JdbCommand.threads());
+
+ // Find the threadid for MYTHREAD-2 in the "threads" command output
+ String output = jdb.getJdbOutput();
+ Matcher m = threadidPattern.matcher(output);
+ String threadid = null;
+ if (m.find()) {
+ threadid = m.group(1);
+ } else {
+ throw new RuntimeException("FAILED: Did not match threadid pattern.");
+ }
+
+ // Setup a breakpoint in MYTHREAD-2.
+ jdb.command(JdbCommand.stopInThreadid(DEBUGGEE_THREAD_CLASS, "brkMethod", threadid));
+
+ // Continue until MYTHREAD-2 breakpoint is hit. If we hit any other breakpoint before
+ // then (we aren't suppose to), then this test will fail.
+ jdb.command(JdbCommand.cont().waitForPrompt("Breakpoint hit: \"thread=MYTHREAD-2\", \\S+MyThread.brkMethod", true));
+ // Continue until the application exits. Once again, hitting a breakpoint will cause
+ // a failure because we are not suppose to hit one.
+ jdb.command(JdbCommand.cont().waitForPrompt(Jdb.APPLICATION_EXIT, true));
+ }
+}
--- a/test/jdk/com/sun/jdi/lib/jdb/JdbCommand.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/jdk/com/sun/jdi/lib/jdb/JdbCommand.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2019, 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
@@ -162,6 +162,9 @@
public static JdbCommand stopIn(String targetClass, String methodName) {
return new JdbCommand("stop in " + targetClass + "." + methodName);
}
+ public static JdbCommand stopInThreadid(String targetClass, String methodName, String threadid) {
+ return new JdbCommand("stop " + threadid + " in " + targetClass + "." + methodName);
+ }
public static JdbCommand thread(int threadNumber) {
return new JdbCommand("thread " + threadNumber);
}
@@ -226,6 +229,10 @@
return new JdbCommand("methods " + classId);
}
+ public static JdbCommand threads() {
+ return new JdbCommand("threads");
+ }
+
// trace [go] methods [thread]
// -- trace method entries and exits.
// -- All threads are suspended unless 'go' is specified
--- a/test/jdk/java/lang/constant/ClassDescTest.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/jdk/java/lang/constant/ClassDescTest.java Tue Feb 26 12:11:29 2019 -0500
@@ -176,6 +176,12 @@
} catch (IllegalArgumentException e) {
// good
}
+ try {
+ cr.arrayType(0);
+ fail("");
+ } catch (IllegalArgumentException e) {
+ // good
+ }
}
public void testArrayClassDesc() throws ReflectiveOperationException {
--- a/test/jdk/java/lang/instrument/NamedBuffer.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/jdk/java/lang/instrument/NamedBuffer.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2019, 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
@@ -64,7 +64,7 @@
public static byte[]
loadBufferFromStream(InputStream stream)
throws IOException
- {
+ {
// hack for now, just assume the stream will fit in our reasonable size buffer.
// if not, panic
int bufferLimit = 200 * 1024;
@@ -83,5 +83,60 @@
0,
actualSize);
return resultBuffer;
+ }
+
+ static final String DEST = System.getProperty("test.classes");
+ static final boolean VERBOSE = false;
+
+ static boolean checkMatch(byte[] buf, byte[] name, int begIdx) {
+ if (buf.length < name.length + begIdx) {
+ return false;
}
+ for (int i = 0; i < name.length; i++) {
+ if (buf[i + begIdx] != name[i]) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ // This function reads a class file from disk and replaces the first character of
+ // the name with the one passed as "replace". Then goes through the bytecodes to
+ // replace all instances of the name of the class with the new name. The
+ // redefinition tests use this to redefine Host$ classes with precompiled class files
+ // Xost.java, Yost.java and Zost.java.
+ static byte[]
+ bytesForHostClass(char replace, String className) throws Throwable {
+ String tail = className.substring(1);
+ String origClassName = "" + replace + tail;
+ File clsfile = new File(DEST + "/" + origClassName + ".class");
+
+ if (VERBOSE) {
+ System.out.println(" Reading bytes from " + clsfile);
+ }
+ byte[] buf = null;
+ try (FileInputStream str = new FileInputStream(clsfile)) {
+ buf = loadBufferFromStream(str);
+ }
+
+ boolean found = false;
+ int dollarSignIdx = className.indexOf('$');
+ int ptrnLen = (dollarSignIdx == -1) ? className.length() : dollarSignIdx;
+ byte[] ptrnBytes = origClassName.substring(0, ptrnLen).getBytes();
+ byte firstByte = className.getBytes()[0];
+
+ for (int i = 0; i < buf.length - ptrnLen; i++) {
+ if (checkMatch(buf, ptrnBytes, i)) {
+ if (VERBOSE) {
+ System.out.println("Appear to have found " + origClassName + " starting at " + i);
+ }
+ buf[i] = firstByte;
+ found = true;
+ }
+ }
+ if (!found) {
+ throw new Error("Could not locate '" + ptrnBytes + "' name in byte array");
+ }
+ return buf;
+ }
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/lang/instrument/RedefineAddDeleteMethod/DeleteMethodHandle/MethodHandleDeletedMethod.java Tue Feb 26 12:11:29 2019 -0500
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2019, 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 8181171
+ * @summary Break ResolvedMethodTable with redefined nest class.
+ * @library /test/lib
+ * @modules java.base/jdk.internal.misc
+ * @modules java.compiler
+ * java.instrument
+ * jdk.jartool/sun.tools.jar
+ * @compile ../../NamedBuffer.java
+ * @compile redef/Xost.java
+ * @run main RedefineClassHelper
+ * @run main/othervm -javaagent:redefineagent.jar -Xlog:redefine+class+update*=debug,membername+table=debug MethodHandleDeletedMethod
+ */
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.lang.invoke.*;
+
+class Host {
+ static MethodHandle fooMH;
+
+ static class A {
+ private static void foo() { System.out.println("OLD foo called"); }
+ }
+ static void bar() throws NoSuchMethodError {
+ A.foo();
+ }
+ static void barMH() throws Throwable {
+ fooMH.invokeExact();
+ }
+
+ public static void reresolve() throws Throwable {
+ fooMH = MethodHandles.lookup().findStatic(A.class, "foo", MethodType.methodType(void.class));
+ }
+
+ static {
+ try {
+ fooMH = MethodHandles.lookup().findStatic(A.class, "foo", MethodType.methodType(void.class));
+ } catch (ReflectiveOperationException ex) {
+ }
+ }
+}
+
+public class MethodHandleDeletedMethod {
+
+ static final String DEST = System.getProperty("test.classes");
+ static final boolean VERBOSE = false;
+
+ private static byte[] bytesForHostClass(char replace) throws Throwable {
+ return NamedBuffer.bytesForHostClass(replace, "Host$A");
+ }
+
+ public static void main(java.lang.String[] unused) throws Throwable {
+ Host h = new Host();
+ h.bar();
+ h.barMH();
+ byte[] buf = bytesForHostClass('X');
+ RedefineClassHelper.redefineClass(Host.A.class, buf);
+ try {
+ h.bar(); // call deleted Method directly
+ throw new RuntimeException("Failed, expected NSME");
+ } catch (NoSuchMethodError nsme) {
+ System.out.println("Received expected NSME");
+ }
+ try {
+ h.barMH(); // call through MethodHandle for deleted Method
+ throw new RuntimeException("Failed, expected NSME");
+ } catch (NoSuchMethodError nsme) {
+ System.out.println("Received expected NSME");
+ }
+ System.out.println("Passed.");
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/lang/instrument/RedefineAddDeleteMethod/DeleteMethodHandle/redef/Xost.java Tue Feb 26 12:11:29 2019 -0500
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2019, 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.
+ */
+
+public class Xost {
+ // Remove static private methods, in A in redefinition.
+ static class A { }
+ // Removed public method to get this to compile, but we don't
+ // try to redefine Host.
+}
--- a/test/jdk/java/nio/Buffer/Basic-X.java.template Tue Feb 26 12:08:20 2019 -0500
+++ b/test/jdk/java/nio/Buffer/Basic-X.java.template Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, 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
@@ -87,6 +87,18 @@
}
}
+ private static void absBulkGet($Type$Buffer b) {
+ int n = b.capacity();
+ int len = n - 7*2;
+ $type$[] a = new $type$[n + 7];
+ b.position(42);
+ b.get(7, a, 7, len);
+ ck(b, b.position() == 42);
+ for (int i = 0; i < len; i++) {
+ ck(b, (long)a[i + 7], (long)(($type$)ic(i)));
+ }
+ }
+
private static void relPut($Type$Buffer b) {
int n = b.capacity();
b.clear();
@@ -136,6 +148,20 @@
}
}
+ private static void absBulkPutArray($Type$Buffer b) {
+ int n = b.capacity();
+ b.clear();
+ int lim = n - 7;
+ int len = lim - 7;
+ b.limit(lim);
+ $type$[] a = new $type$[len + 7];
+ for (int i = 0; i < len; i++)
+ a[i + 7] = ($type$)ic(i);
+ b.position(42);
+ b.put(7, a, 7, len);
+ ck(b, b.position() == 42);
+ }
+
//6231529
private static void callReset($Type$Buffer b) {
b.position(0);
@@ -452,6 +478,10 @@
fail(problem + String.format(": x=%s y=%s", x, y), xb, yb);
}
+ private static void catchNullArgument(Buffer b, Runnable thunk) {
+ tryCatch(b, NullPointerException.class, thunk);
+ }
+
private static void catchIllegalArgument(Buffer b, Runnable thunk) {
tryCatch(b, IllegalArgumentException.class, thunk);
}
@@ -476,7 +506,10 @@
if (ex.isAssignableFrom(x.getClass())) {
caught = true;
} else {
- fail(x.getMessage() + " not expected");
+ String s = x.getMessage();
+ if (s == null)
+ s = x.getClass().getName();
+ fail(s + " not expected");
}
}
if (!caught) {
@@ -513,6 +546,9 @@
bulkPutBuffer(b);
relGet(b);
+ absBulkPutArray(b);
+ absBulkGet(b);
+
#if[char]
bulkPutString(b);
@@ -612,6 +648,26 @@
}
}
+ // Exceptions in absolute bulk operations
+
+ catchNullArgument(b, () -> b.get(7, null, 0, 42));
+ catchNullArgument(b, () -> b.put(7, ($type$[])null, 0, 42));
+
+ $type$[] tmpa = new $type$[42];
+ catchIndexOutOfBounds(b, () -> b.get(7, tmpa, -1, 42));
+ catchIndexOutOfBounds(b, () -> b.get(7, tmpa, 42, 1));
+ catchIndexOutOfBounds(b, () -> b.get(7, tmpa, 41, -1));
+ catchIndexOutOfBounds(b, () -> b.get(-1, tmpa, 0, 1));
+ catchIndexOutOfBounds(b, () -> b.get(b.limit(), tmpa, 0, 1));
+ catchIndexOutOfBounds(b, () -> b.get(b.limit() - 41, tmpa, 0, 42));
+
+ catchIndexOutOfBounds(b, () -> b.put(7, tmpa, -1, 42));
+ catchIndexOutOfBounds(b, () -> b.put(7, tmpa, 42, 1));
+ catchIndexOutOfBounds(b, () -> b.put(7, tmpa, 41, -1));
+ catchIndexOutOfBounds(b, () -> b.put(-1, tmpa, 0, 1));
+ catchIndexOutOfBounds(b, () -> b.put(b.limit(), tmpa, 0, 1));
+ catchIndexOutOfBounds(b, () -> b.put(b.limit() - 41, tmpa, 0, 42));
+
// Values
b.clear();
@@ -819,6 +875,7 @@
catchReadOnlyBuffer(b, () -> absPut(rb));
catchReadOnlyBuffer(b, () -> bulkPutArray(rb));
catchReadOnlyBuffer(b, () -> bulkPutBuffer(rb));
+ catchReadOnlyBuffer(b, () -> absBulkPutArray(rb));
// put($Type$Buffer) should not change source position
final $Type$Buffer src = $Type$Buffer.allocate(1);
@@ -903,6 +960,13 @@
b.position(6);
ck(b, b.subSequence(0,3).toString().equals("ghi"));
+ // absolute bulk get
+ char[] c = new char[end + 1 - (start - 1) + 1]; // [start - 1, end + 1]
+ b.limit(end + 2);
+ b.get(start - 1, c, 0, c.length);
+ for (int i = 0; i < c.length; i++)
+ ck(b, c[i], s.charAt(start - 1 + i));
+
// The index, relative to the position, must be non-negative and
// smaller than remaining().
catchIndexOutOfBounds(b, () -> b.charAt(-1));
--- a/test/jdk/java/nio/Buffer/Basic.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/jdk/java/nio/Buffer/Basic.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, 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
@@ -24,9 +24,9 @@
/* @test
* @summary Unit test for buffers
* @bug 4413135 4414911 4416536 4416562 4418782 4471053 4472779 4490253 4523725
- * 4526177 4463011 4660660 4661219 4663521 4782970 4804304 4938424 6231529
- * 6221101 6234263 6535542 6591971 6593946 6795561 7190219 7199551 8065556
- * 8149469
+ * 4526177 4463011 4660660 4661219 4663521 4782970 4804304 4938424 5029431
+ * 6231529 6221101 6234263 6535542 6591971 6593946 6795561 7190219 7199551
+ * 8065556 8149469
* @modules java.base/java.nio:open
* java.base/jdk.internal.misc
* @author Mark Reinhold
--- a/test/jdk/java/nio/Buffer/BasicByte.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/jdk/java/nio/Buffer/BasicByte.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, 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
@@ -87,6 +87,18 @@
}
}
+ private static void absBulkGet(ByteBuffer b) {
+ int n = b.capacity();
+ int len = n - 7*2;
+ byte[] a = new byte[n + 7];
+ b.position(42);
+ b.get(7, a, 7, len);
+ ck(b, b.position() == 42);
+ for (int i = 0; i < len; i++) {
+ ck(b, (long)a[i + 7], (long)((byte)ic(i)));
+ }
+ }
+
private static void relPut(ByteBuffer b) {
int n = b.capacity();
b.clear();
@@ -136,6 +148,20 @@
}
}
+ private static void absBulkPutArray(ByteBuffer b) {
+ int n = b.capacity();
+ b.clear();
+ int lim = n - 7;
+ int len = lim - 7;
+ b.limit(lim);
+ byte[] a = new byte[len + 7];
+ for (int i = 0; i < len; i++)
+ a[i + 7] = (byte)ic(i);
+ b.position(42);
+ b.put(7, a, 7, len);
+ ck(b, b.position() == 42);
+ }
+
//6231529
private static void callReset(ByteBuffer b) {
b.position(0);
@@ -452,6 +478,10 @@
fail(problem + String.format(": x=%s y=%s", x, y), xb, yb);
}
+ private static void catchNullArgument(Buffer b, Runnable thunk) {
+ tryCatch(b, NullPointerException.class, thunk);
+ }
+
private static void catchIllegalArgument(Buffer b, Runnable thunk) {
tryCatch(b, IllegalArgumentException.class, thunk);
}
@@ -476,7 +506,10 @@
if (ex.isAssignableFrom(x.getClass())) {
caught = true;
} else {
- fail(x.getMessage() + " not expected");
+ String s = x.getMessage();
+ if (s == null)
+ s = x.getClass().getName();
+ fail(s + " not expected");
}
}
if (!caught) {
@@ -513,6 +546,9 @@
bulkPutBuffer(b);
relGet(b);
+ absBulkPutArray(b);
+ absBulkGet(b);
+
@@ -612,6 +648,26 @@
}
}
+ // Exceptions in absolute bulk operations
+
+ catchNullArgument(b, () -> b.get(7, null, 0, 42));
+ catchNullArgument(b, () -> b.put(7, (byte[])null, 0, 42));
+
+ byte[] tmpa = new byte[42];
+ catchIndexOutOfBounds(b, () -> b.get(7, tmpa, -1, 42));
+ catchIndexOutOfBounds(b, () -> b.get(7, tmpa, 42, 1));
+ catchIndexOutOfBounds(b, () -> b.get(7, tmpa, 41, -1));
+ catchIndexOutOfBounds(b, () -> b.get(-1, tmpa, 0, 1));
+ catchIndexOutOfBounds(b, () -> b.get(b.limit(), tmpa, 0, 1));
+ catchIndexOutOfBounds(b, () -> b.get(b.limit() - 41, tmpa, 0, 42));
+
+ catchIndexOutOfBounds(b, () -> b.put(7, tmpa, -1, 42));
+ catchIndexOutOfBounds(b, () -> b.put(7, tmpa, 42, 1));
+ catchIndexOutOfBounds(b, () -> b.put(7, tmpa, 41, -1));
+ catchIndexOutOfBounds(b, () -> b.put(-1, tmpa, 0, 1));
+ catchIndexOutOfBounds(b, () -> b.put(b.limit(), tmpa, 0, 1));
+ catchIndexOutOfBounds(b, () -> b.put(b.limit() - 41, tmpa, 0, 42));
+
// Values
b.clear();
@@ -819,6 +875,7 @@
catchReadOnlyBuffer(b, () -> absPut(rb));
catchReadOnlyBuffer(b, () -> bulkPutArray(rb));
catchReadOnlyBuffer(b, () -> bulkPutBuffer(rb));
+ catchReadOnlyBuffer(b, () -> absBulkPutArray(rb));
// put(ByteBuffer) should not change source position
final ByteBuffer src = ByteBuffer.allocate(1);
@@ -928,6 +985,13 @@
+
+
+
+
+
+
+
public static void test(final byte [] ba) {
int offset = 47;
int length = 900;
--- a/test/jdk/java/nio/Buffer/BasicChar.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/jdk/java/nio/Buffer/BasicChar.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, 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
@@ -87,6 +87,18 @@
}
}
+ private static void absBulkGet(CharBuffer b) {
+ int n = b.capacity();
+ int len = n - 7*2;
+ char[] a = new char[n + 7];
+ b.position(42);
+ b.get(7, a, 7, len);
+ ck(b, b.position() == 42);
+ for (int i = 0; i < len; i++) {
+ ck(b, (long)a[i + 7], (long)((char)ic(i)));
+ }
+ }
+
private static void relPut(CharBuffer b) {
int n = b.capacity();
b.clear();
@@ -136,6 +148,20 @@
}
}
+ private static void absBulkPutArray(CharBuffer b) {
+ int n = b.capacity();
+ b.clear();
+ int lim = n - 7;
+ int len = lim - 7;
+ b.limit(lim);
+ char[] a = new char[len + 7];
+ for (int i = 0; i < len; i++)
+ a[i + 7] = (char)ic(i);
+ b.position(42);
+ b.put(7, a, 7, len);
+ ck(b, b.position() == 42);
+ }
+
//6231529
private static void callReset(CharBuffer b) {
b.position(0);
@@ -452,6 +478,10 @@
fail(problem + String.format(": x=%s y=%s", x, y), xb, yb);
}
+ private static void catchNullArgument(Buffer b, Runnable thunk) {
+ tryCatch(b, NullPointerException.class, thunk);
+ }
+
private static void catchIllegalArgument(Buffer b, Runnable thunk) {
tryCatch(b, IllegalArgumentException.class, thunk);
}
@@ -476,7 +506,10 @@
if (ex.isAssignableFrom(x.getClass())) {
caught = true;
} else {
- fail(x.getMessage() + " not expected");
+ String s = x.getMessage();
+ if (s == null)
+ s = x.getClass().getName();
+ fail(s + " not expected");
}
}
if (!caught) {
@@ -513,6 +546,9 @@
bulkPutBuffer(b);
relGet(b);
+ absBulkPutArray(b);
+ absBulkGet(b);
+
bulkPutString(b);
@@ -612,6 +648,26 @@
}
}
+ // Exceptions in absolute bulk operations
+
+ catchNullArgument(b, () -> b.get(7, null, 0, 42));
+ catchNullArgument(b, () -> b.put(7, (char[])null, 0, 42));
+
+ char[] tmpa = new char[42];
+ catchIndexOutOfBounds(b, () -> b.get(7, tmpa, -1, 42));
+ catchIndexOutOfBounds(b, () -> b.get(7, tmpa, 42, 1));
+ catchIndexOutOfBounds(b, () -> b.get(7, tmpa, 41, -1));
+ catchIndexOutOfBounds(b, () -> b.get(-1, tmpa, 0, 1));
+ catchIndexOutOfBounds(b, () -> b.get(b.limit(), tmpa, 0, 1));
+ catchIndexOutOfBounds(b, () -> b.get(b.limit() - 41, tmpa, 0, 42));
+
+ catchIndexOutOfBounds(b, () -> b.put(7, tmpa, -1, 42));
+ catchIndexOutOfBounds(b, () -> b.put(7, tmpa, 42, 1));
+ catchIndexOutOfBounds(b, () -> b.put(7, tmpa, 41, -1));
+ catchIndexOutOfBounds(b, () -> b.put(-1, tmpa, 0, 1));
+ catchIndexOutOfBounds(b, () -> b.put(b.limit(), tmpa, 0, 1));
+ catchIndexOutOfBounds(b, () -> b.put(b.limit() - 41, tmpa, 0, 42));
+
// Values
b.clear();
@@ -819,6 +875,7 @@
catchReadOnlyBuffer(b, () -> absPut(rb));
catchReadOnlyBuffer(b, () -> bulkPutArray(rb));
catchReadOnlyBuffer(b, () -> bulkPutBuffer(rb));
+ catchReadOnlyBuffer(b, () -> absBulkPutArray(rb));
// put(CharBuffer) should not change source position
final CharBuffer src = CharBuffer.allocate(1);
@@ -903,6 +960,13 @@
b.position(6);
ck(b, b.subSequence(0,3).toString().equals("ghi"));
+ // absolute bulk get
+ char[] c = new char[end + 1 - (start - 1) + 1]; // [start - 1, end + 1]
+ b.limit(end + 2);
+ b.get(start - 1, c, 0, c.length);
+ for (int i = 0; i < c.length; i++)
+ ck(b, c[i], s.charAt(start - 1 + i));
+
// The index, relative to the position, must be non-negative and
// smaller than remaining().
catchIndexOutOfBounds(b, () -> b.charAt(-1));
--- a/test/jdk/java/nio/Buffer/BasicDouble.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/jdk/java/nio/Buffer/BasicDouble.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, 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
@@ -87,6 +87,18 @@
}
}
+ private static void absBulkGet(DoubleBuffer b) {
+ int n = b.capacity();
+ int len = n - 7*2;
+ double[] a = new double[n + 7];
+ b.position(42);
+ b.get(7, a, 7, len);
+ ck(b, b.position() == 42);
+ for (int i = 0; i < len; i++) {
+ ck(b, (long)a[i + 7], (long)((double)ic(i)));
+ }
+ }
+
private static void relPut(DoubleBuffer b) {
int n = b.capacity();
b.clear();
@@ -136,6 +148,20 @@
}
}
+ private static void absBulkPutArray(DoubleBuffer b) {
+ int n = b.capacity();
+ b.clear();
+ int lim = n - 7;
+ int len = lim - 7;
+ b.limit(lim);
+ double[] a = new double[len + 7];
+ for (int i = 0; i < len; i++)
+ a[i + 7] = (double)ic(i);
+ b.position(42);
+ b.put(7, a, 7, len);
+ ck(b, b.position() == 42);
+ }
+
//6231529
private static void callReset(DoubleBuffer b) {
b.position(0);
@@ -452,6 +478,10 @@
fail(problem + String.format(": x=%s y=%s", x, y), xb, yb);
}
+ private static void catchNullArgument(Buffer b, Runnable thunk) {
+ tryCatch(b, NullPointerException.class, thunk);
+ }
+
private static void catchIllegalArgument(Buffer b, Runnable thunk) {
tryCatch(b, IllegalArgumentException.class, thunk);
}
@@ -476,7 +506,10 @@
if (ex.isAssignableFrom(x.getClass())) {
caught = true;
} else {
- fail(x.getMessage() + " not expected");
+ String s = x.getMessage();
+ if (s == null)
+ s = x.getClass().getName();
+ fail(s + " not expected");
}
}
if (!caught) {
@@ -513,6 +546,9 @@
bulkPutBuffer(b);
relGet(b);
+ absBulkPutArray(b);
+ absBulkGet(b);
+
@@ -612,6 +648,26 @@
}
}
+ // Exceptions in absolute bulk operations
+
+ catchNullArgument(b, () -> b.get(7, null, 0, 42));
+ catchNullArgument(b, () -> b.put(7, (double[])null, 0, 42));
+
+ double[] tmpa = new double[42];
+ catchIndexOutOfBounds(b, () -> b.get(7, tmpa, -1, 42));
+ catchIndexOutOfBounds(b, () -> b.get(7, tmpa, 42, 1));
+ catchIndexOutOfBounds(b, () -> b.get(7, tmpa, 41, -1));
+ catchIndexOutOfBounds(b, () -> b.get(-1, tmpa, 0, 1));
+ catchIndexOutOfBounds(b, () -> b.get(b.limit(), tmpa, 0, 1));
+ catchIndexOutOfBounds(b, () -> b.get(b.limit() - 41, tmpa, 0, 42));
+
+ catchIndexOutOfBounds(b, () -> b.put(7, tmpa, -1, 42));
+ catchIndexOutOfBounds(b, () -> b.put(7, tmpa, 42, 1));
+ catchIndexOutOfBounds(b, () -> b.put(7, tmpa, 41, -1));
+ catchIndexOutOfBounds(b, () -> b.put(-1, tmpa, 0, 1));
+ catchIndexOutOfBounds(b, () -> b.put(b.limit(), tmpa, 0, 1));
+ catchIndexOutOfBounds(b, () -> b.put(b.limit() - 41, tmpa, 0, 42));
+
// Values
b.clear();
@@ -819,6 +875,7 @@
catchReadOnlyBuffer(b, () -> absPut(rb));
catchReadOnlyBuffer(b, () -> bulkPutArray(rb));
catchReadOnlyBuffer(b, () -> bulkPutBuffer(rb));
+ catchReadOnlyBuffer(b, () -> absBulkPutArray(rb));
// put(DoubleBuffer) should not change source position
final DoubleBuffer src = DoubleBuffer.allocate(1);
@@ -928,6 +985,13 @@
+
+
+
+
+
+
+
public static void test(final double [] ba) {
int offset = 47;
int length = 900;
--- a/test/jdk/java/nio/Buffer/BasicFloat.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/jdk/java/nio/Buffer/BasicFloat.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, 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
@@ -87,6 +87,18 @@
}
}
+ private static void absBulkGet(FloatBuffer b) {
+ int n = b.capacity();
+ int len = n - 7*2;
+ float[] a = new float[n + 7];
+ b.position(42);
+ b.get(7, a, 7, len);
+ ck(b, b.position() == 42);
+ for (int i = 0; i < len; i++) {
+ ck(b, (long)a[i + 7], (long)((float)ic(i)));
+ }
+ }
+
private static void relPut(FloatBuffer b) {
int n = b.capacity();
b.clear();
@@ -136,6 +148,20 @@
}
}
+ private static void absBulkPutArray(FloatBuffer b) {
+ int n = b.capacity();
+ b.clear();
+ int lim = n - 7;
+ int len = lim - 7;
+ b.limit(lim);
+ float[] a = new float[len + 7];
+ for (int i = 0; i < len; i++)
+ a[i + 7] = (float)ic(i);
+ b.position(42);
+ b.put(7, a, 7, len);
+ ck(b, b.position() == 42);
+ }
+
//6231529
private static void callReset(FloatBuffer b) {
b.position(0);
@@ -452,6 +478,10 @@
fail(problem + String.format(": x=%s y=%s", x, y), xb, yb);
}
+ private static void catchNullArgument(Buffer b, Runnable thunk) {
+ tryCatch(b, NullPointerException.class, thunk);
+ }
+
private static void catchIllegalArgument(Buffer b, Runnable thunk) {
tryCatch(b, IllegalArgumentException.class, thunk);
}
@@ -476,7 +506,10 @@
if (ex.isAssignableFrom(x.getClass())) {
caught = true;
} else {
- fail(x.getMessage() + " not expected");
+ String s = x.getMessage();
+ if (s == null)
+ s = x.getClass().getName();
+ fail(s + " not expected");
}
}
if (!caught) {
@@ -513,6 +546,9 @@
bulkPutBuffer(b);
relGet(b);
+ absBulkPutArray(b);
+ absBulkGet(b);
+
@@ -612,6 +648,26 @@
}
}
+ // Exceptions in absolute bulk operations
+
+ catchNullArgument(b, () -> b.get(7, null, 0, 42));
+ catchNullArgument(b, () -> b.put(7, (float[])null, 0, 42));
+
+ float[] tmpa = new float[42];
+ catchIndexOutOfBounds(b, () -> b.get(7, tmpa, -1, 42));
+ catchIndexOutOfBounds(b, () -> b.get(7, tmpa, 42, 1));
+ catchIndexOutOfBounds(b, () -> b.get(7, tmpa, 41, -1));
+ catchIndexOutOfBounds(b, () -> b.get(-1, tmpa, 0, 1));
+ catchIndexOutOfBounds(b, () -> b.get(b.limit(), tmpa, 0, 1));
+ catchIndexOutOfBounds(b, () -> b.get(b.limit() - 41, tmpa, 0, 42));
+
+ catchIndexOutOfBounds(b, () -> b.put(7, tmpa, -1, 42));
+ catchIndexOutOfBounds(b, () -> b.put(7, tmpa, 42, 1));
+ catchIndexOutOfBounds(b, () -> b.put(7, tmpa, 41, -1));
+ catchIndexOutOfBounds(b, () -> b.put(-1, tmpa, 0, 1));
+ catchIndexOutOfBounds(b, () -> b.put(b.limit(), tmpa, 0, 1));
+ catchIndexOutOfBounds(b, () -> b.put(b.limit() - 41, tmpa, 0, 42));
+
// Values
b.clear();
@@ -819,6 +875,7 @@
catchReadOnlyBuffer(b, () -> absPut(rb));
catchReadOnlyBuffer(b, () -> bulkPutArray(rb));
catchReadOnlyBuffer(b, () -> bulkPutBuffer(rb));
+ catchReadOnlyBuffer(b, () -> absBulkPutArray(rb));
// put(FloatBuffer) should not change source position
final FloatBuffer src = FloatBuffer.allocate(1);
@@ -928,6 +985,13 @@
+
+
+
+
+
+
+
public static void test(final float [] ba) {
int offset = 47;
int length = 900;
--- a/test/jdk/java/nio/Buffer/BasicInt.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/jdk/java/nio/Buffer/BasicInt.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, 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
@@ -87,6 +87,18 @@
}
}
+ private static void absBulkGet(IntBuffer b) {
+ int n = b.capacity();
+ int len = n - 7*2;
+ int[] a = new int[n + 7];
+ b.position(42);
+ b.get(7, a, 7, len);
+ ck(b, b.position() == 42);
+ for (int i = 0; i < len; i++) {
+ ck(b, (long)a[i + 7], (long)((int)ic(i)));
+ }
+ }
+
private static void relPut(IntBuffer b) {
int n = b.capacity();
b.clear();
@@ -136,6 +148,20 @@
}
}
+ private static void absBulkPutArray(IntBuffer b) {
+ int n = b.capacity();
+ b.clear();
+ int lim = n - 7;
+ int len = lim - 7;
+ b.limit(lim);
+ int[] a = new int[len + 7];
+ for (int i = 0; i < len; i++)
+ a[i + 7] = (int)ic(i);
+ b.position(42);
+ b.put(7, a, 7, len);
+ ck(b, b.position() == 42);
+ }
+
//6231529
private static void callReset(IntBuffer b) {
b.position(0);
@@ -452,6 +478,10 @@
fail(problem + String.format(": x=%s y=%s", x, y), xb, yb);
}
+ private static void catchNullArgument(Buffer b, Runnable thunk) {
+ tryCatch(b, NullPointerException.class, thunk);
+ }
+
private static void catchIllegalArgument(Buffer b, Runnable thunk) {
tryCatch(b, IllegalArgumentException.class, thunk);
}
@@ -476,7 +506,10 @@
if (ex.isAssignableFrom(x.getClass())) {
caught = true;
} else {
- fail(x.getMessage() + " not expected");
+ String s = x.getMessage();
+ if (s == null)
+ s = x.getClass().getName();
+ fail(s + " not expected");
}
}
if (!caught) {
@@ -513,6 +546,9 @@
bulkPutBuffer(b);
relGet(b);
+ absBulkPutArray(b);
+ absBulkGet(b);
+
@@ -612,6 +648,26 @@
}
}
+ // Exceptions in absolute bulk operations
+
+ catchNullArgument(b, () -> b.get(7, null, 0, 42));
+ catchNullArgument(b, () -> b.put(7, (int[])null, 0, 42));
+
+ int[] tmpa = new int[42];
+ catchIndexOutOfBounds(b, () -> b.get(7, tmpa, -1, 42));
+ catchIndexOutOfBounds(b, () -> b.get(7, tmpa, 42, 1));
+ catchIndexOutOfBounds(b, () -> b.get(7, tmpa, 41, -1));
+ catchIndexOutOfBounds(b, () -> b.get(-1, tmpa, 0, 1));
+ catchIndexOutOfBounds(b, () -> b.get(b.limit(), tmpa, 0, 1));
+ catchIndexOutOfBounds(b, () -> b.get(b.limit() - 41, tmpa, 0, 42));
+
+ catchIndexOutOfBounds(b, () -> b.put(7, tmpa, -1, 42));
+ catchIndexOutOfBounds(b, () -> b.put(7, tmpa, 42, 1));
+ catchIndexOutOfBounds(b, () -> b.put(7, tmpa, 41, -1));
+ catchIndexOutOfBounds(b, () -> b.put(-1, tmpa, 0, 1));
+ catchIndexOutOfBounds(b, () -> b.put(b.limit(), tmpa, 0, 1));
+ catchIndexOutOfBounds(b, () -> b.put(b.limit() - 41, tmpa, 0, 42));
+
// Values
b.clear();
@@ -819,6 +875,7 @@
catchReadOnlyBuffer(b, () -> absPut(rb));
catchReadOnlyBuffer(b, () -> bulkPutArray(rb));
catchReadOnlyBuffer(b, () -> bulkPutBuffer(rb));
+ catchReadOnlyBuffer(b, () -> absBulkPutArray(rb));
// put(IntBuffer) should not change source position
final IntBuffer src = IntBuffer.allocate(1);
@@ -928,6 +985,13 @@
+
+
+
+
+
+
+
public static void test(final int [] ba) {
int offset = 47;
int length = 900;
--- a/test/jdk/java/nio/Buffer/BasicLong.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/jdk/java/nio/Buffer/BasicLong.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, 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
@@ -87,6 +87,18 @@
}
}
+ private static void absBulkGet(LongBuffer b) {
+ int n = b.capacity();
+ int len = n - 7*2;
+ long[] a = new long[n + 7];
+ b.position(42);
+ b.get(7, a, 7, len);
+ ck(b, b.position() == 42);
+ for (int i = 0; i < len; i++) {
+ ck(b, (long)a[i + 7], (long)((long)ic(i)));
+ }
+ }
+
private static void relPut(LongBuffer b) {
int n = b.capacity();
b.clear();
@@ -136,6 +148,20 @@
}
}
+ private static void absBulkPutArray(LongBuffer b) {
+ int n = b.capacity();
+ b.clear();
+ int lim = n - 7;
+ int len = lim - 7;
+ b.limit(lim);
+ long[] a = new long[len + 7];
+ for (int i = 0; i < len; i++)
+ a[i + 7] = (long)ic(i);
+ b.position(42);
+ b.put(7, a, 7, len);
+ ck(b, b.position() == 42);
+ }
+
//6231529
private static void callReset(LongBuffer b) {
b.position(0);
@@ -452,6 +478,10 @@
fail(problem + String.format(": x=%s y=%s", x, y), xb, yb);
}
+ private static void catchNullArgument(Buffer b, Runnable thunk) {
+ tryCatch(b, NullPointerException.class, thunk);
+ }
+
private static void catchIllegalArgument(Buffer b, Runnable thunk) {
tryCatch(b, IllegalArgumentException.class, thunk);
}
@@ -476,7 +506,10 @@
if (ex.isAssignableFrom(x.getClass())) {
caught = true;
} else {
- fail(x.getMessage() + " not expected");
+ String s = x.getMessage();
+ if (s == null)
+ s = x.getClass().getName();
+ fail(s + " not expected");
}
}
if (!caught) {
@@ -513,6 +546,9 @@
bulkPutBuffer(b);
relGet(b);
+ absBulkPutArray(b);
+ absBulkGet(b);
+
@@ -612,6 +648,26 @@
}
}
+ // Exceptions in absolute bulk operations
+
+ catchNullArgument(b, () -> b.get(7, null, 0, 42));
+ catchNullArgument(b, () -> b.put(7, (long[])null, 0, 42));
+
+ long[] tmpa = new long[42];
+ catchIndexOutOfBounds(b, () -> b.get(7, tmpa, -1, 42));
+ catchIndexOutOfBounds(b, () -> b.get(7, tmpa, 42, 1));
+ catchIndexOutOfBounds(b, () -> b.get(7, tmpa, 41, -1));
+ catchIndexOutOfBounds(b, () -> b.get(-1, tmpa, 0, 1));
+ catchIndexOutOfBounds(b, () -> b.get(b.limit(), tmpa, 0, 1));
+ catchIndexOutOfBounds(b, () -> b.get(b.limit() - 41, tmpa, 0, 42));
+
+ catchIndexOutOfBounds(b, () -> b.put(7, tmpa, -1, 42));
+ catchIndexOutOfBounds(b, () -> b.put(7, tmpa, 42, 1));
+ catchIndexOutOfBounds(b, () -> b.put(7, tmpa, 41, -1));
+ catchIndexOutOfBounds(b, () -> b.put(-1, tmpa, 0, 1));
+ catchIndexOutOfBounds(b, () -> b.put(b.limit(), tmpa, 0, 1));
+ catchIndexOutOfBounds(b, () -> b.put(b.limit() - 41, tmpa, 0, 42));
+
// Values
b.clear();
@@ -819,6 +875,7 @@
catchReadOnlyBuffer(b, () -> absPut(rb));
catchReadOnlyBuffer(b, () -> bulkPutArray(rb));
catchReadOnlyBuffer(b, () -> bulkPutBuffer(rb));
+ catchReadOnlyBuffer(b, () -> absBulkPutArray(rb));
// put(LongBuffer) should not change source position
final LongBuffer src = LongBuffer.allocate(1);
@@ -928,6 +985,13 @@
+
+
+
+
+
+
+
public static void test(final long [] ba) {
int offset = 47;
int length = 900;
--- a/test/jdk/java/nio/Buffer/BasicShort.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/jdk/java/nio/Buffer/BasicShort.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, 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
@@ -87,6 +87,18 @@
}
}
+ private static void absBulkGet(ShortBuffer b) {
+ int n = b.capacity();
+ int len = n - 7*2;
+ short[] a = new short[n + 7];
+ b.position(42);
+ b.get(7, a, 7, len);
+ ck(b, b.position() == 42);
+ for (int i = 0; i < len; i++) {
+ ck(b, (long)a[i + 7], (long)((short)ic(i)));
+ }
+ }
+
private static void relPut(ShortBuffer b) {
int n = b.capacity();
b.clear();
@@ -136,6 +148,20 @@
}
}
+ private static void absBulkPutArray(ShortBuffer b) {
+ int n = b.capacity();
+ b.clear();
+ int lim = n - 7;
+ int len = lim - 7;
+ b.limit(lim);
+ short[] a = new short[len + 7];
+ for (int i = 0; i < len; i++)
+ a[i + 7] = (short)ic(i);
+ b.position(42);
+ b.put(7, a, 7, len);
+ ck(b, b.position() == 42);
+ }
+
//6231529
private static void callReset(ShortBuffer b) {
b.position(0);
@@ -452,6 +478,10 @@
fail(problem + String.format(": x=%s y=%s", x, y), xb, yb);
}
+ private static void catchNullArgument(Buffer b, Runnable thunk) {
+ tryCatch(b, NullPointerException.class, thunk);
+ }
+
private static void catchIllegalArgument(Buffer b, Runnable thunk) {
tryCatch(b, IllegalArgumentException.class, thunk);
}
@@ -476,7 +506,10 @@
if (ex.isAssignableFrom(x.getClass())) {
caught = true;
} else {
- fail(x.getMessage() + " not expected");
+ String s = x.getMessage();
+ if (s == null)
+ s = x.getClass().getName();
+ fail(s + " not expected");
}
}
if (!caught) {
@@ -513,6 +546,9 @@
bulkPutBuffer(b);
relGet(b);
+ absBulkPutArray(b);
+ absBulkGet(b);
+
@@ -612,6 +648,26 @@
}
}
+ // Exceptions in absolute bulk operations
+
+ catchNullArgument(b, () -> b.get(7, null, 0, 42));
+ catchNullArgument(b, () -> b.put(7, (short[])null, 0, 42));
+
+ short[] tmpa = new short[42];
+ catchIndexOutOfBounds(b, () -> b.get(7, tmpa, -1, 42));
+ catchIndexOutOfBounds(b, () -> b.get(7, tmpa, 42, 1));
+ catchIndexOutOfBounds(b, () -> b.get(7, tmpa, 41, -1));
+ catchIndexOutOfBounds(b, () -> b.get(-1, tmpa, 0, 1));
+ catchIndexOutOfBounds(b, () -> b.get(b.limit(), tmpa, 0, 1));
+ catchIndexOutOfBounds(b, () -> b.get(b.limit() - 41, tmpa, 0, 42));
+
+ catchIndexOutOfBounds(b, () -> b.put(7, tmpa, -1, 42));
+ catchIndexOutOfBounds(b, () -> b.put(7, tmpa, 42, 1));
+ catchIndexOutOfBounds(b, () -> b.put(7, tmpa, 41, -1));
+ catchIndexOutOfBounds(b, () -> b.put(-1, tmpa, 0, 1));
+ catchIndexOutOfBounds(b, () -> b.put(b.limit(), tmpa, 0, 1));
+ catchIndexOutOfBounds(b, () -> b.put(b.limit() - 41, tmpa, 0, 42));
+
// Values
b.clear();
@@ -819,6 +875,7 @@
catchReadOnlyBuffer(b, () -> absPut(rb));
catchReadOnlyBuffer(b, () -> bulkPutArray(rb));
catchReadOnlyBuffer(b, () -> bulkPutBuffer(rb));
+ catchReadOnlyBuffer(b, () -> absBulkPutArray(rb));
// put(ShortBuffer) should not change source position
final ShortBuffer src = ShortBuffer.allocate(1);
@@ -928,6 +985,13 @@
+
+
+
+
+
+
+
public static void test(final short [] ba) {
int offset = 47;
int length = 900;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/text/Format/DateFormat/TestDayPeriodWithSDF.java Tue Feb 26 12:11:29 2019 -0500
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2019, 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 8209175
+ * @summary Checks the 'B' character added in the CLDR date-time patterns is
+ * getting resolved with 'a' character (am/pm strings) for burmese locale.
+ * This test case assumes that the 'B' character is added in CLDRv33 update
+ * for burmese locale in the time patterns. Since it is not supported by
+ * SimpleDateFormat it is replaced with the 'a' while CLDR resource
+ * conversion.
+ * @modules jdk.localedata
+ * @run testng/othervm TestDayPeriodWithSDF
+ */
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+import static org.testng.Assert.*;
+
+import java.text.DateFormat;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.GregorianCalendar;
+import java.util.Locale;
+
+public class TestDayPeriodWithSDF {
+
+ private static final Locale BURMESE = new Locale("my");
+ private static final DateFormat FORMAT_SHORT_BURMESE = DateFormat.getTimeInstance(DateFormat.SHORT, BURMESE);
+ private static final DateFormat FORMAT_MEDIUM_BURMESE = DateFormat.getTimeInstance(DateFormat.MEDIUM, BURMESE);
+
+ private static final Date DATE_AM = new GregorianCalendar(2019, Calendar.FEBRUARY, 14, 10, 10, 10).getTime();
+ private static final Date DATE_PM = new GregorianCalendar(2019, Calendar.FEBRUARY, 14, 12, 12, 12).getTime();
+
+ @DataProvider(name = "timePatternData")
+ Object[][] timePatternData() {
+ return new Object[][] {
+ {FORMAT_SHORT_BURMESE, DATE_AM, "\u1014\u1036\u1014\u1000\u103A \u1041\u1040:\u1041\u1040"},
+ {FORMAT_SHORT_BURMESE, DATE_PM, "\u100A\u1014\u1031 \u1041\u1042:\u1041\u1042"},
+ {FORMAT_MEDIUM_BURMESE, DATE_AM, "\u1014\u1036\u1014\u1000\u103A \u1041\u1040:\u1041\u1040:\u1041\u1040"},
+ {FORMAT_MEDIUM_BURMESE, DATE_PM, "\u100A\u1014\u1031 \u1041\u1042:\u1041\u1042:\u1041\u1042"},
+ };
+ }
+
+ @Test(dataProvider = "timePatternData")
+ public void testTimePattern(DateFormat format, Date date, String expected) {
+ String actual = format.format(date);
+ assertEquals(actual, expected);
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/time/test/java/time/format/TestDayPeriodWithDTF.java Tue Feb 26 12:11:29 2019 -0500
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2019, 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 8209175
+ * @summary Checks the 'B' character added in the CLDR date-time patterns is
+ * getting resolved with 'a' character (am/pm strings) for burmese locale.
+ * This test case assumes that the 'B' character is added in CLDRv33 update
+ * for burmese locale in the time patterns. Since it is not supported by
+ * DateTimeFormatter it is replaced with the 'a' while CLDR resource
+ * conversion.
+ * @modules jdk.localedata
+ */
+package test.java.time.format;
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+import static org.testng.Assert.*;
+
+import java.time.LocalTime;
+import java.time.format.DateTimeFormatter;
+import java.time.format.FormatStyle;
+import java.util.Locale;
+
+@Test
+public class TestDayPeriodWithDTF {
+
+ private static final Locale BURMESE = new Locale("my");
+
+ private static final DateTimeFormatter FORMAT_SHORT_BURMESE = DateTimeFormatter.ofLocalizedTime(FormatStyle.SHORT).withLocale(BURMESE);
+ private static final DateTimeFormatter FORMAT_MEDIUM_BURMESE = DateTimeFormatter.ofLocalizedTime(FormatStyle.MEDIUM).withLocale(BURMESE);
+
+ private static final LocalTime LOCAL_TIME_AM = LocalTime.of(10, 10, 10);
+ private static final LocalTime LOCAL_TIME_PM = LocalTime.of(12, 12, 12);
+
+ @DataProvider(name = "timePatternData")
+ Object[][] timePatternData() {
+ return new Object[][] {
+ {FORMAT_SHORT_BURMESE, LOCAL_TIME_AM, "\u1014\u1036\u1014\u1000\u103A 10:10"},
+ {FORMAT_SHORT_BURMESE, LOCAL_TIME_PM, "\u100A\u1014\u1031 12:12"},
+ {FORMAT_MEDIUM_BURMESE, LOCAL_TIME_AM, "\u1014\u1036\u1014\u1000\u103A 10:10:10"},
+ {FORMAT_MEDIUM_BURMESE, LOCAL_TIME_PM, "\u100A\u1014\u1031 12:12:12"},
+ };
+ }
+
+ @Test(dataProvider = "timePatternData")
+ public void testTimePattern(DateTimeFormatter formatter, LocalTime time, String expected) {
+ String actual = formatter.format(time);
+ assertEquals(actual, expected);
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/logging/IsLoggableHandlerTest.java Tue Feb 26 12:11:29 2019 -0500
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2019, 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 8216363
+ * @summary Test that Handler.isLoggable(null) returns false
+ * @run main/othervm IsLoggableHandlerTest
+ */
+import java.io.File;
+import java.io.IOException;
+import java.util.UUID;
+import java.util.logging.ConsoleHandler;
+import java.util.logging.FileHandler;
+import java.util.logging.Handler;
+import java.util.logging.Level;
+import java.util.logging.LogRecord;
+import java.util.logging.MemoryHandler;
+import java.util.logging.StreamHandler;
+import java.util.stream.Stream;
+
+public class IsLoggableHandlerTest {
+
+
+ public static void main(String... args) throws IOException {
+ String userDir = System.getProperty("user.dir", ".");
+ File logfile = new File(userDir, "IsLoggableHandlerTest_" + UUID.randomUUID() + ".log");
+ try {
+ System.out.println("Dummy logfile: " + logfile.getAbsolutePath());
+ Handler h = new CustomHandler();
+ testIsLoggable(h);
+ testIsLoggable(new MemoryHandler(h, 1, Level.ALL));
+ testIsLoggable(new StreamHandler(System.out, new java.util.logging.SimpleFormatter()));
+ testIsLoggable(new FileHandler(logfile.getAbsolutePath()));
+ testIsLoggable(new ConsoleHandler());
+ } finally {
+ if (logfile.canRead()) {
+ try {
+ System.out.println("Deleting dummy logfile: " + logfile.getAbsolutePath());
+ logfile.delete();
+ } catch (Throwable t) {
+ System.out.println("Warning: failed to delete dummy logfile: " + t);
+ t.printStackTrace();
+ }
+ }
+ }
+ }
+
+ public static void testIsLoggable(Handler h) {
+ System.out.println("Testing " + h.getClass().getName());
+ // should not throw NPE but return false
+ if (h.isLoggable(null)) {
+ throw new AssertionError(h.getClass().getName()
+ + ": null record should not be loggable");
+ }
+ h.setLevel(Level.ALL);
+ // should still not throw NPE but return false
+ if (h.isLoggable(null)) {
+ throw new AssertionError(h.getClass().getName()
+ + ": null record should not be loggable");
+ }
+ // should not throw NPE
+ h.publish(null);
+ }
+
+ public static final class CustomHandler extends Handler {
+ @Override
+ public void publish(LogRecord record) { }
+ @Override
+ public void flush() { }
+ @Override
+ public void close() throws SecurityException { }
+ }
+
+
+}
--- a/test/jdk/java/util/logging/TestLoggerWeakRefLeak.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/jdk/java/util/logging/TestLoggerWeakRefLeak.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2019, 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
@@ -123,7 +123,7 @@
}
/**
- * 'vm.heapHisto("-live")' will request a full GC
+ * 'vm.heapHisto("", "-live")' will request a full GC
*/
private static int getInstanceCountFromHeapHisto() throws AttachNotSupportedException, Exception {
int instanceCount = 0;
@@ -131,7 +131,7 @@
HotSpotVirtualMachine vm = (HotSpotVirtualMachine) VirtualMachine
.attach(Long.toString(ProcessTools.getProcessId()));
try {
- try (InputStream heapHistoStream = vm.heapHisto("-live");
+ try (InputStream heapHistoStream = vm.heapHisto("", "-live");
BufferedReader in = new BufferedReader(new InputStreamReader(heapHistoStream))) {
String inputLine;
while ((inputLine = in.readLine()) != null) {
--- a/test/jdk/jdk/jfr/event/runtime/TestSafepointEvents.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/jdk/jdk/jfr/event/runtime/TestSafepointEvents.java Tue Feb 26 12:11:29 2019 -0500
@@ -55,7 +55,6 @@
static final String[] EVENT_NAMES = new String[] {
EventNames.SafepointBegin,
EventNames.SafepointStateSynchronization,
- EventNames.SafepointWaitBlocked,
EventNames.SafepointCleanup,
EventNames.SafepointCleanupTask,
EventNames.SafepointEnd
--- a/test/jdk/sun/security/ssl/SSLContextImpl/BadKSProvider.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/jdk/sun/security/ssl/SSLContextImpl/BadKSProvider.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2019, 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
@@ -21,14 +21,16 @@
* questions.
*/
+//
+// SunJSSE does not support dynamic system properties, no way to re-use
+// system properties in samevm/agentvm mode.
+//
+
/*
* @test
- * @bug 4919147
+ * @bug 4919147 8168069
* @summary Support for token-based KeyStores
* @run main/othervm BadKSProvider
- *
- * SunJSSE does not support dynamic system properties, no way to re-use
- * system properties in samevm/agentvm mode.
*/
import java.io.*;
@@ -176,16 +178,16 @@
// catching the exception is ok,
// but let's try to confirm it is the right exception.
//
- // XXX this test must be updated if the exception message changes
+ // Note: this test must be updated if the exception message changes
Throwable cause = se.getCause();
- if (cause instanceof java.security.NoSuchAlgorithmException == false) {
+ if (!(cause instanceof java.security.NoSuchAlgorithmException)) {
se.printStackTrace();
throw new Exception("Unexpected exception" + se);
}
cause = cause.getCause();
- if (cause instanceof java.security.NoSuchProviderException == false) {
+ if (!(cause instanceof java.security.KeyManagementException)) {
se.printStackTrace();
throw new Exception("Unexpected exception" + se);
}
--- a/test/jdk/sun/security/ssl/SSLContextImpl/BadTSProvider.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/jdk/sun/security/ssl/SSLContextImpl/BadTSProvider.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2019, 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
@@ -28,7 +28,7 @@
/*
* @test
- * @bug 4919147
+ * @bug 4919147 8168069
* @summary Support for token-based KeyStores
* @run main/othervm BadTSProvider
*/
@@ -175,12 +175,10 @@
new BadTSProvider();
throw new SecurityException("expected no-such-provider exception");
} catch (SocketException se) {
-
// catching the exception is ok,
// but let's try to confirm it is the right exception.
//
- // XXX this test must be updated if the exception message changes
-
+ // Note: this test must be updated if the exception message changes
Throwable cause = se.getCause();
if (!(cause instanceof NoSuchAlgorithmException)) {
se.printStackTrace();
@@ -188,13 +186,7 @@
}
cause = cause.getCause();
- if (!(cause instanceof KeyStoreException)) {
- se.printStackTrace();
- throw new Exception("Unexpected exception" + se);
- }
-
- cause = cause.getCause();
- if (!(cause instanceof NoSuchProviderException)) {
+ if (!(cause instanceof KeyManagementException)) {
se.printStackTrace();
throw new Exception("Unexpected exception" + se);
}
--- a/test/jdk/sun/tools/jmap/BasicJMapTest.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/jdk/sun/tools/jmap/BasicJMapTest.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2019, 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
@@ -50,15 +50,22 @@
public static void main(String[] args) throws Exception {
testHisto();
testHistoLive();
+ testHistoAll();
+ testHistoToFile();
+ testHistoLiveToFile();
+ testHistoAllToFile();
testFinalizerInfo();
testClstats();
testDump();
testDumpLive();
+ testDumpAll();
}
private static void testHisto() throws Exception {
- OutputAnalyzer output = jmap("-histo");
+ OutputAnalyzer output = jmap("-histo:");
output.shouldHaveExitValue(0);
+ OutputAnalyzer output1 = jmap("-histo");
+ output1.shouldHaveExitValue(0);
}
private static void testHistoLive() throws Exception {
@@ -66,6 +73,50 @@
output.shouldHaveExitValue(0);
}
+ private static void testHistoAll() throws Exception {
+ OutputAnalyzer output = jmap("-histo:all");
+ output.shouldHaveExitValue(0);
+ }
+
+ private static void testHistoToFile() throws Exception {
+ histoToFile(false);
+ }
+
+ private static void testHistoLiveToFile() throws Exception {
+ histoToFile(true);
+ }
+
+ private static void testHistoAllToFile() throws Exception {
+ boolean explicitAll = true;
+ histoToFile(false, explicitAll);
+ }
+
+ private static void histoToFile(boolean live) throws Exception {
+ boolean explicitAll = false;
+ histoToFile(live, explicitAll);
+ }
+
+ private static void histoToFile(boolean live, boolean explicitAll) throws Exception {
+ if (live == true && explicitAll == true) {
+ fail("Illegal argument setting for jmap -histo");
+ }
+ File file = new File("jmap.histo.file" + System.currentTimeMillis() + ".histo");
+ if (file.exists()) {
+ file.delete();
+ }
+ OutputAnalyzer output;
+ if (live) {
+ output = jmap("-histo:live,file=" + file.getName());
+ } else if (explicitAll == true) {
+ output = jmap("-histo:all,file=" + file.getName());
+ } else {
+ output = jmap("-histo:file=" + file.getName());
+ }
+ output.shouldHaveExitValue(0);
+ output.shouldContain("Heap inspection file created");
+ file.delete();
+ }
+
private static void testFinalizerInfo() throws Exception {
OutputAnalyzer output = jmap("-finalizerinfo");
output.shouldHaveExitValue(0);
@@ -84,7 +135,20 @@
dump(true);
}
+ private static void testDumpAll() throws Exception {
+ boolean explicitAll = true;
+ dump(false, explicitAll);
+ }
+
private static void dump(boolean live) throws Exception {
+ boolean explicitAll = false;
+ dump(live, explicitAll);
+ }
+
+ private static void dump(boolean live, boolean explicitAll) throws Exception {
+ if (live == true && explicitAll == true) {
+ fail("Illegal argument setting for jmap -dump");
+ }
File dump = new File("jmap.dump." + System.currentTimeMillis() + ".hprof");
if (dump.exists()) {
dump.delete();
@@ -92,6 +156,8 @@
OutputAnalyzer output;
if (live) {
output = jmap("-dump:live,format=b,file=" + dump.getName());
+ } else if (explicitAll == true) {
+ output = jmap("-dump:all,format=b,file=" + dump.getName());
} else {
output = jmap("-dump:format=b,file=" + dump.getName());
}
@@ -121,7 +187,7 @@
launcher.addToolArg(Long.toString(ProcessTools.getProcessId()));
processBuilder.command(launcher.getCommand());
- System.out.println(Arrays.toString(processBuilder.command().toArray()).replace(",", ""));
+ System.out.println(Arrays.toString(processBuilder.command().toArray()));
OutputAnalyzer output = ProcessTools.executeProcess(processBuilder);
System.out.println(output.getOutput());
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/sun/util/locale/provider/CheckLoggingFromLocaleProvider.java Tue Feb 26 12:11:29 2019 -0500
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2019, 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 8218960
+ * @modules java.base/sun.util.locale.provider
+ * @modules java.logging
+ * @summary Check that no CONFIG messages are logged on instantiating
+ * SimpleDateFormat with the language-only locale.
+ * @run main CheckLoggingFromLocaleProvider
+ */
+import java.text.*;
+import java.util.*;
+import java.util.logging.*;
+import sun.util.locale.provider.*;
+
+public class CheckLoggingFromLocaleProvider extends StreamHandler {
+
+ @Override
+ public boolean isLoggable(LogRecord lr) {
+ if (lr.getLevel() == Level.CONFIG &&
+ lr.getLoggerName().equals(
+ LocaleServiceProviderPool.class.getCanonicalName())) {
+ throw new RuntimeException("CONFIG message was logged in " +
+ lr.getLoggerName() + ". Message: " + lr.getMessage());
+ }
+ return false;
+ }
+
+ public CheckLoggingFromLocaleProvider() {
+ setLevel(Level.CONFIG);
+ Logger l = LogManager.getLogManager().getLogger("");
+ l.setLevel(Level.CONFIG);
+ l.addHandler(this);
+
+ new SimpleDateFormat("", Locale.ENGLISH);
+ }
+
+ public static void main(String[] args) {
+ new CheckLoggingFromLocaleProvider();
+ }
+}
--- a/test/jdk/tools/jlink/IntegrationTest.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/jdk/tools/jlink/IntegrationTest.java Tue Feb 26 12:11:29 2019 -0500
@@ -49,7 +49,7 @@
import jdk.tools.jlink.internal.Jlink.PluginsConfiguration;
import jdk.tools.jlink.internal.PostProcessor;
import jdk.tools.jlink.internal.plugins.DefaultCompressPlugin;
-import jdk.tools.jlink.internal.plugins.StripDebugPlugin;
+import jdk.tools.jlink.internal.plugins.DefaultStripDebugPlugin;
import tests.Helper;
import tests.JImageGenerator;
@@ -168,7 +168,7 @@
//Strip debug
{
Map<String, String> config1 = new HashMap<>();
- config1.put(StripDebugPlugin.NAME, "");
+ config1.put(DefaultStripDebugPlugin.NAME, "");
Plugin strip = Jlink.newPlugin("strip-debug", config1, null);
lst.add(strip);
}
--- a/test/jdk/tools/jlink/plugins/StripDebugPluginTest.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,162 +0,0 @@
-/*
- * Copyright (c) 2015, 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
- * @summary Test StripDebugPlugin
- * @author Jean-Francois Denise
- * @library ../../lib
- * @build tests.*
- * @modules java.base/jdk.internal.jimage
- * jdk.jlink/jdk.tools.jlink.internal
- * jdk.jlink/jdk.tools.jlink.internal.plugins
- * jdk.jlink/jdk.tools.jlink.plugin
- * jdk.jlink/jdk.tools.jimage
- * jdk.jlink/jdk.tools.jmod
- * jdk.jdeps/com.sun.tools.classfile
- * jdk.compiler
- * @run main StripDebugPluginTest
- */
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.List;
-import java.util.stream.Stream;
-
-import com.sun.tools.classfile.Attribute;
-import com.sun.tools.classfile.ClassFile;
-import com.sun.tools.classfile.Code_attribute;
-import com.sun.tools.classfile.ConstantPoolException;
-import com.sun.tools.classfile.Method;
-import java.util.HashMap;
-import java.util.Map;
-import jdk.tools.jlink.internal.ResourcePoolManager;
-import jdk.tools.jlink.internal.plugins.StripDebugPlugin;
-import jdk.tools.jlink.plugin.ResourcePoolEntry;
-import jdk.tools.jlink.plugin.ResourcePool;
-import jdk.tools.jlink.plugin.Plugin;
-import tests.Helper;
-
-public class StripDebugPluginTest {
- public static void main(String[] args) throws Exception {
- new StripDebugPluginTest().test();
- }
-
- public void test() throws Exception {
- Helper helper = Helper.newHelper();
- if (helper == null) {
- // Skip test if the jmods directory is missing (e.g. exploded image)
- System.err.println("Test not run, NO jmods directory");
- return;
- }
-
- List<String> classes = Arrays.asList("toto.Main", "toto.com.foo.bar.X");
- Path moduleFile = helper.generateModuleCompiledClasses(
- helper.getJmodSrcDir(), helper.getJmodClassesDir(), "leaf1", classes);
- Path moduleInfo = moduleFile.resolve("module-info.class");
-
- // Classes have been compiled in debug.
- List<Path> covered = new ArrayList<>();
- byte[] infoContent = Files.readAllBytes(moduleInfo);
- try (Stream<Path> stream = Files.walk(moduleFile)) {
- for (Iterator<Path> iterator = stream.iterator(); iterator.hasNext(); ) {
- Path p = iterator.next();
- if (Files.isRegularFile(p) && p.toString().endsWith(".class")) {
- byte[] content = Files.readAllBytes(p);
- String path = "/" + helper.getJmodClassesDir().relativize(p).toString();
- String moduleInfoPath = path + "/module-info.class";
- check(path, content, moduleInfoPath, infoContent);
- covered.add(p);
- }
- }
- }
- if (covered.isEmpty()) {
- throw new AssertionError("No class to compress");
- } else {
- System.err.println("removed debug attributes from "
- + covered.size() + " classes");
- }
- }
-
- private void check(String path, byte[] content, String infoPath, byte[] moduleInfo) throws Exception {
- path = path.replace('\\', '/');
- StripDebugPlugin debug = new StripDebugPlugin();
- debug.configure(new HashMap<>());
- ResourcePoolEntry result1 = stripDebug(debug, ResourcePoolEntry.create(path,content), path, infoPath, moduleInfo);
-
- if (!path.endsWith("module-info.class")) {
- if (result1.contentLength() >= content.length) {
- throw new AssertionError("Class size not reduced, debug info not "
- + "removed for " + path);
- }
- checkDebugAttributes(result1.contentBytes());
- }
-
- ResourcePoolEntry result2 = stripDebug(debug, result1, path, infoPath, moduleInfo);
- if (result1.contentLength() != result2.contentLength()) {
- throw new AssertionError("removing debug info twice reduces class size of "
- + path);
- }
- checkDebugAttributes(result1.contentBytes());
- }
-
- private ResourcePoolEntry stripDebug(Plugin debug, ResourcePoolEntry classResource,
- String path, String infoPath, byte[] moduleInfo) throws Exception {
- ResourcePoolManager resources = new ResourcePoolManager();
- resources.add(classResource);
- if (!path.endsWith("module-info.class")) {
- ResourcePoolEntry res2 = ResourcePoolEntry.create(infoPath, moduleInfo);
- resources.add(res2);
- }
- ResourcePoolManager results = new ResourcePoolManager();
- ResourcePool resPool = debug.transform(resources.resourcePool(),
- results.resourcePoolBuilder());
- System.out.println(classResource.path());
-
- return resPool.findEntry(classResource.path()).get();
- }
-
- private void checkDebugAttributes(byte[] strippedClassFile) throws IOException, ConstantPoolException {
- ClassFile classFile = ClassFile.read(new ByteArrayInputStream(strippedClassFile));
- String[] debugAttributes = new String[]{
- Attribute.LineNumberTable,
- Attribute.LocalVariableTable,
- Attribute.LocalVariableTypeTable
- };
- for (Method method : classFile.methods) {
- String methodName = method.getName(classFile.constant_pool);
- Code_attribute code = (Code_attribute) method.attributes.get(Attribute.Code);
- for (String attr : debugAttributes) {
- if (code.attributes.get(attr) != null) {
- throw new AssertionError("Debug attribute was not removed: " + attr +
- " from method " + classFile.getName() + "#" + methodName);
- }
- }
- }
- }
-}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jlink/plugins/StripJavaDebugAttributesPluginTest.java Tue Feb 26 12:11:29 2019 -0500
@@ -0,0 +1,162 @@
+/*
+ * Copyright (c) 2015, 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
+ * @summary Test StripJavaDebugAttributesPlugin
+ * @author Jean-Francois Denise
+ * @library ../../lib
+ * @build tests.*
+ * @modules java.base/jdk.internal.jimage
+ * jdk.jlink/jdk.tools.jlink.internal
+ * jdk.jlink/jdk.tools.jlink.internal.plugins
+ * jdk.jlink/jdk.tools.jlink.plugin
+ * jdk.jlink/jdk.tools.jimage
+ * jdk.jlink/jdk.tools.jmod
+ * jdk.jdeps/com.sun.tools.classfile
+ * jdk.compiler
+ * @run main StripJavaDebugAttributesPluginTest
+ */
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.stream.Stream;
+
+import com.sun.tools.classfile.Attribute;
+import com.sun.tools.classfile.ClassFile;
+import com.sun.tools.classfile.Code_attribute;
+import com.sun.tools.classfile.ConstantPoolException;
+import com.sun.tools.classfile.Method;
+
+import jdk.tools.jlink.internal.ResourcePoolManager;
+import jdk.tools.jlink.internal.plugins.StripJavaDebugAttributesPlugin;
+import jdk.tools.jlink.plugin.Plugin;
+import jdk.tools.jlink.plugin.ResourcePool;
+import jdk.tools.jlink.plugin.ResourcePoolEntry;
+import tests.Helper;
+
+public class StripJavaDebugAttributesPluginTest {
+ public static void main(String[] args) throws Exception {
+ new StripJavaDebugAttributesPluginTest().test();
+ }
+
+ public void test() throws Exception {
+ Helper helper = Helper.newHelper();
+ if (helper == null) {
+ // Skip test if the jmods directory is missing (e.g. exploded image)
+ System.err.println("Test not run, NO jmods directory");
+ return;
+ }
+
+ List<String> classes = Arrays.asList("toto.Main", "toto.com.foo.bar.X");
+ Path moduleFile = helper.generateModuleCompiledClasses(
+ helper.getJmodSrcDir(), helper.getJmodClassesDir(), "leaf1", classes);
+ Path moduleInfo = moduleFile.resolve("module-info.class");
+
+ // Classes have been compiled in debug.
+ List<Path> covered = new ArrayList<>();
+ byte[] infoContent = Files.readAllBytes(moduleInfo);
+ try (Stream<Path> stream = Files.walk(moduleFile)) {
+ for (Iterator<Path> iterator = stream.iterator(); iterator.hasNext(); ) {
+ Path p = iterator.next();
+ if (Files.isRegularFile(p) && p.toString().endsWith(".class")) {
+ byte[] content = Files.readAllBytes(p);
+ String path = "/" + helper.getJmodClassesDir().relativize(p).toString();
+ String moduleInfoPath = path + "/module-info.class";
+ check(path, content, moduleInfoPath, infoContent);
+ covered.add(p);
+ }
+ }
+ }
+ if (covered.isEmpty()) {
+ throw new AssertionError("No class to compress");
+ } else {
+ System.err.println("removed debug attributes from "
+ + covered.size() + " classes");
+ }
+ }
+
+ private void check(String path, byte[] content, String infoPath, byte[] moduleInfo) throws Exception {
+ path = path.replace('\\', '/');
+ StripJavaDebugAttributesPlugin debug = new StripJavaDebugAttributesPlugin();
+ debug.configure(new HashMap<>());
+ ResourcePoolEntry result1 = stripDebug(debug, ResourcePoolEntry.create(path,content), path, infoPath, moduleInfo);
+
+ if (!path.endsWith("module-info.class")) {
+ if (result1.contentLength() >= content.length) {
+ throw new AssertionError("Class size not reduced, debug info not "
+ + "removed for " + path);
+ }
+ checkDebugAttributes(result1.contentBytes());
+ }
+
+ ResourcePoolEntry result2 = stripDebug(debug, result1, path, infoPath, moduleInfo);
+ if (result1.contentLength() != result2.contentLength()) {
+ throw new AssertionError("removing debug info twice reduces class size of "
+ + path);
+ }
+ checkDebugAttributes(result1.contentBytes());
+ }
+
+ private ResourcePoolEntry stripDebug(Plugin debug, ResourcePoolEntry classResource,
+ String path, String infoPath, byte[] moduleInfo) throws Exception {
+ ResourcePoolManager resources = new ResourcePoolManager();
+ resources.add(classResource);
+ if (!path.endsWith("module-info.class")) {
+ ResourcePoolEntry res2 = ResourcePoolEntry.create(infoPath, moduleInfo);
+ resources.add(res2);
+ }
+ ResourcePoolManager results = new ResourcePoolManager();
+ ResourcePool resPool = debug.transform(resources.resourcePool(),
+ results.resourcePoolBuilder());
+ System.out.println(classResource.path());
+
+ return resPool.findEntry(classResource.path()).get();
+ }
+
+ private void checkDebugAttributes(byte[] strippedClassFile) throws IOException, ConstantPoolException {
+ ClassFile classFile = ClassFile.read(new ByteArrayInputStream(strippedClassFile));
+ String[] debugAttributes = new String[]{
+ Attribute.LineNumberTable,
+ Attribute.LocalVariableTable,
+ Attribute.LocalVariableTypeTable
+ };
+ for (Method method : classFile.methods) {
+ String methodName = method.getName(classFile.constant_pool);
+ Code_attribute code = (Code_attribute) method.attributes.get(Attribute.Code);
+ for (String attr : debugAttributes) {
+ if (code.attributes.get(attr) != null) {
+ throw new AssertionError("Debug attribute was not removed: " + attr +
+ " from method " + classFile.getName() + "#" + methodName);
+ }
+ }
+ }
+ }
+}
--- a/test/jtreg-ext/requires/VMProps.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/jtreg-ext/requires/VMProps.java Tue Feb 26 12:11:29 2019 -0500
@@ -37,6 +37,7 @@
import java.util.Properties;
import java.util.concurrent.Callable;
import java.util.concurrent.TimeUnit;
+import java.util.function.Supplier;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -49,13 +50,31 @@
/**
* The Class to be invoked by jtreg prior Test Suite execution to
* collect information about VM.
- * Do not use any API's that may not be available in all target VMs.
+ * Do not use any APIs that may not be available in all target VMs.
* Properties set by this Class will be available in the @requires expressions.
*/
public class VMProps implements Callable<Map<String, String>> {
+ // value known to jtreg as an indicator of error state
+ private static final String ERROR_STATE = "__ERROR__";
private static final WhiteBox WB = WhiteBox.getWhiteBox();
+ private static class SafeMap {
+ private final Map<String, String> map = new HashMap<>();
+
+ public void put(String key, Supplier<String> s) {
+ String value;
+ try {
+ value = s.get();
+ } catch (Throwable t) {
+ System.err.println("failed to get value for " + key);
+ t.printStackTrace(System.err);
+ value = ERROR_STATE + t;
+ }
+ map.put(key, value);
+ }
+ }
+
/**
* Collects information about VM properties.
* This method will be invoked by jtreg.
@@ -64,58 +83,58 @@
*/
@Override
public Map<String, String> call() {
- Map<String, String> map = new HashMap<>();
- map.put("vm.flavor", vmFlavor());
- map.put("vm.compMode", vmCompMode());
- map.put("vm.bits", vmBits());
- map.put("vm.flightRecorder", vmFlightRecorder());
- map.put("vm.simpleArch", vmArch());
- map.put("vm.debug", vmDebug());
- map.put("vm.jvmci", vmJvmci());
- map.put("vm.emulatedClient", vmEmulatedClient());
+ SafeMap map = new SafeMap();
+ map.put("vm.flavor", this::vmFlavor);
+ map.put("vm.compMode", this::vmCompMode);
+ map.put("vm.bits", this::vmBits);
+ map.put("vm.flightRecorder", this::vmFlightRecorder);
+ map.put("vm.simpleArch", this::vmArch);
+ map.put("vm.debug", this::vmDebug);
+ map.put("vm.jvmci", this::vmJvmci);
+ map.put("vm.emulatedClient", this::vmEmulatedClient);
// vm.hasSA is "true" if the VM contains the serviceability agent
// and jhsdb.
- map.put("vm.hasSA", vmHasSA());
+ map.put("vm.hasSA", this::vmHasSA);
// vm.hasSAandCanAttach is "true" if the VM contains the serviceability agent
// and jhsdb and it can attach to the VM.
- map.put("vm.hasSAandCanAttach", vmHasSAandCanAttach());
+ map.put("vm.hasSAandCanAttach", this::vmHasSAandCanAttach);
// vm.hasJFR is "true" if JFR is included in the build of the VM and
// so tests can be executed.
- map.put("vm.hasJFR", vmHasJFR());
- map.put("vm.cpu.features", cpuFeatures());
- map.put("vm.rtm.cpu", vmRTMCPU());
- map.put("vm.rtm.compiler", vmRTMCompiler());
- map.put("vm.aot", vmAOT());
- map.put("vm.aot.enabled", vmAotEnabled());
+ map.put("vm.hasJFR", this::vmHasJFR);
+ map.put("vm.cpu.features", this::cpuFeatures);
+ map.put("vm.rtm.cpu", this::vmRTMCPU);
+ map.put("vm.rtm.compiler", this::vmRTMCompiler);
+ map.put("vm.aot", this::vmAOT);
+ map.put("vm.aot.enabled", this::vmAotEnabled);
// vm.cds is true if the VM is compiled with cds support.
- map.put("vm.cds", vmCDS());
- map.put("vm.cds.custom.loaders", vmCDSForCustomLoaders());
- map.put("vm.cds.archived.java.heap", vmCDSForArchivedJavaHeap());
+ map.put("vm.cds", this::vmCDS);
+ map.put("vm.cds.custom.loaders", this::vmCDSForCustomLoaders);
+ map.put("vm.cds.archived.java.heap", this::vmCDSForArchivedJavaHeap);
// vm.graal.enabled is true if Graal is used as JIT
- map.put("vm.graal.enabled", isGraalEnabled());
- map.put("vm.compiler1.enabled", isCompiler1Enabled());
- map.put("vm.compiler2.enabled", isCompiler2Enabled());
- map.put("docker.support", dockerSupport());
- map.put("release.implementor", implementor());
- map.put("test.vm.gc.nvdimm", isNvdimmTestEnabled());
+ map.put("vm.graal.enabled", this::isGraalEnabled);
+ map.put("vm.compiler1.enabled", this::isCompiler1Enabled);
+ map.put("vm.compiler2.enabled", this::isCompiler2Enabled);
+ map.put("docker.support", this::dockerSupport);
+ map.put("release.implementor", this::implementor);
+ map.put("test.vm.gc.nvdimm", this::isNvdimmTestEnabled);
vmGC(map); // vm.gc.X = true/false
vmOptFinalFlags(map);
- VMProps.dump(map);
- return map;
+ dump(map.map);
+ return map.map;
}
/**
- * Prints a stack trace before returning null.
+ * Print a stack trace before returning error state;
* Used by the various helper functions which parse information from
* VM properties in the case where they don't find an expected property
- * or a propoerty doesn't conform to an expected format.
+ * or a property doesn't conform to an expected format.
*
- * @return null
+ * @return {@link #ERROR_STATE}
*/
- private String nullWithException(String message) {
+ private String errorWithMessage(String message) {
new Exception(message).printStackTrace();
- return null;
+ return ERROR_STATE + message;
}
/**
@@ -125,8 +144,7 @@
String arch = System.getProperty("os.arch");
if (arch.equals("x86_64") || arch.equals("amd64")) {
return "x64";
- }
- else if (arch.contains("86")) {
+ } else if (arch.contains("86")) {
return "x86";
} else {
return arch;
@@ -140,7 +158,7 @@
// E.g. "Java HotSpot(TM) 64-Bit Server VM"
String vmName = System.getProperty("java.vm.name");
if (vmName == null) {
- return nullWithException("Can't get 'java.vm.name' property");
+ return errorWithMessage("Can't get 'java.vm.name' property");
}
Pattern startP = Pattern.compile(".* (\\S+) VM");
@@ -148,7 +166,7 @@
if (m.matches()) {
return m.group(1).toLowerCase();
}
- return nullWithException("Can't get VM flavor from 'java.vm.name'");
+ return errorWithMessage("Can't get VM flavor from 'java.vm.name'");
}
/**
@@ -158,16 +176,17 @@
// E.g. "mixed mode"
String vmInfo = System.getProperty("java.vm.info");
if (vmInfo == null) {
- return nullWithException("Can't get 'java.vm.info' property");
+ return errorWithMessage("Can't get 'java.vm.info' property");
}
- if (vmInfo.toLowerCase().indexOf("mixed mode") != -1) {
+ vmInfo = vmInfo.toLowerCase();
+ if (vmInfo.contains("mixed mode")) {
return "Xmixed";
- } else if (vmInfo.toLowerCase().indexOf("compiled mode") != -1) {
+ } else if (vmInfo.contains("compiled mode")) {
return "Xcomp";
- } else if (vmInfo.toLowerCase().indexOf("interpreted mode") != -1) {
+ } else if (vmInfo.contains("interpreted mode")) {
return "Xint";
} else {
- return nullWithException("Can't get compilation mode from 'java.vm.info'");
+ return errorWithMessage("Can't get compilation mode from 'java.vm.info'");
}
}
@@ -179,7 +198,7 @@
if (dataModel != null) {
return dataModel;
} else {
- return nullWithException("Can't get 'sun.arch.data.model' property");
+ return errorWithMessage("Can't get 'sun.arch.data.model' property");
}
}
@@ -206,7 +225,7 @@
if (debug != null) {
return "" + debug.contains("debug");
} else {
- return nullWithException("Can't get 'jdk.debug' property");
+ return errorWithMessage("Can't get 'jdk.debug' property");
}
}
@@ -224,7 +243,7 @@
protected String vmEmulatedClient() {
String vmInfo = System.getProperty("java.vm.info");
if (vmInfo == null) {
- return "false";
+ return errorWithMessage("Can't get 'java.vm.info' property");
}
return "" + vmInfo.contains(" emulated-client");
}
@@ -241,30 +260,34 @@
* Example vm.gc.G1=true means:
* VM supports G1
* User either set G1 explicitely (-XX:+UseG1GC) or did not set any GC
+ *
* @param map - property-value pairs
*/
- protected void vmGC(Map<String, String> map) {
+ protected void vmGC(SafeMap map) {
for (GC gc: GC.values()) {
- boolean isAcceptable = gc.isSupported() && (gc.isSelected() || GC.isSelectedErgonomically());
- map.put("vm.gc." + gc.name(), "" + isAcceptable);
+ map.put("vm.gc." + gc.name(),
+ () -> "" + (gc.isSupported()
+ && (gc.isSelected() || GC.isSelectedErgonomically())));
}
}
/**
* Selected final flag.
+ *
* @param map - property-value pairs
* @param flagName - flag name
*/
- private void vmOptFinalFlag(Map<String, String> map, String flagName) {
- String value = String.valueOf(WB.getBooleanVMFlag(flagName));
- map.put("vm.opt.final." + flagName, value);
+ private void vmOptFinalFlag(SafeMap map, String flagName) {
+ map.put("vm.opt.final." + flagName,
+ () -> String.valueOf(WB.getBooleanVMFlag(flagName)));
}
/**
* Selected sets of final flags.
+ *
* @param map - property-value pairs
*/
- protected void vmOptFinalFlags(Map<String, String> map) {
+ protected void vmOptFinalFlags(SafeMap map) {
vmOptFinalFlag(map, "ClassUnloading");
vmOptFinalFlag(map, "UseCompressedOops");
vmOptFinalFlag(map, "EnableJVMCI");
@@ -286,10 +309,8 @@
try {
return "" + Platform.shouldSAAttach();
} catch (IOException e) {
- System.out.println("Checking whether SA can attach to the VM failed.");
e.printStackTrace();
- // Run the tests anyways.
- return "true";
+ return errorWithMessage("Checking whether SA can attach to the VM failed.:" + e);
}
}
@@ -350,11 +371,7 @@
* @return true if CDS is supported by the VM to be tested.
*/
protected String vmCDS() {
- if (WB.isCDSIncludedInVmBuild()) {
- return "true";
- } else {
- return "false";
- }
+ return "" + WB.isCDSIncludedInVmBuild();
}
/**
@@ -363,11 +380,7 @@
* @return true if CDS provides support for customer loader in the VM to be tested.
*/
protected String vmCDSForCustomLoaders() {
- if (vmCDS().equals("true") && Platform.areCustomLoadersSupportedForCDS()) {
- return "true";
- } else {
- return "false";
- }
+ return "" + ("true".equals(vmCDS()) && Platform.areCustomLoadersSupportedForCDS());
}
/**
@@ -376,11 +389,7 @@
* @return true if CDS provides support for archive Java heap regions in the VM to be tested.
*/
protected String vmCDSForArchivedJavaHeap() {
- if (vmCDS().equals("true") && WB.isJavaHeapArchiveSupported()) {
- return "true";
- } else {
- return "false";
- }
+ return "" + ("true".equals(vmCDS()) && WB.isJavaHeapArchiveSupported());
}
/**
@@ -389,7 +398,7 @@
* @return true if Graal is used as JIT compiler.
*/
protected String isGraalEnabled() {
- return Compiler.isGraalEnabled() ? "true" : "false";
+ return "" + Compiler.isGraalEnabled();
}
/**
@@ -398,7 +407,7 @@
* @return true if Compiler1 is used as JIT compiler, either alone or as part of the tiered system.
*/
protected String isCompiler1Enabled() {
- return Compiler.isC1Enabled() ? "true" : "false";
+ return "" + Compiler.isC1Enabled();
}
/**
@@ -407,7 +416,7 @@
* @return true if Compiler2 is used as JIT compiler, either alone or as part of the tiered system.
*/
protected String isCompiler2Enabled() {
- return Compiler.isC2Enabled() ? "true" : "false";
+ return "" + Compiler.isC2Enabled();
}
/**
@@ -425,14 +434,11 @@
if (Platform.isX64()) {
isSupported = true;
- }
- else if (Platform.isAArch64()) {
+ } else if (Platform.isAArch64()) {
isSupported = true;
- }
- else if (Platform.isS390x()) {
+ } else if (Platform.isS390x()) {
isSupported = true;
- }
- else if (arch.equals("ppc64le")) {
+ } else if (arch.equals("ppc64le")) {
isSupported = true;
}
}
@@ -445,7 +451,7 @@
}
}
- return (isSupported) ? "true" : "false";
+ return "" + isSupported;
}
private boolean checkDockerSupport() throws IOException, InterruptedException {
@@ -456,30 +462,27 @@
return (p.exitValue() == 0);
}
-
private String implementor() {
try (InputStream in = new BufferedInputStream(new FileInputStream(
System.getProperty("java.home") + "/release"))) {
Properties properties = new Properties();
properties.load(in);
String implementorProperty = properties.getProperty("IMPLEMENTOR");
- return (implementorProperty == null) ? "null" : implementorProperty.replace("\"", "");
+ if (implementorProperty != null) {
+ return implementorProperty.replace("\"", "");
+ }
+ return errorWithMessage("Can't get 'IMPLEMENTOR' property from 'release' file");
} catch (IOException e) {
e.printStackTrace();
+ return errorWithMessage("Failed to read 'release' file " + e);
}
- return null;
}
private String isNvdimmTestEnabled() {
- String isEnbled = System.getenv("TEST_VM_GC_NVDIMM");
- if (isEnbled != null && isEnbled.toLowerCase().equals("true")) {
- return "true";
- }
- return "false";
+ String isEnabled = System.getenv("TEST_VM_GC_NVDIMM");
+ return "" + "true".equalsIgnoreCase(isEnabled);
}
-
-
/**
* Dumps the map to the file if the file name is given as the property.
* This functionality could be helpful to know context in the real
@@ -495,7 +498,8 @@
List<String> lines = new ArrayList<>();
map.forEach((k, v) -> lines.add(k + ":" + v));
try {
- Files.write(Paths.get(dumpFileName), lines, StandardOpenOption.APPEND);
+ Files.write(Paths.get(dumpFileName), lines,
+ StandardOpenOption.APPEND, StandardOpenOption.CREATE);
} catch (IOException e) {
throw new RuntimeException("Failed to dump properties into '"
+ dumpFileName + "'", e);
@@ -504,6 +508,7 @@
/**
* This method is for the testing purpose only.
+ *
* @param args
*/
public static void main(String args[]) {
--- a/test/langtools/TEST.ROOT Tue Feb 26 12:08:20 2019 -0500
+++ b/test/langtools/TEST.ROOT Tue Feb 26 12:11:29 2019 -0500
@@ -15,7 +15,7 @@
groups=TEST.groups
# Minimum jtreg version
-requiredVersion=4.2 b13
+requiredVersion=4.2 b14
# Use new module options
useNewOptions=true
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/jdk/javadoc/doclet/testJavaPackage/TestJavaPackage.java Tue Feb 26 12:11:29 2019 -0500
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2019, 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 8216170
+ * @summary java.lang.IllegalArgumentException: directories not supported
+ * @library /tools/lib ../../lib
+ * @modules jdk.compiler/com.sun.tools.javac.api
+ * jdk.compiler/com.sun.tools.javac.main
+ * jdk.javadoc/jdk.javadoc.internal.api
+ * jdk.javadoc/jdk.javadoc.internal.tool
+ * @build toolbox.ToolBox javadoc.tester.*
+ * @run main TestJavaPackage
+ */
+
+import java.io.IOException;
+import java.nio.file.Path;
+
+import toolbox.ModuleBuilder;
+import toolbox.ToolBox;
+
+import javadoc.tester.JavadocTester;
+
+public class TestJavaPackage extends JavadocTester {
+ public static void main(String... args) throws Exception {
+ TestJavaPackage tester = new TestJavaPackage();
+ tester.runTests();
+ }
+
+ private final ToolBox tb = new ToolBox();
+
+ @Test
+ public void testPackage() throws IOException {
+ Path src = Path.of("src");
+ tb.writeJavaFiles(src,
+ "module com.example.java { exports com.example.java; }",
+ "package com.example.java; public class C { }");
+
+ // Disable the standard check that the output directory is empty.
+ // It is a significant part of the test case that the output directory
+ // is set to the current directory, which (in this case) also contains
+ // the src/ directory.
+ setOutputDirectoryCheck(DirectoryCheck.NONE);
+
+ javadoc("-d", ".", // using "." is important for the test case
+ "-sourcepath", src.toString(),
+ "com.example.java");
+ checkExit(Exit.OK);
+ checkFiles(true,
+ "com.example.java/com/example/java/C.html");
+
+ // repeat the call, to verify the package name "com.example.java" is not
+ // confused with the output directory for the "com.example.java" module,
+ // created by the first call
+
+ javadoc("-d", ".", // using "." is important for the test case
+ "-sourcepath", src.toString(),
+ "com.example.java");
+ checkExit(Exit.OK);
+ checkFiles(true,
+ "com.example.java/com/example/java/C.html");
+ }
+}
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/jdk/javadoc/doclet/testMetadata/TestMetadata.java Tue Feb 26 12:11:29 2019 -0500
@@ -0,0 +1,357 @@
+/*
+ * Copyright (c) 2019, 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 8218998
+ * @summary Add metadata to generated API documentation files
+ * @library /tools/lib ../../lib
+ * @modules jdk.javadoc/jdk.javadoc.internal.tool
+ * @modules jdk.compiler/com.sun.tools.javac.api
+ * jdk.compiler/com.sun.tools.javac.main
+ * jdk.javadoc/jdk.javadoc.internal.api
+ * jdk.javadoc/jdk.javadoc.internal.tool
+ * @build toolbox.ToolBox toolbox.JavacTask javadoc.tester.*
+ * @run main TestMetadata
+ */
+
+import java.io.IOException;
+import java.nio.file.Path;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.TreeSet;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import java.util.stream.Collectors;
+
+import toolbox.ModuleBuilder;
+import toolbox.ToolBox;
+
+import javadoc.tester.JavadocTester;
+
+public class TestMetadata extends JavadocTester {
+ public static void main(String... args) throws Exception {
+ TestMetadata tester = new TestMetadata();
+ tester.runTests();
+ }
+
+ enum Frames { NO_FRAMES, FRAMES };
+ enum Index { SINGLE, SPLIT };
+ enum Source { PACKAGES, MODULES };
+
+ final ToolBox tb = new ToolBox();
+ final Set<String> allGeneratorsFound = new HashSet<>();
+
+ public void runTests() throws Exception {
+ for (Source s : Source.values()) {
+ Path src = genSource(s);
+ for (Frames f : Frames.values()) {
+ for (Index i : Index.values()) {
+ List<String> args = new ArrayList<>();
+ args.add("-d");
+ args.add(String.format("out-%s-%s-%s", s, f, i));
+ args.add("-use");
+ if (s != Source.MODULES) {
+ args.add("-linksource"); // broken, with modules: JDK-8219060
+ }
+ args.add(f == Frames.NO_FRAMES ? "--no-frames" : "--frames");
+ if (i == Index.SPLIT) {
+ args.add("-splitIndex");
+ }
+ if (s == Source.PACKAGES) {
+ args.add("-sourcepath");
+ args.add(src.toString());
+ args.add("pA");
+ args.add("pB");
+ } else {
+ args.add("--module-source-path");
+ args.add(src.toString());
+ args.add("--module");
+ args.add("mA,mB");
+ }
+ javadoc(args.toArray(new String[args.size()]));
+ checkExit(Exit.OK);
+ checkMetadata();
+
+ // spot check the descriptions for declarations
+ switch (s) {
+ case PACKAGES:
+ checkOutput("pA/package-summary.html", true,
+ "<meta name=\"description\" content=\"declaration: package: pA\">");
+ checkOutput("pA/CA.html", true,
+ "<meta name=\"description\" content=\"declaration: package: pA, class: CA\">");
+ break;
+
+ case MODULES:
+ checkOutput("mA/module-summary.html", true,
+ "<meta name=\"description\" content=\"declaration: module: mA\">");
+ checkOutput("mA/pA/package-summary.html", true,
+ "<meta name=\"description\" content=\"declaration: module: mA, package: pA\">");
+ checkOutput("mA/pA/CA.html", true,
+ "<meta name=\"description\" content=\"declaration: module: mA, package: pA, class: CA\">");
+ break;
+ }
+ }
+ }
+ }
+
+ checking ("all generators");
+ if (allGeneratorsFound.equals(allGenerators)) {
+ passed("all generators found");
+ } else {
+ Set<String> notFound = new TreeSet<>(allGenerators);
+ notFound.removeAll(allGeneratorsFound);
+ failed("not found: " + notFound);
+ }
+
+ printSummary();
+ }
+
+ final Pattern nl = Pattern.compile("[\\r\\n]+");
+ final Pattern contentPattern = Pattern.compile("content=\"([^\"]+)\">");
+ final Pattern generatorPattern = Pattern.compile("content=\"javadoc/([^\"]+)\">");
+ final Set<String> allGenerators = Set.of(
+ "AllClassesFrameWriter",
+ "AllClassesIndexWriter",
+ "AllPackagesIndexWriter",
+ "AnnotationTypeWriterImpl",
+ "ClassUseWriter",
+ "ClassWriterImpl",
+ "ConstantsSummaryWriterImpl",
+ "DeprecatedListWriter",
+ "DocFileWriter",
+ "FrameOutputWriter",
+ "HelpWriter",
+ "IndexRedirectWriter",
+ "ModuleFrameWriter",
+ "ModuleIndexFrameWriter",
+ "ModuleIndexWriter",
+ "ModulePackageIndexFrameWriter",
+ "ModuleWriterImpl",
+ "PackageFrameWriter",
+ "PackageIndexFrameWriter",
+ "PackageIndexWriter",
+ "PackageTreeWriter",
+ "PackageUseWriter",
+ "PackageWriterImpl",
+ "SerializedFormWriterImpl",
+ "SingleIndexWriter",
+ "SourceToHTMLConverter",
+ "SplitIndexWriter",
+ "TreeWriter"
+ );
+
+ void checkMetadata() throws IOException {
+ Path outputDirPath = outputDir.toPath();
+ for (Path p : tb.findFiles(".html", outputDirPath)) {
+ checkMetadata(outputDirPath.relativize(p));
+ }
+ }
+
+ void checkMetadata(Path p) {
+ checking("Check generator: " + p);
+
+ List<String> generators = nl.splitAsStream(readOutputFile(p.toString()))
+ .filter(s -> s.contains("<meta name=\"generator\""))
+ .collect(Collectors.toList());
+
+ String generator;
+ switch (generators.size()) {
+ case 0:
+ failed("Not found: <meta name=\"generator\"");
+ return;
+ case 1:
+ generator = generators.get(0);
+ break;
+ default:
+ failed("Multiple found: <meta name=\"generator\"");
+ return;
+ }
+
+ Matcher m = generatorPattern.matcher(generator);
+ if (m.find()) {
+ String content = m.group(1);
+ if (allGenerators.contains(content)) {
+ passed("found: " + content);
+ allGeneratorsFound.add(content);
+ checkDescription(p, content);
+ } else {
+ failed("Unrecognized content: " + content);
+ }
+ } else {
+ failed("Unrecognized line:\n" + generator);
+ }
+
+ }
+
+ void checkDescription(Path p, String generator) {
+ checking("Check description: " + p);
+
+ List<String> descriptions = nl.splitAsStream(readOutputFile(p.toString()))
+ .filter(s -> s.contains("<meta name=\"description\""))
+ .collect(Collectors.toList());
+
+ String description;
+ switch (descriptions.size()) {
+ case 0:
+ if (generator.equals("DocFileWriter")) {
+ passed("Not found, as expected");
+ } else {
+ failed("Not found: <meta name=\"description\"");
+ }
+ return;
+ case 1:
+ description = descriptions.get(0);
+ break;
+ default:
+ failed("Multiple found: <meta name=\"description\"");
+ return;
+ }
+
+ String content;
+ Matcher m = contentPattern.matcher(description);
+ if (m.find()) {
+ content = m.group(1);
+ } else {
+ failed("Unrecognized line:\n" + description);
+ return;
+ }
+
+ switch (generator) {
+ case "AllClassesFrameWriter":
+ case "FrameOutputWriter":
+ case "ModuleFrameWriter":
+ case "ModuleIndexFrameWriter":
+ case "ModulePackageIndexFrameWriter":
+ case "PackageFrameWriter":
+ case "PackageIndexFrameWriter":
+ check(generator, content, content.contains("frame"));
+ break;
+
+ case "AllClassesIndexWriter":
+ case "AllPackagesIndexWriter":
+ case "ModuleIndexWriter":
+ case "PackageIndexWriter":
+ check(generator, content, content.contains("index"));
+ break;
+
+
+ case "AnnotationTypeWriterImpl":
+ case "ClassWriterImpl":
+ case "ModuleWriterImpl":
+ case "PackageWriterImpl":
+ check(generator, content, content.startsWith("declaration: "));
+ break;
+
+ case "ClassUseWriter":
+ case "PackageUseWriter":
+ check(generator, content, content.startsWith("use: "));
+ break;
+
+ case "ConstantsSummaryWriterImpl":
+ check(generator, content, content.contains("constants"));
+ break;
+
+ case "DeprecatedListWriter":
+ check(generator, content, content.contains("deprecated"));
+ break;
+
+ case "DocFileWriter":
+ passed("no constraint for user-provided doc-files");
+ break;
+
+ case "HelpWriter":
+ check(generator, content, content.contains("help"));
+ break;
+
+ case "IndexRedirectWriter":
+ check(generator, content, content.contains("redirect"));
+ break;
+
+ case "PackageTreeWriter":
+ case "TreeWriter":
+ check(generator, content, content.contains("tree"));
+ break;
+
+ case "SerializedFormWriterImpl":
+ check(generator, content, content.contains("serialized"));
+ break;
+
+ case "SingleIndexWriter":
+ case "SplitIndexWriter":
+ check(generator, content, content.startsWith("index"));
+ break;
+
+ case "SourceToHTMLConverter":
+ check(generator, content, content.startsWith("source:"));
+ break;
+
+ default:
+ failed("unexpected generator: " + generator);
+ break;
+ }
+ }
+
+ void check(String generator, String content, boolean ok) {
+ if (ok) {
+ passed("OK: " + generator + " " + content);
+ } else {
+ failed("unexpected value for " + generator + ": " + content);
+ }
+ }
+
+ Path genSource(Source s) throws IOException {
+ Path src = Path.of("src-" + s);
+ switch (s) {
+ case PACKAGES:
+ tb.writeJavaFiles(src,
+ "/** Package pA. */ package pA;",
+ "/** Class pA.CA. */ package pA; public class CA { }",
+ "/** Anno pA.Anno, */ package pA; public @interface Anno { }",
+ "/** Serializable pA.Ser, */ package pA; public class Ser implements java.io.Serializable { }",
+ "/** Package pB. */ package pB;",
+ "/** Class pB.CB. */ package pB; public class CB { }");
+ tb.writeFile(src.resolve("pA").resolve("doc-files").resolve("extra.html"),
+ "<!doctype html>\n<html><head></head><body>Extra</body></html>");
+ break;
+
+ case MODULES:
+ new ModuleBuilder(tb, "mA")
+ .exports("pA")
+ .classes("/** Package mA/pA. */ package pA;")
+ .classes("/** Class mA/pA.CA. */ package pA; public class CA { }")
+ .write(src);
+ new ModuleBuilder(tb, "mB")
+ .exports("pB")
+ .classes("/** Package mB/pB. */ package pB;")
+ .classes("/** Class mB/pB.CB. */ package pB; public class CB { }")
+ .write(src);
+ break;
+ }
+
+ return src;
+ }
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/jdk/javadoc/doclet/testPackageSpecificStylesheet/TestPackageSpecificStylesheet.java Tue Feb 26 12:11:29 2019 -0500
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2019, 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 8213354
+ * @summary Support package-specific stylesheets
+ * @library /tools/lib ../../lib
+ * @modules jdk.javadoc/jdk.javadoc.internal.tool
+ * @build javadoc.tester.* toolbox.ToolBox builder.ClassBuilder
+ * @run main TestPackageSpecificStylesheet
+ */
+
+
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.List;
+
+import builder.ClassBuilder;
+import toolbox.ToolBox;
+
+import javadoc.tester.JavadocTester;
+
+public class TestPackageSpecificStylesheet extends JavadocTester {
+
+ final ToolBox tb;
+
+ public static void main(String... args) throws Exception {
+ TestPackageSpecificStylesheet tester = new TestPackageSpecificStylesheet();
+ tester.runTests(m -> new Object[]{Paths.get(m.getName())});
+ }
+
+ TestPackageSpecificStylesheet() {
+ tb = new ToolBox();
+ }
+
+ @Test
+ public void test(Path base) throws Exception {
+ Path srcDir = base.resolve("src");
+ Path outDir = base.resolve("out");
+
+ new ClassBuilder(tb, "pkg.A")
+ .setComments("<span>test span style</span>")
+ .setModifiers("public", "class")
+ .write(srcDir);
+
+ Path docFilesDir = Files.createDirectories(srcDir.resolve("pkg").resolve("doc-files"));
+ Path stylesheet = docFilesDir.resolve("spanstyle.css");
+ Files.createFile(stylesheet);
+ Files.write(stylesheet, List.of("span{ color:blue; }"));
+
+ new ClassBuilder(tb, "pkg2.B")
+ .setModifiers("public", "class")
+ .write(srcDir);
+
+ javadoc("-d", outDir.toString(),
+ "-sourcepath", srcDir.toString(),
+ "pkg", "pkg2");
+
+ checkExit(Exit.OK);
+
+ checkOutput("pkg/A.html", true,
+ "<link rel=\"stylesheet\" type=\"text/css\" href=\"doc-files/spanstyle.css\"" +
+ " title=\"Style\">");
+
+ checkOutput("pkg/package-summary.html", true,
+ "<link rel=\"stylesheet\" type=\"text/css\" href=\"doc-files/spanstyle.css\"" +
+ " title=\"Style\">");
+
+ checkOutput("pkg2/B.html", false,
+ "<link rel=\"stylesheet\" type=\"text/css\" href=\"doc-files/spanstyle.css\"" +
+ " title=\"Style\">");
+
+ }
+}
--- a/test/langtools/jdk/javadoc/tool/EncodingTest.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/langtools/jdk/javadoc/tool/EncodingTest.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -29,7 +29,7 @@
* @modules jdk.compiler/com.sun.tools.javac.main
* @modules jdk.javadoc/jdk.javadoc.internal.api
* @modules jdk.javadoc/jdk.javadoc.internal.tool
- * @library /tools/lib /tools/javadoc/lib
+ * @library /tools/lib
* @build toolbox.JavacTask toolbox.JavadocTask toolbox.TestRunner toolbox.ToolBox
* @run main EncodingTest
*/
--- a/test/langtools/jdk/javadoc/tool/EnsureNewOldDoclet.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/langtools/jdk/javadoc/tool/EnsureNewOldDoclet.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, 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
@@ -36,13 +36,11 @@
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
-import java.util.Map;
import java.util.Set;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import javax.lang.model.element.Element;
-import com.sun.javadoc.Tag;
import com.sun.source.doctree.DocTree;
import toolbox.*;
@@ -76,9 +74,6 @@
final static String NEW_DOCLET_MARKER = "NEW_DOCLET_MARKER";
final static String NEW_TAGLET_MARKER = "Registered Taglet " + CLASS_NAME + "\\$NewTaglet";
- final static Pattern WARN_TEXT = Pattern.compile("Users are strongly recommended to migrate" +
- " to the new APIs.");
-
final static String NEW_STDDOCLET = "jdk.javadoc.doclet.StandardDoclet";
@@ -118,23 +113,6 @@
checkOutput(testName, out, NEW_HEADER);
}
- // input: old doclet
- // outcome: old tool
- @Test
- public void testOldDoclet() throws Exception {
- setArgs("-classpath", ".", // ambient classpath insulation
- "-doclet",
- OLD_DOCLET_CLASS_NAME,
- "-docletpath",
- testClasses,
- testSrc.toString());
- Task.Result tr = task.run(Task.Expect.SUCCESS);
- List<String> out = tr.getOutputLines(Task.OutputKind.STDOUT);
- List<String> err = tr.getOutputLines(Task.OutputKind.STDERR);
- checkOutput(testName, out, OLD_DOCLET_MARKER);
- checkOutput(testName, err, WARN_TEXT);
- }
-
// input: new doclet and new taglet
// outcome: new doclet and new taglet should register
@Test
@@ -175,13 +153,6 @@
throw new Exception(testCase + ": Expected string not found: " + toFind);
}
- public static class OldDoclet extends com.sun.javadoc.Doclet {
- public static boolean start(com.sun.javadoc.RootDoc root) {
- System.out.println(OLD_DOCLET_MARKER);
- return true;
- }
- }
-
public static class NewTaglet implements jdk.javadoc.doclet.Taglet {
@Override
--- a/test/langtools/jdk/javadoc/tool/api/basic/GetTask_DocletClassTest.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,163 +0,0 @@
-/*
- * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * 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 6493690
- * @summary javadoc should have a javax.tools.Tool service provider
- * @modules jdk.javadoc
- * @build APITest
- * @run main GetTask_DocletClassTest
- * @key randomness
- */
-
-import java.io.File;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Random;
-import javax.tools.DocumentationTool;
-import javax.tools.DocumentationTool.DocumentationTask;
-import javax.tools.JavaFileObject;
-import javax.tools.StandardJavaFileManager;
-import javax.tools.ToolProvider;
-
-import com.sun.javadoc.DocErrorReporter;
-import com.sun.javadoc.LanguageVersion;
-import com.sun.javadoc.RootDoc;
-
-/**
- * Tests for DocumentationTool.getTask docletClass parameter.
- */
-public class GetTask_DocletClassTest extends APITest {
- public static void main(String... args) throws Exception {
- new GetTask_DocletClassTest().run();
- }
-
- /**
- * Verify that an alternate doclet can be specified.
- *
- * There is no standard interface or superclass for a doclet;
- * the only requirement is that it provides static methods that
- * can be invoked via reflection. So, for now, the doclet is
- * specified as a class.
- * Because we cannot create and use a unique instance of the class,
- * we verify that the doclet has been called by having it record
- * (in a static field!) the comment from the last time it was invoked,
- * which is randomly generated each time the test is run.
- */
- @Test
- public void testDoclet() throws Exception {
- Random r = new Random();
- int key = r.nextInt();
- JavaFileObject srcFile = createSimpleJavaFileObject(
- "pkg/C",
- "package pkg; /** " + key + "*/ public class C { }");
- DocumentationTool tool = ToolProvider.getSystemDocumentationTool();
- try (StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null)) {
- File outDir = getOutDir();
- fm.setLocation(DocumentationTool.Location.DOCUMENTATION_OUTPUT, Arrays.asList(outDir));
- Iterable<? extends JavaFileObject> files = Arrays.asList(srcFile);
- DocumentationTask t = tool.getTask(null, fm, null, TestDoclet.class, null, files);
- if (t.call()) {
- System.err.println("task succeeded");
- if (TestDoclet.lastCaller.equals(String.valueOf(key)))
- System.err.println("found expected key: " + key);
- else
- error("Expected key not found");
- checkFiles(outDir, Collections.<String>emptySet());
- } else {
- throw new Exception("task failed");
- }
- }
- }
-
- public static class TestDoclet {
- static String lastCaller;
- public static boolean start(RootDoc root) {
- lastCaller = root.classNamed("pkg.C").commentText().trim();
- return true;
- }
-
- public static int optionLength(String option) {
- return 0; // default is option unknown
- }
-
- public static boolean validOptions(String options[][],
- DocErrorReporter reporter) {
- return true; // default is options are valid
- }
-
- public static LanguageVersion languageVersion() {
- return LanguageVersion.JAVA_1_1;
- }
- }
-
- /**
- * Verify that exceptions from a doclet are thrown as expected.
- */
- @Test
- public void testBadDoclet() throws Exception {
- JavaFileObject srcFile = createSimpleJavaFileObject();
- DocumentationTool tool = ToolProvider.getSystemDocumentationTool();
- try (StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null)) {
- File outDir = getOutDir();
- fm.setLocation(DocumentationTool.Location.DOCUMENTATION_OUTPUT, Arrays.asList(outDir));
- Iterable<? extends JavaFileObject> files = Arrays.asList(srcFile);
- DocumentationTask t = tool.getTask(null, fm, null, BadDoclet.class, null, files);
- try {
- t.call();
- error("call completed without exception");
- } catch (RuntimeException e) {
- e.printStackTrace();
- Throwable c = e.getCause();
- if (c.getClass() == UnexpectedError.class)
- System.err.println("exception caught as expected: " + c);
- else
- throw e;
- }
- }
- }
-
- public static class UnexpectedError extends Error { }
-
- public static class BadDoclet {
- public static boolean start(RootDoc root) {
- throw new UnexpectedError();
- }
-
- public static int optionLength(String option) {
- return 0; // default is option unknown
- }
-
- public static boolean validOptions(String options[][],
- DocErrorReporter reporter) {
- return true; // default is options are valid
- }
-
- public static LanguageVersion languageVersion() {
- return LanguageVersion.JAVA_1_1;
- }
- }
-
-}
-
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/jdk/javadoc/tool/removeOldDoclet/OldDoclet.jasm Tue Feb 26 12:11:29 2019 -0500
@@ -0,0 +1,28 @@
+
+super public class OldDoclet
+ extends com/sun/javadoc/Doclet
+ version 55:0
+{
+
+
+public Method "<init>":"()V"
+ stack 1 locals 1
+{
+ aload_0;
+ invokespecial Method com/sun/javadoc/Doclet."<init>":"()V";
+ return;
+
+}
+
+public static Method start:"(Lcom/sun/javadoc/RootDoc;)Z"
+ stack 2 locals 1
+{
+ getstatic Field java/lang/System.out:"Ljava/io/PrintStream;";
+ ldc String "OLD_DOCLET_MARKER";
+ invokevirtual Method java/io/PrintStream.println:"(Ljava/lang/String;)V";
+ iconst_1;
+ ireturn;
+
+}
+
+} // end Class OldDoclet
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/jdk/javadoc/tool/removeOldDoclet/RemoveOldDoclet.java Tue Feb 26 12:11:29 2019 -0500
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2019, 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 8215584
+ * @summary Remove support for the "old" doclet API in com/sun/javadoc
+ * @library /tools/lib ../../lib
+ * @modules jdk.javadoc/jdk.javadoc.internal.tool
+ * @build javadoc.tester.* toolbox.ToolBox builder.ClassBuilder
+ * @compile OldDoclet.jasm
+ * @run main RemoveOldDoclet
+ */
+
+
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+import builder.ClassBuilder;
+import toolbox.ToolBox;
+
+import javadoc.tester.JavadocTester;
+
+public class RemoveOldDoclet extends JavadocTester {
+
+ final ToolBox tb;
+
+ public static void main(String... args) throws Exception {
+ RemoveOldDoclet tester = new RemoveOldDoclet();
+ tester.runTests(m -> new Object[]{Paths.get(m.getName())});
+ }
+
+ RemoveOldDoclet() {
+ tb = new ToolBox();
+ }
+
+ @Test
+ public void testInvokeOldDoclet(Path base) throws Exception {
+ Path srcDir = base.resolve("src");
+ Path outDir = base.resolve("out");
+
+ new ClassBuilder(tb, "pkg.A")
+ .setModifiers("public", "class")
+ .write(srcDir);
+
+ javadoc("-d", outDir.toString(),
+ "-doclet", "OldDoclet",
+ "-docletpath", System.getProperty("test.classes", "."),
+ "-sourcepath", srcDir.toString(),
+ "pkg");
+
+ checkExit(Exit.ERROR);
+ checkOutput(Output.OUT, true,
+ "javadoc: error - Class OldDoclet is not a valid doclet.\n"
+ + "Note: As of JDK 13, the com.sun.javadoc API is no longer supported.");
+ }
+}
--- a/test/langtools/tools/javac/6330997/T6330997.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/langtools/tools/javac/6330997/T6330997.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2019, 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
@@ -32,8 +32,8 @@
* jdk.compiler/com.sun.tools.javac.main
* jdk.compiler/com.sun.tools.javac.util
* @clean T1 T2
- * @compile -source 12 -target 13 T1.java
- * @compile -source 12 -target 13 T2.java
+ * @compile T1.java
+ * @compile T2.java
* @run main/othervm T6330997
*/
--- a/test/langtools/tools/javac/ConditionalWithVoid.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/langtools/tools/javac/ConditionalWithVoid.java Tue Feb 26 12:11:29 2019 -0500
@@ -4,7 +4,7 @@
* @summary The compiler was allowing void types in its parsing of conditional expressions.
* @author tball
*
- * @compile/fail/ref=ConditionalWithVoid.out --enable-preview -source 13 -XDrawDiagnostics ConditionalWithVoid.java
+ * @compile/fail/ref=ConditionalWithVoid.out --enable-preview -source ${jdk.version} -XDrawDiagnostics ConditionalWithVoid.java
*/
public class ConditionalWithVoid {
public void test(Object o, String s) {
--- a/test/langtools/tools/javac/diags/Example.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/langtools/tools/javac/diags/Example.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2019, 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
@@ -288,7 +288,7 @@
opts.add("-d");
opts.add(classesDir.getPath());
if (options != null)
- opts.addAll(options);
+ opts.addAll(evalProperties(options));
if (procFiles.size() > 0) {
List<String> pOpts = new ArrayList<>(Arrays.asList("-d", classesDir.getPath()));
@@ -355,6 +355,51 @@
}
}
+ private static List<String> evalProperties(List<String> args) {
+ boolean fast = true;
+ for (String arg : args) {
+ fast = fast && (arg.indexOf("${") == -1);
+ }
+ if (fast) {
+ return args;
+ }
+ List<String> newArgs = new ArrayList<>();
+ for (String arg : args) {
+ newArgs.add(evalProperties(arg));
+ }
+ return newArgs;
+ }
+
+ private static final Pattern namePattern = Pattern.compile("\\$\\{([A-Za-z0-9._]+)\\}");
+ private static final String jdkVersion = Integer.toString(Runtime.version().feature());
+
+ private static String evalProperties(String arg) {
+ Matcher m = namePattern.matcher(arg);
+ StringBuilder sb = null;
+ while (m.find()) {
+ if (sb == null) {
+ sb = new StringBuilder();
+ }
+ String propName = m.group(1);
+ String propValue;
+ switch (propName) {
+ case "jdk.version":
+ propValue = jdkVersion;
+ break;
+ default:
+ propValue = System.getProperty(propName);
+ break;
+ }
+ m.appendReplacement(sb, propValue != null ? propValue : m.group(0).replace("$", "\\$"));
+ }
+ if (sb == null) {
+ return arg;
+ } else {
+ m.appendTail(sb);
+ return sb.toString();
+ }
+ }
+
void createAnnotationServicesFile(File dir, List<File> procFiles) throws IOException {
File servicesDir = new File(new File(dir, "META-INF"), "services");
servicesDir.mkdirs();
--- a/test/langtools/tools/javac/diags/examples/BreakAmbiguousTarget.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/langtools/tools/javac/diags/examples/BreakAmbiguousTarget.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, 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
@@ -24,7 +24,7 @@
// key: compiler.err.break.ambiguous.target
// key: compiler.note.preview.filename
// key: compiler.note.preview.recompile
-// options: --enable-preview -source 13
+// options: --enable-preview -source ${jdk.version}
class BreakAmbiguousTarget {
void m(int i, int j) {
--- a/test/langtools/tools/javac/diags/examples/BreakExprNotImmediate.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/langtools/tools/javac/diags/examples/BreakExprNotImmediate.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, 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
@@ -33,7 +33,7 @@
// key: compiler.note.preview.filename
// key: compiler.note.preview.recompile
// key: compiler.note.note
-// options: --enable-preview -source 13
+// options: --enable-preview -source ${jdk.version}
// run: backdoor
class BreakExprNotImmediate {
--- a/test/langtools/tools/javac/diags/examples/BreakMissingValue.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/langtools/tools/javac/diags/examples/BreakMissingValue.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, 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
@@ -24,7 +24,7 @@
// key: compiler.err.break.missing.value
// key: compiler.note.preview.filename
// key: compiler.note.preview.recompile
-// options: --enable-preview -source 13
+// options: --enable-preview -source ${jdk.version}
class BreakMissingValue {
int t(int i) {
--- a/test/langtools/tools/javac/diags/examples/BreakOutsideSwitchExpression.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/langtools/tools/javac/diags/examples/BreakOutsideSwitchExpression.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, 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
@@ -24,7 +24,7 @@
// key: compiler.err.break.outside.switch.expression
// key: compiler.note.preview.filename
// key: compiler.note.preview.recompile
-// options: --enable-preview -source 13
+// options: --enable-preview -source ${jdk.version}
class BreakOutsideSwitchExpression {
int t(int i) {
--- a/test/langtools/tools/javac/diags/examples/ContinueOutsideSwitchExpression.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/langtools/tools/javac/diags/examples/ContinueOutsideSwitchExpression.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, 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
@@ -24,7 +24,7 @@
// key: compiler.err.continue.outside.switch.expression
// key: compiler.note.preview.filename
// key: compiler.note.preview.recompile
-// options: --enable-preview -source 13
+// options: --enable-preview -source ${jdk.version}
class ContinueOutsideSwitchExpression {
int t(int i) {
--- a/test/langtools/tools/javac/diags/examples/IncompatibleTypesInSwitchExpression.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/langtools/tools/javac/diags/examples/IncompatibleTypesInSwitchExpression.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,7 @@
// key: compiler.misc.inconvertible.types
// key: compiler.note.preview.filename
// key: compiler.note.preview.recompile
-// options: --enable-preview -source 13
+// options: --enable-preview -source ${jdk.version}
class IncompatibleTypesInSwitchExpression {
--- a/test/langtools/tools/javac/diags/examples/MultipleCaseLabels.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/langtools/tools/javac/diags/examples/MultipleCaseLabels.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
// key: compiler.misc.feature.multiple.case.labels
// key: compiler.warn.preview.feature.use.plural
-// options: --enable-preview -source 13 -Xlint:preview
+// options: --enable-preview -source ${jdk.version} -Xlint:preview
class MultipleCaseLabels {
void m(int i) {
--- a/test/langtools/tools/javac/diags/examples/NotExhaustive.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/langtools/tools/javac/diags/examples/NotExhaustive.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, 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
@@ -24,7 +24,7 @@
// key: compiler.err.not.exhaustive
// key: compiler.note.preview.filename
// key: compiler.note.preview.recompile
-// options: --enable-preview -source 13
+// options: --enable-preview -source ${jdk.version}
class NotExhaustive {
int t(int i) {
--- a/test/langtools/tools/javac/diags/examples/PreviewFeatureUse.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/langtools/tools/javac/diags/examples/PreviewFeatureUse.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,7 @@
//key: compiler.warn.preview.feature.use.plural
//key: compiler.misc.feature.diamond
//key: compiler.misc.feature.lambda
-//options: -Xlint:preview -XDforcePreview -source 13 --enable-preview
+//options: -Xlint:preview -XDforcePreview -source ${jdk.version} --enable-preview
import java.util.ArrayList;
--- a/test/langtools/tools/javac/diags/examples/PreviewFilename.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/langtools/tools/javac/diags/examples/PreviewFilename.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
// key: compiler.note.preview.filename
// key: compiler.note.preview.recompile
-// options: -XDforcePreview -source 13 --enable-preview
+// options: -XDforcePreview -source ${jdk.version} --enable-preview
import java.util.ArrayList;
import java.util.List;
--- a/test/langtools/tools/javac/diags/examples/PreviewFilenameAdditional.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/langtools/tools/javac/diags/examples/PreviewFilenameAdditional.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, 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
@@ -24,7 +24,7 @@
// key: compiler.note.preview.filename.additional
// key: compiler.warn.preview.feature.use
// key: compiler.misc.feature.diamond
-// options: -Xlint:preview -Xmaxwarns 1 -XDforcePreview -source 13 --enable-preview
+// options: -Xlint:preview -Xmaxwarns 1 -XDforcePreview -source ${jdk.version} --enable-preview
import java.util.ArrayList;
--- a/test/langtools/tools/javac/diags/examples/PreviewPlural/PreviewPlural.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/langtools/tools/javac/diags/examples/PreviewPlural/PreviewPlural.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
// key: compiler.note.preview.plural
// key: compiler.note.preview.recompile
-// options: -XDforcePreview -source 13 --enable-preview
+// options: -XDforcePreview -source ${jdk.version} --enable-preview
import java.util.ArrayList;
--- a/test/langtools/tools/javac/diags/examples/ReturnOutsideSwitchExpression.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/langtools/tools/javac/diags/examples/ReturnOutsideSwitchExpression.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, 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
@@ -24,7 +24,7 @@
// key: compiler.err.return.outside.switch.expression
// key: compiler.note.preview.filename
// key: compiler.note.preview.recompile
-// options: --enable-preview -source 13
+// options: --enable-preview -source ${jdk.version}
class ReturnOutsideSwitchExpression {
int t(int i) {
--- a/test/langtools/tools/javac/diags/examples/RuleCompletesNormally.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/langtools/tools/javac/diags/examples/RuleCompletesNormally.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, 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
@@ -24,7 +24,7 @@
// key: compiler.err.rule.completes.normally
// key: compiler.note.preview.filename
// key: compiler.note.preview.recompile
-// options: --enable-preview -source 13
+// options: --enable-preview -source ${jdk.version}
class RuleCompletesNormally {
public String convert(int i) {
--- a/test/langtools/tools/javac/diags/examples/SwitchCaseUnexpectedStatement.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/langtools/tools/javac/diags/examples/SwitchCaseUnexpectedStatement.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, 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
@@ -24,7 +24,7 @@
// key: compiler.err.switch.case.unexpected.statement
// key: compiler.note.preview.filename
// key: compiler.note.preview.recompile
-// options: --enable-preview -source 13
+// options: --enable-preview -source ${jdk.version}
class ReturnOutsideSwitchExpression {
void t(int i) {
--- a/test/langtools/tools/javac/diags/examples/SwitchExpressionCompletesNormally.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/langtools/tools/javac/diags/examples/SwitchExpressionCompletesNormally.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, 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
@@ -24,7 +24,7 @@
// key: compiler.err.switch.expression.completes.normally
// key: compiler.note.preview.filename
// key: compiler.note.preview.recompile
-// options: --enable-preview -source 13
+// options: --enable-preview -source ${jdk.version}
class SwitchExpressionCompletesNormally {
public String convert(int i) {
--- a/test/langtools/tools/javac/diags/examples/SwitchExpressionEmpty.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/langtools/tools/javac/diags/examples/SwitchExpressionEmpty.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, 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
@@ -24,7 +24,7 @@
// key: compiler.err.switch.expression.empty
// key: compiler.note.preview.filename
// key: compiler.note.preview.recompile
-// options: --enable-preview -source 13
+// options: --enable-preview -source ${jdk.version}
class BreakOutsideSwitchExpression {
String t(E e) {
--- a/test/langtools/tools/javac/diags/examples/SwitchExpressionTargetCantBeVoid.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/langtools/tools/javac/diags/examples/SwitchExpressionTargetCantBeVoid.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,7 @@
// key: compiler.misc.switch.expression.target.cant.be.void
// key: compiler.note.preview.filename
// key: compiler.note.preview.recompile
-// options: --enable-preview -source 13
+// options: --enable-preview -source ${jdk.version}
class SwitchExpressionTargetCantBeVoid {
--- a/test/langtools/tools/javac/diags/examples/SwitchExpressions.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/langtools/tools/javac/diags/examples/SwitchExpressions.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
// key: compiler.misc.feature.switch.expressions
// key: compiler.warn.preview.feature.use.plural
-// options: --enable-preview -source 13 -Xlint:preview
+// options: --enable-preview -source ${jdk.version} -Xlint:preview
class SwitchExpressions {
int m(int i) {
--- a/test/langtools/tools/javac/diags/examples/SwitchMixingCaseTypes.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/langtools/tools/javac/diags/examples/SwitchMixingCaseTypes.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, 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
@@ -24,7 +24,7 @@
// key: compiler.err.switch.mixing.case.types
// key: compiler.note.preview.filename
// key: compiler.note.preview.recompile
-// options: --enable-preview -source 13
+// options: --enable-preview -source ${jdk.version}
class SwitchMixingCaseTypes {
--- a/test/langtools/tools/javac/diags/examples/SwitchRules.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/langtools/tools/javac/diags/examples/SwitchRules.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
// key: compiler.misc.feature.switch.rules
// key: compiler.warn.preview.feature.use.plural
-// options: --enable-preview -source 13 -Xlint:preview
+// options: --enable-preview -source ${jdk.version} -Xlint:preview
class SwitchExpressions {
void m(int i) {
--- a/test/langtools/tools/javac/expswitch/ExpSwitchNestingTest.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/langtools/tools/javac/expswitch/ExpSwitchNestingTest.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, 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
@@ -75,7 +75,8 @@
}
}
- private static String[] PREVIEW_OPTIONS = {"--enable-preview", "-source", "13"};
+ private static String[] PREVIEW_OPTIONS = {"--enable-preview", "-source",
+ Integer.toString(Runtime.version().feature())};
private void program(String... constructs) {
String s = "class C { static boolean cond = false; static int x = 0; void m() { # } }";
--- a/test/langtools/tools/javac/lambda/BadSwitchExpressionLambda.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/langtools/tools/javac/lambda/BadSwitchExpressionLambda.java Tue Feb 26 12:11:29 2019 -0500
@@ -2,7 +2,7 @@
* @test /nodynamiccopyright/
* @bug 8206986
* @summary Adding switch expressions
- * @compile/fail/ref=BadSwitchExpressionLambda.out -XDrawDiagnostics --enable-preview -source 13 BadSwitchExpressionLambda.java
+ * @compile/fail/ref=BadSwitchExpressionLambda.out -XDrawDiagnostics --enable-preview -source ${jdk.version} BadSwitchExpressionLambda.java
*/
class BadSwitchExpressionLambda {
--- a/test/langtools/tools/javac/parser/JavacParserTest.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/langtools/tools/javac/parser/JavacParserTest.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, 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
@@ -88,14 +88,14 @@
public class JavacParserTest extends TestCase {
static final JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
static final JavaFileManager fm = tool.getStandardFileManager(null, null, null);
+ public static final String SOURCE_VERSION =
+ Integer.toString(Runtime.version().feature());
private JavacParserTest(){}
public static void main(String... args) throws Exception {
- try {
+ try (fm) {
new JavacParserTest().run(args);
- } finally {
- fm.close();
}
}
@@ -1096,7 +1096,7 @@
String expectedErrors = "Test.java:1:178: compiler.err.switch.case.unexpected.statement\n";
StringWriter out = new StringWriter();
JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(out, fm, null,
- Arrays.asList("-XDrawDiagnostics", "--enable-preview", "-source", "13"),
+ Arrays.asList("-XDrawDiagnostics", "--enable-preview", "-source", SOURCE_VERSION),
null, Arrays.asList(new MyFileObject(code)));
CompilationUnitTree cut = ct.parse().iterator().next();
--- a/test/langtools/tools/javac/preview/classReaderTest/Client.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/langtools/tools/javac/preview/classReaderTest/Client.java Tue Feb 26 12:11:29 2019 -0500
@@ -2,9 +2,9 @@
* @test /nodynamiccopyright/
* @bug 8199194
* @summary smoke test for --enabled-preview classreader support
- * @compile -XDforcePreview --enable-preview -source 13 Bar.java
+ * @compile -XDforcePreview --enable-preview -source ${jdk.version} Bar.java
* @compile/fail/ref=Client.nopreview.out -Xlint:preview -XDrawDiagnostics Client.java
- * @compile/fail/ref=Client.preview.out -Werror -Xlint:preview -XDrawDiagnostics --enable-preview -source 13 Client.java
+ * @compile/fail/ref=Client.preview.out -Werror -Xlint:preview -XDrawDiagnostics --enable-preview -source ${jdk.version} Client.java
*/
public class Client {
--- a/test/langtools/tools/javac/switchexpr/BlockExpression.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/langtools/tools/javac/switchexpr/BlockExpression.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,7 @@
* @test
* @bug 8206986
* @summary Verify rule cases with expression statements and throw statements work.
- * @compile --enable-preview -source 13 BlockExpression.java
+ * @compile --enable-preview -source ${jdk.version} BlockExpression.java
* @run main/othervm --enable-preview BlockExpression
*/
--- a/test/langtools/tools/javac/switchexpr/BooleanNumericNonNumeric.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/langtools/tools/javac/switchexpr/BooleanNumericNonNumeric.java Tue Feb 26 12:11:29 2019 -0500
@@ -2,7 +2,7 @@
* @test /nodynamiccopyright/
* @bug 8206986
* @summary Verify the type of a conditional expression with nested switch expression is computed properly
- * @compile/fail/ref=BooleanNumericNonNumeric.out -XDrawDiagnostics --enable-preview -source 13 BooleanNumericNonNumeric.java
+ * @compile/fail/ref=BooleanNumericNonNumeric.out -XDrawDiagnostics --enable-preview -source ${jdk.version} BooleanNumericNonNumeric.java
*/
public class BooleanNumericNonNumeric {
--- a/test/langtools/tools/javac/switchexpr/BreakTest.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/langtools/tools/javac/switchexpr/BreakTest.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, 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
@@ -61,12 +61,13 @@
public static void main(String[] args) throws Exception {
final JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
+ String sourceVersion = Integer.toString(Runtime.version().feature());
assert tool != null;
DiagnosticListener<JavaFileObject> noErrors = d -> {};
StringWriter out = new StringWriter();
JavacTask ct = (JavacTask) tool.getTask(out, null, noErrors,
- List.of("-XDdev", "--enable-preview", "-source", "13"), null,
+ List.of("-XDdev", "--enable-preview", "-source", sourceVersion), null,
Arrays.asList(new MyFileObject(CODE)));
List<String> labels = new ArrayList<>();
new TreePathScanner<Void, Void>() {
--- a/test/langtools/tools/javac/switchexpr/CRT.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/langtools/tools/javac/switchexpr/CRT.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, 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
@@ -48,6 +48,8 @@
new CRT().run();
}
+ private static final String SOURCE_VERSION = Integer.toString(Runtime.version().feature());
+
private ToolBox tb = new ToolBox();
private void run() throws Exception {
@@ -151,7 +153,7 @@
new JavacTask(tb)
.options("-Xjcov",
"--enable-preview",
- "-source", "13")
+ "-source", SOURCE_VERSION)
.outdir(classes)
.sources("public class Test {\n" +
code +
--- a/test/langtools/tools/javac/switchexpr/DefiniteAssignment1.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/langtools/tools/javac/switchexpr/DefiniteAssignment1.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,7 @@
* @test
* @bug 8214031
* @summary Verify that definite assignment when true works (legal code)
- * @compile --enable-preview --source 13 DefiniteAssignment1.java
+ * @compile --enable-preview --source ${jdk.version} DefiniteAssignment1.java
* @run main/othervm --enable-preview DefiniteAssignment1
*/
public class DefiniteAssignment1 {
--- a/test/langtools/tools/javac/switchexpr/DefiniteAssignment2.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/langtools/tools/javac/switchexpr/DefiniteAssignment2.java Tue Feb 26 12:11:29 2019 -0500
@@ -2,7 +2,7 @@
* @test /nodynamiccopyright/
* @bug 8214031
* @summary Verify that definite assignment when true works (illegal code)
- * @compile/fail/ref=DefiniteAssignment2.out --enable-preview --source 13 -XDrawDiagnostics DefiniteAssignment2.java
+ * @compile/fail/ref=DefiniteAssignment2.out --enable-preview --source ${jdk.version} -XDrawDiagnostics DefiniteAssignment2.java
*/
public class DefiniteAssignment2 {
--- a/test/langtools/tools/javac/switchexpr/EmptySwitch.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/langtools/tools/javac/switchexpr/EmptySwitch.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,7 @@
* @test
* @bug 8206986
* @summary Verify than an empty switch expression is rejected.
- * @compile/fail/ref=EmptySwitch.out --enable-preview -source 13 -XDrawDiagnostics EmptySwitch.java
+ * @compile/fail/ref=EmptySwitch.out --enable-preview -source ${jdk.version} -XDrawDiagnostics EmptySwitch.java
*/
public class EmptySwitch {
--- a/test/langtools/tools/javac/switchexpr/ExhaustiveEnumSwitch.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/langtools/tools/javac/switchexpr/ExhaustiveEnumSwitch.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,7 @@
* @test
* @bug 8206986
* @summary Verify that an switch expression over enum can be exhaustive without default.
- * @compile --enable-preview -source 13 ExhaustiveEnumSwitch.java
+ * @compile --enable-preview -source ${jdk.version} ExhaustiveEnumSwitch.java
* @compile ExhaustiveEnumSwitchExtra.java
* @run main/othervm --enable-preview ExhaustiveEnumSwitch
*/
--- a/test/langtools/tools/javac/switchexpr/ExpressionSwitch.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/langtools/tools/javac/switchexpr/ExpressionSwitch.java Tue Feb 26 12:11:29 2019 -0500
@@ -3,7 +3,7 @@
* @bug 8206986
* @summary Check expression switch works.
* @compile/fail/ref=ExpressionSwitch-old.out -source 9 -Xlint:-options -XDrawDiagnostics ExpressionSwitch.java
- * @compile --enable-preview -source 13 ExpressionSwitch.java
+ * @compile --enable-preview -source ${jdk.version} ExpressionSwitch.java
* @run main/othervm --enable-preview ExpressionSwitch
*/
--- a/test/langtools/tools/javac/switchexpr/ExpressionSwitchBreaks1.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/langtools/tools/javac/switchexpr/ExpressionSwitchBreaks1.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,7 @@
* @test
* @bug 8206986
* @summary Verify behavior of various kinds of breaks.
- * @compile --enable-preview -source 13 ExpressionSwitchBreaks1.java
+ * @compile --enable-preview -source ${jdk.version} ExpressionSwitchBreaks1.java
* @run main/othervm --enable-preview ExpressionSwitchBreaks1
*/
--- a/test/langtools/tools/javac/switchexpr/ExpressionSwitchBreaks2.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/langtools/tools/javac/switchexpr/ExpressionSwitchBreaks2.java Tue Feb 26 12:11:29 2019 -0500
@@ -2,7 +2,7 @@
* @test /nodynamiccopyright/
* @bug 8206986
* @summary Check behavior for invalid breaks.
- * @compile/fail/ref=ExpressionSwitchBreaks2.out -XDrawDiagnostics --enable-preview -source 13 ExpressionSwitchBreaks2.java
+ * @compile/fail/ref=ExpressionSwitchBreaks2.out -XDrawDiagnostics --enable-preview -source ${jdk.version} ExpressionSwitchBreaks2.java
*/
public class ExpressionSwitchBreaks2 {
--- a/test/langtools/tools/javac/switchexpr/ExpressionSwitchBugs.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/langtools/tools/javac/switchexpr/ExpressionSwitchBugs.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,7 @@
* @test
* @bug 8206986 8214114 8214529
* @summary Verify various corner cases with nested switch expressions.
- * @compile --enable-preview -source 13 ExpressionSwitchBugs.java
+ * @compile --enable-preview -source ${jdk.version} ExpressionSwitchBugs.java
* @run main/othervm --enable-preview ExpressionSwitchBugs
*/
--- a/test/langtools/tools/javac/switchexpr/ExpressionSwitchBugsInGen.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/langtools/tools/javac/switchexpr/ExpressionSwitchBugsInGen.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,7 @@
* @test
* @bug 8214031
* @summary Verify various corner cases with nested switch expressions.
- * @compile --enable-preview -source 13 ExpressionSwitchBugsInGen.java
+ * @compile --enable-preview -source ${jdk.version} ExpressionSwitchBugsInGen.java
* @run main/othervm --enable-preview ExpressionSwitchBugsInGen
*/
--- a/test/langtools/tools/javac/switchexpr/ExpressionSwitchCodeFromJLS.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/langtools/tools/javac/switchexpr/ExpressionSwitchCodeFromJLS.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,7 @@
* @test
* @bug 8206986
* @summary Check switch expressions
- * @compile --enable-preview -source 13 ExpressionSwitchCodeFromJLS.java
+ * @compile --enable-preview -source ${jdk.version} ExpressionSwitchCodeFromJLS.java
* @run main/othervm --enable-preview ExpressionSwitchCodeFromJLS
*/
--- a/test/langtools/tools/javac/switchexpr/ExpressionSwitchDA.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/langtools/tools/javac/switchexpr/ExpressionSwitchDA.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,7 @@
* @test
* @bug 8206986
* @summary Check definite (un)assignment for in switch expressions.
- * @compile --enable-preview -source 13 ExpressionSwitchDA.java
+ * @compile --enable-preview -source ${jdk.version} ExpressionSwitchDA.java
* @run main/othervm --enable-preview ExpressionSwitchDA
*/
--- a/test/langtools/tools/javac/switchexpr/ExpressionSwitchEmbedding.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/langtools/tools/javac/switchexpr/ExpressionSwitchEmbedding.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,7 @@
* @test
* @bug 8214031 8214114
* @summary Verify switch expressions embedded in various statements work properly.
- * @compile --enable-preview -source 13 ExpressionSwitchEmbedding.java
+ * @compile --enable-preview -source ${jdk.version} ExpressionSwitchEmbedding.java
* @run main/othervm --enable-preview ExpressionSwitchEmbedding
*/
--- a/test/langtools/tools/javac/switchexpr/ExpressionSwitchFallThrough.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/langtools/tools/javac/switchexpr/ExpressionSwitchFallThrough.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,7 @@
* @test
* @bug 8206986
* @summary Check fall through in switch expressions.
- * @compile --enable-preview -source 13 ExpressionSwitchFallThrough.java
+ * @compile --enable-preview -source ${jdk.version} ExpressionSwitchFallThrough.java
* @run main/othervm --enable-preview ExpressionSwitchFallThrough
*/
--- a/test/langtools/tools/javac/switchexpr/ExpressionSwitchFallThrough1.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/langtools/tools/javac/switchexpr/ExpressionSwitchFallThrough1.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,7 @@
* @test
* @bug 8206986
* @summary Check fall through in switch expressions.
- * @compile --enable-preview -source 13 ExpressionSwitchFallThrough1.java
+ * @compile --enable-preview -source ${jdk.version} ExpressionSwitchFallThrough1.java
* @run main/othervm --enable-preview ExpressionSwitchFallThrough1
*/
--- a/test/langtools/tools/javac/switchexpr/ExpressionSwitchFlow.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/langtools/tools/javac/switchexpr/ExpressionSwitchFlow.java Tue Feb 26 12:11:29 2019 -0500
@@ -2,7 +2,7 @@
* @test /nodynamiccopyright/
* @bug 8212982
* @summary Verify a compile-time error is produced if switch expression does not provide a value
- * @compile/fail/ref=ExpressionSwitchFlow.out --enable-preview -source 13 -XDrawDiagnostics ExpressionSwitchFlow.java
+ * @compile/fail/ref=ExpressionSwitchFlow.out --enable-preview -source ${jdk.version} -XDrawDiagnostics ExpressionSwitchFlow.java
*/
public class ExpressionSwitchFlow {
--- a/test/langtools/tools/javac/switchexpr/ExpressionSwitchInExpressionSwitch.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/langtools/tools/javac/switchexpr/ExpressionSwitchInExpressionSwitch.java Tue Feb 26 12:11:29 2019 -0500
@@ -25,7 +25,7 @@
* @test
* @bug 8206986
* @summary Check switch expressions embedded in switch expressions.
- * @compile --enable-preview -source 13 ExpressionSwitchInExpressionSwitch.java
+ * @compile --enable-preview -source ${jdk.version} ExpressionSwitchInExpressionSwitch.java
* @run main/othervm --enable-preview ExpressionSwitchInExpressionSwitch
*/
--- a/test/langtools/tools/javac/switchexpr/ExpressionSwitchInfer.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/langtools/tools/javac/switchexpr/ExpressionSwitchInfer.java Tue Feb 26 12:11:29 2019 -0500
@@ -2,7 +2,7 @@
* @test /nodynamiccopyright/
* @bug 8206986
* @summary Check types inferred for switch expressions.
- * @compile/fail/ref=ExpressionSwitchInfer.out -XDrawDiagnostics --enable-preview -source 13 ExpressionSwitchInfer.java
+ * @compile/fail/ref=ExpressionSwitchInfer.out -XDrawDiagnostics --enable-preview -source ${jdk.version} ExpressionSwitchInfer.java
*/
import java.util.ArrayList;
--- a/test/langtools/tools/javac/switchexpr/ExpressionSwitchIntersectionTypes.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/langtools/tools/javac/switchexpr/ExpressionSwitchIntersectionTypes.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,7 @@
* @test
* @bug 8206986
* @summary Verify behavior when an intersection type is inferred for switch expression.
- * @compile --enable-preview -source 13 ExpressionSwitchIntersectionTypes.java
+ * @compile --enable-preview -source ${jdk.version} ExpressionSwitchIntersectionTypes.java
* @run main/othervm --enable-preview ExpressionSwitchIntersectionTypes
*/
--- a/test/langtools/tools/javac/switchexpr/ExpressionSwitchNotExhaustive.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/langtools/tools/javac/switchexpr/ExpressionSwitchNotExhaustive.java Tue Feb 26 12:11:29 2019 -0500
@@ -2,7 +2,7 @@
* @test /nodynamiccopyright/
* @bug 8206986
* @summary Verify behavior of not exhaustive switch expressions.
- * @compile/fail/ref=ExpressionSwitchNotExhaustive.out -XDrawDiagnostics --enable-preview -source 13 ExpressionSwitchNotExhaustive.java
+ * @compile/fail/ref=ExpressionSwitchNotExhaustive.out -XDrawDiagnostics --enable-preview -source ${jdk.version} ExpressionSwitchNotExhaustive.java
*/
public class ExpressionSwitchNotExhaustive {
--- a/test/langtools/tools/javac/switchexpr/ExpressionSwitchUnreachable.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/langtools/tools/javac/switchexpr/ExpressionSwitchUnreachable.java Tue Feb 26 12:11:29 2019 -0500
@@ -2,7 +2,7 @@
* @test /nodynamiccopyright/
* @bug 8206986
* @summary Verify reachability in switch expressions.
- * @compile/fail/ref=ExpressionSwitchUnreachable.out -XDrawDiagnostics --enable-preview -source 13 ExpressionSwitchUnreachable.java
+ * @compile/fail/ref=ExpressionSwitchUnreachable.out -XDrawDiagnostics --enable-preview -source ${jdk.version} ExpressionSwitchUnreachable.java
*/
public class ExpressionSwitchUnreachable {
--- a/test/langtools/tools/javac/switchexpr/ParseIncomplete.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/langtools/tools/javac/switchexpr/ParseIncomplete.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, 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
@@ -61,13 +61,14 @@
final JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
assert tool != null;
DiagnosticListener<JavaFileObject> noErrors = d -> {};
+ String sourceVersion = Integer.toString(Runtime.version().feature());
for (int i = 0; i < CODE.length(); i++) {
String code = CODE.substring(0, i + 1);
StringWriter out = new StringWriter();
try {
JavacTask ct = (JavacTask) tool.getTask(out, null, noErrors,
- List.of("-XDdev", "--enable-preview", "-source", "13"), null,
+ List.of("-XDdev", "--enable-preview", "-source", sourceVersion), null,
Arrays.asList(new MyFileObject(code)));
ct.parse().iterator().next();
} catch (Throwable t) {
--- a/test/langtools/tools/javac/switchexpr/ParserRecovery.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/langtools/tools/javac/switchexpr/ParserRecovery.java Tue Feb 26 12:11:29 2019 -0500
@@ -2,7 +2,7 @@
* @test /nodynamiccopyright/
* @bug 8206986
* @summary Verify the parser handles broken input gracefully.
- * @compile/fail/ref=ParserRecovery.out -XDrawDiagnostics --enable-preview -source 13 ParserRecovery.java
+ * @compile/fail/ref=ParserRecovery.out -XDrawDiagnostics --enable-preview -source ${jdk.version} ParserRecovery.java
*/
public class ParserRecovery {
--- a/test/langtools/tools/javac/switchexpr/SwitchExpressionIsNotAConstant.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/langtools/tools/javac/switchexpr/SwitchExpressionIsNotAConstant.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,7 @@
* @bug 8214113
* @summary Verify the switch expression's type does not have a constant attached,
* and so the switch expression is not elided.
- * @compile --enable-preview --source 13 SwitchExpressionIsNotAConstant.java
+ * @compile --enable-preview --source ${jdk.version} SwitchExpressionIsNotAConstant.java
* @run main/othervm --enable-preview SwitchExpressionIsNotAConstant
*/
public class SwitchExpressionIsNotAConstant {
--- a/test/langtools/tools/javac/switchexpr/SwitchExpressionScopesIsolated.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/langtools/tools/javac/switchexpr/SwitchExpressionScopesIsolated.java Tue Feb 26 12:11:29 2019 -0500
@@ -2,7 +2,7 @@
* @test /nodynamiccopyright/
* @bug 8206986
* @summary Verify that scopes in rule cases are isolated.
- * @compile/fail/ref=SwitchExpressionScopesIsolated.out -XDrawDiagnostics --enable-preview -source 13 SwitchExpressionScopesIsolated.java
+ * @compile/fail/ref=SwitchExpressionScopesIsolated.out -XDrawDiagnostics --enable-preview -source ${jdk.version} SwitchExpressionScopesIsolated.java
*/
public class SwitchExpressionScopesIsolated {
--- a/test/langtools/tools/javac/switchexpr/SwitchExpressionSimpleVisitorTest.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/langtools/tools/javac/switchexpr/SwitchExpressionSimpleVisitorTest.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, 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
@@ -89,7 +89,7 @@
StringWriter out = new StringWriter();
JavacTask ct = (JavacTask) tool.getTask(out, null, noErrors,
- List.of("--enable-preview", "-source", "13"), null,
+ List.of("--enable-preview", "-source", Integer.toString(Runtime.version().feature())), null,
Arrays.asList(new MyFileObject(code)));
return ct.parse().iterator().next();
}
--- a/test/langtools/tools/javac/switchexpr/TryCatch.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/langtools/tools/javac/switchexpr/TryCatch.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,7 @@
* @test
* @bug 8214114
* @summary Verify try-catch inside a switch expression works properly.
- * @compile --enable-preview -source 13 TryCatch.java
+ * @compile --enable-preview -source ${jdk.version} TryCatch.java
* @run main/othervm --enable-preview TryCatch
*/
public class TryCatch {
--- a/test/langtools/tools/javac/switchextra/CaseTest.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/langtools/tools/javac/switchextra/CaseTest.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, 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
@@ -47,12 +47,13 @@
public class CaseTest {
public static void main(String[] args) throws Exception {
- new CaseTest().testLabels();
- new CaseTest().testStatement();
- new CaseTest().testRule();
+ String sourceVersion = Integer.toString(Runtime.version().feature());
+ new CaseTest().testLabels(sourceVersion);
+ new CaseTest().testStatement(sourceVersion);
+ new CaseTest().testRule(sourceVersion);
}
- void testLabels() throws Exception {
+ void testLabels(String sourceVersion) throws Exception {
String code = "class Test {\n" +
" void t(int i) {\n" +
" switch(i) {\n" +
@@ -72,7 +73,7 @@
.collect(Collectors.joining(",", "[", "]")));
return super.visitCase(node, p);
}
- }.scan(parse(code), null);
+ }.scan(parse(code, sourceVersion), null);
List<String> expected = Arrays.asList("0", "[0]", "1", "[1,2]", "null", "[]");
@@ -81,7 +82,7 @@
}
}
- void testStatement() throws Exception {
+ void testStatement(String sourceVersion) throws Exception {
String code = "class Test {\n" +
" void t(int i) {\n" +
" switch(i) {\n" +
@@ -102,10 +103,10 @@
}
return super.visitCase(node, p);
}
- }.scan(parse(code), null);
+ }.scan(parse(code, sourceVersion), null);
}
- void testRule() throws Exception {
+ void testRule(String sourceVersion) throws Exception {
String code = "class Test {\n" +
" void t(int i) {\n" +
" switch(i) {\n" +
@@ -126,17 +127,17 @@
}
return super.visitCase(node, p);
}
- }.scan(parse(code), null);
+ }.scan(parse(code, sourceVersion), null);
}
- private CompilationUnitTree parse(String code) throws IOException {
+ private CompilationUnitTree parse(String code, String sourceVersion) throws IOException {
final JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
assert tool != null;
DiagnosticListener<JavaFileObject> noErrors = d -> {};
StringWriter out = new StringWriter();
JavacTask ct = (JavacTask) tool.getTask(out, null, noErrors,
- List.of("-XDdev", "--enable-preview", "-source", "13"), null,
+ List.of("-XDdev", "--enable-preview", "-source", sourceVersion), null,
Arrays.asList(new MyFileObject(code)));
return ct.parse().iterator().next();
}
--- a/test/langtools/tools/javac/switchextra/MultipleLabelsExpression.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/langtools/tools/javac/switchextra/MultipleLabelsExpression.java Tue Feb 26 12:11:29 2019 -0500
@@ -3,7 +3,7 @@
* @bug 8206986
* @summary Verify cases with multiple labels work properly.
* @compile/fail/ref=MultipleLabelsExpression-old.out -source 9 -Xlint:-options -XDrawDiagnostics MultipleLabelsExpression.java
- * @compile --enable-preview -source 13 MultipleLabelsExpression.java
+ * @compile --enable-preview -source ${jdk.version} MultipleLabelsExpression.java
* @run main/othervm --enable-preview MultipleLabelsExpression
*/
--- a/test/langtools/tools/javac/switchextra/MultipleLabelsStatement.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/langtools/tools/javac/switchextra/MultipleLabelsStatement.java Tue Feb 26 12:11:29 2019 -0500
@@ -3,7 +3,7 @@
* @bug 8206986
* @summary Verify cases with multiple labels work properly.
* @compile/fail/ref=MultipleLabelsStatement-old.out -source 9 -Xlint:-options -XDrawDiagnostics MultipleLabelsStatement.java
- * @compile --enable-preview -source 13 MultipleLabelsStatement.java
+ * @compile --enable-preview -source ${jdk.version} MultipleLabelsStatement.java
* @run main/othervm --enable-preview MultipleLabelsStatement
*/
--- a/test/langtools/tools/javac/switchextra/RuleParsingTest.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/langtools/tools/javac/switchextra/RuleParsingTest.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, 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
@@ -48,10 +48,11 @@
public class RuleParsingTest {
public static void main(String[] args) throws Exception {
- new RuleParsingTest().testParseComplexExpressions();
+ String sourceVersion = Integer.toString(Runtime.version().feature());
+ new RuleParsingTest().testParseComplexExpressions(sourceVersion);
}
- void testParseComplexExpressions() throws Exception {
+ void testParseComplexExpressions(String sourceVersion) throws Exception {
String[] expressions = {
"(a)",
"a",
@@ -94,7 +95,7 @@
StringWriter out = new StringWriter();
JavacTask ct = (JavacTask) tool.getTask(out, null, noErrors,
- List.of("--enable-preview", "-source", "13"), null,
+ List.of("--enable-preview", "-source", sourceVersion), null,
Arrays.asList(new MyFileObject(code.toString())));
CompilationUnitTree cut = ct.parse().iterator().next();
Trees trees = Trees.instance(ct);
--- a/test/langtools/tools/javac/switchextra/SwitchArrowBrokenConstant.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/langtools/tools/javac/switchextra/SwitchArrowBrokenConstant.java Tue Feb 26 12:11:29 2019 -0500
@@ -3,7 +3,7 @@
* @bug 8206986
* @summary Verify reasonable errors are produced when neither ':' nor '->'
* is found are the expression of a case
- * @compile/fail/ref=SwitchArrowBrokenConstant.out -source 13 --enable-preview -Xlint:-preview -XDrawDiagnostics SwitchArrowBrokenConstant.java
+ * @compile/fail/ref=SwitchArrowBrokenConstant.out -source ${jdk.version} --enable-preview -Xlint:-preview -XDrawDiagnostics SwitchArrowBrokenConstant.java
*/
public class SwitchArrowBrokenConstant {
--- a/test/langtools/tools/javac/switchextra/SwitchStatementArrow.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/langtools/tools/javac/switchextra/SwitchStatementArrow.java Tue Feb 26 12:11:29 2019 -0500
@@ -3,7 +3,7 @@
* @bug 8206986
* @summary Verify rule cases work properly.
* @compile/fail/ref=SwitchStatementArrow-old.out -source 9 -Xlint:-options -XDrawDiagnostics SwitchStatementArrow.java
- * @compile --enable-preview -source 13 SwitchStatementArrow.java
+ * @compile --enable-preview -source ${jdk.version} SwitchStatementArrow.java
* @run main/othervm --enable-preview SwitchStatementArrow
*/
--- a/test/langtools/tools/javac/switchextra/SwitchStatementBroken.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/langtools/tools/javac/switchextra/SwitchStatementBroken.java Tue Feb 26 12:11:29 2019 -0500
@@ -2,7 +2,7 @@
* @test /nodynamiccopyright/
* @bug 8206986
* @summary Verify that rule and ordinary cases cannot be mixed.
- * @compile/fail/ref=SwitchStatementBroken.out -XDrawDiagnostics --enable-preview -source 13 SwitchStatementBroken.java
+ * @compile/fail/ref=SwitchStatementBroken.out -XDrawDiagnostics --enable-preview -source ${jdk.version} SwitchStatementBroken.java
*/
public class SwitchStatementBroken {
--- a/test/langtools/tools/javac/switchextra/SwitchStatementBroken2.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/langtools/tools/javac/switchextra/SwitchStatementBroken2.java Tue Feb 26 12:11:29 2019 -0500
@@ -2,7 +2,7 @@
* @test /nodynamiccopyright/
* @bug 8206986
* @summary Verify that not allowed types of statements cannot be used in rule case.
- * @compile/fail/ref=SwitchStatementBroken2.out -XDrawDiagnostics --enable-preview -source 13 SwitchStatementBroken2.java
+ * @compile/fail/ref=SwitchStatementBroken2.out -XDrawDiagnostics --enable-preview -source ${jdk.version} SwitchStatementBroken2.java
*/
public class SwitchStatementBroken2 {
--- a/test/langtools/tools/javac/switchextra/SwitchStatementScopesIsolated.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/langtools/tools/javac/switchextra/SwitchStatementScopesIsolated.java Tue Feb 26 12:11:29 2019 -0500
@@ -2,7 +2,7 @@
* @test /nodynamiccopyright/
* @bug 8206986
* @summary Verify that scopes in rule cases are isolated.
- * @compile/fail/ref=SwitchStatementScopesIsolated.out -XDrawDiagnostics --enable-preview -source 13 SwitchStatementScopesIsolated.java
+ * @compile/fail/ref=SwitchStatementScopesIsolated.out -XDrawDiagnostics --enable-preview -source ${jdk.version} SwitchStatementScopesIsolated.java
*/
public class SwitchStatementScopesIsolated {
--- a/test/langtools/tools/javadoc/6176978/T6176978.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,81 +0,0 @@
-/*
- * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * 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 6176978
- * @summary current Javadoc's invocation and extension (Doclet) mechanisms are problematic
- * @modules jdk.javadoc
- * @build T6176978
- * @run main T6176978
- */
-
-import java.io.*;
-import java.net.*;
-
-public class T6176978
-{
- public static void main(String[] args) throws Exception {
- // create and use a temp dir that will not be on jtreg's
- // default class path
- File tmpDir = new File("tmp");
- tmpDir.mkdirs();
-
- File testSrc = new File(System.getProperty("test.src", "."));
- String[] javac_args = {
- "-d",
- "tmp",
- new File(testSrc, "X.java").getPath()
- };
-
- int rc = com.sun.tools.javac.Main.compile(javac_args);
- if (rc != 0)
- throw new Error("javac exit code: " + rc);
-
- String[] jdoc_args = {
- "-doclet",
- "X",
- new File(testSrc, "T6176978.java").getPath()
- };
-
- rc = com.sun.tools.javadoc.Main.execute(jdoc_args);
- if (rc == 0)
- throw new Error("javadoc unexpectedly succeeded");
-
-
-
- Thread currThread = Thread.currentThread();
- ClassLoader saveClassLoader = currThread.getContextClassLoader();
- URLClassLoader urlCL = new URLClassLoader(new URL[] { tmpDir.toURL() });
- currThread.setContextClassLoader(urlCL);
-
- try {
- rc = com.sun.tools.javadoc.Main.execute(jdoc_args);
- if (rc != 0)
- throw new Error("javadoc exit: " + rc);
- }
- finally {
- currThread.setContextClassLoader(saveClassLoader);
- }
- }
-}
--- a/test/langtools/tools/javadoc/6176978/X.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-/*
- * Copyright (c) 2008, 2009, 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.
- */
-
-import com.sun.javadoc.*;
-
-public class X {
- public static boolean start(RootDoc root) {
- System.out.println("X.start");
- return true;
- }
-}
--- a/test/langtools/tools/javadoc/6227454/Test.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,142 +0,0 @@
-/*
- * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * 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 6227454
- * @summary package.html and overview.html may not be read fully
- * @modules jdk.javadoc
- */
-
-import java.io.*;
-
-import com.sun.javadoc.Doclet;
-import com.sun.javadoc.RootDoc;
-
-public class Test extends Doclet {
- public static void main(String... args) throws Exception {
- new Test().run();
- }
-
- void run() throws Exception {
- test("<body>ABC XYZ</body>");
- test("<body>ABC XYZ</BODY>");
- test("<BODY>ABC XYZ</body>");
- test("<BODY>ABC XYZ</BODY>");
- test("<BoDy>ABC XYZ</bOdY>");
- test(" ABC XYZ</bOdY>", "Body tag missing from HTML");
- test("<body>ABC XYZ ", "Close body tag missing from HTML");
- test(" ABC XYZ ", "Body tag missing from HTML");
- test("<body>ABC" + bigText(8192, 40) + "XYZ</body>");
-
- if (errors > 0)
- throw new Exception(errors + " errors occurred");
- }
-
- void test(String body) throws IOException {
- test(body, null);
- }
-
- void test(String body, String expectError) throws IOException {
- String docType = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" "
- + "\"http://www.w3.org/TR/html4/loose.dtd\">";
- String headTag = "<head><title>Title </title></head>";
- String text = docType + "<html>" + headTag + body + "</html>";
- testNum++;
- System.err.println("test " + testNum);
- File file = writeFile("overview" + testNum + ".html", text);
- String thisClassName = Test.class.getName();
- File testSrc = new File(System.getProperty("test.src"));
- String[] args = {
- "-classpath", ".",
- "-package",
- "-overview", file.getPath(),
- new File(testSrc, thisClassName + ".java").getPath()
- };
-
- StringWriter sw = new StringWriter();
- PrintWriter pw = new PrintWriter(sw);
- int rc = com.sun.tools.javadoc.Main.execute(
- "javadoc",
- pw, pw, pw,
- thisClassName,
- args);
- pw.close();
- String out = sw.toString();
- if (!out.isEmpty())
- System.err.println(out);
- System.err.println("javadoc exit: rc=" + rc);
-
- if (expectError == null) {
- if (rc != 0)
- error("unexpected exit from javadoc; rc:" + rc);
- } else {
- if (!out.contains(expectError))
- error("expected error text not found: " + expectError);
- }
- }
-
- String bigText(int lines, int lineLength) {
- StringBuilder sb = new StringBuilder();
- for (int i = 0; i < lineLength; i++)
- sb.append(String.valueOf(i % 10));
- sb.append("\n");
- String line = sb.toString();
- sb.setLength(0);
- for (int i = 0; i < lines; i++)
- sb.append(line);
- return sb.toString();
- }
-
- File writeFile(String path, String body) throws IOException {
- File f = new File(path);
- FileWriter out = new FileWriter(f);
- try {
- out.write(body);
- } finally {
- out.close();
- }
- return f;
- }
-
- void error(String msg) {
- System.err.println("Error: " + msg);
- errors++;
- }
-
- int testNum;
- int errors;
-
- public static boolean start(RootDoc root) {
- String text = root.commentText();
- if (text.length() < 64)
- System.err.println("text: '" + text + "'");
- else
- System.err.println("text: '"
- + text.substring(0, 20)
- + "..."
- + text.substring(text.length() - 20)
- + "'");
- return text.startsWith("ABC") && text.endsWith("XYZ");
- }
-}
--- a/test/langtools/tools/javadoc/6942366/T6942366.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,133 +0,0 @@
-/*
- * Copyright (c) 2010, 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.
- *
- * 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 6942366
- * @summary javadoc no longer inherits doc from sourcepath
- * @modules jdk.javadoc
- * @library /tools/javadoc/lib
- * @build p.Base Test ToyDoclet
- * @run main T6942366
- */
-
-import java.io.*;
-import java.util.*;
-
-public class T6942366 {
- public static void main(String... args) throws Exception {
- new T6942366().run();
- }
-
- File testSrc;
- File testClasses;
- int count;
- int errors;
-
- void run() throws Exception {
- testSrc = new File(System.getProperty("test.src"));
- testClasses = new File(System.getProperty("test.classes"));
-
- test(true, false);
- test(false, true);
- test(true, true);
-
- if (errors > 0)
- throw new Exception(errors + " errors found");
- }
-
- void test(boolean useSourcePath, boolean useClassPath) throws Exception {
- System.out.println("test " + (++count) + " sp:" + useSourcePath + " cp:" + useClassPath);
- File testDir = new File("test" + count);
- testDir.mkdirs();
-
- List<String> args = new ArrayList<String>();
- args.add("-doclet");
- args.add("ToyDoclet");
- if (useSourcePath) {
- args.add("-sourcepath");
- args.add(testSrc.getPath());
- }
- if (useClassPath) {
- args.add("-classpath");
- args.add(testClasses.getPath());
- } else {
- // override classpath to avoid stuff jtreg might have put on papth
- args.add("-classpath");
- args.add(".");
- }
-
- args.add(new File(testSrc, "Test.java").getPath());
- System.out.println("ToyDoclet: " + args);
-
- StringWriter sw = new StringWriter();
- PrintWriter pw = new PrintWriter(sw);
-
- int rc = com.sun.tools.javadoc.Main.execute("ToyDoclet", pw, pw, pw,
- "ToyDoclet", getClass().getClassLoader(),
- args.toArray(new String[args.size()]));
-
- if (rc != 0)
- throw new Exception("unexpected exit from javadoc, rc=" + rc);
-
- if (useSourcePath && useClassPath) {
- long srcLastMod = new File(testSrc, "Test.java").lastModified();
- long classLastMod = new File(testClasses, "Test.class").lastModified();
- System.out.println("Test.java last modified: " + new Date(srcLastMod));
- System.out.println("Test.class last modified: " + new Date(classLastMod));
- System.out.println((srcLastMod > classLastMod ? "source" : "class") + " is newer");
- }
-
- String s = "javadoc-for-Base.m";
- boolean expect = useSourcePath;
- boolean found = sw.toString().contains(s);
- if (found) {
- if (expect)
- System.out.println("javadoc content \"" + s + "\" found, as expected");
- else
- error("javadoc content \"" + s + "\" found unexpectedly");
- } else {
- if (expect)
- error("javadoc content \"" + s + "\" not found");
- else
- System.out.println("javadoc content \"" + s + "\" not found, as expected");
- }
-
- System.out.println();
- }
-
- boolean contains(File f, String s) throws Exception {
- byte[] buf = new byte[(int) f.length()];
- try (DataInputStream in = new DataInputStream(new FileInputStream(f))) {
- in.readFully(buf);
- }
- return new String(buf).contains(s);
- }
-
- void error(String msg) {
- System.out.println("Error: " + msg);
- errors++;
- }
-
-}
-
--- a/test/langtools/tools/javadoc/6942366/Test.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * 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.
- */
-
-public class Test extends p.Base {
- // overrides Base.m
- public void m() { }
-}
-
--- a/test/langtools/tools/javadoc/6942366/p/Base.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * 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 p;
-
-public class Base {
- /** javadoc-for-Base.m. */
- public void m() { }
-}
-
--- a/test/langtools/tools/javadoc/6958836/Test.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,177 +0,0 @@
-/*
- * Copyright (c) 2010, 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.
- *
- * 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 6958836 8002168
- * @summary javadoc should support -Xmaxerrs and -Xmaxwarns
- * @modules jdk.javadoc
- */
-
-import java.io.*;
-import java.util.*;
-
-import com.sun.javadoc.DocErrorReporter;
-import com.sun.javadoc.RootDoc;
-
-
-
-public class Test {
- private static final String ERROR_MARKER = "Error-count";
- private static final String WARNING_MARKER = "Warning-count";
-
- public static void main(String... args) throws Exception {
- new Test().run();
- }
-
- void run() throws Exception {
- javadoc("Errors", list(), 10, 0);
- javadoc("Errors", list("-Xmaxerrs", "0"), 10, 0);
- javadoc("Errors", list("-Xmaxerrs", "2"), 2, 0);
- javadoc("Errors", list("-Xmaxerrs", "4"), 4, 0);
- javadoc("Errors", list("-Xmaxerrs", "20"), 10, 0);
-
- javadoc("Warnings", list(), 0, 10);
- javadoc("Warnings", list("-Xmaxwarns", "0"), 0, 10);
- javadoc("Warnings", list("-Xmaxwarns", "2"), 0, 2);
- javadoc("Warnings", list("-Xmaxwarns", "4"), 0, 4);
- javadoc("Warnings", list("-Xmaxwarns", "20"), 0, 10);
-
- if (errors > 0)
- throw new Exception(errors + " errors occurred.");
- }
-
- void javadoc(String selector, List<String> testOpts,
- int expectErrs, int expectWarns) {
- System.err.println("Test " + (++count) + ": " + selector + " " + testOpts);
- File testOutDir = new File("test" + count);
-
- List<String> opts = new ArrayList<String>();
- // Force en_US locale in lieu of something like -XDrawDiagnostics.
- // For some reason, this must be the first option when used.
- opts.addAll(list("-locale", "en_US"));
- opts.add(new File(System.getProperty("test.src"),
- Test.class.getSimpleName() + ".java").getPath());
- opts.addAll(testOpts);
- opts.add("-gen" + selector);
-
- StringWriter errSW = new StringWriter();
- PrintWriter errPW = new PrintWriter(errSW);
- StringWriter warnSW = new StringWriter();
- PrintWriter warnPW = new PrintWriter(warnSW);
- StringWriter noteSW = new StringWriter();
- PrintWriter notePW = new PrintWriter(noteSW);
-
- int rc = com.sun.tools.javadoc.Main.execute("javadoc",
- errPW, warnPW, notePW,
- "Test$TestDoclet",
- getClass().getClassLoader(),
- opts.toArray(new String[opts.size()]));
- System.err.println("rc: " + rc);
-
- errPW.close();
- String errOut = errSW.toString();
- System.err.println("Errors:\n" + errOut);
- warnPW.close();
- String warnOut = warnSW.toString();
- System.err.println("Warnings:\n" + warnOut);
- notePW.close();
- String noteOut = noteSW.toString();
- System.err.println("Notes:\n" + noteOut);
-
- check(errOut, ERROR_MARKER, expectErrs);
- check(warnOut, WARNING_MARKER, expectWarns); // requires -locale en_US
- }
-
- void check(String text, String expectText, int expectCount) {
- int foundCount = 0;
- for (String line: text.split("[\r\n]+")) {
- if (line.contains(expectText))
- foundCount++;
- }
- if (foundCount != expectCount) {
- error("incorrect number of matches found: " + foundCount
- + ", expected: " + expectCount);
- }
- }
-
- private List<String> list(String... args) {
- return Arrays.asList(args);
- }
-
- void error(String msg) {
- System.err.println(msg);
- errors++;
- }
-
- int count;
- int errors;
-
- public static class TestDoclet {
- static boolean genErrors = false;
- static boolean genWarnings = false;
-
- public static boolean start(RootDoc root) {
- // generate 10 errors or warnings
- for (int i = 1 ; i <= 10 ; i++) {
- if (genErrors)
- root.printError(ERROR_MARKER + " " + i);
- if (genWarnings)
- root.printWarning(WARNING_MARKER + " " + i);
- }
- return true;
- }
-
- public static int optionLength(String option) {
- if (option == null) {
- throw new Error("invalid usage: ");
- }
- System.out.println("option: " + option);
- switch (option.trim()) {
- case "-genErrors":
- return 1;
- case "-genWarnings":
- return 1;
- default:
- return 0;
- }
- }
-
- public static boolean validOptions(String[][] options, DocErrorReporter reporter) {
- for (int i = 0 ; i < options.length; i++) {
- String opt = options[i][0].trim();
- switch (opt) {
- case "-genErrors":
- genErrors = true;
- genWarnings = false;
- break;
- case "-genWarnings":
- genErrors = false;
- genWarnings = true;
- break;
- }
- }
- return true;
- }
- }
-}
--- a/test/langtools/tools/javadoc/6964914/Error.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-/*
- * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * 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.
- */
-
-public class Error {
- Object x // no semicolon
-}
--- a/test/langtools/tools/javadoc/6964914/JavacWarning.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-/*
- * Copyright (c) 2010, 2014, 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.
- */
-
-public class JavacWarning {
- String _ = null; // this will cause a warning with -source 8 (this is an error as of -source 9)
-}
--- a/test/langtools/tools/javadoc/6964914/JavadocWarning.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-/*
- * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * 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.
- */
-
-public class JavadocWarning {
- /** @see DoesNotExist */
- int x;
-}
--- a/test/langtools/tools/javadoc/6964914/Test.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +0,0 @@
-/*
- * Copyright (c) 2010, 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.
- *
- * 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 6964914
- * @summary javadoc does not output number of warnings using user written doclet
- * @modules jdk.javadoc/com.sun.tools.doclets.standard
- */
-
-import java.io.*;
-
-public class Test {
- public static void main(String... args) throws Exception {
- new Test().run();
- }
-
- public void run() throws Exception {
- javadoc("Error.java", "1 error");
- javadoc("JavacWarning.java", "1 warning");
- if (errors > 0)
- throw new Exception(errors + " errors found");
- }
-
- void javadoc(String path, String expect) {
- File testSrc = new File(System.getProperty("test.src"));
- String[] args = {
- "-source", "8",
- "-classpath", ".",
- "-package",
- new File(testSrc, path).getPath()
- };
-
- StringWriter sw = new StringWriter();
- PrintWriter pw = new PrintWriter(sw);
- int rc = com.sun.tools.javadoc.Main.execute(
- "javadoc",
- pw, pw, pw,
- com.sun.tools.doclets.standard.Standard.class.getName(),
- args);
- pw.close();
- String out = sw.toString();
- if (!out.isEmpty())
- System.err.println(out);
- System.err.println("javadoc exit: rc=" + rc);
-
- if (!out.contains(expect))
- error("expected text not found: " + expect);
- }
-
- void error(String msg) {
- System.err.println("Error: " + msg);
- errors++;
- }
-
- int errors;
-}
--- a/test/langtools/tools/javadoc/6964914/TestStdDoclet.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,104 +0,0 @@
-/*
- * Copyright (c) 2011, 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 6964914 8182765
- * @summary javadoc does not output number of warnings using user written doclet
- */
-
-import java.io.*;
-import java.util.*;
-
-/**
- * Dummy javadoc comment.
- * @author jjg
- * @see DoesNotExist
- */
-public class TestStdDoclet {
- public static void main(String... args) throws Exception {
- new TestStdDoclet().run();
- }
-
- /**
- * More dummy comments.
- * @throws DoesNotExist oops, javadoc does not see this
- * @see DoesNotExist
- */
- void run() throws Exception {
- File javaHome = new File(System.getProperty("java.home"));
- File javadoc = new File(new File(javaHome, "bin"), "javadoc");
- File testSrc = new File(System.getProperty("test.src"));
-
- // run javadoc in separate process to ensure doclet executed under
- // normal user conditions w.r.t. classloader
- String thisClassName = TestStdDoclet.class.getName();
- List<String> cmdArgs = new ArrayList<>();
- cmdArgs.add(javadoc.getPath());
- cmdArgs.addAll(Arrays.asList(
- "-classpath", ".", // insulates us from ambient classpath
- "-Xdoclint:none",
- "-package",
- new File(testSrc, thisClassName + ".java").getPath()
- ));
- Process p = new ProcessBuilder()
- .command(cmdArgs)
- .redirectErrorStream(true)
- .start();
-
- int actualDocletWarnCount = 0;
- int reportedDocletWarnCount = 0;
- BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream()));
- try {
- String line;
- while ((line = in.readLine()) != null) {
- System.err.println(line);
- if (line.contains("DoesNotExist"))
- actualDocletWarnCount++;
- if (line.matches("[0-9]+ warning(s)?"))
- reportedDocletWarnCount =
- Integer.valueOf(line.substring(0, line.indexOf(" ")));
- }
- } finally {
- in.close();
- }
- int rc = p.waitFor();
- if (rc != 0)
- System.err.println("javadoc failed, rc:" + rc);
-
- int expectedDocletWarnCount = 2;
- checkEqual("actual", actualDocletWarnCount, "expected", expectedDocletWarnCount);
- checkEqual("actual", actualDocletWarnCount, "reported", reportedDocletWarnCount);
- }
-
- /**
- * Private method should not cause a warning.
- * @see DoesNotExist
- */
- private void checkEqual(String l1, int i1, String l2, int i2) throws Exception {
- if (i1 != i2)
- throw new Exception(l1 + " warn count, " + i1 + ", does not match "
- + l2 + " warn count, " + i2);
- }
-
-}
--- a/test/langtools/tools/javadoc/6964914/TestUserDoclet.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,103 +0,0 @@
-/*
- * Copyright (c) 2011, 2016, 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 6964914
- * @summary javadoc does not output number of warnings using user written doclet
- * @modules jdk.javadoc
- */
-
-import java.io.*;
-import java.util.*;
-
-import com.sun.javadoc.Doclet;
-import com.sun.javadoc.RootDoc;
-
-public class TestUserDoclet extends Doclet {
- public static void main(String... args) throws Exception {
- new TestUserDoclet().run();
- }
-
- static final String docletWarning = "warning from test doclet";
-
- /** Main doclet method. */
- public static boolean start(RootDoc root) {
- root.printWarning(null, docletWarning);
- return true;
- }
-
- /** Main test method. */
- void run() throws Exception {
- File javaHome = new File(System.getProperty("java.home"));
- File javadoc = new File(new File(javaHome, "bin"), "javadoc");
- File testSrc = new File(System.getProperty("test.src"));
- File testClasses = new File(System.getProperty("test.classes"));
-
- // run javadoc in separate process to ensure doclet executed under
- // normal user conditions w.r.t. classloader
- String thisClassName = TestUserDoclet.class.getName();
- List<String> cmdArgs = new ArrayList<>();
- cmdArgs.add(javadoc.getPath());
- cmdArgs.addAll(Arrays.asList(
- "-doclet", thisClassName,
- "-docletpath", testClasses.getPath(),
- new File(testSrc, thisClassName + ".java").getPath()
- ));
- Process p = new ProcessBuilder()
- .command(cmdArgs)
- .redirectErrorStream(true)
- .start();
-
- int actualDocletWarnCount = 0;
- int reportedDocletWarnCount = 0;
- BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream()));
- try {
- String line;
- while ((line = in.readLine()) != null) {
- System.err.println(line);
- if (line.contains(docletWarning))
- actualDocletWarnCount++;
- if (line.matches("[0-9]+ warning(s)?"))
- reportedDocletWarnCount =
- Integer.valueOf(line.substring(0, line.indexOf(" ")));
- }
- } finally {
- in.close();
- }
- int rc = p.waitFor();
- if (rc != 0)
- System.err.println("javadoc failed, rc:" + rc);
-
- int expectedDocletWarnCount = 1;
- checkEqual("actual", actualDocletWarnCount, "expected", expectedDocletWarnCount);
- checkEqual("actual", actualDocletWarnCount, "reported", reportedDocletWarnCount);
- }
-
- void checkEqual(String l1, int i1, String l2, int i2) throws Exception {
- if (i1 != i2)
- throw new Exception(l1 + " warn count, " + i1 + ", does not match "
- + l2 + " warn count, " + i2);
- }
-
-}
--- a/test/langtools/tools/javadoc/8025693/Test.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,92 +0,0 @@
-/*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * 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 8025693
- * @summary javadoc should ignore <clinit> methods found in classes on classpath
- * @modules jdk.javadoc
- */
-
-import java.io.*;
-
-public class Test {
- public static void main(String[] args) throws Exception {
- new Test().run();
- }
-
- final File baseFile = new File("src/Base.java");
- final String baseText =
- "package p;\n" +
- "public class Base { static { } }\n";
-
- final File srcFile = new File("src/C.java");
- final String srcText =
- "package p;\n" +
- "/** comment */\n" +
- "public abstract class C extends Base { }\n";
-
- void run() throws Exception {
- File classesDir = new File("classes");
- classesDir.mkdirs();
- writeFile(baseFile, baseText);
- String[] javacArgs = {
- "-d", classesDir.getPath(),
- baseFile.getPath()
- };
- com.sun.tools.javac.Main.compile(javacArgs);
-
- writeFile(srcFile, srcText);
- String[] args = {
- "-d", "api",
- "-classpath", classesDir.getPath(),
- "-package", "p",
- srcFile.getPath()
- };
-
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- PrintStream ps = new PrintStream(baos);
- PrintStream prev = System.err;
- System.setErr(ps);
- try {
- int rc = com.sun.tools.javadoc.Main.execute(args);
- } finally {
- System.err.flush();
- System.setErr(prev);
- }
- String out = baos.toString();
- System.out.println(out);
-
- String errorMessage = "java.lang.IllegalArgumentException: <clinit>";
- if (out.contains(errorMessage))
- throw new Exception("error message found: " + errorMessage);
- }
-
- void writeFile(File file, String body) throws IOException {
- file.getParentFile().mkdirs();
- try (FileWriter out = new FileWriter(file)) {
- out.write(body);
- }
- }
-}
-
--- a/test/langtools/tools/javadoc/8147801/T8147801.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,181 +0,0 @@
-/*
- * Copyright (c) 2016, 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.
- *
- * 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 8147801
- * @summary java.nio.file.ClosedFileSystemException when using Javadoc API's in JDK9
- * @modules jdk.javadoc/com.sun.tools.javadoc
- * @library jarsrc
- * @build lib.* p.*
- * @run main T8147801
- */
-
-import java.io.File;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.nio.file.ClosedFileSystemException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.jar.JarEntry;
-import java.util.jar.JarOutputStream;
-import java.util.stream.Stream;
-
-import com.sun.javadoc.ClassDoc;
-import com.sun.javadoc.FieldDoc;
-import com.sun.javadoc.RootDoc;
-
-/*
- * This test verifies the use of the hidden fileManager.deferClose
- * option, to work around the limitation that javadoc objects
- * (like RootDoc and related types) should cannot normally be used
- * after javadoc exits, closing its file manager (if it opened it.)
- *
- * The test runs javadoc on a chain of classes, 1 in source form,
- * and 2 in a jar file. javadoc/javac will "complete" classes found
- * in source, but will eagerly "classes" in class form.
- * The chain is p/Test.java -> lib/Lib1.class -> lib/Lib2.class.
- * After javadoc exits, the classes are examined, to finally force
- * the classes to be completed, possibly causing javac to try and access
- * references into a .jar file system which has now been closed.
- *
- * The test runs two test cases -- one without the workaround option,
- * to test the validity of the test case, and one with the workaround
- * option, to test that it works as expected.
- */
-public class T8147801 {
- public static void main(String... args) throws Exception {
- new T8147801().run();
- }
-
- void run() throws Exception {
- initJar();
- test(false);
- test(true);
- if (errors > 0) {
- throw new Exception(errors + " errors occurred");
- }
- }
-
- void test(boolean withOption) {
- System.err.println("Testing " + (withOption ? "with" : "without") + " option");
- try {
- String dump = "";
- RootDoc root = getRootDoc(withOption);
- for (ClassDoc cd: root.specifiedClasses()) {
- dump += dump(cd);
- }
- if (dump.contains("lib.Lib2.i")) {
- if (!withOption) {
- error("control case failed: Lib2 class file was read, unexpectedly, without using option");
- }
- } else {
- if (withOption) {
- error("test case failed: could not read Lib2 class file, using option");
- }
- }
- } catch (ClosedFileSystemException e) {
- error("Unexpected exception: " + e);
- }
- System.err.println();
- }
-
- RootDoc getRootDoc(boolean withOption) {
- List<String> opts = new ArrayList<>();
- if (withOption)
- opts.add("-XDfileManager.deferClose=10");
- opts.add("-doclet");
- opts.add(getClass().getName());
- opts.add("-classpath");
- opts.add(jarPath.toString());
- opts.add(Paths.get(System.getProperty("test.src"), "p", "Test.java").toString());
- System.err.println("javadoc opts: " + opts);
- int rc = com.sun.tools.javadoc.Main.execute(
- "javadoc",
- // by specifying our own class loader, we get the same Class instance as this
- getClass().getClassLoader(),
- opts.toArray(new String[opts.size()]));
- if (rc != 0) {
- error("unexpected exit from javadoc or doclet: " + rc);
- }
- return cachedRoot;
- }
-
- String dump(ClassDoc cd) {
- StringWriter sw = new StringWriter();
- PrintWriter pw = new PrintWriter(sw);
- dump(pw, "", cd);
- String out = sw.toString();
- System.err.println(out);
- return out;
- }
-
- void dump(PrintWriter out, String prefix, ClassDoc cd) {
- out.println(prefix + "class: " + cd);
- for (FieldDoc fd: cd.fields()) {
- out.println(prefix + " " + fd);
- if (fd.type().asClassDoc() != null) {
- dump(out, prefix + " ", fd.type().asClassDoc());
- }
- }
- }
-
- void initJar() throws IOException {
- String testClassPath = System.getProperty("test.class.path", "");
- Path jarsrc = Stream.of(testClassPath.split(File.pathSeparator))
- .map(Paths::get)
- .filter(e -> e.endsWith("jarsrc"))
- .findAny()
- .orElseThrow(() -> new InternalError("jarsrc not found"));
- jarPath = Paths.get("lib.jar");
- try (JarOutputStream out = new JarOutputStream(Files.newOutputStream(jarPath))) {
- String[] classNames = {"Lib1.class", "Lib2.class"};
- for (String cn : classNames) {
- out.putNextEntry(new JarEntry("lib/" + cn));
- Path libClass = jarsrc.resolve("lib").resolve(cn);
- out.write(Files.readAllBytes(libClass));
- }
- }
- }
-
- void error(String msg) {
- System.err.println("Error: " + msg);
- errors++;
- }
-
- Path jarPath;
- int errors;
-
- // Bad doclet caches the RootDoc for later use
-
- static RootDoc cachedRoot;
-
- public static boolean start(RootDoc root) {
- cachedRoot = root;
- return true;
- }
-}
--- a/test/langtools/tools/javadoc/8147801/jarsrc/lib/Lib1.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package lib;
-
-public class Lib1 {
- public Lib2 lib2;
-}
--- a/test/langtools/tools/javadoc/8147801/jarsrc/lib/Lib2.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 2016, 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.
- *
- * 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 lib;
-
-public class Lib2 {
- public int i;
-}
--- a/test/langtools/tools/javadoc/8147801/p/Test.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package p;
-
-public class Test {
- public lib.Lib1 lib1;
-}
-
--- a/test/langtools/tools/javadoc/AddOpensTest.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +0,0 @@
-/*
- * 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 8181878
- * @summary javadoc should support/ignore --add-opens
- * @modules jdk.compiler/com.sun.tools.javac.api
- * @modules jdk.compiler/com.sun.tools.javac.main
- * @modules jdk.javadoc/jdk.javadoc.internal.api
- * @modules jdk.javadoc/jdk.javadoc.internal.tool
- * @library /tools/lib /tools/javadoc/lib
- * @build toolbox.JavacTask toolbox.JavadocTask toolbox.TestRunner toolbox.ToolBox ToyDoclet
- * @run main AddOpensTest
- */
-
-import java.io.IOException;
-import java.nio.charset.StandardCharsets;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-
-import toolbox.JavadocTask;
-import toolbox.Task;
-import toolbox.TestRunner;
-import toolbox.ToolBox;
-
-public class AddOpensTest extends TestRunner {
- public static void main(String... args) throws Exception {
- AddOpensTest t = new AddOpensTest();
- t.runTests();
- }
-
- private final ToolBox tb = new ToolBox();
- private final Path src = Paths.get("src");
- private final Path api = Paths.get("api");
-
- AddOpensTest() throws Exception {
- super(System.err);
- init();
- }
-
- void init() throws IOException {
- tb.writeJavaFiles(src, "public class C { }");
- }
-
- @Test
- public void testEncoding() {
- Task.Result result = new JavadocTask(tb, Task.Mode.EXEC)
- .options("-docletpath", System.getProperty("test.class.path"),
- "-doclet", "ToyDoclet",
- "--add-opens", "some.module")
- .files(src.resolve("C.java"))
- .run(Task.Expect.SUCCESS)
- .writeAll();
- }
-}
-
--- a/test/langtools/tools/javadoc/BadOptionsTest.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,173 +0,0 @@
-/*
- * Copyright (c) 2002, 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 8169676
- * @summary boolean result of Option.process is often ignored
- * @modules jdk.compiler/com.sun.tools.javac.api
- * @modules jdk.compiler/com.sun.tools.javac.main
- * @modules jdk.javadoc/jdk.javadoc.internal.api
- * @modules jdk.javadoc/jdk.javadoc.internal.tool
- * @library /tools/lib /tools/javadoc/lib
- * @build toolbox.JavacTask toolbox.JavadocTask toolbox.TestRunner toolbox.ToolBox ToyDoclet
- * @run main BadOptionsTest
- */
-
-import java.io.IOException;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Locale;
-import java.util.Objects;
-import java.util.Set;
-
-import javax.lang.model.SourceVersion;
-
-import jdk.javadoc.doclet.Doclet;
-import jdk.javadoc.doclet.DocletEnvironment;
-import jdk.javadoc.doclet.Reporter;
-
-import toolbox.JavadocTask;
-import toolbox.ModuleBuilder;
-import toolbox.Task;
-import toolbox.TestRunner;
-import toolbox.ToolBox;
-
-/*
- * This is primarily a test of the error reporting mechanisms
- * for bad options provided by javac and utilized by javadoc.
- * It is not an exhaustive test of all bad option forms detected
- * by javac/javadoc.
- */
-public class BadOptionsTest extends TestRunner {
-
- public static void main(String... args) throws Exception {
- BadOptionsTest t = new BadOptionsTest();
- t.runTests();
- }
-
- private final ToolBox tb = new ToolBox();
- private final Path src = Paths.get("src");
- private final Class<?> docletClass;
-
- BadOptionsTest() throws Exception {
- super(System.err);
- docletClass = getClass().getClassLoader().loadClass("ToyDoclet");
- init();
- }
-
- void init() throws IOException {
- tb.writeJavaFiles(src,
- "public class C { }");
-
- }
-
- @Test
- public void testAddModulesEmptyArg() {
- Task.Result result = new JavadocTask(tb, Task.Mode.API)
- .docletClass(docletClass)
- .options("--add-modules", "")
- .files(src.resolve("C.java"))
- .run(Task.Expect.FAIL)
- .writeAll();
- checkFound(result.getOutput(Task.OutputKind.DIRECT),
- "javadoc: error - error: no value for --add-modules option");
- checkNotFound(result, "Exception", "at jdk.javadoc/");
- }
-
- @Test
- public void testAddModulesBadName() {
- Task.Result result = new JavadocTask(tb, Task.Mode.API)
- .docletClass(docletClass)
- .options("--add-modules", "123")
- .files(src.resolve("C.java"))
- .run(Task.Expect.FAIL)
- .writeAll();
- checkFound(result.getOutput(Task.OutputKind.DIRECT),
- "error: bad name in value for --add-modules option: '123'");
- checkNotFound(result, "Exception", "at jdk.javadoc/");
- }
-
- @Test
- public void testAddExportsEmptyArg() {
- Task.Result result = new JavadocTask(tb, Task.Mode.API)
- .docletClass(docletClass)
- .options("--add-exports", "")
- .files(src.resolve("C.java"))
- .run(Task.Expect.FAIL)
- .writeAll();
- checkFound(result.getOutput(Task.OutputKind.DIRECT),
- "javadoc: error - error: no value for --add-exports option");
- checkNotFound(result, "Exception", "at jdk.javadoc/");
- }
-
- @Test
- public void testAddExportsBadArg() {
- Task.Result result = new JavadocTask(tb, Task.Mode.API)
- .docletClass(docletClass)
- .options("--add-exports", "m/p")
- .files(src.resolve("C.java"))
- .run(Task.Expect.FAIL)
- .writeAll();
- checkFound(result.getOutput(Task.OutputKind.DIRECT),
- "javadoc: error - error: bad value for --add-exports option: 'm/p'");
- checkNotFound(result, "Exception", "at jdk.javadoc/");
- }
-
- @Test
- public void testAddExportsBadName() {
- Task.Result result = new JavadocTask(tb, Task.Mode.API)
- .docletClass(docletClass)
- .options("--add-exports", "m!/p1=m2")
- .files(src.resolve("C.java"))
- .run()
- .writeAll();
- checkFound(result.getOutput(Task.OutputKind.DIRECT),
- "warning: bad name in value for --add-exports option: 'm!'");
- checkNotFound(result, "Exception", "at jdk.javadoc/");
- }
-
- private void checkFound(String log, String... expect) {
- for (String e : expect) {
- if (!log.contains(e)) {
- error("Expected string not found: '" + e + "'");
- }
- }
- }
-
- private void checkNotFound(Task.Result result, String... unexpected) {
- for (Task.OutputKind k : Task.OutputKind.values()) {
- String r = result.getOutput(k);
- for (String u : unexpected) {
- if (r.contains(u)) {
- error("Unexpected string found: '" + u + "'");
- }
- }
- }
- }
-}
--- a/test/langtools/tools/javadoc/BooleanConst.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,71 +0,0 @@
-/*
- * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * 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 4587494
- * @summary Constant field values for boolean Data-Types don't use true and false
- * @author gafter
- * @modules jdk.javadoc
- * @run main BooleanConst
- */
-
-import com.sun.javadoc.*;
-import java.util.*;
-
-public class BooleanConst extends Doclet
-{
- public static void main(String[] args) {
- // run javadoc on package p
- if (com.sun.tools.javadoc.Main.
- execute("javadoc", "BooleanConst", BooleanConst.class.getClassLoader(),
- new String[] {System.getProperty("test.src", ".") + java.io.File.separatorChar + "BooleanConst.java"}) != 0)
- throw new Error();
- }
-
- public static final boolean b1 = false;
- public static final boolean b2 = true;
-
- public static boolean start(com.sun.javadoc.RootDoc root) {
- ClassDoc[] classes = root.classes();
- if (classes.length != 1)
- throw new Error("1 " + Arrays.asList(classes));
- ClassDoc self = classes[0];
- FieldDoc[] fields = self.fields();
- if (fields.length != 2)
- throw new Error("2 " + Arrays.asList(fields));
- for (int i=0; i<fields.length; i++) {
- FieldDoc f = fields[i];
- if (f.name().equals("b1")) {
- Object value = f.constantValue();
- if (value == null || !(value instanceof Boolean) || ((Boolean)value).booleanValue())
- throw new Error("4 " + value);
- } else if (f.name().equals("b2")) {
- Object value = f.constantValue();
- if (value == null || !(value instanceof Boolean) || !((Boolean)value).booleanValue())
- throw new Error("5 " + value);
- } else throw new Error("3 " + f.name());
- }
- return true;
- }
-}
--- a/test/langtools/tools/javadoc/BreakIteratorWarning.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,66 +0,0 @@
-/*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * 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 4959985
- * @summary Verify that (verbose) warnings are no longer generated when
- * the default first-sentence algorithm doesn't match the
- * BreakIterator algorithm.
- * @modules jdk.javadoc
- */
-
-import com.sun.javadoc.*;
-
-public class BreakIteratorWarning extends Doclet {
-
- public static void main(String[] args) {
- String thisFile = "" +
- new java.io.File(System.getProperty("test.src", "."),
- "BreakIteratorWarning.java");
-
- if (com.sun.tools.javadoc.Main.execute(
- "javadoc",
- "BreakIteratorWarning",
- BreakIteratorWarning.class.getClassLoader(),
- new String[] {"-Xwerror", thisFile}) != 0)
- throw new Error("Javadoc encountered warnings or errors.");
- }
-
- public static boolean start(RootDoc root) {
- ClassDoc cd = root.classes()[0];
- FieldDoc fd = cd.fields()[0];
- fd.firstSentenceTags();
- return true;
- }
-
-
- /**
- * "He'll never catch up!" the Sicilian cried. "Inconceivable!"
- * "You keep using that word!" the Spaniard snapped. "I do not
- * think it means what you think it means."
- *
- * <p> This comment used to trigger a warning, but no longer does.
- */
- public String author = "William Goldman";
-}
--- a/test/langtools/tools/javadoc/CheckResourceKeys.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,248 +0,0 @@
-/*
- * Copyright (c) 2010, 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.
- *
- * 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 8000612
- * @summary need test program to validate javadoc resource bundles
- * @modules jdk.javadoc/com.sun.tools.javadoc.resources:open
- * jdk.jdeps/com.sun.tools.classfile
- */
-
-import java.io.*;
-import java.util.*;
-import javax.tools.*;
-import com.sun.tools.classfile.*;
-
-/**
- * Compare string constants in javadoc classes against keys in javadoc resource bundles.
- */
-public class CheckResourceKeys {
- /**
- * Main program.
- * Options:
- * -finddeadkeys
- * look for keys in resource bundles that are no longer required
- * -findmissingkeys
- * look for keys in resource bundles that are missing
- *
- * @throws Exception if invoked by jtreg and errors occur
- */
- public static void main(String... args) throws Exception {
- CheckResourceKeys c = new CheckResourceKeys();
- if (c.run(args))
- return;
-
- if (is_jtreg())
- throw new Exception(c.errors + " errors occurred");
- else
- System.exit(1);
- }
-
- static boolean is_jtreg() {
- return (System.getProperty("test.src") != null);
- }
-
- /**
- * Main entry point.
- */
- boolean run(String... args) throws Exception {
- boolean findDeadKeys = false;
- boolean findMissingKeys = false;
-
- if (args.length == 0) {
- if (is_jtreg()) {
- findDeadKeys = true;
- findMissingKeys = true;
- } else {
- System.err.println("Usage: java CheckResourceKeys <options>");
- System.err.println("where options include");
- System.err.println(" -finddeadkeys find keys in resource bundles which are no longer required");
- System.err.println(" -findmissingkeys find keys in resource bundles that are required but missing");
- return true;
- }
- } else {
- for (String arg: args) {
- if (arg.equalsIgnoreCase("-finddeadkeys"))
- findDeadKeys = true;
- else if (arg.equalsIgnoreCase("-findmissingkeys"))
- findMissingKeys = true;
- else
- error("bad option: " + arg);
- }
- }
-
- if (errors > 0)
- return false;
-
- Set<String> codeKeys = getCodeKeys();
- Set<String> resourceKeys = getResourceKeys();
-
- System.err.println("found " + codeKeys.size() + " keys in code");
- System.err.println("found " + resourceKeys.size() + " keys in resource bundles");
-
- if (findDeadKeys)
- findDeadKeys(codeKeys, resourceKeys);
-
- if (findMissingKeys)
- findMissingKeys(codeKeys, resourceKeys);
-
- return (errors == 0);
- }
-
- /**
- * Find keys in resource bundles which are probably no longer required.
- * A key is required if there is a string in the code that is a resource key,
- * or if the key is well-known according to various pragmatic rules.
- */
- void findDeadKeys(Set<String> codeKeys, Set<String> resourceKeys) {
- for (String rk: resourceKeys) {
- if (codeKeys.contains(rk))
- continue;
-
- error("Resource key not found in code: '" + rk + "'");
- }
- }
-
- /**
- * For all strings in the code that look like they might be
- * a resource key, verify that a key exists.
- */
- void findMissingKeys(Set<String> codeKeys, Set<String> resourceKeys) {
- for (String ck: codeKeys) {
- if (resourceKeys.contains(ck))
- continue;
- error("No resource for \"" + ck + "\"");
- }
- }
-
- /**
- * Get the set of strings from (most of) the javadoc classfiles.
- */
- Set<String> getCodeKeys() throws IOException {
- Set<String> results = new TreeSet<String>();
- JavaCompiler c = ToolProvider.getSystemJavaCompiler();
- try (JavaFileManager fm = c.getStandardFileManager(null, null, null)) {
- JavaFileManager.Location javadocLoc = findJavadocLocation(fm);
- String[] pkgs = {
- "com.sun.tools.javadoc"
- };
- for (String pkg: pkgs) {
- for (JavaFileObject fo: fm.list(javadocLoc,
- pkg, EnumSet.of(JavaFileObject.Kind.CLASS), true)) {
- String name = fo.getName();
- // ignore resource files
- if (name.matches(".*resources.[A-Za-z_0-9]+\\.class.*"))
- continue;
- scan(fo, results);
- }
- }
-
- // special handling for code strings synthesized in
- // com.sun.tools.doclets.internal.toolkit.util.Util.getTypeName
- String[] extras = {
- "AnnotationType", "Class", "Enum", "Error", "Exception", "Interface"
- };
- for (String s: extras) {
- if (results.contains("doclet." + s))
- results.add("doclet." + s.toLowerCase());
- }
-
- // special handling for code strings synthesized in
- // com.sun.tools.javadoc.Messager
- results.add("javadoc.error.msg");
- results.add("javadoc.note.msg");
- results.add("javadoc.note.pos.msg");
- results.add("javadoc.warning.msg");
-
- return results;
- }
- }
-
- // depending on how the test is run, javadoc may be on bootclasspath or classpath
- JavaFileManager.Location findJavadocLocation(JavaFileManager fm) {
- JavaFileManager.Location[] locns =
- { StandardLocation.PLATFORM_CLASS_PATH, StandardLocation.CLASS_PATH };
- try {
- for (JavaFileManager.Location l: locns) {
- JavaFileObject fo = fm.getJavaFileForInput(l,
- "com.sun.tools.javadoc.Main", JavaFileObject.Kind.CLASS);
- if (fo != null) {
- System.err.println("found javadoc in " + l);
- return l;
- }
- }
- } catch (IOException e) {
- throw new Error(e);
- }
- throw new IllegalStateException("Cannot find javadoc");
- }
-
- /**
- * Get the set of strings from a class file.
- * Only strings that look like they might be a resource key are returned.
- */
- void scan(JavaFileObject fo, Set<String> results) throws IOException {
- //System.err.println("scan " + fo.getName());
- InputStream in = fo.openInputStream();
- try {
- ClassFile cf = ClassFile.read(in);
- for (ConstantPool.CPInfo cpinfo: cf.constant_pool.entries()) {
- if (cpinfo.getTag() == ConstantPool.CONSTANT_Utf8) {
- String v = ((ConstantPool.CONSTANT_Utf8_info) cpinfo).value;
- if (v.matches("(doclet|main|javadoc|tag)\\.[A-Za-z0-9-_.]+"))
- results.add(v);
- }
- }
- } catch (ConstantPoolException ignore) {
- } finally {
- in.close();
- }
- }
-
- /**
- * Get the set of keys from the javadoc resource bundles.
- */
- Set<String> getResourceKeys() {
- Module jdk_javadoc = ModuleLayer.boot().findModule("jdk.javadoc").get();
- String[] names = {
- "com.sun.tools.javadoc.resources.javadoc",
- };
- Set<String> results = new TreeSet<String>();
- for (String name : names) {
- ResourceBundle b = ResourceBundle.getBundle(name, jdk_javadoc);
- results.addAll(b.keySet());
- }
- return results;
- }
-
- /**
- * Report an error.
- */
- void error(String msg) {
- System.err.println("Error: " + msg);
- errors++;
- }
-
- int errors;
-}
--- a/test/langtools/tools/javadoc/CompletionError.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,158 +0,0 @@
-/*
- * Copyright (c) 2015, 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.
- *
- * 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 8135307
- * @summary Check that CompletionFailures for missing classes are not incorrectly passed to
- * the javadoc API clients.
- * @library /tools/lib
- * @modules jdk.compiler/com.sun.tools.javac.api
- * jdk.compiler/com.sun.tools.javac.main
- * jdk.jdeps/com.sun.tools.javap
- * @build toolbox.JavacTask toolbox.ToolBox
- * @run main CompletionError
- */
-
-import java.io.File;
-
-import com.sun.javadoc.*;
-import com.sun.tools.javadoc.Main;
-
-import toolbox.JavacTask;
-import toolbox.ToolBox;
-
-public class CompletionError extends Doclet
-{
- private static final String template =
- "public class CompletionErrorAuxiliary #extends CompletionErrorMissing# #implements CompletionErrorIntfMissing# {" +
- " #public CompletionErrorMissing tf;#" +
- " #public CompletionErrorMissing tm() { return null; }#" +
- " #public void tm(CompletionErrorMissing m) {}#" +
- " #public void tm() throws CompletionErrorExcMissing {}#" +
- " #public <T extends CompletionErrorMissing> void tm() {}#" +
- " public String toString() { return null; }" +
- "}";
-
- private static final String testSrc = System.getProperty("test.src");
- private static final String testClassPath = System.getProperty("test.class.path");
-
- public static void main(String[] args) throws Exception {
- String[] templateParts = template.split("#");
- int sources = templateParts.length / 2;
- for (int source = 0; source < sources; source++) {
- StringBuilder testSource = new StringBuilder();
- for (int i = 0; i < templateParts.length; i += 2) {
- testSource.append(templateParts[i]);
- if (i == 2 * source) {
- testSource.append(templateParts[i + 1]);
- }
- }
- test = 0;
- testsDone = false;
- while (!testsDone) {
- ToolBox tb = new ToolBox();
- new JavacTask(tb)
- .sources(testSource.toString(),
- "public class CompletionErrorMissing {}",
- "public interface CompletionErrorIntfMissing {}",
- "public class CompletionErrorExcMissing extends Exception {}")
- .outdir(".")
- .run()
- .writeAll();
- tb.deleteFiles("CompletionErrorMissing.class", "CompletionErrorIntfMissing.class", "CompletionErrorExcMissing.class");
- // run javadoc:
- if (Main.execute("javadoc", "CompletionError", CompletionError.class.getClassLoader(),
- "-classpath", "." + File.pathSeparator + testClassPath,
- new File(testSrc, "CompletionError.java").getPath()) != 0)
- throw new Error();
- }
- }
- }
-
- private static int test;
- private static boolean testsDone;
-
- public static boolean start(com.sun.javadoc.RootDoc root) {
- ClassDoc aux = root.classNamed("CompletionErrorAuxiliary");
- if (aux == null)
- throw new AssertionError("Cannot find CompletionErrorAuxiliary");
-
- FieldDoc tf = findField(aux, "tf");
- MethodDoc tm = findMethod(aux, "tm");
- MethodDoc cm = findMethod(aux, "toString");
- switch (test) {
- case 0: aux.superclass(); break;
- case 1: aux.superclassType(); break;
- case 2: aux.interfaces(); break;
- case 3: aux.interfaceTypes(); break;
- case 4: if (tf != null) tf.type(); break;
- case 5: if (tm != null) tm.overriddenClass(); break;
- case 6: if (tm != null) tm.overriddenMethod(); break;
- case 7: if (tm != null) tm.overriddenType(); break;
- case 8:
- if (tm != null) {
- for (Parameter p : tm.parameters()) {
- p.type();
- }
- }
- break;
- case 9: if (tm != null) tm.receiverType(); break;
- case 10: if (tm != null) tm.returnType(); break;
- case 11: if (tm != null) tm.thrownExceptionTypes(); break;
- case 12: if (tm != null) tm.thrownExceptions(); break;
- case 13:
- if (tm != null) {
- for (TypeVariable tv : tm.typeParameters()) {
- tv.bounds();
- }
- }
- break;
- case 14: if (cm != null) cm.overriddenClass(); break;
- case 15: if (cm != null) cm.overriddenMethod(); break;
- case 16: if (cm != null) cm.overriddenType(); testsDone = true; break;
- default:
- throw new IllegalStateException("Unrecognized test!");
- }
- test++;
- return true;
- }
-
- private static MethodDoc findMethod(ClassDoc cd, String name) {
- for (MethodDoc m : cd.methods()) {
- if (name.equals(m.name()))
- return m;
- }
-
- return null;
- }
-
- private static FieldDoc findField(ClassDoc cd, String name) {
- for (FieldDoc m : cd.fields()) {
- if (name.equals(m.name()))
- return m;
- }
-
- return null;
- }
-}
--- a/test/langtools/tools/javadoc/EncodingTest.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,80 +0,0 @@
-/*
- * 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 8188649
- * @summary javadoc -encoding doesn't work when using the old doclet API
- * @modules jdk.compiler/com.sun.tools.javac.api
- * @modules jdk.compiler/com.sun.tools.javac.main
- * @modules jdk.javadoc/jdk.javadoc.internal.api
- * @modules jdk.javadoc/jdk.javadoc.internal.tool
- * @library /tools/lib /tools/javadoc/lib
- * @build toolbox.JavacTask toolbox.JavadocTask toolbox.TestRunner toolbox.ToolBox ToyDoclet
- * @run main EncodingTest
- */
-
-import java.io.IOException;
-import java.nio.charset.StandardCharsets;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-
-import toolbox.JavadocTask;
-import toolbox.Task;
-import toolbox.TestRunner;
-import toolbox.ToolBox;
-
-public class EncodingTest extends TestRunner {
- public static void main(String... args) throws Exception {
- EncodingTest t = new EncodingTest();
- t.runTests();
- }
-
- private final ToolBox tb = new ToolBox();
- private final Path src = Paths.get("src");
-
- EncodingTest() throws Exception {
- super(System.err);
- init();
- }
-
- void init() throws IOException {
- Files.createDirectories(src);
- Files.write(src.resolve("C.java"),
- "/** \u03b1\u03b2\u03b3 */ public class C { }".getBytes(StandardCharsets.UTF_8));
- }
-
- @Test
- public void testEncoding() {
- Task.Result result = new JavadocTask(tb, Task.Mode.EXEC)
- .options("-docletpath", System.getProperty("test.class.path"),
- "-doclet", "ToyDoclet",
- "-J-Dfile.encoding=ASCII",
- "-encoding", "UTF-8")
- .files(src.resolve("C.java"))
- .run(Task.Expect.SUCCESS)
- .writeAll();
- }
-}
-
--- a/test/langtools/tools/javadoc/FlagsTooEarly.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,63 +0,0 @@
-/*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * 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 4904495
- * @summary Compilation may go awry if we ask a symbol for its flags during
- * javac's Enter phase, before the flags are generally available.
- * @modules jdk.javadoc
- */
-
-import com.sun.javadoc.*;
-
-public class FlagsTooEarly extends Doclet {
-
- public static void main(String[] args) {
- String thisFile = "" +
- new java.io.File(System.getProperty("test.src", "."),
- "FlagsTooEarly.java");
-
- if (com.sun.tools.javadoc.Main.execute(
- "javadoc",
- "FlagsTooEarly",
- FlagsTooEarly.class.getClassLoader(),
- new String[] {"-Xwerror", thisFile}) != 0)
- throw new Error("Javadoc encountered warnings or errors.");
- }
-
- /*
- * The world's simplest doclet.
- */
- public static boolean start(RootDoc root) {
- return true;
- }
-
-
- /*
- * The following sets up the scenario for triggering the (potential) bug.
- */
- C2 c;
- static class C1 { }
- static class C2 { }
-}
--- a/test/langtools/tools/javadoc/InlineTagsWithBraces.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,82 +0,0 @@
-/*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * 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 4965490
- * @summary Verify that matching braces can appear within inline tags.
- * @modules jdk.javadoc
- */
-
-import com.sun.javadoc.*;
-
-/**
- * This is a {@code test} comment.
- * It is {@bold {@underline only} a test}.
- * We would like some code
- * {@code for (int i : nums) { doit(i); } return; }
- * to be embedded {@maybe {even {a couple {of levels}}} deep}.
- */
-public class InlineTagsWithBraces extends Doclet {
-
- private static String[] expectedTags = {
- "Text", "@code", "Text",
- "@bold", "Text", "@code", "Text",
- "@maybe", "Text"
- };
- private static String[] expectedText = {
- "This is a ", "test", " comment.\n" +
- " It is ", "{@underline only} a test", ".\n" +
- " We would like some code\n" +
- " ", "for (int i : nums) { doit(i); } return; ", "\n" +
- " to be embedded ", "{even {a couple {of levels}}} deep", "."
- };
-
-
- public static void main(String[] args) {
- String thisFile = "" +
- new java.io.File(System.getProperty("test.src", "."),
- "InlineTagsWithBraces.java");
-
- if (com.sun.tools.javadoc.Main.execute(
- "javadoc",
- "InlineTagsWithBraces",
- InlineTagsWithBraces.class.getClassLoader(),
- new String[] {"-Xwerror", thisFile}) != 0)
- throw new Error("Javadoc encountered warnings or errors.");
- }
-
- public static boolean start(RootDoc root) {
- ClassDoc cd = root.classes()[0];
- Tag[] tags = cd.inlineTags();
-
- for (int i = 0; i < tags.length; i++) {
- if (!tags[i].name().equals(expectedTags[i]) ||
- !tags[i].text().equals(expectedText[i])) {
- throw new Error("Tag \"" + tags[i] + "\" not as expected");
- }
- }
-
- return true;
- }
-}
--- a/test/langtools/tools/javadoc/LangVers.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,74 +0,0 @@
-/*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * 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 4909767
- * @summary Verify that omitting Doclet.languageVersion() hides 1.5 language
- * features from the doclet.
- * @modules jdk.javadoc
- */
-
-import java.util.List;
-import com.sun.javadoc.*;
-
-public class LangVers extends Doclet {
-
- public static void main(String[] args) {
- String thisFile = "" +
- new java.io.File(System.getProperty("test.src", "."),
- "LangVers.java");
-
- if (com.sun.tools.javadoc.Main.execute(
- "javadoc",
- "LangVers",
- LangVers.class.getClassLoader(),
- new String[] {thisFile}) != 0)
- throw new Error("Javadoc encountered warnings or errors.");
- }
-
- public static boolean start(RootDoc root) {
- ClassDoc fishdoc = root.classNamed("LangVers.Fish");
- System.out.println(fishdoc);
- if (fishdoc.isEnum()) {
- throw new Error("Enums are not hidden.");
- }
-
- for (MethodDoc meth : fishdoc.methods()) {
- System.out.println(meth);
- if (meth.flatSignature().indexOf('<') >= 0) {
- throw new Error("Type parameters are not hidden.");
- }
- }
-
- return true;
- }
-
- public enum Fish {
- One, Two, Red, Blue;
-
- public void enroll(List<? super Fish> school) {
- school.add(this);
- }
- }
-}
--- a/test/langtools/tools/javadoc/MaxWarns.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,115 +0,0 @@
-/*
- * Copyright (c) 2013, 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.
- *
- * 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 8005644
- * @summary set default max errs and max warns
- * @modules jdk.javadoc/com.sun.tools.doclets.standard
- */
-
-import java.io.File;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import com.sun.javadoc.DocErrorReporter;
-import com.sun.javadoc.RootDoc;
-
-public class MaxWarns {
- public static void main(String... args) throws Exception {
- new MaxWarns().run();
- }
-
- void run() throws Exception {
- final int defaultMaxWarns = 100;
- File f = new File(System.getProperty("test.src"), "MaxWarns.java");
- String out = javadoc(f);
- check(out, defaultMaxWarns);
-
- if (errors > 0)
- throw new Exception(errors + " errors occurred");
- }
-
- String javadoc(File f) {
- StringWriter sw = new StringWriter();
- PrintWriter pw = new PrintWriter(sw);
- String[] args = { f.getPath() };
- int rc = com.sun.tools.javadoc.Main.execute("javadoc", pw, pw, pw,
- "MaxWarns$TestDoclet",
- getClass().getClassLoader(), args);
- pw.flush();
- return sw.toString();
- }
-
- private static final String WARNING_TEXT = "count ";
-
- void check(String out, int count) {
- System.err.println(out);
- Pattern warn = Pattern.compile("warning - " + WARNING_TEXT + "[0-9]+");
- Matcher m = warn.matcher(out);
- int n = 0;
- for (int start = 0; m.find(start); start = m.start() + 1) {
- n++;
- }
- if (n != count)
- error("unexpected number of warnings reported: " + n + "; expected: " + count);
-
- Pattern warnCount = Pattern.compile("(?ms).*^([0-9]+) warnings$.*");
- m = warnCount.matcher(out);
- if (m.matches()) {
- n = Integer.parseInt(m.group(1));
- if (n != count)
- error("unexpected number of warnings reported: " + n + "; expected: " + count);
- } else
- error("total count not found");
- }
-
- void error(String msg) {
- System.err.println("Error: " + msg);
- errors++;
- }
-
- int errors;
-
- public static class TestDoclet {
-
- public static boolean start(RootDoc root) {
- // generate 150 warnings
- for (int i = 1 ; i <= 150 ; i++) {
- root.printWarning(WARNING_TEXT + i);
- }
- return true;
- }
-
- public static int optionLength(String option) {
- return 0;
- }
-
- public static boolean validOptions(String[][] options, DocErrorReporter reporter) {
- return true;
- }
- }
-}
-
--- a/test/langtools/tools/javadoc/MethodLinks.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,69 +0,0 @@
-/*
- * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * 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 4628281
- * @summary Int. links missing from return/param types when .java files passd in
- * @author gafter
- * @modules jdk.javadoc
- * @run main MethodLinks
- */
-
-import com.sun.javadoc.*;
-import java.util.*;
-
-public class MethodLinks extends Doclet
-{
- public static void main(String[] args) {
- if (com.sun.tools.javadoc.Main.
- execute("javadoc", "MethodLinks", MethodLinks.class.getClassLoader(),
- new String[] {System.getProperty("test.src", ".") +
- java.io.File.separatorChar + "MethodLinks.java"}
- ) != 0)
- throw new Error();
- }
-
- /** The parameter type and return type should link to the current
- * class. */
- public MethodLinks SAMPLE(MethodLinks x) {
- return x;
- }
-
- public static boolean start(com.sun.javadoc.RootDoc root) {
- ClassDoc[] classes = root.classes();
- if (classes.length != 1)
- throw new Error("1 " + Arrays.asList(classes));
- ClassDoc self = classes[0];
- MethodDoc[] allMethods = self.methods();
- MethodDoc SAMPLE = null;
- for (int i=0; i<allMethods.length; i++)
- if (allMethods[i].name().equals("SAMPLE"))
- SAMPLE = allMethods[i];
- return
- self == SAMPLE.parameters()[0].type().asClassDoc()
- &&
- self == SAMPLE.returnType().asClassDoc()
- ;
- }
-}
--- a/test/langtools/tools/javadoc/NoStar.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * 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 4587562
- * @summary tool: Indentation messed up for javadoc comments omitting preceding *
- * @author gafter
- * @modules jdk.javadoc
- * @run main NoStar
- */
-
-import com.sun.javadoc.*;
-import java.util.*;
-
-/** First sentence.
-0
- 1
- 2
- 3
- 4
- 5
-*/
-public class NoStar extends Doclet
-{
- public static void main(String[] args) {
- if (com.sun.tools.javadoc.Main.
- execute("javadoc", "NoStar", NoStar.class.getClassLoader(),
- new String[] {System.getProperty("test.src", ".") + java.io.File.separatorChar + "NoStar.java"}) != 0)
- throw new Error();
- }
-
- public static boolean start(com.sun.javadoc.RootDoc root) {
- ClassDoc[] classes = root.classes();
- if (classes.length != 1)
- throw new Error("1 " + Arrays.asList(classes));
- ClassDoc self = classes[0];
- String c = self.commentText();
- System.out.println("\"" + c + "\"");
- return c.equals("First sentence.\n0\n 1\n 2\n 3\n 4\n 5");
- }
-}
--- a/test/langtools/tools/javadoc/ReleaseOption.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,69 +0,0 @@
-/*
- * Copyright (c) 2015, 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.
- *
- * 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.
- */
-
-import java.io.File;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.function.Predicate;
-
-import com.sun.tools.javadoc.Main;
-
-/**
- * @test
- * @bug 8086737
- * @summary Test --release option in javadoc
- * @run main ReleaseOption
- */
-public class ReleaseOption {
- public static void main(String... args) {
- new ReleaseOption().run();
- }
-
- void run() {
- doRunTest(0, out -> out.contains("compiler.err.doesnt.exist: java.util.stream"), "--release", "7");
- doRunTest(0, out -> !out.contains("compiler.err.doesnt.exist: java.util.stream"), "--release", "8");
- doRunTest(1, out -> true, "--release", "7", "-source", "7");
- doRunTest(1, out -> true, "--release", "7", "-bootclasspath", "any");
- }
-
- void doRunTest(int expectedResult, Predicate<String> validate, String... args) {
- System.err.println("running with args: " + Arrays.asList(args));
- List<String> options = new ArrayList<>();
- options.addAll(Arrays.asList(args));
- options.add("-XDrawDiagnostics");
- options.add(new File(System.getProperty("test.src", "."), "ReleaseOptionSource.java").getPath());
- StringWriter out = new StringWriter();
- PrintWriter pw = new PrintWriter(out);
- int actualResult = Main.execute("javadoc", pw, pw, pw, "com.sun.tools.doclets.standard.Standard", options.toArray(new String[0]));
- System.err.println("actual result=" + actualResult);
- System.err.println("actual output=" + out.toString());
- if (actualResult != expectedResult)
- throw new Error("Exit code not as expected");
- if (!validate.test(out.toString())) {
- throw new Error("Output not as expected");
- }
- }
-}
--- a/test/langtools/tools/javadoc/ReleaseOptionSource.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * 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.
- */
-
-import java.util.stream.Stream;
-
-public class ReleaseOptionSource {
- public Stream s;
-}
--- a/test/langtools/tools/javadoc/T4994049/FileWithTabs.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-/*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * 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.
- */
-
-public class FileWithTabs {
-\tpublic void tabbedMethod() {}
-}
--- a/test/langtools/tools/javadoc/T4994049/T4994049.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,100 +0,0 @@
-/*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * 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 4994049
- * @summary Unit test for SourcePosition.column with respect to tab expansion
- * @author Peter von der Ah\u00e9
- * @modules jdk.javadoc
- * @run main T4994049 FileWithTabs.java
- */
-
-import com.sun.javadoc.*;
-import java.io.*;
-import static com.sun.tools.javadoc.Main.execute;
-
-public class T4994049 extends Doclet {
-
- public static boolean start(RootDoc root) {
- for (ClassDoc klass : root.classes()) {
- for (MethodDoc method : klass.methods()) {
- if (method.name().equals("tabbedMethod")) {
- if (method.position().column() == 21) {
- System.out.println(method.position().column() + ": OK!");
- return true;
- } else {
- System.err.println(method.position() + ": wrong tab expansion");
- return false;
- }
- }
- }
- }
- return false;
- }
-
- public static void main(String... args) throws Exception {
- File testSrc = new File(System.getProperty("test.src"));
- File tmpSrc = new File("tmpSrc");
- initTabs(testSrc, tmpSrc);
-
- for (String file : args) {
- File source = new File(tmpSrc, file);
- int rc = execute("javadoc", "T4994049", T4994049.class.getClassLoader(),
- new String[]{ source.getPath() } );
- if (rc != 0)
- throw new Error("Unexpected return code from javadoc: " + rc);
- }
- }
-
- static void initTabs(File from, File to) throws IOException {
- for (File f: from.listFiles()) {
- File t = new File(to, f.getName());
- if (f.isDirectory()) {
- initTabs(f, t);
- } else if (f.getName().endsWith(".java")) {
- write(t, read(f).replace("\\t", "\t"));
- }
- }
- }
-
- static String read(File f) throws IOException {
- StringBuilder sb = new StringBuilder();
- try (BufferedReader in = new BufferedReader(new FileReader(f))) {
- String line;
- while ((line = in.readLine()) != null) {
- sb.append(line);
- sb.append("\n");
- }
- }
- return sb.toString();
- }
-
- static void write(File f, String s) throws IOException {
- f.getParentFile().mkdirs();
- try (Writer out = new FileWriter(f)) {
- out.write(s);
- }
- }
-
-}
--- a/test/langtools/tools/javadoc/T6968833.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +0,0 @@
-/*
- * Copyright (c) 2002, 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.
- *
- * 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 6968833
- * @summary javadoc reports error but still returns 0
- * @modules jdk.javadoc
- * @library lib
- * @build ToyDoclet
- * @run main T6968833
- */
-
-import java.io.*;
-
-public class T6968833 {
- public static void main(String... args) throws IOException {
- new T6968833().run();
- }
-
- void run() throws IOException {
- String testClasses = System.getProperty("test.classes");
-
- File srcDir = new File("src");
- // following file cause a doclet error, as there is nothing to document
- File f = writeFile(srcDir, "Foo.java", "class Foo { }");
- String[] args = { "-docletpath", testClasses,
- "-doclet", "ToyDoclet",
- f.getPath() };
- int rc = com.sun.tools.javadoc.Main.execute(args);
- if (rc == 0)
- throw new Error("Unexpected exit from javadoc: " + rc);
- }
-
- File writeFile(File dir, String path, String s) throws IOException {
- File f = new File(dir, path);
- f.getParentFile().mkdirs();
- try (Writer out = new FileWriter(f)) {
- out.write(s);
- }
- return f;
- }
-}
-
--- a/test/langtools/tools/javadoc/XWerror.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * 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 4099527
- * @summary javadoc tool: want flag to exit nonzero if there were warnings.
- * @author gafter
- * @modules jdk.javadoc
- * @run main XWerror
- */
-
-import com.sun.javadoc.*;
-import java.util.*;
-
-public class XWerror extends Doclet
-{
- public static void main(String[] args) {
- if (com.sun.tools.javadoc.Main.
- execute("javadoc", "XWerror", XWerror.class.getClassLoader(),
- new String[] {"-Xwerror",
- System.getProperty("test.src", ".") +
- java.io.File.separatorChar +
- "XWerror.java"}) == 0)
- throw new Error();
- }
-
- public static boolean start(com.sun.javadoc.RootDoc root) {
- root.printWarning(null, "warning message");
- return false;
- }
-}
--- a/test/langtools/tools/javadoc/annotations/annotateMethodsFields/Main.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,80 +0,0 @@
-/*
- * Copyright (c) 2003, 2016, 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 4904495 5008037
- * @summary Test annotations of methods, fields, enum constants, and
- * annotation type elements.
- * Test an annotation type with a type nested within.
- * @library ../../lib
- * @modules jdk.javadoc
- * @compile ../../lib/OldToolTester.java Main.java
- * @run main Main
- */
-
-import java.io.IOException;
-import com.sun.javadoc.*;
-
-public class Main extends OldToolTester.Doclet {
-
- private static final OldToolTester tester = new OldToolTester("Main", "pkg1");
-
- public static void main(String[] args) throws IOException {
- tester.run();
- tester.verify();
- }
-
- public static boolean start(RootDoc root) {
- try {
- for (PackageDoc p : root.specifiedPackages()) {
- for (AnnotationTypeDoc a : p.annotationTypes()) {
- for (AnnotationTypeElementDoc e : a.elements()) {
- tester.printAnnotationTypeElement(e);
- }
- tester.println();
- }
- for (ClassDoc e : p.enums()) {
- for (FieldDoc ec : e.enumConstants()) {
- tester.printField(ec);
- }
- tester.println();
- }
- for (ClassDoc cd : p.ordinaryClasses()) {
- for (FieldDoc f : cd.fields()) {
- tester.printField(f);
- }
- tester.println();
- for (MethodDoc m : cd.methods()) {
- tester.printMethod(m);
- }
- tester.println();
- }
- }
-
- return true;
- } catch (IOException e) {
- return false;
- }
- }
-}
--- a/test/langtools/tools/javadoc/annotations/annotateMethodsFields/expected.out Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,22 +0,0 @@
-element pkg1.A.value()
- annotations:
- @pkg1.A("value")
- returns:
- String
-
-field E econst
- annotations:
- @pkg1.A("econst")
-
-field int f
- annotations:
- @pkg1.A("f")
-
-method pkg1.B.m1(int)
- signature: (int)
- (int)
- annotations:
- @pkg1.A("m1")
- returns:
- void
-
--- a/test/langtools/tools/javadoc/annotations/annotateMethodsFields/pkg1/A.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-/*
- * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package pkg1;
-
-public @interface A {
- interface N {
- }
-
- @A("value")
- String value();
-}
--- a/test/langtools/tools/javadoc/annotations/annotateMethodsFields/pkg1/B.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package pkg1;
-
-public class B {
- @A("f")
- public int f;
-
- @A("m1")
- public void m1(int i) {
- }
-}
--- a/test/langtools/tools/javadoc/annotations/annotateMethodsFields/pkg1/E.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package pkg1;
-
-public enum E {
- @A("econst")
- econst
-}
--- a/test/langtools/tools/javadoc/annotations/annotatePackage/Main.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,67 +0,0 @@
-/*
- * Copyright (c) 2004, 2016, 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 5031168
- * @summary Test package annotations and package-info.java package comments.
- * @library ../../lib
- * @modules jdk.javadoc
- * @compile ../../lib/OldToolTester.java Main.java
- * @run main Main
- */
-
-import java.io.*;
-import com.sun.javadoc.*;
-
-public class Main extends OldToolTester.Doclet {
-
- private static final OldToolTester tester = new OldToolTester("Main", "pkg1", "pkg2");
-
- public static void main(String[] args) throws IOException {
- tester.run();
- tester.verify();
- }
-
- public static boolean start(RootDoc root) {
- try {
- for (PackageDoc pkg : root.specifiedPackages()) {
- tester.println("/**");
- tester.println(pkg.commentText());
- for (Tag tag : pkg.tags())
- tester.println(tag);
- tester.println("*/");
-
- tester.printPackage(pkg);
- tester.println();
- }
- for (ClassDoc cd : root.classes()) {
- tester.println(cd);
- }
-
- return true;
- } catch (IOException e) {
- return false;
- }
- }
-}
--- a/test/langtools/tools/javadoc/annotations/annotatePackage/expected.out Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,21 +0,0 @@
-/**
-This is package pkg1.
-
- For every problem, there is a solution that is simple, elegant, and wrong.
-@author:H. L. Mencken
-@since:1880
-*/
-package pkg1
- annotations:
- @java.lang.Deprecated
- @pkg1.A(boolean.class)
-
-/**
-Albert Einstein commenting on the book
-<i>110 German Scientists Against Einstein</i>:
-"If I had been wrong it would only have needed one."
-*/
-package pkg2
-
-pkg1.A
-pkg2.B
--- a/test/langtools/tools/javadoc/annotations/annotatePackage/pkg1/A.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-/*
- * Copyright (c) 2004, 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.
- */
-
-/**
- * Doc comment here is ignored.
- */
-package pkg1;
-
-public @interface A {
- Class value();
-}
--- a/test/langtools/tools/javadoc/annotations/annotatePackage/pkg1/package-info.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2004, 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.
- */
-
-/**
- * This is package pkg1.
- *
- * For every problem, there is a solution that is simple, elegant, and wrong.
- *
- * @author H. L. Mencken
- * @since 1880
- */
-
-@Deprecated
-@A(boolean.class)
-package pkg1;
--- a/test/langtools/tools/javadoc/annotations/annotatePackage/pkg1/package.html Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,19 +0,0 @@
-<html>
-
-<head>
-<!---------- This file, and these words, will be ignored. ---------->
-</head>
-
-<body>
-
-Voice or no voice, the people can always be brought to the bidding of
-the leaders. That is easy. All you have to do is tell them they are
-being attacked, and denounce the peacemakers for lack of patriotism
-and exposing the country to danger. It works the same in any country.
-<pre>
- Hermann Goering
- Commander in Chief, Luftwaffe
-</pre>
-
-</body>
-</html>
--- a/test/langtools/tools/javadoc/annotations/annotatePackage/pkg2/B.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-/*
- * Copyright (c) 2004, 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.
- */
-
-/**
- * Doc comment here is ignored.
- */
-package pkg2;
-
-public class B {
-}
--- a/test/langtools/tools/javadoc/annotations/annotatePackage/pkg2/package.html Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,11 +0,0 @@
-<html>
-
-<body>
-
-Albert Einstein commenting on the book
-<i>110 German Scientists Against Einstein</i>:
-"If I had been wrong it would only have needed one."
-
-</body>
-
-</html>
--- a/test/langtools/tools/javadoc/annotations/annotateParams/Main.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,74 +0,0 @@
-/*
- * Copyright (c) 2004, 2016, 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 5031171
- * @summary Test parameter annotations.
- * @library ../../lib
- * @modules jdk.javadoc
- * @compile ../../lib/OldToolTester.java Main.java
- * @run main Main
- */
-
-import java.io.IOException;
-import com.sun.javadoc.*;
-
-public class Main extends OldToolTester.Doclet {
-
- private static final OldToolTester tester = new OldToolTester("Main", "pkg1");
-
- public static void main(String[] args) throws IOException {
- tester.run();
- tester.verify();
- }
-
- public static boolean start(RootDoc root) {
- try {
- for (PackageDoc pkg : root.specifiedPackages()) {
- for (ClassDoc cd : pkg.ordinaryClasses()) {
- for (ConstructorDoc c : cd.constructors()) {
- tester.println(c);
- tester.println();
- for (Parameter p : c.parameters()) {
- tester.printParameter(p);
- }
- tester.println();
- }
- for (MethodDoc m : cd.methods()) {
- tester.println(m);
- tester.println();
- for (Parameter p : m.parameters()) {
- tester.printParameter(p);
- }
- tester.println();
- }
- }
- }
-
- return true;
- } catch (IOException e) {
- return false;
- }
- }
-}
--- a/test/langtools/tools/javadoc/annotations/annotateParams/expected.out Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,17 +0,0 @@
-pkg1.C(boolean)
-
-parameter boolean p0
- annotations:
- @pkg1.A("p0")
-
-pkg1.C.m(int, int, java.lang.String)
-
-parameter int p1
- annotations:
- @pkg1.A("p1")
-parameter int p2
-parameter String p3
- annotations:
- @java.lang.Deprecated
- @pkg1.A("p3")
-
--- a/test/langtools/tools/javadoc/annotations/annotateParams/pkg1/A.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package pkg1;
-
-public @interface A {
- String value();
-}
--- a/test/langtools/tools/javadoc/annotations/annotateParams/pkg1/C.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package pkg1;
-
-public class C {
-
- public C(@A("p0") boolean p0) {
- }
-
- public void m(@A("p1") int p1,
- int p2,
- @Deprecated @A("p3") String p3) {
- }
-}
--- a/test/langtools/tools/javadoc/annotations/badVals/Main.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-/*
- * Copyright (c) 2004, 2016, 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 5029874
- * @summary Verify that bad annotation values don't result in NPE
- * @library ../../lib
- * @modules jdk.javadoc
- */
-
-import java.io.IOException;
-import com.sun.javadoc.*;
-
-public class Main extends OldToolTester.Doclet {
-
- private static final OldToolTester tester = new OldToolTester("Main", "pkg1");
-
- public static void main(String[] args) throws IOException {
- tester.run();
- }
-
- public static boolean start(RootDoc root) {
- try {
- for (ClassDoc cd : root.classes()) {
- tester.printClass(cd);
- }
-
- return true;
- } catch (IOException e) {
- return false;
- }
- }
-}
--- a/test/langtools/tools/javadoc/annotations/badVals/pkg1/A.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package pkg1;
-
-import java.lang.annotation.*;
-
-public class A {
-
- @Retention(BOGUS) // illegal
- public @interface A1 {}
-
- @Target({BOGUS}) // illegal
- public @interface A2 {}
-
- @Retention(true) // illegal
- public @interface A3 {}
-
- public @interface A4 {
- ElementType value() default BOGUS; // illegal
- }
-
- public @interface A5 {
- int[] value() default {true}; // illegal
- }
-}
--- a/test/langtools/tools/javadoc/annotations/defaults/Main.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,69 +0,0 @@
-/*
- * Copyright (c) 2003, 2016, 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 4904495
- * @summary Test an annotation type with default element values, and
- * annotations that use them.
- * @library ../../lib
- * @modules jdk.javadoc
- * @compile ../../lib/OldToolTester.java Main.java
- * @run main Main
- */
-
-import java.io.IOException;
-import com.sun.javadoc.*;
-import com.sun.javadoc.AnnotationDesc.*;
-
-public class Main extends OldToolTester.Doclet {
-
- private static final OldToolTester tester = new OldToolTester("Main", "pkg1");
-
- public static void main(String[] args) throws IOException {
- tester.run();
- tester.verify();
- }
-
- public static boolean start(RootDoc root) {
- try {
- for (AnnotationTypeDoc at :
- root.specifiedPackages()[0].annotationTypes()) {
- tester.printAnnotationType(at);
- tester.println();
- }
-
- for (ClassDoc cd :
- root.specifiedPackages()[0].interfaces()) {
- for (MethodDoc m : cd.methods()) {
- tester.printMethod(m);
- }
- tester.println();
- }
-
- return true;
- } catch (IOException e) {
- return false;
- }
- }
-}
--- a/test/langtools/tools/javadoc/annotations/defaults/expected.out Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-@interface pkg1.A
- elements:
- String value() default "sigh"
- int i() default 2
- double d() default 3.14
- boolean b() default true
- java.lang.Class c() default java.lang.Boolean.class
- java.lang.Class<? extends java.lang.Number> w() default java.lang.Long.class
- ElementType e() default java.lang.annotation.ElementType.TYPE
- A a() default @pkg1.A(d=2.718)
- java.lang.String[] sa() default {"up", "down"}
-
-method pkg1.B.m1()
- signature: ()
- ()
- annotations:
- @pkg1.A
- returns:
- void
-method pkg1.B.m2()
- signature: ()
- ()
- annotations:
- @pkg1.A("flip")
- returns:
- void
-method pkg1.B.m3()
- signature: ()
- ()
- annotations:
- @pkg1.A("flop")
- returns:
- void
-method pkg1.B.m4()
- signature: ()
- ()
- annotations:
- @pkg1.A(c=java.lang.Boolean.class, w=java.lang.Long.class, sa={})
- returns:
- void
-method pkg1.B.m5()
- signature: ()
- ()
- annotations:
- @pkg1.A(i=0, e=java.lang.annotation.ElementType.FIELD)
- returns:
- void
-method pkg1.B.m6()
- signature: ()
- ()
- annotations:
- @pkg1.A(a=@pkg1.A("splat"))
- returns:
- void
-
--- a/test/langtools/tools/javadoc/annotations/defaults/pkg1/A.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package pkg1;
-
-public @interface A {
- String value() default "sigh";
- int i() default 1+1;
- double d() default 3.14;
- boolean b() default true;
- Class c() default Boolean.class;
- Class<? extends Number> w() default Long.class;
- java.lang.annotation.ElementType e() default java.lang.annotation.ElementType.TYPE;
- A a() default @A(d=2.718);
- String[] sa() default {"up", "down"};
-}
--- a/test/langtools/tools/javadoc/annotations/defaults/pkg1/B.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package pkg1;
-
-public interface B {
- @A void m1();
- @A("flip") void m2();
- @A(value="flop") void m3();
- @A(c=Boolean.class, w=Long.class, sa={})
- void m4();
- @A(i=0, e=java.lang.annotation.ElementType.FIELD) void m5();
- @A(a=@A("splat")) void m6();
-}
--- a/test/langtools/tools/javadoc/annotations/elementTypes/Main.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,63 +0,0 @@
-/*
- * Copyright (c) 2003, 2016, 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 4904495
- * @summary Test an annotation type and annotations with elements of various
- * types.
- * @library ../../lib
- * @modules jdk.javadoc
- * @compile ../../lib/OldToolTester.java Main.java
- * @run main Main
- */
-
-import java.io.IOException;
-import java.util.Arrays;
-import com.sun.javadoc.*;
-import com.sun.javadoc.AnnotationDesc.*;
-
-public class Main extends OldToolTester.Doclet {
-
- private static final OldToolTester tester = new OldToolTester("Main", "pkg1");
-
- public static void main(String[] args) throws IOException {
- tester.run();
- tester.verify();
- }
-
- public static boolean start(RootDoc root) {
- try {
- ClassDoc[] cds = root.classes();
- Arrays.sort(cds);
- for (ClassDoc cd : cds) {
- tester.printClass(cd);
- tester.println();
- }
-
- return true;
- } catch (IOException e) {
- return false;
- }
- }
-}
--- a/test/langtools/tools/javadoc/annotations/elementTypes/expected.out Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,17 +0,0 @@
-@interface pkg1.A
- elements:
- int i()
- double d()
- boolean b()
- String s()
- java.lang.Class c()
- java.lang.Class<? extends java.lang.Number> w()
- ElementType e()
- A a()
- java.lang.String[] sa()
-
-interface pkg1.B
- name: B / B / pkg1.B
- annotations:
- @pkg1.A(i=2, d=3.14, b=true, s="sigh", c=java.lang.Boolean.class, w=java.lang.Long.class, e=java.lang.annotation.ElementType.TYPE, a=@pkg1.A, sa={"up", "down"})
-
--- a/test/langtools/tools/javadoc/annotations/elementTypes/pkg1/A.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package pkg1;
-
-public @interface A {
- int i();
- double d();
- boolean b();
- String s();
- Class c();
- Class<? extends Number> w();
- java.lang.annotation.ElementType e();
- A a();
- String[] sa();
-}
--- a/test/langtools/tools/javadoc/annotations/elementTypes/pkg1/B.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package pkg1;
-
-@A(i = 1+1,
- d = 3.14,
- b = true,
- s = "sigh",
- c = Boolean.class,
- w = Long.class,
- e = java.lang.annotation.ElementType.TYPE,
- a = @A,
- sa = {"up", "down"})
-public interface B {
-}
--- a/test/langtools/tools/javadoc/annotations/missing/Main.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +0,0 @@
-/*
- * Copyright 2009 Google, Inc. All Rights Reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact 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 6709246
- * @summary Class-cast exception when annotation type is missing.
- * @library ../../lib
- * @modules jdk.javadoc
- */
-
-import java.io.IOException;
-import com.sun.javadoc.RootDoc;
-import com.sun.javadoc.ClassDoc;
-import com.sun.javadoc.AnnotationDesc;
-
-public class Main extends OldToolTester.Doclet {
-
- private static final OldToolTester tester = new OldToolTester("Main", "somepackage");
-
- public static void main(String... args) throws Exception {
- tester.run();
- }
-
- public static boolean start(RootDoc root) {
- for (ClassDoc d : root.classes()) {
- for (AnnotationDesc a : d.annotations()) {
- System.out.println(a.annotationType());
- }
- }
- return true;
- }
-}
--- a/test/langtools/tools/javadoc/annotations/missing/somepackage/MissingAnnotationClass.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-/*
- * Copyright 2009 Google, Inc. All Rights Reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package somepackage;
-
-/**
- * This class has an annotation which is not available.
- */
-@NoSuchAnnotation
-public class MissingAnnotationClass {
-}
--- a/test/langtools/tools/javadoc/annotations/shortcuts/Main.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2003, 2016, 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 4904495
- * @summary Verify that "shortcuts" are used when printing annotations.
- * @library ../../lib
- * @modules jdk.javadoc
- * @compile ../../lib/OldToolTester.java Main.java
- * @run main Main
- */
-
-import java.io.IOException;
-import com.sun.javadoc.*;
-
-public class Main extends OldToolTester.Doclet {
-
- private static final OldToolTester tester = new OldToolTester("Main", "pkg1");
-
- public static void main(String[] args) throws IOException {
- tester.run();
- tester.verify();
- }
-
- public static boolean start(RootDoc root) {
- try {
- for (ClassDoc cd : root.classes()) {
- if (cd.isInterface()) {
- tester.printClass(cd);
- }
- }
-
- return true;
- } catch (IOException e) {
- return false;
- }
- }
-}
--- a/test/langtools/tools/javadoc/annotations/shortcuts/expected.out Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,6 +0,0 @@
-interface pkg1.A
- name: A / A / pkg1.A
- annotations:
- @pkg1.Value("there is only one")
- @pkg1.Array(favoriteNumbers=3.5)
- @pkg1.Marker
--- a/test/langtools/tools/javadoc/annotations/shortcuts/pkg1/A.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package pkg1;
-
-@Value("there is only one")
-@Array(favoriteNumbers={3.5})
-@Marker
-public interface A {
-}
--- a/test/langtools/tools/javadoc/annotations/shortcuts/pkg1/Array.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package pkg1;
-
-public @interface Array {
- double[] favoriteNumbers();
-}
--- a/test/langtools/tools/javadoc/annotations/shortcuts/pkg1/Marker.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package pkg1;
-
-public @interface Marker {
-}
--- a/test/langtools/tools/javadoc/annotations/shortcuts/pkg1/Value.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package pkg1;
-
-public @interface Value {
- String value();
-}
--- a/test/langtools/tools/javadoc/api/basic/APITest.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,250 +0,0 @@
-/*
- * 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.
- *
- * 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.
- */
-
-import java.io.File;
-import java.io.IOException;
-import java.lang.annotation.Annotation;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.net.URI;
-import java.nio.file.DirectoryStream;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Set;
-import java.util.TreeSet;
-import java.util.stream.*;
-
-import javax.tools.JavaFileObject;
-import javax.tools.SimpleJavaFileObject;
-
-
-/*
- * Superclass with utility methods for API tests.
- */
-class APITest {
- protected APITest() { }
-
- /** Marker annotation for test cases. */
- @Retention(RetentionPolicy.RUNTIME)
- @interface Test { }
-
- /** Invoke all methods annotated with @Test. */
- protected void run() throws Exception {
- for (Method m: getClass().getDeclaredMethods()) {
- Annotation a = m.getAnnotation(Test.class);
- if (a != null) {
- testCount++;
- testName = m.getName();
- System.err.println("test: " + testName);
- try {
- m.invoke(this, new Object[] { });
- } catch (InvocationTargetException e) {
- Throwable cause = e.getCause();
- throw (cause instanceof Exception) ? ((Exception) cause) : e;
- }
- System.err.println();
- }
- }
-
- if (testCount == 0)
- error("no tests found");
-
- StringBuilder summary = new StringBuilder();
- if (testCount != 1)
- summary.append(testCount).append(" tests");
- if (errorCount > 0) {
- if (summary.length() > 0) summary.append(", ");
- summary.append(errorCount).append(" errors");
- }
- System.err.println(summary);
- if (errorCount > 0)
- throw new Exception(errorCount + " errors found");
- }
-
- /**
- * Create a directory in which to store generated doc files.
- * Avoid using the default (current) directory, so that we can
- * be sure that javadoc is writing in the intended location,
- * not a default location.
- */
- protected File getOutDir() {
- File dir = new File(testName);
- dir.mkdirs();
- return dir;
- }
-
- /**
- * Create a directory in which to store generated doc files.
- * Avoid using the default (current) directory, so that we can
- * be sure that javadoc is writing in the intended location,
- * not a default location.
- */
- protected File getOutDir(String path) {
- File dir = new File(testName, path);
- dir.mkdirs();
- return dir;
- }
-
- protected JavaFileObject createSimpleJavaFileObject() {
- return createSimpleJavaFileObject("pkg/C", "package pkg; public class C { }");
- }
-
- protected JavaFileObject createSimpleJavaFileObject(final String binaryName, final String content) {
- return new SimpleJavaFileObject(
- URI.create("myfo:///" + binaryName + ".java"), JavaFileObject.Kind.SOURCE) {
- @Override
- public CharSequence getCharContent(boolean ignoreEncoding) {
- return content;
- }
- };
- }
-
- protected void checkFiles(File dir, Set<String> expectFiles) {
- Set<File> files = new HashSet<File>();
- listFiles(dir, files);
- Set<String> foundFiles = new HashSet<String>();
- URI dirURI = dir.toURI();
- for (File f: files)
- foundFiles.add(dirURI.relativize(f.toURI()).getPath());
- checkFiles(foundFiles, expectFiles, dir);
- }
-
- protected void checkFiles(Path dir, Set<String> expectFiles) throws IOException {
- Set<Path> files = new HashSet<Path>();
- listFiles(dir, files);
- Set<String> foundFiles = new HashSet<String>();
- for (Path f: files) {
- foundFiles.add(dir.relativize(f).toString().replace(f.getFileSystem().getSeparator(), "/"));
- }
- checkFiles(foundFiles, expectFiles, dir);
- }
-
- private void checkFiles(Set<String> foundFiles, Set<String> expectFiles, Object where) {
- if (!foundFiles.equals(expectFiles)) {
- Set<String> missing = new TreeSet<String>(expectFiles);
- missing.removeAll(foundFiles);
- if (!missing.isEmpty())
- error("the following files were not found in " + where + ": " + missing);
- Set<String> unexpected = new TreeSet<String>(foundFiles);
- unexpected.removeAll(expectFiles);
- if (!unexpected.isEmpty())
- error("the following unexpected files were found in " + where + ": " + unexpected);
- }
- }
-
- protected void listFiles(File dir, Set<File> files) {
- for (File f: dir.listFiles()) {
- if (f.isDirectory())
- listFiles(f, files);
- else if (f.isFile())
- files.add(f);
- }
- }
-
- private void listFiles(Path dir, Set<Path> files) throws IOException {
- try (DirectoryStream<Path> ds = Files.newDirectoryStream(dir)) {
- for (Path f: ds) {
- if (Files.isDirectory(f))
- listFiles(f, files);
- else if (Files.isRegularFile(f))
- files.add(f);
- }
- }
- }
-
- protected void error(String msg) {
- System.err.println("Error: " + msg);
- errorCount++;
- }
-
- protected int testCount;
- protected int errorCount;
-
- protected String testName;
-
- /**
- * Standard files generated by processing a documented class pkg.C.
- */
- protected static Set<String> standardExpectFiles = new HashSet<>(Arrays.asList(
- "allclasses-index.html",
- "allpackages-index.html",
- "constant-values.html",
- "deprecated-list.html",
- "help-doc.html",
- "index-all.html",
- "index.html",
- "jquery/jquery-3.3.1.js",
- "jquery/jquery-migrate-3.0.1.js",
- "jquery/jquery-ui.js",
- "jquery/jquery-ui.css",
- "jquery/jquery-ui.min.js",
- "jquery/jquery-ui.min.css",
- "jquery/jquery-ui.structure.min.css",
- "jquery/jquery-ui.structure.css",
- "jquery/external/jquery/jquery.js",
- "jquery/jszip/dist/jszip.js",
- "jquery/jszip/dist/jszip.min.js",
- "jquery/jszip-utils/dist/jszip-utils.js",
- "jquery/jszip-utils/dist/jszip-utils.min.js",
- "jquery/jszip-utils/dist/jszip-utils-ie.js",
- "jquery/jszip-utils/dist/jszip-utils-ie.min.js",
- "jquery/images/ui-bg_glass_65_dadada_1x400.png",
- "jquery/images/ui-icons_454545_256x240.png",
- "jquery/images/ui-bg_glass_95_fef1ec_1x400.png",
- "jquery/images/ui-bg_glass_75_dadada_1x400.png",
- "jquery/images/ui-bg_highlight-soft_75_cccccc_1x100.png",
- "jquery/images/ui-icons_888888_256x240.png",
- "jquery/images/ui-icons_2e83ff_256x240.png",
- "jquery/images/ui-icons_cd0a0a_256x240.png",
- "jquery/images/ui-bg_glass_55_fbf9ee_1x400.png",
- "jquery/images/ui-icons_222222_256x240.png",
- "jquery/images/ui-bg_glass_75_e6e6e6_1x400.png",
- "member-search-index.js",
- "member-search-index.zip",
- "overview-tree.html",
- "element-list",
- "package-search-index.js",
- "package-search-index.zip",
- "pkg/C.html",
- "pkg/package-summary.html",
- "pkg/package-tree.html",
- "resources/glass.png",
- "resources/x.png",
- "script.js",
- "search.js",
- "stylesheet.css",
- "type-search-index.js",
- "type-search-index.zip"
- ));
-
- protected static Set<String> noIndexFiles = standardExpectFiles.stream()
- .filter(s -> !s.startsWith("jquery") && !s.startsWith("resources") && !s.endsWith("zip")
- && !s.equals("index-all.html") && !s.equals("search.js") && !s.endsWith("-search-index.js")
- && !s.equals("allclasses-index.html") && !s.equals("allpackages-index.html"))
- .collect(Collectors.toSet());
-}
-
--- a/test/langtools/tools/javadoc/api/basic/DocletPathTest.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,114 +0,0 @@
-/*
- * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * 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 6493690
- * @summary javadoc should have a javax.tools.Tool service provider
- * @modules java.compiler
- * jdk.compiler
- * @build APITest
- * @run main DocletPathTest
- */
-
-import java.io.File;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.util.Arrays;
-import javax.tools.DocumentationTool;
-import javax.tools.DocumentationTool.DocumentationTask;
-import javax.tools.JavaCompiler;
-import javax.tools.JavaFileObject;
-import javax.tools.StandardJavaFileManager;
-import javax.tools.StandardLocation;
-import javax.tools.ToolProvider;
-
-/**
- * Tests for locating a doclet via the file manager's DOCLET_PATH.
- */
-public class DocletPathTest extends APITest {
- public static void main(String... args) throws Exception {
- new DocletPathTest().run();
- }
-
- /**
- * Verify that an alternate doclet can be specified, and located via
- * the file manager's DOCLET_PATH.
- */
- @Test
- public void testDocletPath() throws Exception {
- JavaFileObject docletSrc =
- createSimpleJavaFileObject("DocletOnDocletPath", docletSrcText);
- File docletDir = getOutDir("classes");
- JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
- try (StandardJavaFileManager cfm = compiler.getStandardFileManager(null, null, null)) {
- cfm.setLocation(StandardLocation.CLASS_OUTPUT, Arrays.asList(docletDir));
- Iterable<? extends JavaFileObject> cfiles = Arrays.asList(docletSrc);
- if (!compiler.getTask(null, cfm, null, null, null, cfiles).call())
- throw new Exception("cannot compile doclet");
- }
-
- JavaFileObject srcFile = createSimpleJavaFileObject();
- DocumentationTool tool = ToolProvider.getSystemDocumentationTool();
- try (StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null)) {
- File outDir = getOutDir("api");
- fm.setLocation(DocumentationTool.Location.DOCUMENTATION_OUTPUT, Arrays.asList(outDir));
- fm.setLocation(DocumentationTool.Location.DOCLET_PATH, Arrays.asList(docletDir));
- Iterable<? extends JavaFileObject> files = Arrays.asList(srcFile);
- Iterable<String> options = Arrays.asList("-doclet", "DocletOnDocletPath");
- StringWriter sw = new StringWriter();
- PrintWriter pw = new PrintWriter(sw);
- DocumentationTask t = tool.getTask(pw, fm, null, null, options, files);
- boolean ok = t.call();
- String out = sw.toString();
- System.err.println(">>" + out + "<<");
- if (ok) {
- if (out.contains(TEST_STRING)) {
- System.err.println("doclet executed as expected");
- } else {
- error("test string not found in doclet output");
- }
- } else {
- error("task failed");
- }
- }
- }
-
- private static final String TEST_STRING = "DocletOnDocletPath found and running";
-
- private static final String docletSrcText =
- "import com.sun.javadoc.*;\n" +
- "public class DocletOnDocletPath {\n" +
- " public static boolean start(RootDoc doc) {\n" +
- " doc.printNotice(\"" + TEST_STRING + "\");\n" +
- " return true;\n" +
- " }\n" +
- " public static int optionLength(String option) { return 0; }\n" +
- " public static boolean validOptions(String options[][],\n" +
- " DocErrorReporter reporter) { return true; }\n" +
- " public static LanguageVersion languageVersion() {\n" +
- " return LanguageVersion.JAVA_1_1;\n" +
- " }\n" +
- "}\n";
-}
-
--- a/test/langtools/tools/javadoc/api/basic/DocumentationToolLocationTest.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,75 +0,0 @@
-/*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * 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 8025844
- * @summary test DocumentationTool.Location methods
- * @modules java.compiler
- * jdk.compiler
- * @build APITest
- * @run main DocumentationToolLocationTest
- */
-
-import javax.tools.DocumentationTool;
-import java.util.Objects;
-
-/**
- * Test for DocumentationTool.Location methods.
- */
-public class DocumentationToolLocationTest extends APITest {
- public static void main(String[] args) throws Exception {
- new DocumentationToolLocationTest().run();
- }
-
- /**
- * Test getName() method
- */
- @Test
- public void testGetName() throws Exception {
- // getName() returns name(). This is for test coverage of getName.
- for (DocumentationTool.Location dl: DocumentationTool.Location.values()) {
- String expect = dl.name();
- String found = dl.getName();
- if (!Objects.equals(expect, found))
- throw new Exception("mismatch for " + dl + "; expected " + expect + ", found " + found);
- }
- }
-
- /**
- * Test generated enum methods values() and valueOf()
- */
- @Test
- public void testEnumMethods() throws Exception {
- DocumentationTool.Location[] values = DocumentationTool.Location.values();
- if (values.length != 3)
- throw new Exception("unexpected number of values returned");
-
- for (DocumentationTool.Location dl: values) {
- DocumentationTool.Location expect = dl;
- DocumentationTool.Location found = DocumentationTool.Location.valueOf(dl.name());
- if (!Objects.equals(expect, found))
- throw new Exception("mismatch for " + dl + "; expected " + expect + ", found " + found);
- }
- }
-}
--- a/test/langtools/tools/javadoc/api/basic/GetSourceVersionsTest.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,63 +0,0 @@
-/*
- * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * 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 6493690
- * @summary javadoc should have a javax.tools.Tool service provider
- * @modules java.compiler
- * jdk.compiler
- * @build APITest
- * @run main GetSourceVersionsTest
- */
-
-import java.util.EnumSet;
-import java.util.Set;
-import javax.lang.model.SourceVersion;
-import javax.tools.DocumentationTool;
-import javax.tools.ToolProvider;
-
-/**
- * Tests for DocumentationTool.getSourceVersions method.
- */
-public class GetSourceVersionsTest extends APITest {
- public static void main(String... args) throws Exception {
- new GetSourceVersionsTest().run();
- }
-
- /**
- * Verify getSourceVersions.
- */
- @Test
- public void testRun() throws Exception {
- DocumentationTool tool = ToolProvider.getSystemDocumentationTool();
- Set<SourceVersion> found = tool.getSourceVersions();
- Set<SourceVersion> expect = EnumSet.range(SourceVersion.RELEASE_3, SourceVersion.latest());
- if (!expect.equals(found)) {
- System.err.println("expect: " + expect);
- System.err.println(" found: " + expect);
- error("unexpected versions");
- }
- }
-}
-
--- a/test/langtools/tools/javadoc/api/basic/GetTask_DiagListenerTest.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,91 +0,0 @@
-/*
- * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * 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 6493690
- * @summary javadoc should have a javax.tools.Tool service provider
- * @modules java.compiler
- * jdk.compiler
- * @build APITest
- * @run main GetTask_DiagListenerTest
- */
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import javax.tools.Diagnostic;
-import javax.tools.DiagnosticCollector;
-import javax.tools.DocumentationTool;
-import javax.tools.DocumentationTool.DocumentationTask;
-import javax.tools.JavaFileObject;
-import javax.tools.StandardJavaFileManager;
-import javax.tools.ToolProvider;
-
-/**
- * Tests for DocumentationTool.getTask diagnosticListener parameter.
- */
-public class GetTask_DiagListenerTest extends APITest {
- public static void main(String... args) throws Exception {
- new GetTask_DiagListenerTest().run();
- }
-
- /**
- * Verify that a diagnostic listener can be specified.
- * Note that messages from the tool and doclet are imperfectly modeled
- * because the DocErrorReporter API works in terms of localized strings
- * and file:line positions. Therefore, messages reported via DocErrorReporter
- * and simply wrapped and passed through.
- */
- @Test
- public void testDiagListener() throws Exception {
- JavaFileObject srcFile = createSimpleJavaFileObject("pkg/C", "package pkg; public error { }");
- DocumentationTool tool = ToolProvider.getSystemDocumentationTool();
- try (StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null)) {
- File outDir = getOutDir();
- fm.setLocation(DocumentationTool.Location.DOCUMENTATION_OUTPUT, Arrays.asList(outDir));
- Iterable<? extends JavaFileObject> files = Arrays.asList(srcFile);
- DiagnosticCollector<JavaFileObject> dc = new DiagnosticCollector<JavaFileObject>();
- DocumentationTask t = tool.getTask(null, fm, dc, null, null, files);
- if (t.call()) {
- throw new Exception("task succeeded unexpectedly");
- } else {
- List<String> diagCodes = new ArrayList<String>();
- for (Diagnostic d: dc.getDiagnostics()) {
- System.err.println(d);
- diagCodes.add(d.getCode());
- }
- List<String> expect = Arrays.asList(
- "javadoc.note.msg", // Loading source file
- "compiler.err.expected3", // class, interface, or enum expected
- "javadoc.note.msg"); // 1 error
- if (!diagCodes.equals(expect))
- throw new Exception("unexpected diagnostics occurred");
- System.err.println("diagnostics received as expected");
- }
- }
- }
-
-}
-
--- a/test/langtools/tools/javadoc/api/basic/GetTask_DocletClassTest.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,161 +0,0 @@
-/*
- * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * 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 6493690
- * @summary javadoc should have a javax.tools.Tool service provider
- * @modules jdk.javadoc
- * @build APITest
- * @run main GetTask_DocletClassTest
- * @key randomness
- */
-
-import com.sun.javadoc.DocErrorReporter;
-import com.sun.javadoc.LanguageVersion;
-import com.sun.javadoc.RootDoc;
-import java.io.File;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Random;
-import javax.tools.DocumentationTool;
-import javax.tools.DocumentationTool.DocumentationTask;
-import javax.tools.JavaFileObject;
-import javax.tools.StandardJavaFileManager;
-import javax.tools.ToolProvider;
-
-/**
- * Tests for DocumentationTool.getTask docletClass parameter.
- */
-public class GetTask_DocletClassTest extends APITest {
- public static void main(String... args) throws Exception {
- new GetTask_DocletClassTest().run();
- }
-
- /**
- * Verify that an alternate doclet can be specified.
- *
- * There is no standard interface or superclass for a doclet;
- * the only requirement is that it provides static methods that
- * can be invoked via reflection. So, for now, the doclet is
- * specified as a class.
- * Because we cannot create and use a unique instance of the class,
- * we verify that the doclet has been called by having it record
- * (in a static field!) the comment from the last time it was invoked,
- * which is randomly generated each time the test is run.
- */
- @Test
- public void testDoclet() throws Exception {
- Random r = new Random();
- int key = r.nextInt();
- JavaFileObject srcFile = createSimpleJavaFileObject(
- "pkg/C",
- "package pkg; /** " + key + "*/ public class C { }");
- DocumentationTool tool = ToolProvider.getSystemDocumentationTool();
- try (StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null)) {
- File outDir = getOutDir();
- fm.setLocation(DocumentationTool.Location.DOCUMENTATION_OUTPUT, Arrays.asList(outDir));
- Iterable<? extends JavaFileObject> files = Arrays.asList(srcFile);
- DocumentationTask t = tool.getTask(null, fm, null, TestDoclet.class, null, files);
- if (t.call()) {
- System.err.println("task succeeded");
- if (TestDoclet.lastCaller.equals(String.valueOf(key)))
- System.err.println("found expected key: " + key);
- else
- error("Expected key not found");
- checkFiles(outDir, Collections.<String>emptySet());
- } else {
- throw new Exception("task failed");
- }
- }
- }
-
- public static class TestDoclet {
- static String lastCaller;
- public static boolean start(RootDoc root) {
- lastCaller = root.classNamed("pkg.C").commentText().trim();
- return true;
- }
-
- public static int optionLength(String option) {
- return 0; // default is option unknown
- }
-
- public static boolean validOptions(String options[][],
- DocErrorReporter reporter) {
- return true; // default is options are valid
- }
-
- public static LanguageVersion languageVersion() {
- return LanguageVersion.JAVA_1_1;
- }
- }
-
- /**
- * Verify that exceptions from a doclet are thrown as expected.
- */
- @Test
- public void testBadDoclet() throws Exception {
- JavaFileObject srcFile = createSimpleJavaFileObject();
- DocumentationTool tool = ToolProvider.getSystemDocumentationTool();
- try (StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null)) {
- File outDir = getOutDir();
- fm.setLocation(DocumentationTool.Location.DOCUMENTATION_OUTPUT, Arrays.asList(outDir));
- Iterable<? extends JavaFileObject> files = Arrays.asList(srcFile);
- DocumentationTask t = tool.getTask(null, fm, null, BadDoclet.class, null, files);
- try {
- t.call();
- error("call completed without exception");
- } catch (RuntimeException e) {
- Throwable c = e.getCause();
- if (c.getClass() == UnexpectedError.class)
- System.err.println("exception caught as expected: " + c);
- else
- throw e;
- }
- }
- }
-
- public static class UnexpectedError extends Error { }
-
- public static class BadDoclet {
- public static boolean start(RootDoc root) {
- throw new UnexpectedError();
- }
-
- public static int optionLength(String option) {
- return 0; // default is option unknown
- }
-
- public static boolean validOptions(String options[][],
- DocErrorReporter reporter) {
- return true; // default is options are valid
- }
-
- public static LanguageVersion languageVersion() {
- return LanguageVersion.JAVA_1_1;
- }
- }
-
-}
-
--- a/test/langtools/tools/javadoc/api/basic/GetTask_FileManagerTest.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,156 +0,0 @@
-/*
- * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * 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 6493690 8024434
- * @summary javadoc should have a javax.tools.Tool service provider
- * @modules jdk.compiler/com.sun.tools.javac.file
- * jdk.compiler/com.sun.tools.javac.util
- * @build APITest
- * @run main GetTask_FileManagerTest
- */
-
-import java.io.File;
-import java.io.IOException;
-import java.nio.file.Path;
-import java.util.Arrays;
-import java.util.Set;
-
-import javax.tools.DocumentationTool;
-import javax.tools.DocumentationTool.DocumentationTask;
-import javax.tools.FileObject;
-import javax.tools.ForwardingJavaFileManager;
-import javax.tools.JavaFileObject;
-import javax.tools.JavaFileObject.Kind;
-import javax.tools.StandardJavaFileManager;
-import javax.tools.ToolProvider;
-
-import com.sun.tools.javac.file.JavacFileManager;
-import com.sun.tools.javac.util.Context;
-
-/**
- * Tests for DocumentationTool.getTask fileManager parameter.
- */
-public class GetTask_FileManagerTest extends APITest {
- public static void main(String... args) throws Exception {
- new GetTask_FileManagerTest().run();
- }
-
- /**
- * Verify that an alternate file manager can be specified:
- * in this case, a TestFileManager.
- */
- @Test
- public void testFileManager() throws Exception {
- JavaFileObject srcFile = createSimpleJavaFileObject();
- DocumentationTool tool = ToolProvider.getSystemDocumentationTool();
- StandardJavaFileManager fm = new TestFileManager();
- File outDir = getOutDir();
- fm.setLocation(DocumentationTool.Location.DOCUMENTATION_OUTPUT, Arrays.asList(outDir));
- Iterable<? extends JavaFileObject> files = Arrays.asList(srcFile);
- DocumentationTask t = tool.getTask(null, fm, null, null, Arrays.asList("-verbose"), files);
- if (t.call()) {
- System.err.println("task succeeded");
- checkFiles(outDir, standardExpectFiles);
- } else {
- throw new Exception("task failed");
- }
- }
-
- /**
- * Verify that exceptions from a bad file manager are thrown as expected.
- */
- @Test
- public void testBadFileManager() throws Exception {
- JavaFileObject srcFile = createSimpleJavaFileObject();
- DocumentationTool tool = ToolProvider.getSystemDocumentationTool();
- StandardJavaFileManager fm = new TestFileManager() {
- @Override
- public Iterable<JavaFileObject> list(Location location,
- String packageName,
- Set<Kind> kinds,
- boolean recurse)
- throws IOException {
- throw new UnexpectedError();
- }
- };
- fm.setLocation(DocumentationTool.Location.DOCUMENTATION_OUTPUT, Arrays.asList(getOutDir()));
- Iterable<? extends JavaFileObject> files = Arrays.asList(srcFile);
- DocumentationTask t = tool.getTask(null, fm, null, null, null, files);
- try {
- t.call();
- error("call completed without exception");
- } catch (RuntimeException e) {
- Throwable c = e.getCause();
- if (c.getClass() == UnexpectedError.class)
- System.err.println("exception caught as expected: " + c);
- else
- throw e;
- }
- }
-
- public static class UnexpectedError extends Error { }
-
- /*
- * A JavaFileManager which is not a JavacFileManager, even though it uses one internally for
- * convenience.
- */
- static class TestFileManager extends ForwardingJavaFileManager<StandardJavaFileManager>
- implements StandardJavaFileManager {
- TestFileManager() {
- super(new JavacFileManager(new Context(), false, null));
- }
-
- @Override
- public Iterable<? extends JavaFileObject> getJavaFileObjectsFromFiles(Iterable<? extends File> files) {
- return fileManager.getJavaFileObjectsFromFiles(files);
- }
-
- @Override
- public Iterable<? extends JavaFileObject> getJavaFileObjects(File... files) {
- return fileManager.getJavaFileObjects(files);
- }
-
- @Override
- public Iterable<? extends JavaFileObject> getJavaFileObjectsFromStrings(Iterable<String> names) {
- return fileManager.getJavaFileObjectsFromStrings(names);
- }
-
- @Override
- public Iterable<? extends JavaFileObject> getJavaFileObjects(String... names) {
- return fileManager.getJavaFileObjects(names);
- }
-
- @Override
- public void setLocation(Location location, Iterable<? extends File> path) throws IOException {
- fileManager.setLocation(location, path);
- }
-
- @Override
- public Iterable<? extends File> getLocation(Location location) {
- return fileManager.getLocation(location);
- }
-
- }
-}
--- a/test/langtools/tools/javadoc/api/basic/GetTask_FileObjectsTest.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,136 +0,0 @@
-/*
- * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * 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 6493690
- * @summary javadoc should have a javax.tools.Tool service provider
- * @modules java.compiler
- * jdk.compiler
- * @build APITest
- * @run main GetTask_FileObjectsTest
- */
-
-import java.io.File;
-import java.util.Arrays;
-import javax.tools.DocumentationTool;
-import javax.tools.DocumentationTool.DocumentationTask;
-import javax.tools.JavaFileObject;
-import javax.tools.StandardJavaFileManager;
-import javax.tools.ToolProvider;
-
-/**
- * Tests for DocumentationTool.getTask fileObjects parameter.
- */
-public class GetTask_FileObjectsTest extends APITest {
- public static void main(String... args) throws Exception {
- new GetTask_FileObjectsTest().run();
- }
-
- /**
- * Verify that expected output files are written via the file manager,
- * for a source file read from the file system with StandardJavaFileManager.
- */
- @Test
- public void testStandardFileObject() throws Exception {
- File testSrc = new File(System.getProperty("test.src"));
- File srcFile = new File(testSrc, "pkg/C.java");
- DocumentationTool tool = ToolProvider.getSystemDocumentationTool();
- try (StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null)) {
- File outDir = getOutDir();
- fm.setLocation(DocumentationTool.Location.DOCUMENTATION_OUTPUT, Arrays.asList(outDir));
- Iterable<? extends JavaFileObject> files = fm.getJavaFileObjects(srcFile);
- DocumentationTask t = tool.getTask(null, fm, null, null, null, files);
- if (t.call()) {
- System.err.println("task succeeded");
- checkFiles(outDir, standardExpectFiles);
- } else {
- throw new Exception("task failed");
- }
- }
- }
-
- /**
- * Verify that expected output files are written via the file manager,
- * for an in-memory file object.
- */
- @Test
- public void testMemoryFileObject() throws Exception {
- JavaFileObject srcFile = createSimpleJavaFileObject();
- DocumentationTool tool = ToolProvider.getSystemDocumentationTool();
- try (StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null)) {
- File outDir = getOutDir();
- fm.setLocation(DocumentationTool.Location.DOCUMENTATION_OUTPUT, Arrays.asList(outDir));
- Iterable<? extends JavaFileObject> files = Arrays.asList(srcFile);
- DocumentationTask t = tool.getTask(null, fm, null, null, null, files);
- if (t.call()) {
- System.err.println("task succeeded");
- checkFiles(outDir, standardExpectFiles);
- } else {
- throw new Exception("task failed");
- }
- }
- }
-
- /**
- * Verify bad file object is handled correctly.
- */
- @Test
- public void testBadFileObject() throws Exception {
- File testSrc = new File(System.getProperty("test.src"));
- File srcFile = new File(testSrc, "pkg/C.class"); // unacceptable file kind
- DocumentationTool tool = ToolProvider.getSystemDocumentationTool();
- try (StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null)) {
- File outDir = getOutDir();
- fm.setLocation(DocumentationTool.Location.DOCUMENTATION_OUTPUT, Arrays.asList(outDir));
- Iterable<? extends JavaFileObject> files = fm.getJavaFileObjects(srcFile);
- try {
- DocumentationTask t = tool.getTask(null, fm, null, null, null, files);
- error("getTask succeeded, no exception thrown");
- } catch (IllegalArgumentException e) {
- System.err.println("exception caught as expected: " + e);
- }
- }
- }
-
- /**
- * Verify null is handled correctly.
- */
- @Test
- public void testNull() throws Exception {
- DocumentationTool tool = ToolProvider.getSystemDocumentationTool();
- try (StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null)) {
- File outDir = getOutDir();
- fm.setLocation(DocumentationTool.Location.DOCUMENTATION_OUTPUT, Arrays.asList(outDir));
- Iterable<? extends JavaFileObject> files = Arrays.asList((JavaFileObject) null);
- try {
- DocumentationTask t = tool.getTask(null, fm, null, null, null, files);
- error("getTask succeeded, no exception thrown");
- } catch (NullPointerException e) {
- System.err.println("exception caught as expected: " + e);
- }
- }
- }
-
-}
-
--- a/test/langtools/tools/javadoc/api/basic/GetTask_OptionsTest.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,97 +0,0 @@
-/*
- * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * 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 6493690 8141492
- * @summary javadoc should have a javax.tools.Tool service provider
- * @modules java.compiler
- * jdk.compiler
- * @build APITest
- * @run main GetTask_OptionsTest
- */
-
-import java.io.File;
-import java.util.Arrays;
-import java.util.Set;
-import java.util.TreeSet;
-import javax.tools.DocumentationTool;
-import javax.tools.DocumentationTool.DocumentationTask;
-import javax.tools.JavaFileObject;
-import javax.tools.StandardJavaFileManager;
-import javax.tools.ToolProvider;
-
-/**
- * Tests for DocumentationTool.getTask options parameter.
- */
-public class GetTask_OptionsTest extends APITest {
- public static void main(String... args) throws Exception {
- new GetTask_OptionsTest().run();
- }
-
- /**
- * Verify that expected output files are written for given options.
- */
- @Test
- public void testNoIndex() throws Exception {
- JavaFileObject srcFile = createSimpleJavaFileObject();
- DocumentationTool tool = ToolProvider.getSystemDocumentationTool();
- try (StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null)) {
- File outDir = getOutDir();
- fm.setLocation(DocumentationTool.Location.DOCUMENTATION_OUTPUT, Arrays.asList(outDir));
- Iterable<? extends JavaFileObject> files = Arrays.asList(srcFile);
- Iterable<String> options = Arrays.asList("-noindex");
- DocumentationTask t = tool.getTask(null, fm, null, null, options, files);
- if (t.call()) {
- System.err.println("task succeeded");
- Set<String> expectFiles = new TreeSet<String>(noIndexFiles);
- checkFiles(outDir, expectFiles);
- } else {
- error("task failed");
- }
- }
- }
-
- /**
- * Verify null is handled correctly.
- */
- @Test
- public void testNull() throws Exception {
- JavaFileObject srcFile = createSimpleJavaFileObject();
- DocumentationTool tool = ToolProvider.getSystemDocumentationTool();
- try (StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null)) {
- File outDir = getOutDir();
- fm.setLocation(DocumentationTool.Location.DOCUMENTATION_OUTPUT, Arrays.asList(outDir));
- Iterable<String> options = Arrays.asList((String) null);
- Iterable<? extends JavaFileObject> files = Arrays.asList(srcFile);
- try {
- DocumentationTask t = tool.getTask(null, fm, null, null, options, files);
- error("getTask succeeded, no exception thrown");
- } catch (NullPointerException e) {
- System.err.println("exception caught as expected: " + e);
- }
- }
- }
-
-}
-
--- a/test/langtools/tools/javadoc/api/basic/GetTask_WriterTest.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,82 +0,0 @@
-/*
- * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * 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 6493690
- * @summary javadoc should have a javax.tools.Tool service provider
- * @modules java.compiler
- * jdk.compiler
- * @build APITest
- * @run main GetTask_WriterTest
- */
-
-import java.io.File;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.util.Arrays;
-import javax.tools.DocumentationTool;
-import javax.tools.DocumentationTool.DocumentationTask;
-import javax.tools.JavaFileObject;
-import javax.tools.StandardJavaFileManager;
-import javax.tools.ToolProvider;
-
-/**
- * Tests for DocumentationTool.getTask writer parameter.
- */
-public class GetTask_WriterTest extends APITest {
- public static void main(String... args) throws Exception {
- new GetTask_WriterTest().run();
- }
-
- /**
- * Verify that a writer can be provided.
- */
- @Test
- public void testWriter() throws Exception {
- JavaFileObject srcFile = createSimpleJavaFileObject();
- DocumentationTool tool = ToolProvider.getSystemDocumentationTool();
- try (StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null)) {
- File outDir = getOutDir();
- fm.setLocation(DocumentationTool.Location.DOCUMENTATION_OUTPUT, Arrays.asList(outDir));
- Iterable<? extends JavaFileObject> files = Arrays.asList(srcFile);
- StringWriter sw = new StringWriter();
- PrintWriter pw = new PrintWriter(sw);
- DocumentationTask t = tool.getTask(pw, fm, null, null, null, files);
- if (t.call()) {
- System.err.println("task succeeded");
- checkFiles(outDir, standardExpectFiles);
- String out = sw.toString();
- System.err.println(">>" + out + "<<");
- for (String f: standardExpectFiles) {
- String f1 = f.replace('/', File.separatorChar);
- if (f1.endsWith(".html") && !out.contains(f1))
- throw new Exception("expected string not found: " + f1);
- }
- } else {
- throw new Exception("task failed");
- }
- }
- }
-}
-
--- a/test/langtools/tools/javadoc/api/basic/Task_reuseTest.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,96 +0,0 @@
-/*
- * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * 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 6493690
- * @summary javadoc should have a javax.tools.Tool service provider
- * @modules java.compiler
- * jdk.compiler
- * @build APITest
- * @run main Task_reuseTest
- */
-
-import java.io.File;
-import java.util.Arrays;
-import java.util.Locale;
-import javax.tools.DocumentationTool;
-import javax.tools.DocumentationTool.DocumentationTask;
-import javax.tools.JavaFileObject;
-import javax.tools.StandardJavaFileManager;
-import javax.tools.ToolProvider;
-
-/**
- * Tests for reusing a documentation task.
- */
-public class Task_reuseTest extends APITest {
- public static void main(String... args) throws Exception {
- new Task_reuseTest().run();
- }
-
- /**
- * Verify that call can only be called once.
- */
- @Test
- public void testReuse() throws Exception {
- DocumentationTask t = getAndRunTask();
- try {
- t.call();
- error("task was reused without exception");
- } catch (IllegalStateException e) {
- System.err.println("caught exception " + e);
- }
- }
-
- /**
- * Verify that cannot update task after call
- */
- @Test
- public void testUpdateSetLocale() throws Exception {
- DocumentationTask t = getAndRunTask();
- try {
- t.setLocale(Locale.getDefault());
- error("task was reused without exception");
- } catch (IllegalStateException e) {
- System.err.println("caught exception " + e);
- }
- }
-
- private DocumentationTask getAndRunTask() throws Exception {
- JavaFileObject srcFile = createSimpleJavaFileObject();
- DocumentationTool tool = ToolProvider.getSystemDocumentationTool();
- try (StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null)) {
- File outDir = getOutDir();
- fm.setLocation(DocumentationTool.Location.DOCUMENTATION_OUTPUT, Arrays.asList(outDir));
- Iterable<? extends JavaFileObject> files = Arrays.asList(srcFile);
- DocumentationTask t = tool.getTask(null, fm, null, null, null, files);
- if (t.call()) {
- System.err.println("task succeeded");
- return t;
- } else {
- throw new Exception("task failed");
- }
- }
- }
-}
-
--- a/test/langtools/tools/javadoc/api/basic/pkg/C.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * 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 pkg;
-
-public class C { }
-
--- a/test/langtools/tools/javadoc/api/basic/taglets/UnderlineTaglet.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,152 +0,0 @@
-/*
- * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or
- * without modification, are permitted provided that the following
- * conditions are met:
- *
- * -Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * -Redistribution in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of Oracle nor the names of
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * This software is provided "AS IS," without a warranty of any
- * kind. ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND
- * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY
- * EXCLUDED. SUN AND ITS LICENSORS SHALL NOT BE LIABLE FOR ANY
- * DAMAGES OR LIABILITIES SUFFERED BY LICENSEE AS A RESULT OF OR
- * RELATING TO USE, MODIFICATION OR DISTRIBUTION OF THE SOFTWARE OR
- * ITS DERIVATIVES. IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE
- * FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT,
- * SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER
- * CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF
- * THE USE OF OR INABILITY TO USE SOFTWARE, EVEN IF SUN HAS BEEN
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
- * You acknowledge that Software is not designed, licensed or
- * intended for use in the design, construction, operation or
- * maintenance of any nuclear facility.
- */
-
-import com.sun.tools.doclets.Taglet;
-import com.sun.javadoc.*;
-import java.util.Map;
-
-/**
- * A sample Inline Taglet representing {@underline ...}. This tag can
- * be used in any kind of {@link com.sun.javadoc.Doc}.
- * The text is underlined. For example,
- * "@underline UNDERLINE ME" would be shown as: <u>UNDERLINE ME</u>.
- *
- * @author Jamie Ho
- * @since 1.4
- */
-
-public class UnderlineTaglet implements Taglet {
-
- private static final String NAME = "underline";
-
- /**
- * Return the name of this custom tag.
- */
- public String getName() {
- return NAME;
- }
-
- /**
- * @return true since this tag can be used in a field
- * doc comment
- */
- public boolean inField() {
- return true;
- }
-
- /**
- * @return true since this tag can be used in a constructor
- * doc comment
- */
- public boolean inConstructor() {
- return true;
- }
-
- /**
- * @return true since this tag can be used in a method
- * doc comment
- */
- public boolean inMethod() {
- return true;
- }
-
- /**
- * @return true since this tag can be used in an overview
- * doc comment
- */
- public boolean inOverview() {
- return true;
- }
-
- /**
- * @return true since this tag can be used in a package
- * doc comment
- */
- public boolean inPackage() {
- return true;
- }
-
- /**
- * @return true since this
- */
- public boolean inType() {
- return true;
- }
-
- /**
- * Will return true since this is an inline tag.
- * @return true since this is an inline tag.
- */
-
- public boolean isInlineTag() {
- return true;
- }
-
- /**
- * Register this Taglet.
- * @param tagletMap the map to register this tag to.
- */
- public static void register(Map tagletMap) {
- UnderlineTaglet tag = new UnderlineTaglet();
- Taglet t = (Taglet) tagletMap.get(tag.getName());
- if (t != null) {
- tagletMap.remove(tag.getName());
- }
- tagletMap.put(tag.getName(), tag);
- }
-
- /**
- * Given the <code>Tag</code> representation of this custom
- * tag, return its string representation.
- * @param tag he <code>Tag</code> representation of this custom tag.
- */
- public String toString(Tag tag) {
- return "<u>" + tag.text() + "</u>";
- }
-
- /**
- * This method should not be called since arrays of inline tags do not
- * exist. Method {@link #tostring(Tag)} should be used to convert this
- * inline tag to a string.
- * @param tags the array of <code>Tag</code>s representing of this custom tag.
- */
- public String toString(Tag[] tags) {
- return null;
- }
-}
-
--- a/test/langtools/tools/javadoc/completionFailure/CompletionFailure.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * 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 4670772 6328529
- * @summary Completion failures should be ignored in javadoc.
- * @author gafter
- * @modules jdk.javadoc
- */
-
-import com.sun.javadoc.*;
-import java.util.*;
-
-public class CompletionFailure extends Doclet
-{
- public static void main(String[] args) {
- // run javadoc on package pkg
- if (com.sun.tools.javadoc.Main.execute("javadoc",
- "CompletionFailure",
- CompletionFailure.class.getClassLoader(),
- new String[]{"pkg"}) != 0)
- throw new Error();
- }
-
- public static boolean start(com.sun.javadoc.RootDoc root) {
- ClassDoc[] classes = root.classes();
- if (classes.length != 1)
- throw new Error("1 " + Arrays.asList(classes));
- return true;
- }
-}
--- a/test/langtools/tools/javadoc/completionFailure/pkg/A.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-/*
- * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package pkg;
-
-public class A {
-}
--- a/test/langtools/tools/javadoc/completionFailure/pkg/B.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-/*
- * Copyright (c) 2002, 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.
- */
-
-import pkg.A;
-
-public class B {
-}
--- a/test/langtools/tools/javadoc/dupOk/DupOk.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * 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 4673477
- * @summary The first definition found for each class should be documented
- * @author gafter
- * @modules jdk.javadoc
- */
-
-import com.sun.javadoc.*;
-import java.util.*;
-
-public class DupOk extends Doclet
-{
- public static void main(String[] args) {
- // run javadoc on package p
- if (com.sun.tools.javadoc.Main.
- execute("javadoc", "DupOk", DupOk.class.getClassLoader(),
- new String[]
- {"-sourcepath",
- System.getProperty("test.src", ".") + java.io.File.separatorChar + "sp1" +
- System.getProperty("path.separator") +
- System.getProperty("test.src", ".") + java.io.File.separatorChar + "sp2",
- "p"
- }) != 0)
- throw new Error();
- }
-
- public static boolean start(com.sun.javadoc.RootDoc root) {
- ClassDoc[] classes = root.classes();
- if (classes.length != 2)
- throw new Error("1 " + Arrays.asList(classes));
- for (int i=0; i<classes.length; i++) {
- ClassDoc clazz = classes[i];
- if (clazz.fields().length != 1)
- throw new Error("2 " + clazz + " " + Arrays.asList(clazz.fields()));
- }
- return true;
- }
-}
--- a/test/langtools/tools/javadoc/dupOk/sp1/p/A.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package p;
-
-public class A {
- public int x;
-}
--- a/test/langtools/tools/javadoc/dupOk/sp2/p/A.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-/*
- * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package p;
-
-public class A {}
--- a/test/langtools/tools/javadoc/dupOk/sp2/p/B.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package p;
-
-public class B {
- public int x;
-}
--- a/test/langtools/tools/javadoc/enum/docComments/Main.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,78 +0,0 @@
-/*
- * Copyright (c) 2003, 2016, 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 4421066
- * @summary Verify the comments in an enum type.
- * @library ../../lib
- * @modules jdk.javadoc
- * @compile ../../lib/OldToolTester.java Main.java
- * @run main Main
- */
-
-import java.io.IOException;
-import com.sun.javadoc.*;
-
-public class Main extends OldToolTester.Doclet {
-
- private static final OldToolTester tester =
- new OldToolTester("Main", "-package", "pkg1");
-
- public static void main(String[] args) throws IOException {
- tester.run();
- }
-
- public static boolean start(RootDoc root) {
- ClassDoc operation = root.classes()[0];
- boolean ok =
- checkComment(operation.commentText(), "Arithmetic operations.");
-
- for (FieldDoc f : operation.fields()) {
- if (f.name().equals("plus")) {
- ok = checkComment(f.commentText(), "Addition") && ok;
- for (MethodDoc m : operation.methods()) {
- if (m.name().equals("eval")) {
- ok = checkComment(m.commentText(),
- "Perform arithmetic operation " +
- "represented by this constant.") &&
- ok;
- break;
- }
- }
- break;
- }
- }
- if (!ok) {
- throw new Error("Comments don't match expectations.");
- } else {
- return true;
- }
- }
-
- private static boolean checkComment(String found, String expected) {
- System.out.println("expected: \"" + expected + "\"");
- System.out.println("found: \"" + found + "\"");
- return expected.equals(found);
- }
-}
--- a/test/langtools/tools/javadoc/enum/docComments/pkg1/Operation.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package pkg1;
-
-/*
- * Example from JSR 201, which borrowed it from "Effective Java".
- */
-
-/**
- * Arithmetic operations.
- */
-public abstract enum Operation {
- /** Addition */
- plus {
- /** Add 'em up. */
- double eval(double x, double y) { return x + y; }
- },
- minus {
- double eval(double x, double y) { return x - y; }
- },
- times {
- double eval(double x, double y) { return x * y; }
- },
- divided_by {
- double eval(double x, double y) { return x / y; }
- };
-
- /**
- * Perform arithmetic operation represented by this constant.
- */
- abstract double eval(double x, double y);
-}
--- a/test/langtools/tools/javadoc/enum/enumType/Main.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +0,0 @@
-/*
- * Copyright (c) 2003, 2016, 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 4421066
- * @summary Verify the contents of an enum type.
- * @library ../../lib
- * @modules jdk.javadoc
- * @compile ../../lib/OldToolTester.java Main.java
- * @run main Main
- */
-
-import java.io.IOException;
-import com.sun.javadoc.*;
-
-public class Main extends OldToolTester.Doclet {
-
- private static final OldToolTester tester = new OldToolTester("Main", "pkg1");
-
- public static void main(String[] args) throws IOException {
- tester.run();
- tester.verify();
- }
-
- public static boolean start(RootDoc root) {
- try {
- for (ClassDoc cd : root.classes()) {
- tester.printClass(cd);
- }
-
- return true;
- } catch (IOException e) {
- return false;
- }
- }
-}
--- a/test/langtools/tools/javadoc/enum/enumType/expected.out Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,18 +0,0 @@
-enum pkg1.QuotablePerson
- name: QuotablePerson / QuotablePerson / pkg1.QuotablePerson
- superclass:
- java.lang.Enum<pkg1.QuotablePerson>
- enum constants:
- Thoreau
- McLuhan
- Pynchon
- Mencken
- Allen
- Vidal
- Occam
- Groening
- Juvenal
- Eco
- methods:
- pkg1.QuotablePerson[] values()
- QuotablePerson valueOf(String)
--- a/test/langtools/tools/javadoc/enum/enumType/pkg1/QuotablePerson.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +0,0 @@
-/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package pkg1;
-
-/**
- * Some people we love to quote.
- */
-public enum QuotablePerson {
-
- /** "Beware of all enterprises that require new clothes." */
- Thoreau,
-
- /**
- * "A point of view can be a dangerous luxury when substituted for
- * insight and understanding."
- */
- McLuhan,
-
- /**
- * "If they can keep you asking the wrong questions, they don't have to
- * worry about the answers."
- */
- Pynchon,
-
- /**
- * "For every problem, there is a solution that is simple, elegant,
- * and wrong."
- */
- Mencken,
-
- /**
- * "Formerly unsolvable equations are dealt with by threats of reprisals."
- */
- Allen,
-
- /** "It is not enough to succeed. Others must fail." */
- Vidal,
-
- /** "Entia non sunt multiplicanda praeter necessitatem." */
- Occam,
-
- /**
- * "Love is a snowmobile racing across the tundra and then suddenly it
- * flips over, pinning you underneath. At night, the ice weasels come."
- */
- Groening,
-
- /** "Sed Quis custodiet ipsos custodes?" */
- Juvenal,
-
- /**
- * "The list could surely go on, and there is nothing more wonderful
- * than a list, instrument of wondrous hypotyposis."
- */
- Eco
-}
--- a/test/langtools/tools/javadoc/generics/genericClass/Main.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +0,0 @@
-/*
- * Copyright (c) 2003, 2016, 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 4421066
- * @summary Verify the contents of the ClassDoc of a generic class.
- * @library ../../lib
- * @modules jdk.javadoc
- * @compile ../../lib/OldToolTester.java Main.java
- * @run main Main
- */
-
-import java.io.IOException;
-import com.sun.javadoc.*;
-
-public class Main extends OldToolTester.Doclet {
-
- private static final OldToolTester tester = new OldToolTester("Main", "pkg1");
-
- public static void main(String[] args) throws IOException {
- tester.run();
- tester.verify();
- }
-
- public static boolean start(RootDoc root) {
- try {
- for (ClassDoc cd : root.classes()) {
- tester.printClass(cd);
- }
-
- return true;
- } catch (IOException e) {
- return false;
- }
- }
-}
--- a/test/langtools/tools/javadoc/generics/genericClass/expected.out Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,16 +0,0 @@
-class pkg1.A<T>
- name: A / A / pkg1.A
- type parameters:
- T
- superclass:
- java.lang.Object
- fields:
- T t
- pkg1.A<T> at
- pkg1.A<java.lang.String> as
- constructors:
- A()
- methods:
- void m1(T)
- void m2(A<T>)
- void m3(A<String>)
--- a/test/langtools/tools/javadoc/generics/genericClass/pkg1/A.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package pkg1;
-
-public class A<T> {
- public T t;
- public A<T> at;
- public A<String> as;
-
- public void m1(T t) {}
- public void m2(A<T> at) {}
- public void m3(A<String> as) {}
-}
--- a/test/langtools/tools/javadoc/generics/genericInnerAndOuter/Main.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 2003, 2016, 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 4421066
- * @summary Verify the contents of the ClassDoc of
- * a generic class with a generic inner class.
- * @library ../../lib
- * @modules jdk.javadoc
- * @compile ../../lib/OldToolTester.java Main.java
- * @run main Main
- */
-
-import java.io.IOException;
-import java.util.Arrays;
-import com.sun.javadoc.*;
-
-public class Main extends OldToolTester.Doclet {
-
- private static final OldToolTester tester = new OldToolTester("Main", "pkg1");
-
- public static void main(String[] args) throws IOException {
- tester.run();
- tester.verify();
- }
-
- public static boolean start(RootDoc root) {
- try {
- ClassDoc[] cds = root.classes();
- Arrays.sort(cds);
- for (ClassDoc cd : cds) {
- tester.printClass(cd);
- tester.println();
- }
-
- return true;
- } catch (IOException e) {
- return false;
- }
- }
-}
--- a/test/langtools/tools/javadoc/generics/genericInnerAndOuter/expected.out Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +0,0 @@
-class pkg1.O<T>
- name: O / O / pkg1.O
- type parameters:
- T
- superclass:
- java.lang.Object
- constructors:
- O()
-
-class pkg1.O<T>.I<S>
- name: I / O.I / pkg1.O.I
- type parameters:
- S
- nested in:
- pkg1.O<T>
- superclass:
- java.lang.Object
- constructors:
- I()
- methods:
- void m1(O<String>.I<Number>)
-
-class pkg1.X<T>
- name: X / X / pkg1.X
- type parameters:
- T
- superclass:
- java.lang.Object
- constructors:
- X()
-
-class pkg1.X<T>.Y
- name: Y / X.Y / pkg1.X.Y
- nested in:
- pkg1.X<T>
- superclass:
- java.lang.Object
- constructors:
- Y()
-
-class pkg1.X<T>.Y.Z<S>
- name: Z / X.Y.Z / pkg1.X.Y.Z
- type parameters:
- S
- nested in:
- pkg1.X<T>.Y
- superclass:
- java.lang.Object
- constructors:
- Z()
- methods:
- void m1(X<String>.Y.Z<Number>)
-
--- a/test/langtools/tools/javadoc/generics/genericInnerAndOuter/pkg1/O.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package pkg1;
-
-public class O<T> {
- public class I<S> {
- public void m1(O<String>.I<Number> a) {}
- }
-}
--- a/test/langtools/tools/javadoc/generics/genericInnerAndOuter/pkg1/X.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package pkg1;
-
-public class X<T> {
- public class Y {
- public class Z<S> {
- public void m1(X<String>.Y.Z<Number> a) {}
- }
- }
-}
--- a/test/langtools/tools/javadoc/generics/genericInterface/Main.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +0,0 @@
-/*
- * Copyright (c) 2003, 2016, 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 4421066
- * @summary Verify the contents of the ClassDoc of a generic interface.
- * @library ../../lib
- * @modules jdk.javadoc
- * @compile ../../lib/OldToolTester.java Main.java
- * @run main Main
- */
-
-import java.io.IOException;
-import com.sun.javadoc.*;
-
-public class Main extends OldToolTester.Doclet {
-
- private static final OldToolTester tester = new OldToolTester("Main", "pkg1");
-
- public static void main(String[] args) throws IOException {
- tester.run();
- tester.verify();
- }
-
- public static boolean start(RootDoc root) {
- try {
- for (ClassDoc cd : root.classes()) {
- tester.printClass(cd);
- }
-
- return true;
- } catch (IOException e) {
- return false;
- }
- }
-}
--- a/test/langtools/tools/javadoc/generics/genericInterface/expected.out Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,6 +0,0 @@
-interface pkg1.A<T>
- name: A / A / pkg1.A
- type parameters:
- T
- methods:
- void m1(T)
--- a/test/langtools/tools/javadoc/generics/genericInterface/pkg1/A.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package pkg1;
-
-public interface A<T> {
- void m1(T t);
-}
--- a/test/langtools/tools/javadoc/generics/genericMethod/Main.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,60 +0,0 @@
-/*
- * Copyright (c) 2003, 2016, 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 4421066
- * @summary Verify the reading of generic methods and constructors.
- * @library ../../lib
- * @modules jdk.javadoc
- * @compile ../../lib/OldToolTester.java Main.java
- * @run main Main
- */
-
-import java.io.IOException;
-import com.sun.javadoc.*;
-
-public class Main extends OldToolTester.Doclet {
-
- private static final OldToolTester tester = new OldToolTester("Main", "pkg1");
-
- public static void main(String[] args) throws IOException {
- tester.run();
- tester.verify();
- }
-
- public static boolean start(RootDoc root) {
- try {
- for (ClassDoc cd : root.classes()) {
- for (ConstructorDoc c : cd.constructors())
- tester.printConstructor(c);
- for (MethodDoc m : cd.methods())
- tester.printMethod(m);
- }
-
- return true;
- } catch (IOException e) {
- return false;
- }
- }
-}
--- a/test/langtools/tools/javadoc/generics/genericMethod/expected.out Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,20 +0,0 @@
-constructor <T>pkg1.A()
- signature: ()
- ()
- type parameters:
- T
-method pkg1.A.<T>m1(T)
- signature: (T)
- (T)
- type parameters:
- T
- returns:
- void
-method pkg1.A.<T extends java.lang.Number, U>m2(T, U)
- signature: (T, U)
- (T, U)
- type parameters:
- T extends java.lang.Number
- U
- returns:
- void
--- a/test/langtools/tools/javadoc/generics/genericMethod/pkg1/A.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package pkg1;
-
-public class A {
- public <T> A() {}
- public <T> void m1(T t) {}
- public <T extends Number, U> void m2(T t, U u) {}
-}
--- a/test/langtools/tools/javadoc/generics/genericSuper/Main.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 2003, 2016, 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 4421066
- * @summary Verify the contents of the ClassDoc of a generic class.
- * @library ../../lib
- * @modules jdk.javadoc
- * @compile ../../lib/OldToolTester.java Main.java
- * @run main Main
- */
-
-import java.io.IOException;
-import java.util.Arrays;
-import com.sun.javadoc.*;
-
-public class Main extends OldToolTester.Doclet {
-
- private static final OldToolTester tester =
- new OldToolTester("Main", "pkg1", "-package");
-
- public static void main(String[] args) throws IOException {
- tester.run();
- tester.verify();
- }
-
- public static boolean start(RootDoc root) {
- try {
- ClassDoc[] cds = root.classes();
- Arrays.sort(cds);
- for (ClassDoc cd : cds) {
- tester.printClass(cd);
- tester.println();
- }
-
- return true;
- } catch (IOException e) {
- return false;
- }
- }
-}
--- a/test/langtools/tools/javadoc/generics/genericSuper/expected.out Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-class pkg1.A<V, W>
- name: A / A / pkg1.A
- type parameters:
- V
- W
- superclass:
- pkg1.S<W, V>
- interfaces:
- pkg1.I<java.lang.String>
- constructors:
- A()
-
-interface pkg1.I<R>
- name: I / I / pkg1.I
- type parameters:
- R
-
-class pkg1.S<T, U>
- name: S / S / pkg1.S
- type parameters:
- T
- U
- superclass:
- java.lang.Object
- constructors:
- S()
-
--- a/test/langtools/tools/javadoc/generics/genericSuper/pkg1/A.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package pkg1;
-
-class S<T,U> {
-}
-
-interface I<R> {
-}
-
-public class A<V,W> extends S<W,V> implements I<String> {
-}
--- a/test/langtools/tools/javadoc/generics/supertypes/Main.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,80 +0,0 @@
-/*
- * Copyright (c) 2003, 2016, 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 4922918
- * @summary Check supertypes and superinterfaces of parameterized types.
- * @library ../../lib
- * @modules jdk.javadoc
- * @compile ../../lib/OldToolTester.java Main.java
- * @run main Main
- */
-
-import java.io.IOException;
-import java.util.Comparator;
-import java.util.Arrays;
-import com.sun.javadoc.*;
-
-public class Main extends OldToolTester.Doclet {
-
- private static final OldToolTester tester = new OldToolTester("Main", "pkg1");
-
- public static void main(String[] args) throws IOException {
- tester.run();
- tester.verify();
- }
-
- public static boolean start(RootDoc root) {
- try {
- ClassDoc[] cds = root.classes();
- Arrays.sort(cds);
- for (ClassDoc cd : cds) {
- ParameterizedType arrayList =
- cd.superclassType().asParameterizedType();
- tester.println(arrayList);
- tester.println();
-
- tester.println(arrayList.superclassType());
- Type[] interfaces = arrayList.interfaceTypes();
- // Sort interfaces by type name, for consistent output.
- Arrays.sort(interfaces,
- new Comparator<Type>() {
- public int compare(Type t1, Type t2) {
- String name1 = t1.qualifiedTypeName();
- String name2 = t2.qualifiedTypeName();
- return name1.compareTo(name2);
- }
- });
- for (Type t : interfaces) {
- tester.println(t);
- }
- tester.println();
- }
-
- return true;
- } catch (IOException e) {
- return false;
- }
- }
-}
--- a/test/langtools/tools/javadoc/generics/supertypes/expected.out Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,16 +0,0 @@
-java.util.ArrayList<java.lang.String>
-
-java.util.AbstractList<java.lang.String>
-java.io.Serializable
-java.lang.Cloneable
-java.util.List<java.lang.String>
-java.util.RandomAccess
-
-java.util.ArrayList<X>
-
-java.util.AbstractList<X>
-java.io.Serializable
-java.lang.Cloneable
-java.util.List<X>
-java.util.RandomAccess
-
--- a/test/langtools/tools/javadoc/generics/supertypes/pkg1/A.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package pkg1;
-
-import java.util.ArrayList;
-
-public class A extends ArrayList<String> {
-}
--- a/test/langtools/tools/javadoc/generics/supertypes/pkg1/B.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package pkg1;
-
-import java.util.ArrayList;
-
-public class B<X> extends ArrayList<X> {
-}
--- a/test/langtools/tools/javadoc/generics/throwsGeneric/Main.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +0,0 @@
-/*
- * Copyright (c) 2003, 2016, 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 4421066
- * @summary Verify the reading of generic methods and constructors.
- * @library ../../lib
- * @modules jdk.javadoc
- * @compile ../../lib/OldToolTester.java Main.java
- * @run main Main
- */
-
-import java.io.IOException;
-import com.sun.javadoc.*;
-
-public class Main extends OldToolTester.Doclet {
-
- private static final OldToolTester tester = new OldToolTester("Main", "pkg1");
-
- public static void main(String[] args) throws IOException {
- tester.run();
- tester.verify();
- }
-
- public static boolean start(RootDoc root) {
- try {
- for (ClassDoc cd : root.classes()) {
- for (MethodDoc m : cd.methods())
- tester.printMethod(m);
- }
-
- return true;
- } catch (IOException e) {
- return false;
- }
- }
-}
--- a/test/langtools/tools/javadoc/generics/throwsGeneric/expected.out Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,16 +0,0 @@
-method pkg1.A.m1()
- signature: ()
- ()
- throws:
- T extends java.lang.Throwable
- returns:
- void
-method pkg1.A.<U extends java.lang.Throwable>m2()
- signature: ()
- ()
- type parameters:
- U extends java.lang.Throwable
- throws:
- U extends java.lang.Throwable
- returns:
- void
--- a/test/langtools/tools/javadoc/generics/throwsGeneric/pkg1/A.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package pkg1;
-
-public interface A<T extends Throwable> {
- void m1() throws T;
- <U extends Throwable> void m2() throws U;
-}
--- a/test/langtools/tools/javadoc/generics/tparamCycle/Main.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,63 +0,0 @@
-/*
- * Copyright (c) 2003, 2016, 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 4421066
- * @summary Check a type parameter whose bound cycles back on itself.
- * @library ../../lib
- * @modules jdk.javadoc
- * @compile ../../lib/OldToolTester.java Main.java
- * @run main Main
- */
-
-import java.io.IOException;
-import com.sun.javadoc.*;
-
-public class Main extends OldToolTester.Doclet {
-
- private static final OldToolTester tester = new OldToolTester("Main", "pkg1");
-
- public static void main(String[] args) throws IOException {
- tester.run();
- }
-
- public static boolean start(RootDoc root) {
- ClassDoc cd = root.classes()[0];
- System.out.println("*** " + cd);
- TypeVariable E = cd.typeParameters()[0];
- System.out.println("*** " + E);
- Type bound = E.bounds()[0];
- System.out.println("*** " + bound);
-
- // Verify that we have an instantiation of Enum<E>, and not
- // the generic interface.
- ParameterizedType enumE = (ParameterizedType)bound;
-
- if (enumE.asClassDoc() != cd) {
- throw new Error("Type declaration and type use don't match up.");
- } else {
- return true;
- }
- }
-}
--- a/test/langtools/tools/javadoc/generics/tparamCycle/pkg1/LikeEnum.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package pkg1;
-
-public interface LikeEnum<E extends LikeEnum<E>> {
-}
--- a/test/langtools/tools/javadoc/generics/tparamTagOnMethod/Main.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2003, 2016, 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 4421066
- * @summary Verify the reading of type parameter tags on methods.
- * @library ../../lib
- * @modules jdk.javadoc
- * @compile ../../lib/OldToolTester.java Main.java
- * @run main Main
- */
-
-import java.io.IOException;
-import com.sun.javadoc.*;
-
-public class Main extends OldToolTester.Doclet {
-
- private static final OldToolTester tester = new OldToolTester("Main", "pkg1");
-
- public static void main(String[] args) throws IOException {
- tester.run();
- tester.verify();
- }
-
- public static boolean start(RootDoc root) {
- try {
- for (ClassDoc cd : root.classes()) {
- for (MethodDoc m : cd.methods()) {
- tester.printMethod(m);
- }
- }
-
- return true;
- } catch (IOException e) {
- return false;
- }
- }
-}
--- a/test/langtools/tools/javadoc/generics/tparamTagOnMethod/expected.out Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,12 +0,0 @@
-method pkg1.A.<T, U>m1(T, U)
- signature: (T, U)
- (T, U)
- @param <T> the kind of thing
- @param <U> the other kind of thing
- @param t the thing itself
- @param u the other thing
- type parameters:
- T
- U
- returns:
- void
--- a/test/langtools/tools/javadoc/generics/tparamTagOnMethod/pkg1/A.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package pkg1;
-
-public interface A {
- /**
- * @param <T> the kind of thing
- * @param <U> the other kind of thing
- * @param t the thing itself
- * @param u the other thing
- */
- public <T,U> void m1(T t, U u);
-}
--- a/test/langtools/tools/javadoc/generics/tparamTagOnType/Main.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +0,0 @@
-/*
- * Copyright (c) 2003, 2016, 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 4421066
- * @summary Verify the reading of a type parameter tag on an interface.
- * @library ../../lib
- * @modules jdk.javadoc
- * @compile ../../lib/OldToolTester.java Main.java
- * @run main Main
- */
-
-import java.io.IOException;
-import com.sun.javadoc.*;
-
-public class Main extends OldToolTester.Doclet {
-
- private static final OldToolTester tester = new OldToolTester("Main", "pkg1");
-
- public static void main(String[] args) throws IOException {
- tester.run();
- tester.verify();
- }
-
- public static boolean start(RootDoc root) {
- try {
- for (ClassDoc cd : root.classes()) {
- tester.printClass(cd);
- }
-
- return true;
- } catch (IOException e) {
- return false;
- }
- }
-}
--- a/test/langtools/tools/javadoc/generics/tparamTagOnType/expected.out Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,5 +0,0 @@
-interface pkg1.A<T>
- name: A / A / pkg1.A
- type parameters:
- T
- @param <T> the type parameter
--- a/test/langtools/tools/javadoc/generics/tparamTagOnType/pkg1/A.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package pkg1;
-
-/**
- * @param <T> the type parameter
- */
-public interface A<T> {
-}
--- a/test/langtools/tools/javadoc/generics/wildcards/Main.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +0,0 @@
-/*
- * Copyright (c) 2003, 2016, 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 4421066
- * @summary Verify the contents of the ClassDoc of a generic class.
- * @library ../../lib
- * @modules jdk.javadoc
- * @compile ../../lib/OldToolTester.java Main.java
- * @run main Main
- */
-
-import java.io.IOException;
-import com.sun.javadoc.*;
-
-public class Main extends OldToolTester.Doclet {
-
- private static final OldToolTester tester = new OldToolTester("Main", "pkg1");
-
- public static void main(String[] args) throws IOException {
- tester.run();
- tester.verify();
- }
-
- public static boolean start(RootDoc root) {
- try {
- for (ClassDoc cd : root.classes()) {
- tester.printClass(cd);
- }
-
- return true;
- } catch (IOException e) {
- return false;
- }
- }
-}
--- a/test/langtools/tools/javadoc/generics/wildcards/expected.out Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,16 +0,0 @@
-class pkg1.A<T>
- name: A / A / pkg1.A
- type parameters:
- T
- superclass:
- java.lang.Object
- fields:
- pkg1.A<?> f1
- pkg1.A<? extends java.lang.Number> f2
- pkg1.A<? super java.lang.Long> f3
- constructors:
- A()
- methods:
- void m1(A<?>)
- void m2(A<? extends Number>)
- void m3(A<? super Long>)
--- a/test/langtools/tools/javadoc/generics/wildcards/pkg1/A.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package pkg1;
-
-public class A<T> {
- public A<?> f1;
- public A<? extends Number> f2;
- public A<? super Long> f3;
-
- public void m1(A<?> p1) {}
- public void m2(A<? extends Number> p2) {}
- public void m3(A<? super Long> p3) {}
-}
--- a/test/langtools/tools/javadoc/imports/I.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2004, 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.
- */
-
-// The following imported class is bogus, but should still be returned
-// when inquired of.
-import bo.o.o.o.Gus;
-
-public interface I {
-}
--- a/test/langtools/tools/javadoc/imports/MissingImport.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * 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 5012972
- * @summary ClassDoc.getImportedClasses should return a class even if
- * it's not in the classpath.
- * @modules jdk.javadoc
- */
-
-import com.sun.javadoc.*;
-
-
-public class MissingImport extends Doclet {
-
- public static void main(String[] args) {
- String thisFile = "" +
- new java.io.File(System.getProperty("test.src", "."),
- "I.java");
-
- if (com.sun.tools.javadoc.Main.execute(
- "javadoc",
- "MissingImport",
- MissingImport.class.getClassLoader(),
- new String[] {thisFile}) != 0)
- throw new Error("Javadoc encountered warnings or errors.");
- }
-
- /*
- * The world's simplest doclet.
- */
- public static boolean start(RootDoc root) {
- ClassDoc c = root.classNamed("I");
- ClassDoc[] imps = c.importedClasses();
- if (imps.length == 0 ||
- !imps[0].qualifiedName().equals("bo.o.o.o.Gus")) {
- throw new Error("Import bo.o.o.o.Gus not found");
- }
- return true;
- }
-}
--- a/test/langtools/tools/javadoc/lib/OldToolTester.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,338 +0,0 @@
-/*
- * Copyright (c) 2003, 2016, 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.
- */
-
-/*
- * A utility used to invoke and test the javadoc tool.
- *
- * @author Scott Seligman
- */
-
-
-import java.io.*;
-import java.util.*;
-import com.sun.javadoc.*;
-
-
-public class OldToolTester {
-
- protected final String TEST_SRC = System.getProperty("test.src", ".");
- protected final String TEST_CLASSES = System.getProperty("test.classes",
- ".");
- private final String DEFAULT_ARGS[] = {
- "-sourcepath", TEST_SRC,
- };
-
- private final File outputFile = new File(TEST_CLASSES, "testrun.out");
- private final File expectedOutputFile = new File(TEST_SRC, "expected.out");
-// private final File bootstrapMarkerFile = new File("bootstrap");
-
- // True if we should "set expectations" by writing the expected output file
- // rather than reading it and comparing.
-// private final boolean bootstrap = bootstrapMarkerFile.isFile();
-
- private String docletName;
- private String[] args;
- private Writer out = null;
-
-
- /*
- * Individual tests can extend this to create generics-aware doclets.
- */
- public static abstract class Doclet extends com.sun.javadoc.Doclet {
- public static LanguageVersion languageVersion() {
- return LanguageVersion.JAVA_1_5;
- }
- }
-
-
- public OldToolTester(String docletName) {
- this(docletName, new String[0]);
- }
-
- public OldToolTester(String docletName, String... additionalArgs) {
- this.docletName = docletName;
-
- int len = DEFAULT_ARGS.length + additionalArgs.length;
- args = new String[len];
- System.arraycopy(DEFAULT_ARGS, 0, args, 0, DEFAULT_ARGS.length);
- System.arraycopy(additionalArgs, 0, args, DEFAULT_ARGS.length,
- additionalArgs.length);
-
- try {
- out = new BufferedWriter(new FileWriter(outputFile));
- } catch (IOException e) {
- throw new Error("Could not open output file " + outputFile);
- }
- }
-
- public void run() throws IOException {
- try {
- if (com.sun.tools.javadoc.Main.execute("javadoc",
- docletName,
- getClass().getClassLoader(),
- args) != 0) {
- throw new Error("Javadoc errors encountered.");
- }
- System.out.println("--> Output written to " + outputFile);
- } finally {
- out.close();
- }
- }
-
- /*
- * Compare output of test run to expected output.
- * Throw an Error if they don't match.
- */
- public void verify() throws IOException {
- BufferedReader thisRun =
- new BufferedReader(new FileReader(outputFile));
- BufferedReader expected =
- new BufferedReader(new FileReader(expectedOutputFile));
-
- for (int lineNum = 1; true; lineNum++) {
- String line1 = thisRun.readLine();
- String line2 = expected.readLine();
- if (line1 == null && line2 == null) {
- return; // EOF with all lines matching
- }
- if (line1 == null || !line1.equals(line2)) {
- throw new Error(outputFile + ":" + lineNum +
- ": output doesn't match");
- }
- }
- }
-
-
- public void println(Object o) throws IOException {
- prln(0, o);
- }
-
- public void println() throws IOException {
- prln();
- }
-
- public void printPackage(PackageDoc p) throws IOException {
- prPackage(0, p);
- }
-
- public void printClass(ClassDoc cd) throws IOException {
- if (cd.isAnnotationType())
- printAnnotationType((AnnotationTypeDoc)cd);
- else
- prClass(0, cd);
- }
-
- public void printAnnotationType(AnnotationTypeDoc at) throws IOException {
- prAnnotationType(0, at);
- }
-
- public void printField(FieldDoc f) throws IOException {
- prField(0, f);
- }
-
- public void printParameter(Parameter p) throws IOException {
- prParameter(0, p);
- }
-
- public void printMethod(MethodDoc m) throws IOException {
- prln(0, "method " + m);
- prMethod(0, m);
- }
-
- public void printAnnotationTypeElement(AnnotationTypeElementDoc e)
- throws IOException {
- prln(0, "element " + e);
- prMethod(0, e);
- }
-
- public void printConstructor(ConstructorDoc c) throws IOException {
- prln(0, "constructor " + c);
- prExecutable(0, c);
- }
-
-
- private void prPackage(int off, PackageDoc p) throws IOException {
- prln(off, "package " + p);
- prAnnotations(off + 2, p.annotations());
- }
-
- private void prClass(int off, ClassDoc cd) throws IOException {
- prln(off,
- (cd.isInterface() ? "interface" : cd.isEnum() ? "enum" : "class")
- + " " + cd);
- prln(off + 2, "name: " + cd.simpleTypeName() + " / " +
- cd.typeName() + " / " + cd.qualifiedTypeName());
- prAnnotations(off + 2, cd.annotations());
- prLabel(off + 2, "type parameters");
- for (Type t : cd.typeParameters())
- prln(off + 4, t);
- prParamTags(off + 2, cd.typeParamTags());
- prLabel(off + 2, "nested in");
- prln(off + 4, cd.containingClass());
- prLabel(off + 2, "superclass");
- prln(off + 4, cd.superclassType());
- prLabel(off + 2, "interfaces");
- Type[] ts = cd.interfaceTypes();
- Arrays.sort(ts);
- for (Type t : ts)
- prln(off + 4, t);
- prLabel(off + 2, "enum constants");
- for (FieldDoc f : cd.enumConstants())
- prln(off + 4, f.name());
- prLabel(off + 2, "fields");
- for (FieldDoc f : cd.fields())
- prln(off + 4, f.type() + " " + f.name());
- prLabel(off + 2, "constructors");
- for (ConstructorDoc c : cd.constructors())
- prln(off + 4, c.name() + c.flatSignature());
- prLabel(off + 2, "methods");
- for (MethodDoc m : cd.methods())
- prln(off + 4, typeUseString(m.returnType()) + " " +
- m.name() + m.flatSignature());
- }
-
- private void prAnnotationType(int off, AnnotationTypeDoc at)
- throws IOException {
- prln(off, "@interface " + at);
- prAnnotations(off + 2, at.annotations());
- prLabel(off + 2, "elements");
- for (AnnotationTypeElementDoc e : at.elements()) {
- String def = (e.defaultValue() == null)
- ? ""
- : " default " + e.defaultValue();
- prln(off + 4, typeUseString(e.returnType()) + " " + e.name() +
- e.flatSignature() + def);
- }
- }
-
- private void prField(int off, FieldDoc f) throws IOException {
- prln(off, "field " + typeUseString(f.type()) + " " + f.name());
- prAnnotations(off + 2, f.annotations());
- }
-
- private void prParameter(int off, Parameter p) throws IOException {
- prln(off, "parameter " + p);
- prAnnotations(off + 2, p.annotations());
- }
-
- private void prMethod(int off, MethodDoc m) throws IOException {
- prExecutable(off, m);
- prLabel(off + 2, "returns");
- prln(off + 4, typeUseString(m.returnType()));
- prLabel(off + 2, "overridden type");
- prln(off + 4, m.overriddenType());
- }
-
- private void prExecutable(int off, ExecutableMemberDoc m)
- throws IOException {
- if (!m.isAnnotationTypeElement()) {
- prln(off + 2, "signature: " + m.flatSignature());
- prln(off + 2, " " + m.signature());
- }
- prAnnotations(off + 2, m.annotations());
- prParamTags(off + 2, m.typeParamTags());
- prParamTags(off + 2, m.paramTags());
- prLabel(off + 2, "type parameters");
- for (Type t : m.typeParameters())
- prln(off + 4, t);
- prLabel(off + 2, "throws");
- Type[] ts = m.thrownExceptionTypes();
- Arrays.sort(ts);
- for (Type t : ts)
- prln(off + 4, t);
- }
-
- private void prAnnotations(int off, AnnotationDesc[] as)
- throws IOException {
- prLabel(off, "annotations");
- for (AnnotationDesc a : as)
- prln(off + 2, a.toString());
- }
-
- private void prParamTags(int off, ParamTag tags[]) throws IOException {
- for (ParamTag tag : tags)
- prParamTag(off, tag);
- }
-
- private void prParamTag(int off, ParamTag tag) throws IOException {
- String name = tag.parameterName();
- if (tag.isTypeParameter()) name = "<" + name + ">";
- prln(off, "@param " + name + " " + tag.parameterComment());
- }
-
-
- private String typeUseString(Type t) {
- return (t instanceof ClassDoc || t instanceof TypeVariable)
- ? t.typeName()
- : t.toString();
- }
-
-
- // Labels queued for possible printing. Innermost is first in list.
- List<Line> labels = new ArrayList<Line>();
-
- // Print label if its section is nonempty.
- void prLabel(int off, String s) {
- while (!labels.isEmpty() && labels.get(0).off >= off)
- labels.remove(0);
- labels.add(0, new Line(off, s));
- }
-
- // Print queued labels with offsets less than "off".
- void popLabels(int off) throws IOException {
- while (!labels.isEmpty()) {
- Line label = labels.remove(0);
- if (label.off < off)
- prln(label.off, label.o + ":");
- }
- }
-
- // Print "o" at given offset.
- void pr(int off, Object o) throws IOException {
- popLabels(off);
- for (int i = 0; i < off; i++)
- out.write(' ');
- if (o != null)
- out.write(o.toString());
- }
-
- // Print "o" (if non-null) at given offset, then newline.
- void prln(int off, Object o) throws IOException {
- if (o != null) {
- pr(off, o);
- prln();
- }
- }
-
- // Print newline.
- void prln() throws IOException {
- out.write('\n'); // don't want platform-dependent separator
- }
-
-
- static class Line {
- int off;
- Object o;
- Line(int off, Object o) { this.off = off; this.o = o; }
- }
-}
--- a/test/langtools/tools/javadoc/lib/ToyDoclet.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,78 +0,0 @@
-/*
- * Copyright (c) 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.
- *
- * 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.
- */
-
-import java.util.Arrays;
-
-import com.sun.javadoc.ClassDoc;
-import com.sun.javadoc.PackageDoc;
-import com.sun.javadoc.ProgramElementDoc;
-import com.sun.javadoc.RootDoc;
-
-@SuppressWarnings("deprecation")
-public class ToyDoclet {
-
- public static boolean start(RootDoc root) {
- String whoami = "I am a toy doclet";
- root.printNotice("Notice: " + whoami);
- boolean status = false;
- for (ClassDoc cls : root.classes()) {
- if (!status) status = true;
- root.printNotice("Classes: " + cls);
- printClassMembers(root, cls);
- }
- for (ClassDoc cls : root.specifiedClasses()) {
- if (!status) status = true;
- root.printNotice("Specified-classes: " + cls);
- printClassMembers(root, cls);
- }
- for (PackageDoc pkg : root.specifiedPackages()) {
- if (!status) status = true;
- root.printNotice("Specified-packages: " + pkg);
- }
- return status;
- }
-
- static void printClassMembers(RootDoc root, ClassDoc cls) {
- root.printNotice("Members for: " + cls);
- root.printNotice(" extends " + Arrays.asList(cls.superclass()));
- root.printNotice(" Fields: ");
- printMembers(root, cls.fields());
- root.printNotice(" Constructor: ");
- printMembers(root, cls.constructors());
- root.printNotice(" Method: ");
- printMembers(root, cls.methods());
- if (cls.superclass() != null && !cls.superclassType().toString().equals("java.lang.Object"))
- printClassMembers(root, cls.superclass());
- }
-
- static void printMembers(RootDoc root, ProgramElementDoc[] pgmDocs) {
- for (ProgramElementDoc pgmDoc : pgmDocs) {
- root.printNotice(" " + pgmDoc + ", Comments: " + pgmDoc.getRawCommentText());
- }
- }
-
- public static int optionLength(String option) {
- System.out.println("option: " + option);
- return 0; // all options are unsupported
- }
-}
--- a/test/langtools/tools/javadoc/nestedClass/NestedClass.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,60 +0,0 @@
-/*
- * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * 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 4694497
- * @summary BDoclet API: Bad ClassDoc for nested classes when built from .class files
- * @author gafter
- * @modules jdk.javadoc
- * @compile NestedClass.java NestedClassB.java
- * @run main NestedClass
- */
-
-import com.sun.javadoc.*;
-import java.util.*;
-
-public class NestedClass extends Doclet
-{
- public NestedClassB b;
-
- public static void main(String[] args) {
- if (com.sun.tools.javadoc.Main.
- execute("javadoc", "NestedClass", NestedClass.class.getClassLoader(),
- new String[] {System.getProperty("test.src", ".") +
- java.io.File.separatorChar +
- "NestedClass.java"})
- != 0)
- throw new Error();
- }
-
- public static boolean start(com.sun.javadoc.RootDoc root) {
- ClassDoc[] classes = root.classes();
- if (classes.length != 1)
- throw new Error("1 " + Arrays.asList(classes));
- ClassDoc self = classes[0];
- FieldDoc B = self.fields()[0];
- ClassDoc[] Binner = B.type().asClassDoc().innerClasses();
- return Binner.length == 1;
- }
-}
--- a/test/langtools/tools/javadoc/nestedClass/NestedClassB.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-/*
- * Copyright (c) 2002, 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.
- */
-
-public class NestedClassB {
- public static class Inner {}
-}
--- a/test/langtools/tools/javadoc/nonConstExprs/Test.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 2013, 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.
- *
- * 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 8010310
- * @summary Error processing sources with -private
- * @modules jdk.javadoc
- */
-
-import java.io.File;
-
-public class Test {
- public static void main(String... args) throws Exception {
- File testSrc = new File(System.getProperty("test.src"));
- String[] jdoc_args = {
- new File(testSrc, Test.class.getSimpleName() + ".java").getPath()
- };
- int rc = com.sun.tools.javadoc.Main.execute(jdoc_args);
- if (rc != 0)
- throw new Exception("unexpected return code from javadoc: " + rc);
- }
-
- static int array[] = { 1, 2, 3};
- static int method(int p) { return p; }
- static int value = 0;
-
- public int not_static_not_final = 1;
- public static int static_not_final = 2;
- public final int not_static_final = 3;
- public static final int static_final = 4;
-
- public static final int array_index = array[0];
- public static final int method_call = method(0);
- public static final int inner_class = new Test() { }.method(0);
- public static final int new_class = new Test().method(0);
- public static final int pre_inc = ++value;
- public static final int pre_dec = --value;
- public static final int post_inc = value++;
- public static final int post_dec = value--;
-}
-
--- a/test/langtools/tools/javadoc/outputRedirect/Test.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * 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 4587487
- * @summary com.sun.tools.javadoc.Main.execute ignores PrintWriters
- * @author gafter
- * @modules jdk.javadoc
- * @compile p/OutputRedirect.java
- * @run main p.OutputRedirect
- */
-
-// jtreg description-only file
--- a/test/langtools/tools/javadoc/outputRedirect/p/OutputRedirect.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,68 +0,0 @@
-/*
- * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package p;
-
-import java.io.*;
-import com.sun.tools.javadoc.Main;
-
-public class OutputRedirect {
-
- public static void main(String[] args) {
- PrintStream originalOutput = System.out;
- try {
- doTest();
- } finally {
- // restore things
- System.setOut(originalOutput);
- }
- }
-
- static void doTest() {
- ByteArrayOutputStream redirectedOutput = new ByteArrayOutputStream();
- PrintStream originalOutput = System.out;
-
- // redirect System.out to a buffer
- System.setOut(new PrintStream(redirectedOutput));
-
- PrintWriter sink = new PrintWriter(new ByteArrayOutputStream());
-
- // execute javadoc
- int result = Main.execute("javadoc", sink, sink, sink,
- "com.sun.tools.doclets.standard.Standard",
- new String[] {"p"}
- );
-
-
- // test whether javadoc did any output to System.out
- if (redirectedOutput.toByteArray().length > 0) {
- originalOutput.println("Test failed; here's what javadoc wrote on its standard output:");
- originalOutput.println(redirectedOutput.toString());
- throw new Error("javadoc output wasn\'t properly redirected");
- } else if (result != 0) {
- throw new Error("javadoc run failed");
- } else {
- originalOutput.println("OK, good");
- }
- }
-}
--- a/test/langtools/tools/javadoc/parser/7091528/T7091528.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,86 +0,0 @@
-/*
- * Copyright (c) 2009, 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.
- *
- * 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 7091528 8029145 8037484
- * @summary ensures javadoc parses unique source files and ignores all class files
- * @modules jdk.javadoc/com.sun.tools.doclets.standard
- * @library /tools/javadoc/lib
- * @build ToyDoclet
- * @compile p/C1.java p/q/C2.java
- * @run main T7091528
- */
-
-import java.io.File;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-
-public class T7091528 {
- public static void main(String... args) {
- new T7091528().run();
- }
- void run() {
- File testSrc = new File(System.getProperty("test.src"));
- File testClasses = new File(System.getProperty("test.classes"));
- // 7091528, tests if class files are being ignored
- runTest(
- "-sourcepath", testClasses + File.pathSeparator + testSrc,
- "-subpackages",
- "p");
- // 8029145, tests if unique source files are parsed
- runTest(
- "-sourcepath", testSrc.getAbsolutePath(),
- "-subpackages",
- "p:p.q");
- File testPkgDir = new File(testSrc, "p");
- File testFile = new File(testPkgDir, "C3.java");
- runTest(
- "-sourcepath", testSrc.getAbsolutePath(),
- testFile.getAbsolutePath(),
- "p");
- runTest(
- "-classpath", testSrc.getAbsolutePath(),
- testFile.getAbsolutePath(),
- "p");
-
- }
- void runTest(String... args) {
- StringWriter sw = new StringWriter();
- PrintWriter pw = new PrintWriter(sw);
- int rc = com.sun.tools.javadoc.Main.execute("example", pw, pw, pw,
- "ToyDoclet", getClass().getClassLoader(), args);
- pw.close();
-
- String out = sw.toString();
- if (!out.isEmpty()) {
- System.err.println(out);
- }
-
- if (rc != 0)
- throw new Error("javadoc failed: exit code = " + rc);
-
- if (out.matches("(?s).*p/[^ ]+\\.class.*"))
- throw new Error("reading .class files");
- }
-}
--- a/test/langtools/tools/javadoc/parser/7091528/p/C1.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * 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 p1;
-
-/** This is class C1. */
-public class C1 { }
-
--- a/test/langtools/tools/javadoc/parser/7091528/p/C3.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-/*
- * Copyright (c) 2014, 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.
- */
-
-/** This is class C3, and no package for me please */
-public class C3 {}
-
--- a/test/langtools/tools/javadoc/parser/7091528/p/q/C2.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * 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 p.q;
-
-/** This is class p.q.C2. */
-public class C2 { }
-
--- a/test/langtools/tools/javadoc/sourceOnly/Test.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 2015, 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.
- *
- * 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 4548768 8034258
- * @summary Javadoc in JDK 1.4 uses classpath and not just source dir
- * @author gafter
- * @modules jdk.javadoc
- * @compile p/SourceOnly.java p/NonSource.jasm
- * @run main p.SourceOnly
- */
-
-// this file is just a dummy to get the javadoc started.
-//
-// NOTE: this test only seems to work in separate JVM mode for
-// reasons having something to do with javing tools.jar
-// on the classpath. Until that is sorted out, these tests
-// must be run in separate VM mode.
--- a/test/langtools/tools/javadoc/sourceOnly/p/NonSource.jasm Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 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.
- *
- * 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 p;
-
-super public class NonSource
- version 46:0
-{
- public Method "<init>":"()V"
- stack 1 locals 1
- {
- aload_0;
- invokespecial Method java/lang/Object."<init>":"()V";
- return;
- }
-}
--- a/test/langtools/tools/javadoc/sourceOnly/p/SourceOnly.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 2008, 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.
- *
- * 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 p;
-
-/** Test that when running javadoc on a package, we only get
- * documentation for those classes for which source was provided.
- */
-public class SourceOnly extends com.sun.javadoc.Doclet {
- NonSource dependency; // force a compilation error if not on classpath.
-
- public static void main(String[] args) {
- // run javadoc on package p
- int result = com.sun.tools.javadoc.Main.
- execute("javadoc", "p.SourceOnly", SourceOnly.class.getClassLoader(), new String[] {"p"});
- if (result != 0)
- throw new Error();
- }
-
- public static boolean start(com.sun.javadoc.RootDoc root) {
- if (root.classes().length != 1)
- throw new Error("wrong set of classes documented: " + java.util.Arrays.asList(root.classes()));
- return true;
- }
-}
--- a/test/langtools/tools/javadoc/sourceOption/SourceOption.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,79 +0,0 @@
-/*
- * Copyright (c) 2006, 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 6507179
- * @summary Ensure that "-source" option isn't ignored.
- * @author Scott Seligman
- * @modules jdk.javadoc
- * @run main/fail SourceOption 7
- * @run main SourceOption 9
- * @run main SourceOption
- */
-
-/*
- * In order to test whether or not the -source option is working
- * correctly, this test tries to parse source code that contains
- * a feature that is not available in at least one of the currently
- * supported previous versions.
- *
- * Parsing such code should be expected to fail; if the action
- * passes, that means the -source option is (incorrectly) ineffective.
- *
- * Additional actions are performed to ensure that the source
- * provided is valid for the current release of the JDK.
- *
- * As support for older versions of the platform are dropped, the
- * source code (currently p/LambdaConstructTest.java) will need to
- * be updated with a more recent feature.
- */
-
-import com.sun.javadoc.*;
-
-public class SourceOption extends Doclet {
-
- public static void main(String[] args) {
- String[] params;
- if ((args == null) || (args.length==0)) {
- params = new String[]{"p"};
- System.out.println("NOTE : -source not provided, default taken");
- } else {
- params = new String[]{"-source", args[0], "p"};
- System.out.println("NOTE : -source will be: " + args[0]);
- }
-
- if (com.sun.tools.javadoc.Main.execute(
- "javadoc",
- "SourceOption",
- SourceOption.class.getClassLoader(),
- params) != 0)
- throw new Error("Javadoc encountered warnings or errors.");
-
- }
-
- public static boolean start(RootDoc root) {
- root.classes(); // force parser into action
- return true;
- }
-}
--- a/test/langtools/tools/javadoc/sourceOption/p/LambdaConstructTest.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) 2014, 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.
- */
-
-public class LambdaConstructTest {
- public static void main(String[] args) {
-
- System.out.println("=== LambdaConstructTest ===");
-
- // Lambda Runnable
- Runnable lambda = () -> System.out.println("it's a Lambda world!");
-
- // Run it!
- lambda.run();
-
- }
-}
-
--- a/test/langtools/tools/javadoc/subpackageIgnore/SubpackageIgnore.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-/*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * 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 4773013
- * @summary When hunting subpackages, silently ignore any directory name that
- * can't be part of a subpackage.
- * @modules jdk.javadoc
- */
-
-import com.sun.javadoc.*;
-
-public class SubpackageIgnore extends Doclet {
-
- public static void main(String[] args) {
- if (com.sun.tools.javadoc.Main.execute(
- "javadoc",
- "SubpackageIgnore",
- SubpackageIgnore.class.getClassLoader(),
- new String[] {"-Xwerror",
- "-sourcepath",
- System.getProperty("test.src", "."),
- "-subpackages",
- "pkg1"}) != 0)
- throw new Error("Javadoc encountered warnings or errors.");
- }
-
- /*
- * The world's simplest doclet.
- */
- public static boolean start(RootDoc root) {
- return true;
- }
-}
--- a/test/langtools/tools/javadoc/subpackageIgnore/pkg1/not-subpkg/SomeJavaFile.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,23 +0,0 @@
-/*
- * Copyright (c) 2003, 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.
- */
-
--- a/test/langtools/tools/javadoc/varArgs/Main.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,65 +0,0 @@
-/*
- * Copyright (c) 2003, 2016, 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 4421066 5006659
- * @summary Verify the contents of a ClassDoc containing a varArgs method.
- * Verify that see/link tags can use "..." notation.
- * @library ../lib
- * @modules jdk.javadoc
- * @compile ../lib/OldToolTester.java Main.java
- * @run main Main
- */
-
-import java.io.IOException;
-import com.sun.javadoc.*;
-
-public class Main extends OldToolTester.Doclet {
-
- private static final OldToolTester tester =
- new OldToolTester("Main", "-Xwerror", "pkg1");
-
- public static void main(String[] args) throws IOException {
- tester.run();
- tester.verify();
- }
-
- public static boolean start(RootDoc root) {
- try {
- for (ClassDoc cd : root.classes()) {
- tester.printClass(cd);
-
- for (SeeTag tag : cd.seeTags()) {
- if (tag.referencedMember() != cd.methods()[0]) {
- throw new Error("5006659: @see tag meets varArgs");
- }
- }
- }
-
- return true;
- } catch (IOException e) {
- return false;
- }
- }
-}
--- a/test/langtools/tools/javadoc/varArgs/expected.out Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,4 +0,0 @@
-interface pkg1.A
- name: A / A / pkg1.A
- methods:
- void m1(int, String...)
--- a/test/langtools/tools/javadoc/varArgs/pkg1/A.java Tue Feb 26 12:08:20 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package pkg1;
-
-/**
- * Interface A.
- *
- * @see #m1(int, String[])
- * @see #m1(int, String...)
- */
-public interface A {
- void m1(int i, String... ss);
-}
--- a/test/lib/jdk/test/lib/Utils.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/lib/jdk/test/lib/Utils.java Tue Feb 26 12:11:29 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, 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
@@ -88,6 +88,11 @@
*/
public static final String TEST_SRC = System.getProperty("test.src", "").trim();
+ /**
+ * Returns the value of 'test.root' system property.
+ */
+ public static final String TEST_ROOT = System.getProperty("test.root", "").trim();
+
/*
* Returns the value of 'test.jdk' system property
*/
@@ -96,12 +101,13 @@
/*
* Returns the value of 'compile.jdk' system property
*/
- public static final String COMPILE_JDK= System.getProperty("compile.jdk", TEST_JDK);
+ public static final String COMPILE_JDK = System.getProperty("compile.jdk", TEST_JDK);
/**
* Returns the value of 'test.classes' system property
*/
public static final String TEST_CLASSES = System.getProperty("test.classes", ".");
+
/**
* Defines property name for seed value.
*/
@@ -118,9 +124,9 @@
*/
public static final long SEED = Long.getLong(SEED_PROPERTY_NAME, new Random().nextLong());
/**
- * Returns the value of 'test.timeout.factor' system property
- * converted to {@code double}.
- */
+ * Returns the value of 'test.timeout.factor' system property
+ * converted to {@code double}.
+ */
public static final double TIMEOUT_FACTOR;
static {
String toFactor = System.getProperty("test.timeout.factor", "1.0");
@@ -128,9 +134,9 @@
}
/**
- * Returns the value of JTREG default test timeout in milliseconds
- * converted to {@code long}.
- */
+ * Returns the value of JTREG default test timeout in milliseconds
+ * converted to {@code long}.
+ */
public static final long DEFAULT_TEST_TIMEOUT = TimeUnit.SECONDS.toMillis(120);
private Utils() {
--- a/test/lib/jdk/test/lib/jfr/EventNames.java Tue Feb 26 12:08:20 2019 -0500
+++ b/test/lib/jdk/test/lib/jfr/EventNames.java Tue Feb 26 12:11:29 2019 -0500
@@ -66,7 +66,6 @@
public final static String ClassUnload = PREFIX + "ClassUnload";
public final static String SafepointBegin = PREFIX + "SafepointBegin";
public final static String SafepointStateSynchronization = PREFIX + "SafepointStateSynchronization";
- public final static String SafepointWaitBlocked = PREFIX + "SafepointWaitBlocked";
public final static String SafepointCleanup = PREFIX + "SafepointCleanup";
public final static String SafepointCleanupTask = PREFIX + "SafepointCleanupTask";
public final static String SafepointEnd = PREFIX + "SafepointEnd";
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/micro/org/openjdk/bench/java/nio/CharBuffers.java Tue Feb 26 12:11:29 2019 -0500
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2019, 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 org.openjdk.bench.java.nio;
+
+import java.nio.CharBuffer;
+import java.util.Arrays;
+import java.util.concurrent.TimeUnit;
+
+import org.openjdk.jmh.annotations.Benchmark;
+import org.openjdk.jmh.annotations.BenchmarkMode;
+import org.openjdk.jmh.annotations.Level;
+import org.openjdk.jmh.annotations.Mode;
+import org.openjdk.jmh.annotations.OutputTimeUnit;
+import org.openjdk.jmh.annotations.Param;
+import org.openjdk.jmh.annotations.Scope;
+import org.openjdk.jmh.annotations.Setup;
+import org.openjdk.jmh.annotations.State;
+
+@BenchmarkMode(Mode.AverageTime)
+@OutputTimeUnit(TimeUnit.NANOSECONDS)
+@State(Scope.Thread)
+public class CharBuffers {
+
+ @Param({"2", "256", "16384"})
+ public int numChars;
+
+ public String str;
+ public CharBuffer buf;
+
+ @Setup(Level.Iteration)
+ public void createString() {
+ char[] c = new char[numChars];
+ Arrays.fill(c, 'X');
+ str = String.valueOf(c);
+ buf = CharBuffer.allocate(numChars);
+ }
+
+ @Benchmark
+ public CharBuffer putString() {
+ buf.clear();
+ return buf.put(str);
+ }
+
+}
--- a/test/nashorn/TEST.ROOT Tue Feb 26 12:08:20 2019 -0500
+++ b/test/nashorn/TEST.ROOT Tue Feb 26 12:11:29 2019 -0500
@@ -8,7 +8,7 @@
groups=TEST.groups
# Minimum jtreg version
-requiredVersion=4.2 b13
+requiredVersion=4.2 b14
# Use new module options
useNewOptions=true