mirror of
https://github.com/openjdk/jdk.git
synced 2026-05-06 19:59:17 +00:00
Merge
This commit is contained in:
commit
7ab17924f5
@ -105,7 +105,7 @@ public class ArgumentAttr extends JCTree.Visitor {
|
||||
private Env<AttrContext> env;
|
||||
|
||||
/** Result of method attribution. */
|
||||
private Type result;
|
||||
Type result;
|
||||
|
||||
/** Cache for argument types; behavior is influences by the currrently selected cache policy. */
|
||||
Map<UniquePos, ArgumentType<?>> argumentTypeCache = new LinkedHashMap<>();
|
||||
@ -215,13 +215,8 @@ public class ArgumentAttr extends JCTree.Visitor {
|
||||
processArg(that, () -> {
|
||||
T speculativeTree = (T)deferredAttr.attribSpeculative(that, env, attr.new MethodAttrInfo() {
|
||||
@Override
|
||||
protected void attr(JCTree tree, Env<AttrContext> env) {
|
||||
//avoid speculative attribution loops
|
||||
if (!new UniquePos(tree).equals(pos)) {
|
||||
super.attr(tree, env);
|
||||
} else {
|
||||
visitTree(tree);
|
||||
}
|
||||
protected boolean needsArgumentAttr(JCTree tree) {
|
||||
return !new UniquePos(tree).equals(pos);
|
||||
}
|
||||
});
|
||||
return argumentTypeFactory.apply(speculativeTree);
|
||||
|
||||
@ -505,9 +505,12 @@ public class Attr extends JCTree.Visitor {
|
||||
this.checkMode = checkMode;
|
||||
}
|
||||
|
||||
protected void attr(JCTree tree, Env<AttrContext> env) {
|
||||
tree.accept(Attr.this);
|
||||
}
|
||||
/**
|
||||
* Should {@link Attr#attribTree} use the {@ArgumentAttr} visitor instead of this one?
|
||||
* @param tree The tree to be type-checked.
|
||||
* @return true if {@ArgumentAttr} should be used.
|
||||
*/
|
||||
protected boolean needsArgumentAttr(JCTree tree) { return false; }
|
||||
|
||||
protected Type check(final DiagnosticPosition pos, final Type found) {
|
||||
return chk.checkType(pos, found, pt, checkContext);
|
||||
@ -553,8 +556,8 @@ public class Attr extends JCTree.Visitor {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void attr(JCTree tree, Env<AttrContext> env) {
|
||||
result = argumentAttr.attribArg(tree, env);
|
||||
protected boolean needsArgumentAttr(JCTree tree) {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected ResultInfo dup(Type newPt) {
|
||||
@ -644,7 +647,11 @@ public class Attr extends JCTree.Visitor {
|
||||
try {
|
||||
this.env = env;
|
||||
this.resultInfo = resultInfo;
|
||||
resultInfo.attr(tree, env);
|
||||
if (resultInfo.needsArgumentAttr(tree)) {
|
||||
result = argumentAttr.attribArg(tree, env);
|
||||
} else {
|
||||
tree.accept(this);
|
||||
}
|
||||
if (tree == breakTree &&
|
||||
resultInfo.checkContext.deferredAttrContext().mode == AttrMode.CHECK) {
|
||||
throw new BreakAttr(copyEnv(env));
|
||||
|
||||
@ -2107,10 +2107,32 @@ public class Check {
|
||||
Name moduleName = tree.sym.name;
|
||||
Assert.checkNonNull(moduleName);
|
||||
if (lint.isEnabled(LintCategory.MODULE)) {
|
||||
String moduleNameString = moduleName.toString();
|
||||
int nameLength = moduleNameString.length();
|
||||
if (nameLength > 0 && Character.isDigit(moduleNameString.charAt(nameLength - 1))) {
|
||||
log.warning(Lint.LintCategory.MODULE, tree.qualId.pos(), Warnings.PoorChoiceForModuleName(moduleName));
|
||||
JCExpression qualId = tree.qualId;
|
||||
while (qualId != null) {
|
||||
Name componentName;
|
||||
DiagnosticPosition pos;
|
||||
switch (qualId.getTag()) {
|
||||
case SELECT:
|
||||
JCFieldAccess selectNode = ((JCFieldAccess) qualId);
|
||||
componentName = selectNode.name;
|
||||
pos = selectNode.pos();
|
||||
qualId = selectNode.selected;
|
||||
break;
|
||||
case IDENT:
|
||||
componentName = ((JCIdent) qualId).name;
|
||||
pos = qualId.pos();
|
||||
qualId = null;
|
||||
break;
|
||||
default:
|
||||
throw new AssertionError("Unexpected qualified identifier: " + qualId.toString());
|
||||
}
|
||||
if (componentName != null) {
|
||||
String moduleNameComponentString = componentName.toString();
|
||||
int nameLength = moduleNameComponentString.length();
|
||||
if (nameLength > 0 && Character.isDigit(moduleNameComponentString.charAt(nameLength - 1))) {
|
||||
log.warning(Lint.LintCategory.MODULE, pos, Warnings.PoorChoiceForModuleName(componentName));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -473,10 +473,14 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
|
||||
}
|
||||
} else {
|
||||
if (isValidFile(fname, fileKinds)) {
|
||||
RelativeFile file = new RelativeFile(subdirectory, fname);
|
||||
JavaFileObject fe = PathFileObject.forDirectoryPath(JavacFileManager.this,
|
||||
file.resolveAgainst(directory), userPath, file);
|
||||
resultList.append(fe);
|
||||
try {
|
||||
RelativeFile file = new RelativeFile(subdirectory, fname);
|
||||
JavaFileObject fe = PathFileObject.forDirectoryPath(JavacFileManager.this,
|
||||
file.resolveAgainst(directory), userPath, file);
|
||||
resultList.append(fe);
|
||||
} catch (InvalidPathException e) {
|
||||
throw new IOException("error accessing directory " + directory + e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1537,7 +1537,7 @@ compiler.warn.finally.cannot.complete=\
|
||||
|
||||
# 0: name
|
||||
compiler.warn.poor.choice.for.module.name=\
|
||||
module name {0} should avoid terminal digits
|
||||
module name component {0} should avoid terminal digits
|
||||
|
||||
# 0: string
|
||||
compiler.warn.incubating.modules=\
|
||||
|
||||
@ -169,11 +169,7 @@ public class ConstructorWriterImpl extends AbstractExecutableMemberWriter
|
||||
*/
|
||||
@Override
|
||||
public void setSummaryColumnStyleAndScope(HtmlTree thTree) {
|
||||
if (foundNonPubConstructor) {
|
||||
thTree.addStyle(HtmlStyle.colSecond);
|
||||
} else {
|
||||
thTree.addStyle(HtmlStyle.colFirst);
|
||||
}
|
||||
thTree.addStyle(HtmlStyle.colConstructorName);
|
||||
thTree.addAttr(HtmlAttr.SCOPE, "row");
|
||||
}
|
||||
|
||||
|
||||
@ -130,6 +130,7 @@ public class Contents {
|
||||
public final Content nextPackageLabel;
|
||||
public final Content noFramesLabel;
|
||||
public final Content noScriptMessage;
|
||||
public final Content openModuleLabel;
|
||||
public final Content overridesLabel;
|
||||
public final Content overviewLabel;
|
||||
public final Content packageHierarchies;
|
||||
@ -244,6 +245,7 @@ public class Contents {
|
||||
nextPackageLabel = getNonBreakContent("doclet.Next_Package");
|
||||
noFramesLabel = getNonBreakContent("doclet.No_Frames");
|
||||
noScriptMessage = getContent("doclet.No_Script_Message");
|
||||
openModuleLabel = getContent("doclet.Open_Module");
|
||||
overridesLabel = getContent("doclet.Overrides");
|
||||
overviewLabel = getContent("doclet.Overview");
|
||||
packageHierarchies = getContent("doclet.Package_Hierarchies");
|
||||
|
||||
@ -98,19 +98,19 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW
|
||||
= new TreeMap<>(utils.makeModuleComparator());
|
||||
|
||||
/**
|
||||
* Map of additional modules and modifiers, transitive closure, required by this module.
|
||||
* Map of indirect modules and modifiers, transitive closure, required by this module.
|
||||
*/
|
||||
private final Map<ModuleElement, Content> additionalModules
|
||||
private final Map<ModuleElement, Content> indirectModules
|
||||
= new TreeMap<>(utils.makeModuleComparator());
|
||||
|
||||
/**
|
||||
* Map of packages exported by this module and the modules it's been exported to.
|
||||
* Map of packages exported by this module and the modules it has been exported to.
|
||||
*/
|
||||
private final Map<PackageElement, SortedSet<ModuleElement>> exportedPackages
|
||||
= new TreeMap<>(utils.makePackageComparator());
|
||||
|
||||
/**
|
||||
* Map of opened packages by this module and the modules it's been opened to.
|
||||
* Map of opened packages by this module and the modules it has been opened to.
|
||||
*/
|
||||
private final Map<PackageElement, SortedSet<ModuleElement>> openedPackages
|
||||
= new TreeMap<>(utils.makePackageComparator());
|
||||
@ -121,15 +121,15 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW
|
||||
private final SortedSet<PackageElement> concealedPackages = new TreeSet<>(utils.makePackageComparator());
|
||||
|
||||
/**
|
||||
* Map of additional modules (transitive closure) and its exported packages.
|
||||
* Map of indirect modules (transitive closure) and their exported packages.
|
||||
*/
|
||||
private final Map<ModuleElement, SortedSet<PackageElement>> additionalPackages
|
||||
private final Map<ModuleElement, SortedSet<PackageElement>> indirectPackages
|
||||
= new TreeMap<>(utils.makeModuleComparator());
|
||||
|
||||
/**
|
||||
* Map of additional modules (transitive closure) and its open packages.
|
||||
* Map of indirect modules (transitive closure) and their open packages.
|
||||
*/
|
||||
private final Map<ModuleElement, SortedSet<PackageElement>> additionalOpenPackages
|
||||
private final Map<ModuleElement, SortedSet<PackageElement>> indirectOpenPackages
|
||||
= new TreeMap<>(utils.makeModuleComparator());
|
||||
|
||||
/**
|
||||
@ -212,8 +212,10 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW
|
||||
Content annotationContent = new HtmlTree(HtmlTag.P);
|
||||
addAnnotationInfo(mdle, annotationContent);
|
||||
div.addContent(annotationContent);
|
||||
Content label = mdle.isOpen() && (configuration.docEnv.getModuleMode() == ModuleMode.ALL)
|
||||
? contents.openModuleLabel : contents.moduleLabel;
|
||||
Content tHeading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true,
|
||||
HtmlStyle.title, contents.moduleLabel);
|
||||
HtmlStyle.title, label);
|
||||
tHeading.addContent(Contents.SPACE);
|
||||
Content moduleHead = new RawHtml(heading);
|
||||
tHeading.addContent(moduleHead);
|
||||
@ -264,12 +266,12 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW
|
||||
CommentHelper ch = utils.getCommentHelper(mdle);
|
||||
// Get module dependencies using the module's transitive closure.
|
||||
Map<ModuleElement, String> dependentModules = utils.getDependentModules(mdle);
|
||||
// Add all dependent modules to additional modules set. We will remove the modules,
|
||||
// listed using the requires directive, from this set to come up with the table of additional
|
||||
// Add all dependent modules to indirect modules set. We will remove the modules,
|
||||
// listed using the requires directive, from this set to come up with the table of indirect
|
||||
// required modules.
|
||||
dependentModules.forEach((module, mod) -> {
|
||||
if (shouldDocument(module)) {
|
||||
additionalModules.put(module, new StringContent(mod));
|
||||
indirectModules.put(module, new StringContent(mod));
|
||||
}
|
||||
});
|
||||
(ElementFilter.requiresIn(mdle.getDirectives())).forEach((directive) -> {
|
||||
@ -278,11 +280,11 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW
|
||||
if (moduleMode == ModuleMode.ALL || directive.isTransitive()) {
|
||||
requires.put(m, new StringContent(utils.getModifiers(directive)));
|
||||
} else {
|
||||
// For api mode, just keep the public requires in dependentModules for display of
|
||||
// additional packages in the "Packages" section.
|
||||
// For api mode, just keep the public requires in dependentModules for display of
|
||||
// indirect packages in the "Packages" section.
|
||||
dependentModules.remove(m);
|
||||
}
|
||||
additionalModules.remove(m);
|
||||
}
|
||||
indirectModules.remove(m);
|
||||
}
|
||||
});
|
||||
|
||||
@ -320,7 +322,7 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW
|
||||
mdleList.addAll(targetMdles);
|
||||
}
|
||||
// Qualified opens should not be displayed in the api mode. So if mdleList is empty,
|
||||
// it's opened to all modules and hence can be added.
|
||||
// it is opened to all modules and hence can be added.
|
||||
if (moduleMode == ModuleMode.ALL || mdleList.isEmpty()) {
|
||||
openedPackages.put(p, mdleList);
|
||||
}
|
||||
@ -331,7 +333,7 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW
|
||||
concealedPackages.removeAll(exportedPackages.keySet());
|
||||
concealedPackages.removeAll(openedPackages.keySet());
|
||||
// Get all the exported and opened packages, for the transitive closure of the module, to be displayed in
|
||||
// the additional packages tables.
|
||||
// the indirect packages tables.
|
||||
dependentModules.forEach((module, mod) -> {
|
||||
SortedSet<PackageElement> pkgList = new TreeSet<>(utils.makePackageComparator());
|
||||
(ElementFilter.exportsIn(module.getDirectives())).forEach((directive) -> {
|
||||
@ -343,7 +345,7 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW
|
||||
// If none of the transitive modules have exported packages to be displayed, we should not be
|
||||
// displaying the table and so it should not be added to the map.
|
||||
if (!pkgList.isEmpty()) {
|
||||
additionalPackages.put(module, pkgList);
|
||||
indirectPackages.put(module, pkgList);
|
||||
}
|
||||
SortedSet<PackageElement> openPkgList = new TreeSet<>(utils.makePackageComparator());
|
||||
(ElementFilter.opensIn(module.getDirectives())).forEach((directive) -> {
|
||||
@ -355,7 +357,7 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW
|
||||
// If none of the transitive modules have opened packages to be displayed, we should not be
|
||||
// displaying the table and so it should not be added to the map.
|
||||
if (!openPkgList.isEmpty()) {
|
||||
additionalOpenPackages.put(module, openPkgList);
|
||||
indirectOpenPackages.put(module, openPkgList);
|
||||
}
|
||||
});
|
||||
// Get all the services listed as uses directive.
|
||||
@ -471,31 +473,31 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addModulesSummary(Content summaryContentTree) {
|
||||
if (display(requires) || display(additionalModules)) {
|
||||
if (display(requires) || display(indirectModules)) {
|
||||
HtmlTree li = new HtmlTree(HtmlTag.LI);
|
||||
li.addStyle(HtmlStyle.blockList);
|
||||
addSummaryHeader(HtmlConstants.START_OF_MODULES_SUMMARY, SectionName.MODULES,
|
||||
contents.navModules, li);
|
||||
if (display(requires)) {
|
||||
String text = configuration.getText("doclet.Requires_Summary");
|
||||
String tableSummary = configuration.getText("doclet.Member_Table_Summary",
|
||||
configuration.getText("doclet.Requires_Summary"),
|
||||
configuration.getText("doclet.modules"));
|
||||
String text = configuration.getText("doclet.Requires_Summary");
|
||||
String tableSummary = configuration.getText("doclet.Member_Table_Summary",
|
||||
configuration.getText("doclet.Requires_Summary"),
|
||||
configuration.getText("doclet.modules"));
|
||||
Content table = getTableHeader(text, tableSummary, HtmlStyle.requiresSummary, requiresTableHeader);
|
||||
Content tbody = new HtmlTree(HtmlTag.TBODY);
|
||||
addModulesList(requires, tbody);
|
||||
table.addContent(tbody);
|
||||
li.addContent(table);
|
||||
}
|
||||
// Display additional modules table in both "api" and "all" mode.
|
||||
if (display(additionalModules)) {
|
||||
String amrText = configuration.getText("doclet.Additional_Modules_Required_Summary");
|
||||
// Display indirect modules table in both "api" and "all" mode.
|
||||
if (display(indirectModules)) {
|
||||
String amrText = configuration.getText("doclet.Indirect_Requires_Summary");
|
||||
String amrTableSummary = configuration.getText("doclet.Member_Table_Summary",
|
||||
configuration.getText("doclet.Additional_Modules_Required_Summary"),
|
||||
configuration.getText("doclet.Indirect_Requires_Summary"),
|
||||
configuration.getText("doclet.modules"));
|
||||
Content amrTable = getTableHeader(amrText, amrTableSummary, HtmlStyle.requiresSummary, requiresTableHeader);
|
||||
Content amrTbody = new HtmlTree(HtmlTag.TBODY);
|
||||
addModulesList(additionalModules, amrTbody);
|
||||
addModulesList(indirectModules, amrTbody);
|
||||
amrTable.addContent(amrTbody);
|
||||
li.addContent(amrTable);
|
||||
}
|
||||
@ -530,7 +532,7 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW
|
||||
|
||||
public void addPackagesSummary(Content summaryContentTree) {
|
||||
if (display(exportedPackages) || display(openedPackages) || display(concealedPackages)
|
||||
|| display(additionalPackages) || display(additionalOpenPackages)) {
|
||||
|| display(indirectPackages) || display(indirectOpenPackages)) {
|
||||
HtmlTree li = new HtmlTree(HtmlTag.LI);
|
||||
li.addStyle(HtmlStyle.blockList);
|
||||
addSummaryHeader(HtmlConstants.START_OF_PACKAGES_SUMMARY, SectionName.PACKAGES,
|
||||
@ -541,29 +543,29 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW
|
||||
if (display(exportedPackages) || display(openedPackages) || display(concealedPackages)) {
|
||||
addPackageSummary(tableSummary, li);
|
||||
}
|
||||
if (display(additionalPackages)) {
|
||||
String aepText = configuration.getText("doclet.Additional_Exported_Packages_Summary");
|
||||
String aepTableSummary = configuration.getText("doclet.Additional_Packages_Table_Summary",
|
||||
configuration.getText("doclet.Additional_Exported_Packages_Summary"),
|
||||
if (display(indirectPackages)) {
|
||||
String aepText = configuration.getText("doclet.Indirect_Exports_Summary");
|
||||
String aepTableSummary = configuration.getText("doclet.Indirect_Packages_Table_Summary",
|
||||
configuration.getText("doclet.Indirect_Exports_Summary"),
|
||||
configuration.getText("doclet.modules"),
|
||||
configuration.getText("doclet.packages"));
|
||||
Content aepTable = getTableHeader(aepText, aepTableSummary, HtmlStyle.packagesSummary,
|
||||
additionalPackagesTableHeader);
|
||||
indirectPackagesTableHeader);
|
||||
Content aepTbody = new HtmlTree(HtmlTag.TBODY);
|
||||
addAdditionalPackages(aepTbody, additionalPackages);
|
||||
addIndirectPackages(aepTbody, indirectPackages);
|
||||
aepTable.addContent(aepTbody);
|
||||
li.addContent(aepTable);
|
||||
}
|
||||
if (display(additionalOpenPackages)) {
|
||||
String aopText = configuration.getText("doclet.Additional_Opened_Packages_Summary");
|
||||
String aopTableSummary = configuration.getText("doclet.Additional_Packages_Table_Summary",
|
||||
configuration.getText("doclet.Additional_Opened_Packages_Summary"),
|
||||
if (display(indirectOpenPackages)) {
|
||||
String aopText = configuration.getText("doclet.Indirect_Opens_Summary");
|
||||
String aopTableSummary = configuration.getText("doclet.Indirect_Packages_Table_Summary",
|
||||
configuration.getText("doclet.Indirect_Opens_Summary"),
|
||||
configuration.getText("doclet.modules"),
|
||||
configuration.getText("doclet.packages"));
|
||||
Content aopTable = getTableHeader(aopText, aopTableSummary, HtmlStyle.packagesSummary,
|
||||
additionalPackagesTableHeader);
|
||||
indirectPackagesTableHeader);
|
||||
Content aopTbody = new HtmlTree(HtmlTag.TBODY);
|
||||
addAdditionalPackages(aopTbody, additionalOpenPackages);
|
||||
addIndirectPackages(aopTbody, indirectOpenPackages);
|
||||
aopTable.addContent(aopTbody);
|
||||
li.addContent(aopTable);
|
||||
}
|
||||
@ -734,14 +736,14 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the additional packages for the module being documented.
|
||||
* Add the indirect packages for the module being documented.
|
||||
*
|
||||
* @param tbody the content tree to which the table will be added
|
||||
* @param ap additional packages to be added
|
||||
* @param ip indirect packages to be added
|
||||
*/
|
||||
public void addAdditionalPackages(Content tbody, Map<ModuleElement, SortedSet<PackageElement>> ap) {
|
||||
public void addIndirectPackages(Content tbody, Map<ModuleElement, SortedSet<PackageElement>> ip) {
|
||||
boolean altColor = true;
|
||||
for (Map.Entry<ModuleElement, SortedSet<PackageElement>> entry : ap.entrySet()) {
|
||||
for (Map.Entry<ModuleElement, SortedSet<PackageElement>> entry : ip.entrySet()) {
|
||||
ModuleElement m = entry.getKey();
|
||||
SortedSet<PackageElement> pkgList = entry.getValue();
|
||||
Content moduleLinkContent = getModuleLink(m, new StringContent(m.getQualifiedName()));
|
||||
@ -773,19 +775,6 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW
|
||||
contents.navServices, li);
|
||||
String text;
|
||||
String tableSummary;
|
||||
if (display(uses)) {
|
||||
text = configuration.getText("doclet.Uses_Summary");
|
||||
tableSummary = configuration.getText("doclet.Member_Table_Summary",
|
||||
configuration.getText("doclet.Uses_Summary"),
|
||||
configuration.getText("doclet.types"));
|
||||
Content table = getTableHeader(text, tableSummary, HtmlStyle.usesSummary, usesTableHeader);
|
||||
Content tbody = new HtmlTree(HtmlTag.TBODY);
|
||||
addUsesList(tbody);
|
||||
if (!tbody.isEmpty()) {
|
||||
table.addContent(tbody);
|
||||
li.addContent(table);
|
||||
}
|
||||
}
|
||||
if (display(provides)) {
|
||||
text = configuration.getText("doclet.Provides_Summary");
|
||||
tableSummary = configuration.getText("doclet.Member_Table_Summary",
|
||||
@ -799,6 +788,19 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW
|
||||
li.addContent(table);
|
||||
}
|
||||
}
|
||||
if (display(uses)) {
|
||||
text = configuration.getText("doclet.Uses_Summary");
|
||||
tableSummary = configuration.getText("doclet.Member_Table_Summary",
|
||||
configuration.getText("doclet.Uses_Summary"),
|
||||
configuration.getText("doclet.types"));
|
||||
Content table = getTableHeader(text, tableSummary, HtmlStyle.usesSummary, usesTableHeader);
|
||||
Content tbody = new HtmlTree(HtmlTag.TBODY);
|
||||
addUsesList(tbody);
|
||||
if (!tbody.isEmpty()) {
|
||||
table.addContent(tbody);
|
||||
li.addContent(table);
|
||||
}
|
||||
}
|
||||
HtmlTree ul = HtmlTree.UL(HtmlStyle.blockList, li);
|
||||
summaryContentTree.addContent(ul);
|
||||
}
|
||||
@ -975,12 +977,12 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW
|
||||
? getHyperLink(SectionName.MODULE_DESCRIPTION, contents.navModuleDescription)
|
||||
: contents.navModuleDescription);
|
||||
addNavGap(liNav);
|
||||
liNav.addContent((display(requires) || display(additionalModules))
|
||||
liNav.addContent((display(requires) || display(indirectModules))
|
||||
? getHyperLink(SectionName.MODULES, contents.navModules)
|
||||
: contents.navModules);
|
||||
addNavGap(liNav);
|
||||
liNav.addContent((display(exportedPackages) || display(openedPackages) || display(concealedPackages)
|
||||
|| display(additionalPackages) || display(additionalOpenPackages))
|
||||
|| display(indirectPackages) || display(indirectOpenPackages))
|
||||
? getHyperLink(SectionName.PACKAGES, contents.navPackages)
|
||||
: contents.navPackages);
|
||||
addNavGap(liNav);
|
||||
|
||||
@ -106,7 +106,7 @@ public class TagletWriterImpl extends TagletWriter {
|
||||
String desc = ch.getText(itt.getDescription());
|
||||
|
||||
String anchorName = htmlWriter.getName(tagText);
|
||||
Content result = HtmlTree.A_ID(anchorName, new StringContent(tagText));
|
||||
Content result = HtmlTree.A_ID(HtmlStyle.searchTagResult, anchorName, new StringContent(tagText));
|
||||
if (configuration.createindex && !tagText.isEmpty()) {
|
||||
SearchIndexItem si = new SearchIndexItem();
|
||||
si.setLabel(tagText);
|
||||
|
||||
@ -46,6 +46,7 @@ public enum HtmlStyle {
|
||||
bottomNav,
|
||||
circle,
|
||||
classUseContainer,
|
||||
colConstructorName,
|
||||
colFirst,
|
||||
colLast,
|
||||
colSecond,
|
||||
@ -98,6 +99,7 @@ public enum HtmlStyle {
|
||||
rightIframe,
|
||||
rowColor,
|
||||
searchTagLink,
|
||||
searchTagResult,
|
||||
seeLabel,
|
||||
serializedFormContainer,
|
||||
simpleTagLabel,
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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
|
||||
@ -264,6 +264,21 @@ public class HtmlTree extends Content {
|
||||
return htmltree;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates an HTML anchor tag with a style class, id attribute and a body.
|
||||
*
|
||||
* @param styleClass stylesheet class for the tag
|
||||
* @param id id for the anchor tag
|
||||
* @param body body for the anchor tag
|
||||
* @return an HtmlTree object
|
||||
*/
|
||||
public static HtmlTree A_ID(HtmlStyle styleClass, String id, Content body) {
|
||||
HtmlTree htmltree = A_ID(id, body);
|
||||
if (styleClass != null)
|
||||
htmltree.addStyle(styleClass);
|
||||
return htmltree;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a CAPTION tag with some content.
|
||||
*
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 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
|
||||
@ -36,7 +36,6 @@ import jdk.javadoc.internal.doclets.toolkit.util.DocFile;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocletConstants;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.ModulePackageTypes;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.TableTabTypes;
|
||||
|
||||
|
||||
@ -88,7 +87,7 @@ public class HtmlWriter {
|
||||
/**
|
||||
* Header for tables displaying modules and exported packages.
|
||||
*/
|
||||
protected final List<String> additionalPackagesTableHeader;
|
||||
protected final List<String> indirectPackagesTableHeader;
|
||||
|
||||
/**
|
||||
* Header for tables displaying types and description.
|
||||
@ -136,18 +135,18 @@ public class HtmlWriter {
|
||||
packageTableHeader.add(resources.getText("doclet.Package"));
|
||||
packageTableHeader.add(resources.getText("doclet.Description"));
|
||||
requiresTableHeader = new ArrayList<>();
|
||||
requiresTableHeader.add(resources.getText("doclet.Modifier"));
|
||||
requiresTableHeader.add(resources.getText("doclet.Modifier"));
|
||||
requiresTableHeader.add(resources.getText("doclet.Module"));
|
||||
requiresTableHeader.add(resources.getText("doclet.Description"));
|
||||
exportedPackagesTableHeader = new ArrayList<>();
|
||||
exportedPackagesTableHeader.add(resources.getText("doclet.Package"));
|
||||
if (configuration.docEnv.getModuleMode() == ModuleMode.ALL) {
|
||||
exportedPackagesTableHeader.add(resources.getText("doclet.Module"));
|
||||
exportedPackagesTableHeader.add(resources.getText("doclet.Module"));
|
||||
}
|
||||
exportedPackagesTableHeader.add(resources.getText("doclet.Description"));
|
||||
additionalPackagesTableHeader = new ArrayList<>();
|
||||
additionalPackagesTableHeader.add(resources.getText("doclet.Module"));
|
||||
additionalPackagesTableHeader.add(resources.getText("doclet.Packages"));
|
||||
indirectPackagesTableHeader = new ArrayList<>();
|
||||
indirectPackagesTableHeader.add(resources.getText("doclet.From"));
|
||||
indirectPackagesTableHeader.add(resources.getText("doclet.Packages"));
|
||||
usesTableHeader = new ArrayList<>();
|
||||
usesTableHeader.add(resources.getText("doclet.Type"));
|
||||
usesTableHeader.add(resources.getText("doclet.Description"));
|
||||
|
||||
@ -6,6 +6,7 @@ doclet.Window_Overview_Summary=Overview
|
||||
doclet.Element=Element
|
||||
doclet.Package=Package
|
||||
doclet.Module=Module
|
||||
doclet.Open_Module=Open Module
|
||||
doclet.All_Packages=All Packages
|
||||
doclet.All_Modules=All Modules
|
||||
doclet.None=None
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
|
||||
<!--
|
||||
Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
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
|
||||
@ -33,8 +33,8 @@
|
||||
<ModuleDescription/>
|
||||
<ModuleTags/>
|
||||
<Summary>
|
||||
<ModulesSummary/>
|
||||
<PackagesSummary/>
|
||||
<ModulesSummary/>
|
||||
<ServicesSummary/>
|
||||
</Summary>
|
||||
</Content>
|
||||
|
||||
@ -86,12 +86,13 @@ doclet.tag_misuse=Tag {0} cannot be used in {1} documentation. It can only be u
|
||||
doclet.javafx_tag_misuse=Tags @propertyGetter, @propertySetter and @propertyDescription can only be used in JavaFX properties getters and setters.
|
||||
doclet.Package_Summary=Package Summary
|
||||
doclet.Requires_Summary=Requires
|
||||
doclet.Additional_Modules_Required_Summary=Additional Modules Required
|
||||
doclet.Additional_Exported_Packages_Summary=Additional Exported Packages
|
||||
doclet.Additional_Opened_Packages_Summary=Additional Opened Packages
|
||||
doclet.Exported_Packages_Summary=Exported Packages
|
||||
doclet.Opened_Packages_Summary=Opened Packages
|
||||
doclet.Concealed_Packages_Summary=Concealed Packages
|
||||
doclet.Indirect_Requires_Summary=Indirect Requires
|
||||
doclet.Indirect_Exports_Summary=Indirect Exports
|
||||
doclet.Indirect_Opens_Summary=Indirect Opens
|
||||
doclet.Exported_Packages_Summary=Exports
|
||||
doclet.Opened_Packages_Summary=Opens
|
||||
doclet.Concealed_Packages_Summary=Concealed
|
||||
doclet.From=From
|
||||
doclet.Packages_Summary=Packages
|
||||
doclet.Uses_Summary=Uses
|
||||
doclet.Provides_Summary=Provides
|
||||
@ -160,7 +161,7 @@ doclet.Property_Detail=Property Detail
|
||||
doclet.Method_Detail=Method Detail
|
||||
doclet.Constructor_Detail=Constructor Detail
|
||||
doclet.Deprecated=Deprecated.
|
||||
doclet.DeprecatedForRemoval=Deprecated, for removal: This API element is subject to removal in a future version.
|
||||
doclet.DeprecatedForRemoval=Deprecated, for removal: This API element is subject to removal in a future version.
|
||||
doclet.Hidden=Hidden
|
||||
doclet.Groupname_already_used=In -group option, groupname already used: {0}
|
||||
doclet.value_tag_invalid_reference={0} (referenced by @value tag) is an unknown reference.
|
||||
@ -171,7 +172,7 @@ doclet.in={0} in {1}
|
||||
doclet.Use_Table_Summary=Use table, listing {0}, and an explanation
|
||||
doclet.Constants_Table_Summary={0} table, listing constant fields, and values
|
||||
doclet.Member_Table_Summary={0} table, listing {1}, and an explanation
|
||||
doclet.Additional_Packages_Table_Summary={0} table, listing {1}, and {2}
|
||||
doclet.Indirect_Packages_Table_Summary={0} table, listing {1}, and {2}
|
||||
doclet.fields=fields
|
||||
doclet.Fields=Fields
|
||||
doclet.properties=properties
|
||||
|
||||
@ -42,15 +42,14 @@ a[name]:hover {
|
||||
text-decoration:none;
|
||||
color:#353833;
|
||||
}
|
||||
a[name]:before, a[name]:target {
|
||||
a[name]:before, a[name]:target, a[id]:before, a[id]:target {
|
||||
content:"";
|
||||
display:block;
|
||||
height:120px;
|
||||
margin:-120px 0 0;
|
||||
}
|
||||
a[id]:before, a[id]:target {
|
||||
display:inline-block;
|
||||
position:relative;
|
||||
padding-top:129px;
|
||||
margin-top:-129px;
|
||||
}
|
||||
.searchTagResult:before, .searchTagResult:target {
|
||||
color:red;
|
||||
}
|
||||
pre {
|
||||
@ -540,14 +539,14 @@ Table styles
|
||||
text-align:left;
|
||||
padding:0px 0px 12px 10px;
|
||||
}
|
||||
th.colFirst, th.colSecond, th.colLast, .useSummary th, .constantsSummary th, .packagesSummary th,
|
||||
th.colFirst, th.colSecond, th.colLast, th.colConstructorName, .useSummary th, .constantsSummary th, .packagesSummary th,
|
||||
td.colFirst, td.colSecond, td.colLast, .useSummary td, .constantsSummary td {
|
||||
vertical-align:top;
|
||||
padding-right:0px;
|
||||
padding-top:8px;
|
||||
padding-bottom:3px;
|
||||
}
|
||||
th.colFirst, th.colSecond, th.colLast, .constantsSummary th, .packagesSummary th {
|
||||
th.colFirst, th.colSecond, th.colLast, th.colConstructorName, .constantsSummary th, .packagesSummary th {
|
||||
background:#dee3e9;
|
||||
text-align:left;
|
||||
padding:8px 3px 3px 7px;
|
||||
@ -556,7 +555,7 @@ td.colFirst, th.colFirst {
|
||||
white-space:nowrap;
|
||||
font-size:13px;
|
||||
}
|
||||
td.colSecond, th.colSecond, td.colLast, th.colLast {
|
||||
td.colSecond, th.colSecond, td.colLast, th.colConstructorName, th.colLast {
|
||||
font-size:13px;
|
||||
}
|
||||
.constantsSummary th, .packagesSummary th {
|
||||
@ -573,8 +572,8 @@ td.colSecond, th.colSecond, td.colLast, th.colLast {
|
||||
.usesSummary td.colFirst, .usesSummary th.colFirst,
|
||||
.providesSummary td.colFirst, .providesSummary th.colFirst,
|
||||
.memberSummary td.colFirst, .memberSummary th.colFirst,
|
||||
.memberSummary td.colSecond, .memberSummary th.colSecond,
|
||||
.typeSummary td.colFirst{
|
||||
.memberSummary td.colSecond, .memberSummary th.colSecond, .memberSummary th.colConstructorName,
|
||||
.typeSummary td.colFirst {
|
||||
vertical-align:top;
|
||||
}
|
||||
.packagesSummary th.colLast, .packagesSummary td.colLast {
|
||||
@ -584,6 +583,8 @@ td.colFirst a:link, td.colFirst a:active, td.colFirst a:visited, td.colFirst a:h
|
||||
td.colSecond a:link, td.colSecond a:active, td.colSecond a:visited, td.colSecond a:hover,
|
||||
th.colFirst a:link, th.colFirst a:active, th.colFirst a:visited, th.colFirst a:hover,
|
||||
th.colSecond a:link, th.colSecond a:active, th.colSecond a:visited, th.colSecond a:hover,
|
||||
th.colConstructorName a:link, th.colConstructorName a:active, th.colConstructorName a:visited,
|
||||
th.colConstructorName a:hover,
|
||||
td.colLast a:link, td.colLast a:active, td.colLast a:visited, td.colLast a:hover,
|
||||
.constantValuesContainer td a:link, .constantValuesContainer td a:active,
|
||||
.constantValuesContainer td a:visited, .constantValuesContainer td a:hover {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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
|
||||
@ -95,7 +95,7 @@ public class JavaScriptScanner extends DocTreePathScanner<Void, Consumer<DocTree
|
||||
case "datasrc": case "for": case "href": case "longdesc": case "profile":
|
||||
case "src": case "usemap":
|
||||
List<? extends DocTree> value = tree.getValue();
|
||||
if (!value.isEmpty() && value.get(0).getKind() == Kind.TEXT) {
|
||||
if (value != null && !value.isEmpty() && value.get(0).getKind() == Kind.TEXT) {
|
||||
String v = value.get(0).toString().trim().toLowerCase(Locale.ENGLISH);
|
||||
if (v.startsWith("javascript:")) {
|
||||
f.accept(getCurrentPath());
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, 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
|
||||
@ -1440,7 +1440,7 @@ public class JShellTool implements MessageHandler {
|
||||
: c.command) + " ")
|
||||
.toArray(String[]::new))
|
||||
.completionSuggestions(code, cursor, anchor);
|
||||
} else if (code.startsWith("/se")) {
|
||||
} else if (code.startsWith("/se") || code.startsWith("se")) {
|
||||
result = new FixedCompletionProvider(SET_SUBCOMMANDS)
|
||||
.completionSuggestions(code.substring(pastSpace), cursor - pastSpace, anchor);
|
||||
} else {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
# 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
|
||||
@ -500,11 +500,11 @@ Supported shortcuts include:\n\
|
||||
Shift-<tab> v\n\t\t\
|
||||
After a complete expression, hold down <shift> while pressing <tab>,\n\t\t\
|
||||
then release and press "v", the expression will be converted to\n\t\t\
|
||||
a variable declaration whose type is based on the type of the expression.\n\t\t\
|
||||
a variable declaration whose type is based on the type of the expression.\n\n\
|
||||
Shift-<tab> i\n\t\t\
|
||||
After an unresolvable identifier, hold down <shift> while pressing <tab>,\n\t\t\
|
||||
then release and press "i", and jshell will propose possible imports\n\t\t\
|
||||
which will resolve the identifier based on the content of the specified classpath.\n\t\t\
|
||||
which will resolve the identifier based on the content of the specified classpath.
|
||||
|
||||
help.context.summary = the evaluation context options for /env /reload and /reset
|
||||
help.context =\
|
||||
@ -928,5 +928,5 @@ startup.feedback = \
|
||||
/set format silent display '' \n
|
||||
|
||||
jshell.fix.wrong.shortcut =\
|
||||
Invalid <fix> character. Use "i" for auto-import or "v" for variable creation. For more information see:\n\
|
||||
Unexpected character after Shift-Tab. Use "i" for auto-import or "v" for variable creation. For more information see:\n\
|
||||
/help shortcuts
|
||||
|
||||
@ -0,0 +1,52 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8176901
|
||||
* @summary The doclet should cope with bad HTML form
|
||||
* @library ../lib
|
||||
* @modules jdk.javadoc/jdk.javadoc.internal.tool
|
||||
* @build JavadocTester
|
||||
* @run main TestBadHtml
|
||||
*/
|
||||
|
||||
public class TestBadHtml extends JavadocTester {
|
||||
|
||||
public static void main(String... args) throws Exception {
|
||||
TestBadHtml tester = new TestBadHtml();
|
||||
tester.runTests();
|
||||
}
|
||||
|
||||
@Test
|
||||
void testNegative() {
|
||||
javadoc("-d", "out1",
|
||||
"-sourcepath", testSrc,
|
||||
"pkg1");
|
||||
|
||||
checkExit(Exit.ERROR);
|
||||
|
||||
checkOutput(Output.STDERR, false, "NullPointerException");
|
||||
checkOutput(Output.OUT, false, "NullPointerException");
|
||||
}
|
||||
}
|
||||
42
langtools/test/jdk/javadoc/doclet/testBadHtml/pkg1/A.java
Normal file
42
langtools/test/jdk/javadoc/doclet/testBadHtml/pkg1/A.java
Normal file
@ -0,0 +1,42 @@
|
||||
/*
|
||||
* 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 pkg1;
|
||||
|
||||
/**
|
||||
* The first sentence.
|
||||
* <parameters the word action is crucial here object>
|
||||
* <parameters the word cite is crucial here object>
|
||||
* <parameters the word classid is crucial here object>
|
||||
* <parameters the word codebase is crucial here object>
|
||||
* <parameters the word data is crucial here object>
|
||||
* <parameters the word datasrc is crucial here object>
|
||||
* <parameters the word for is crucial here object>
|
||||
* <parameters the word href is crucial here object>
|
||||
* <parameters the word longdesc is crucial here object>
|
||||
* <parameters the word profile is crucial here object>
|
||||
* <parameters the word src is crucial here object>
|
||||
* <parameters the word usemap is crucial here object>
|
||||
*/
|
||||
|
||||
public class A {}
|
||||
@ -23,7 +23,7 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 4927552 8026567 8071982 8162674 8175200
|
||||
* @bug 4927552 8026567 8071982 8162674 8175200 8175218
|
||||
* @summary <DESC>
|
||||
* @author jamieh
|
||||
* @library ../lib
|
||||
@ -81,16 +81,16 @@ public class TestDeprecatedDocs extends JavadocTester {
|
||||
+ "extends java.lang.Object</pre>",
|
||||
"<pre>@Deprecated(forRemoval=true)\n"
|
||||
+ "public int field</pre>\n"
|
||||
+ "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version. </span> </div>",
|
||||
+ "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span> </div>",
|
||||
"<pre>@Deprecated(forRemoval=true)\n"
|
||||
+ "public DeprecatedClassByAnnotation​()</pre>\n"
|
||||
+ "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version. </span> </div>",
|
||||
+ "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span> </div>",
|
||||
"<pre>@Deprecated\n"
|
||||
+ "public void method​()</pre>\n"
|
||||
+ "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated.</span> </div>");
|
||||
|
||||
checkOutput("pkg/TestAnnotationType.html", true,
|
||||
"<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version. </span> \n"
|
||||
"<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span> \n"
|
||||
+ "<div class=\"block\"><span class=\"deprecationComment\">annotation_test1 passes.</span></div>\n"
|
||||
+ "</div>\n"
|
||||
+ "<br>\n"
|
||||
@ -100,16 +100,16 @@ public class TestDeprecatedDocs extends JavadocTester {
|
||||
"<pre>@Deprecated(forRemoval=true)\n"
|
||||
+ "static final int field</pre>\n"
|
||||
+ "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This "
|
||||
+ "API element is subject to removal in a future version. </span> <span class=\"deprecationComment\">annotation_test4 passes.</span></div>",
|
||||
+ "API element is subject to removal in a future version.</span> <span class=\"deprecationComment\">annotation_test4 passes.</span></div>",
|
||||
"<pre>@Deprecated(forRemoval=true)\n"
|
||||
+ "int required</pre>\n"
|
||||
+ "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version. </span> "
|
||||
+ "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span> "
|
||||
+ "<span class=\"deprecationComment\">annotation_test3 passes.</span></div>",
|
||||
"<pre>java.lang.String optional</pre>\n"
|
||||
+ "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated.</span> <span class=\"deprecationComment\">annotation_test2 passes.</span></div>");
|
||||
|
||||
checkOutput("pkg/TestClass.html", true,
|
||||
"<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version. </span> \n"
|
||||
"<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span> \n"
|
||||
+ "<div class=\"block\"><span class=\"deprecationComment\">class_test1 passes.</span></div>\n"
|
||||
+ "</div>\n"
|
||||
+ "<br>\n"
|
||||
@ -118,11 +118,11 @@ public class TestDeprecatedDocs extends JavadocTester {
|
||||
+ "extends java.lang.Object</pre>",
|
||||
"<pre>@Deprecated(forRemoval=true)\n"
|
||||
+ "public TestClass​()</pre>\n"
|
||||
+ "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version. </span> "
|
||||
+ "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span> "
|
||||
+ "<span class=\"deprecationComment\">class_test3 passes.</span></div>");
|
||||
|
||||
checkOutput("pkg/TestEnum.html", true,
|
||||
"<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version. </span> \n"
|
||||
"<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span> \n"
|
||||
+ "<div class=\"block\"><span class=\"deprecationComment\">enum_test1 passes.</span></div>\n"
|
||||
+ "</div>\n"
|
||||
+ "<br>\n"
|
||||
@ -131,11 +131,11 @@ public class TestDeprecatedDocs extends JavadocTester {
|
||||
+ "extends java.lang.Enum<<a href=\"../pkg/TestEnum.html\" title=\"enum in pkg\">TestEnum</a>></pre>",
|
||||
"<pre>@Deprecated(forRemoval=true)\n"
|
||||
+ "public static final <a href=\"../pkg/TestEnum.html\" title=\"enum in pkg\">TestEnum</a> FOR_REMOVAL</pre>\n"
|
||||
+ "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version. </span> "
|
||||
+ "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span> "
|
||||
+ "<span class=\"deprecationComment\">enum_test3 passes.</span></div>");
|
||||
|
||||
checkOutput("pkg/TestError.html", true,
|
||||
"<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version. </span> \n"
|
||||
"<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span> \n"
|
||||
+ "<div class=\"block\"><span class=\"deprecationComment\">error_test1 passes.</span></div>\n"
|
||||
+ "</div>\n"
|
||||
+ "<br>\n"
|
||||
@ -144,7 +144,7 @@ public class TestDeprecatedDocs extends JavadocTester {
|
||||
+ "extends java.lang.Error</pre>");
|
||||
|
||||
checkOutput("pkg/TestException.html", true,
|
||||
"<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version. </span> \n"
|
||||
"<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span> \n"
|
||||
+ "<div class=\"block\"><span class=\"deprecationComment\">exception_test1 passes.</span></div>\n"
|
||||
+ "</div>\n"
|
||||
+ "<br>\n"
|
||||
@ -153,7 +153,7 @@ public class TestDeprecatedDocs extends JavadocTester {
|
||||
+ "extends java.lang.Exception</pre>");
|
||||
|
||||
checkOutput("pkg/TestInterface.html", true,
|
||||
"<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version. </span> \n"
|
||||
"<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span> \n"
|
||||
+ "<div class=\"block\"><span class=\"deprecationComment\">interface_test1 passes.</span></div>\n"
|
||||
+ "</div>\n"
|
||||
+ "<br>\n"
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 4951228 6290760 8025633 8026567 8081854 8162363 8175200
|
||||
* @bug 4951228 6290760 8025633 8026567 8081854 8162363 8175200 8177417
|
||||
* @summary Test the case where the overriden method returns a different
|
||||
* type than the method in the child class. Make sure the
|
||||
* documentation is inherited but the return type isn't.
|
||||
@ -43,7 +43,7 @@ public class TestMemberSummary extends JavadocTester {
|
||||
|
||||
@Test
|
||||
void test() {
|
||||
javadoc("-d", "out",
|
||||
javadoc("-d", "out", "-private",
|
||||
"-sourcepath", testSrc,
|
||||
"pkg","pkg2");
|
||||
checkExit(Exit.OK);
|
||||
@ -55,7 +55,15 @@ public class TestMemberSummary extends JavadocTester {
|
||||
+ "returnTypeTest</a></span>​()</code>",
|
||||
// Check return type in member detail.
|
||||
"<pre>public <a href=\"../pkg/PublicChild.html\" title=\"class in pkg\">"
|
||||
+ "PublicChild</a> returnTypeTest​()</pre>");
|
||||
+ "PublicChild</a> returnTypeTest​()</pre>",
|
||||
"<th class=\"colConstructorName\" scope=\"row\"><code><span class=\"memberNameLink\">"
|
||||
+ "<a href=\"../pkg/PublicChild.html#PublicChild--\">PublicChild</a></span>​()</code></th>");
|
||||
|
||||
checkOutput("pkg/PrivateParent.html", true,
|
||||
"<td class=\"colFirst\"><code>private </code></td>\n"
|
||||
+ "<th class=\"colConstructorName\" scope=\"row\"><code><span class=\"memberNameLink\">"
|
||||
+ "<a href=\"../pkg/PrivateParent.html#PrivateParent-int-\">PrivateParent</a></span>​(int i)</code>"
|
||||
+ "</th>");
|
||||
|
||||
// Legacy anchor dimensions (6290760)
|
||||
checkOutput("pkg2/A.html", true,
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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
|
||||
@ -24,6 +24,12 @@
|
||||
package pkg;
|
||||
|
||||
class PrivateParent {
|
||||
/**
|
||||
* Test private constructor.
|
||||
* @param i a test parameter.
|
||||
*/
|
||||
private PrivateParent(int i) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test to make sure the member summary inherits documentation
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
/*
|
||||
* @test
|
||||
* @bug 8154119 8154262 8156077 8157987 8154261 8154817 8135291 8155995 8162363
|
||||
* 8168766 8168688 8162674 8160196 8175799 8174974 8176778
|
||||
* 8168766 8168688 8162674 8160196 8175799 8174974 8176778 8177562 8175218
|
||||
* @summary Test modules support in javadoc.
|
||||
* @author bpatel
|
||||
* @library ../lib
|
||||
@ -277,14 +277,14 @@ public class TestModules extends JavadocTester {
|
||||
+ "<!-- -->\n"
|
||||
+ "</a>\n"
|
||||
+ "<div class=\"block\">This is a test description for the moduleA module. Search "
|
||||
+ "phrase <a id=\"searchphrase\">search phrase</a>.</div>");
|
||||
+ "phrase <a id=\"searchphrase\" class=\"searchTagResult\">search phrase</a>.</div>");
|
||||
checkOutput("moduleB-summary.html", found,
|
||||
"<!-- ============ MODULE DESCRIPTION =========== -->\n"
|
||||
+ "<a name=\"module.description\">\n"
|
||||
+ "<!-- -->\n"
|
||||
+ "</a>\n"
|
||||
+ "<div class=\"block\">This is a test description for the moduleB module. Search "
|
||||
+ "word <a id=\"search_word\">search_word</a> with no description.</div>");
|
||||
+ "word <a id=\"search_word\" class=\"searchTagResult\">search_word</a> with no description.</div>");
|
||||
checkOutput("overview-summary.html", found,
|
||||
"</script>\n"
|
||||
+ "<div class=\"contentContainer\">\n"
|
||||
@ -311,7 +311,7 @@ public class TestModules extends JavadocTester {
|
||||
+ "<li class=\"blockList\">\n"
|
||||
+ "<ul class=\"blockList\">\n"
|
||||
+ "<li class=\"blockList\">\n"
|
||||
+ "<!-- ============ MODULES SUMMARY =========== -->");
|
||||
+ "<!-- ============ PACKAGES SUMMARY =========== -->");
|
||||
checkOutput("moduleB-summary.html", found,
|
||||
"<div class=\"contentContainer\">\n"
|
||||
+ "<ul class=\"blockList\">\n"
|
||||
@ -325,7 +325,7 @@ public class TestModules extends JavadocTester {
|
||||
checkOutput("moduleA-summary.html", found,
|
||||
"<section role=\"region\">\n"
|
||||
+ "<div class=\"deprecatedContent\"><span class=\"deprecatedLabel\">Deprecated, for removal:"
|
||||
+ " This API element is subject to removal in a future version. </span>\n"
|
||||
+ " This API element is subject to removal in a future version.</span>\n"
|
||||
+ "<div class=\"block\"><span class=\"deprecationComment\">This module is deprecated.</span></div>\n"
|
||||
+ "</div>\n"
|
||||
+ "<!-- ============ MODULE DESCRIPTION =========== -->\n"
|
||||
@ -333,7 +333,7 @@ public class TestModules extends JavadocTester {
|
||||
+ "<!-- -->\n"
|
||||
+ "</a>\n"
|
||||
+ "<div class=\"block\">This is a test description for the moduleA module. Search "
|
||||
+ "phrase <a id=\"searchphrase\">search phrase</a>.</div>");
|
||||
+ "phrase <a id=\"searchphrase\" class=\"searchTagResult\">search phrase</a>.</div>");
|
||||
checkOutput("moduleB-summary.html", found,
|
||||
"<section role=\"region\">\n"
|
||||
+ "<!-- ============ MODULE DESCRIPTION =========== -->\n"
|
||||
@ -341,7 +341,7 @@ public class TestModules extends JavadocTester {
|
||||
+ "<!-- -->\n"
|
||||
+ "</a>\n"
|
||||
+ "<div class=\"block\">This is a test description for the moduleB module. Search "
|
||||
+ "word <a id=\"search_word\">search_word</a> with no description.</div>");
|
||||
+ "word <a id=\"search_word\" class=\"searchTagResult\">search_word</a> with no description.</div>");
|
||||
checkOutput("overview-summary.html", found,
|
||||
"</nav>\n"
|
||||
+ "</header>\n"
|
||||
@ -372,7 +372,7 @@ public class TestModules extends JavadocTester {
|
||||
+ "<li class=\"blockList\">\n"
|
||||
+ "<ul class=\"blockList\">\n"
|
||||
+ "<li class=\"blockList\">\n"
|
||||
+ "<!-- ============ MODULES SUMMARY =========== -->");
|
||||
+ "<!-- ============ PACKAGES SUMMARY =========== -->");
|
||||
checkOutput("moduleB-summary.html", found,
|
||||
"<div class=\"contentContainer\">\n"
|
||||
+ "<ul class=\"blockList\">\n"
|
||||
@ -595,7 +595,7 @@ public class TestModules extends JavadocTester {
|
||||
+ "<th class=\"colFirst\" scope=\"row\"><a href=\"testpkg2mdlB/TestInterface2InModuleB.html\" title=\"interface in testpkg2mdlB\">TestInterface2InModuleB</a></th>\n"
|
||||
+ "<td class=\"colLast\"> </td>\n"
|
||||
+ "</tr>",
|
||||
"<caption><span>Opened Packages</span><span class=\"tabEnd\"> </span></caption>\n"
|
||||
"<caption><span>Opens</span><span class=\"tabEnd\"> </span></caption>\n"
|
||||
+ "<tr>\n"
|
||||
+ "<th class=\"colFirst\" scope=\"col\">Package</th>\n"
|
||||
+ "<th class=\"colLast\" scope=\"col\">Description</th>\n"
|
||||
@ -618,7 +618,7 @@ public class TestModules extends JavadocTester {
|
||||
+ "<h1 title=\"Module\" class=\"title\">Module moduleT</h1>\n"
|
||||
+ "</div>",
|
||||
"<div class=\"block\">This is a test description for the moduleT module. "
|
||||
+ "Search phrase <a id=\"searchphrase\">search phrase</a>. "
|
||||
+ "Search phrase <a id=\"searchphrase\" class=\"searchTagResult\">search phrase</a>. "
|
||||
+ "Make sure there are no exported packages.</div>",
|
||||
"<tbody>\n"
|
||||
+ "<tr class=\"altColor\">\n"
|
||||
@ -730,17 +730,12 @@ public class TestModules extends JavadocTester {
|
||||
checkOutput("moduleA-summary.html", true,
|
||||
"<li><a href=\"#module.description\">Description</a> | <a href=\"#modules.summary\">"
|
||||
+ "Modules</a> | <a href=\"#packages.summary\">Packages</a> | Services</li>",
|
||||
"<td class=\"colFirst\">transitive</td>\n"
|
||||
+ "<th class=\"colSecond\" scope=\"row\"><a href=\"moduleB-summary.html\">moduleB</a></th>\n"
|
||||
+ "<td class=\"colLast\">\n"
|
||||
+ "<div class=\"block\">This is a test description for the moduleB module.</div>\n"
|
||||
+ "</td>",
|
||||
"<table class=\"packagesSummary\" summary=\"Additional Exported Packages table, listing modules, and packages\">\n"
|
||||
+ "<caption><span>Additional Exported Packages</span><span class=\"tabEnd\"> </span></caption>",
|
||||
"<table class=\"packagesSummary\" summary=\"Additional Opened Packages table, listing modules, and packages\">\n"
|
||||
+ "<caption><span>Additional Opened Packages</span><span class=\"tabEnd\"> </span></caption>\n"
|
||||
"<table class=\"packagesSummary\" summary=\"Indirect Exports table, listing modules, and packages\">\n"
|
||||
+ "<caption><span>Indirect Exports</span><span class=\"tabEnd\"> </span></caption>",
|
||||
"<table class=\"packagesSummary\" summary=\"Indirect Opens table, listing modules, and packages\">\n"
|
||||
+ "<caption><span>Indirect Opens</span><span class=\"tabEnd\"> </span></caption>\n"
|
||||
+ "<tr>\n"
|
||||
+ "<th class=\"colFirst\" scope=\"col\">Module</th>\n"
|
||||
+ "<th class=\"colFirst\" scope=\"col\">From</th>\n"
|
||||
+ "<th class=\"colLast\" scope=\"col\">Packages</th>\n"
|
||||
+ "</tr>\n",
|
||||
"<th class=\"colFirst\" scope=\"row\"><a href=\"moduleB-summary.html\">moduleB</a></th>\n"
|
||||
@ -751,15 +746,15 @@ public class TestModules extends JavadocTester {
|
||||
checkOutput("moduletags-summary.html", true,
|
||||
"<li><a href=\"#module.description\">Description</a> | <a href=\"#modules.summary\">Modules"
|
||||
+ "</a> | <a href=\"#packages.summary\">Packages</a> | Services</li>",
|
||||
"<table class=\"requiresSummary\" summary=\"Additional Modules Required table, listing modules, and an explanation\">\n"
|
||||
+ "<caption><span>Additional Modules Required</span><span class=\"tabEnd\"> </span></caption>",
|
||||
"<table class=\"requiresSummary\" summary=\"Indirect Requires table, listing modules, and an explanation\">\n"
|
||||
+ "<caption><span>Indirect Requires</span><span class=\"tabEnd\"> </span></caption>",
|
||||
"<td class=\"colFirst\">transitive</td>\n"
|
||||
+ "<th class=\"colSecond\" scope=\"row\"><a href=\"moduleB-summary.html\">moduleB</a></th>\n"
|
||||
+ "<td class=\"colLast\">\n"
|
||||
+ "<div class=\"block\">This is a test description for the moduleB module.</div>\n"
|
||||
+ "</td>",
|
||||
"<table class=\"packagesSummary\" summary=\"Additional Exported Packages table, listing modules, and packages\">\n"
|
||||
+ "<caption><span>Additional Exported Packages</span><span class=\"tabEnd\"> </span></caption>",
|
||||
"<table class=\"packagesSummary\" summary=\"Indirect Exports table, listing modules, and packages\">\n"
|
||||
+ "<caption><span>Indirect Exports</span><span class=\"tabEnd\"> </span></caption>",
|
||||
"<td class=\"colFirst\">transitive static</td>\n"
|
||||
+ "<th class=\"colSecond\" scope=\"row\"><a href=\"moduleA-summary.html\">moduleA</a></th>\n"
|
||||
+ "<td class=\"colLast\">\n"
|
||||
@ -771,16 +766,16 @@ public class TestModules extends JavadocTester {
|
||||
+ "<th class=\"colFirst\" scope=\"col\">Modifier</th>\n"
|
||||
+ "<th class=\"colSecond\" scope=\"col\">Module</th>\n"
|
||||
+ "<th class=\"colLast\" scope=\"col\">Description</th>",
|
||||
"<table class=\"requiresSummary\" summary=\"Additional Modules Required table, listing modules, and an explanation\">\n"
|
||||
+ "<caption><span>Additional Modules Required</span><span class=\"tabEnd\"> </span></caption>\n"
|
||||
"<table class=\"requiresSummary\" summary=\"Indirect Requires table, listing modules, and an explanation\">\n"
|
||||
+ "<caption><span>Indirect Requires</span><span class=\"tabEnd\"> </span></caption>\n"
|
||||
+ "<tr>\n"
|
||||
+ "<th class=\"colFirst\" scope=\"col\">Modifier</th>\n"
|
||||
+ "<th class=\"colSecond\" scope=\"col\">Module</th>\n"
|
||||
+ "<th class=\"colLast\" scope=\"col\">Description</th>",
|
||||
"<table class=\"packagesSummary\" summary=\"Additional Opened Packages table, listing modules, and packages\">\n"
|
||||
+ "<caption><span>Additional Opened Packages</span><span class=\"tabEnd\"> </span></caption>\n"
|
||||
"<table class=\"packagesSummary\" summary=\"Indirect Opens table, listing modules, and packages\">\n"
|
||||
+ "<caption><span>Indirect Opens</span><span class=\"tabEnd\"> </span></caption>\n"
|
||||
+ "<tr>\n"
|
||||
+ "<th class=\"colFirst\" scope=\"col\">Module</th>\n"
|
||||
+ "<th class=\"colFirst\" scope=\"col\">From</th>\n"
|
||||
+ "<th class=\"colLast\" scope=\"col\">Packages</th>\n"
|
||||
+ "</tr>\n",
|
||||
"<th class=\"colFirst\" scope=\"row\"><a href=\"moduleB-summary.html\">moduleB</a></th>\n"
|
||||
@ -797,7 +792,7 @@ public class TestModules extends JavadocTester {
|
||||
"<th class=\"colFirst\" scope=\"row\"><a href=\"testpkgmdlB/package-summary.html\">testpkgmdlB</a></th>\n"
|
||||
+ "<td class=\"colLast\"> </td>",
|
||||
"<table class=\"packagesSummary\" summary=\"Packages table, listing packages, and an explanation\">\n"
|
||||
+ "<caption><span>Opened Packages</span><span class=\"tabEnd\"> </span></caption>\n"
|
||||
+ "<caption><span>Opens</span><span class=\"tabEnd\"> </span></caption>\n"
|
||||
+ "<tr>\n"
|
||||
+ "<th class=\"colFirst\" scope=\"col\">Package</th>\n"
|
||||
+ "<th class=\"colLast\" scope=\"col\">Description</th>\n"
|
||||
@ -830,9 +825,9 @@ public class TestModules extends JavadocTester {
|
||||
+ "<td class=\"colSecond\">All Modules</td>\n"
|
||||
+ "<td class=\"colLast\"> </td>",
|
||||
"<caption><span id=\"t0\" class=\"activeTableTab\"><span>All Packages</span><span class=\"tabEnd\"> </span></span>"
|
||||
+ "<span id=\"t1\" class=\"tableTab\"><span><a href=\"javascript:showPkgs(1);\">Exported Packages</a></span>"
|
||||
+ "<span id=\"t1\" class=\"tableTab\"><span><a href=\"javascript:showPkgs(1);\">Exports</a></span>"
|
||||
+ "<span class=\"tabEnd\"> </span></span><span id=\"t3\" class=\"tableTab\"><span><a href=\"javascript:showPkgs(4);\">"
|
||||
+ "Concealed Packages</a></span><span class=\"tabEnd\"> </span></span></caption>",
|
||||
+ "Concealed</a></span><span class=\"tabEnd\"> </span></span></caption>",
|
||||
"<th class=\"colFirst\" scope=\"row\"><a href=\"concealedpkgmdlA/package-summary.html\">concealedpkgmdlA</a></th>\n"
|
||||
+ "<td class=\"colSecond\">None</td>\n"
|
||||
+ "<td class=\"colLast\"> </td>");
|
||||
@ -854,10 +849,10 @@ public class TestModules extends JavadocTester {
|
||||
+ "<td class=\"colLast\"> <br>(<span class=\"implementationLabel\">Implementation(s):</span> <a href=\"testpkgmdlB/TestClassInModuleB.html\" "
|
||||
+ "title=\"class in testpkgmdlB\">TestClassInModuleB</a>)</td>",
|
||||
"<caption><span id=\"t0\" class=\"activeTableTab\"><span>All Packages</span><span class=\"tabEnd\"> </span></span><span id=\"t1\" class=\"tableTab\"><span>"
|
||||
+ "<a href=\"javascript:showPkgs(1);\">Exported Packages</a></span><span class=\"tabEnd\"> </span></span><span id=\"t2\" class=\"tableTab\"><span>"
|
||||
+ "<a href=\"javascript:showPkgs(2);\">Opened Packages</a></span><span class=\"tabEnd\"> </span></span></caption>");
|
||||
+ "<a href=\"javascript:showPkgs(1);\">Exports</a></span><span class=\"tabEnd\"> </span></span><span id=\"t2\" class=\"tableTab\"><span>"
|
||||
+ "<a href=\"javascript:showPkgs(2);\">Opens</a></span><span class=\"tabEnd\"> </span></span></caption>");
|
||||
checkOutput("moduleC-summary.html", found,
|
||||
"<caption><span>Exported Packages</span><span class=\"tabEnd\"> </span></caption>\n"
|
||||
"<caption><span>Exports</span><span class=\"tabEnd\"> </span></caption>\n"
|
||||
+ "<tr>\n"
|
||||
+ "<th class=\"colFirst\" scope=\"col\">Package</th>\n"
|
||||
+ "<th class=\"colSecond\" scope=\"col\">Module</th>\n"
|
||||
@ -872,7 +867,7 @@ public class TestModules extends JavadocTester {
|
||||
void checkModuleDeprecation(boolean found) {
|
||||
checkOutput("moduleA-summary.html", found,
|
||||
"<div class=\"deprecatedContent\"><span class=\"deprecatedLabel\">Deprecated, for removal:"
|
||||
+ " This API element is subject to removal in a future version. </span>\n"
|
||||
+ " This API element is subject to removal in a future version.</span>\n"
|
||||
+ "<div class=\"block\"><span class=\"deprecationComment\">This module is deprecated.</span></div>\n"
|
||||
+ "</div>");
|
||||
checkOutput("deprecated-list.html", found,
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8141492 8071982 8141636 8147890 8166175 8168965 8176794
|
||||
* @bug 8141492 8071982 8141636 8147890 8166175 8168965 8176794 8175218
|
||||
* @summary Test the search feature of javadoc.
|
||||
* @author bpatel
|
||||
* @library ../lib
|
||||
@ -321,9 +321,9 @@ public class TestSearch extends JavadocTester {
|
||||
+ "pkg2.<a href=\"pkg2/TestEnum.html\" title=\"enum in pkg2\">TestEnum</a></dt>");
|
||||
checkOutput("index-all.html", true,
|
||||
"<div class=\"block\"><span class=\"deprecationComment\">class_test1 passes. Search tag"
|
||||
+ " <a id=\"SearchTagDeprecatedClass\">SearchTagDeprecatedClass</a></span></div>",
|
||||
+ " <a id=\"SearchTagDeprecatedClass\" class=\"searchTagResult\">SearchTagDeprecatedClass</a></span></div>",
|
||||
"<div class=\"block\"><span class=\"deprecationComment\">error_test3 passes. Search tag for\n"
|
||||
+ " method <a id=\"SearchTagDeprecatedMethod\">SearchTagDeprecatedMethod</a></span></div>");
|
||||
+ " method <a id=\"SearchTagDeprecatedMethod\" class=\"searchTagResult\">SearchTagDeprecatedMethod</a></span></div>");
|
||||
}
|
||||
|
||||
void checkSplitIndex() {
|
||||
|
||||
@ -23,7 +23,8 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 4494033 7028815 7052425 8007338 8023608 8008164 8016549 8072461 8154261 8162363 8160196 8151743
|
||||
* @bug 4494033 7028815 7052425 8007338 8023608 8008164 8016549 8072461 8154261 8162363 8160196 8151743 8177417
|
||||
* 8175218
|
||||
* @summary Run tests on doclet stylesheet.
|
||||
* @author jamieh
|
||||
* @library ../lib
|
||||
@ -140,8 +141,8 @@ public class TestStylesheet extends JavadocTester {
|
||||
+ ".usesSummary td.colFirst, .usesSummary th.colFirst,\n"
|
||||
+ ".providesSummary td.colFirst, .providesSummary th.colFirst,\n"
|
||||
+ ".memberSummary td.colFirst, .memberSummary th.colFirst,\n"
|
||||
+ ".memberSummary td.colSecond, .memberSummary th.colSecond,\n"
|
||||
+ ".typeSummary td.colFirst{\n"
|
||||
+ ".memberSummary td.colSecond, .memberSummary th.colSecond, .memberSummary th.colConstructorName,\n"
|
||||
+ ".typeSummary td.colFirst {\n"
|
||||
+ " vertical-align:top;\n"
|
||||
+ "}",
|
||||
".overviewSummary td, .memberSummary td, .typeSummary td,\n"
|
||||
@ -162,6 +163,16 @@ public class TestStylesheet extends JavadocTester {
|
||||
"@import url('resources/fonts/dejavu.css');",
|
||||
".navPadding {\n"
|
||||
+ " padding-top: 107px;\n"
|
||||
+ "}",
|
||||
"a[name]:before, a[name]:target, a[id]:before, a[id]:target {\n"
|
||||
+ " content:\"\";\n"
|
||||
+ " display:inline-block;\n"
|
||||
+ " position:relative;\n"
|
||||
+ " padding-top:129px;\n"
|
||||
+ " margin-top:-129px;\n"
|
||||
+ "}\n"
|
||||
+ ".searchTagResult:before, .searchTagResult:target {\n"
|
||||
+ " color:red;\n"
|
||||
+ "}");
|
||||
|
||||
// Test whether a link to the stylesheet file is inserted properly
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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
|
||||
@ -23,7 +23,7 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8144095 8164825 8169818 8153402 8165405 8177079
|
||||
* @bug 8144095 8164825 8169818 8153402 8165405 8177079 8178013
|
||||
* @summary Test Command Completion
|
||||
* @modules jdk.compiler/com.sun.tools.javac.api
|
||||
* jdk.compiler/com.sun.tools.javac.main
|
||||
@ -173,6 +173,8 @@ public class CommandCompletionTest extends ReplToolTesting {
|
||||
"/save ", "/set "),
|
||||
a -> assertCompletion(a, "/help /set |", false,
|
||||
"editor", "feedback", "format", "mode", "prompt", "start", "truncation"),
|
||||
a -> assertCompletion(a, "/help set |", false,
|
||||
"editor", "feedback", "format", "mode", "prompt", "start", "truncation"),
|
||||
a -> assertCompletion(a, "/help /edit |", false),
|
||||
a -> assertCompletion(a, "/help dr|", false,
|
||||
"drop ")
|
||||
|
||||
83
langtools/test/jdk/jshell/HistoryUITest.java
Normal file
83
langtools/test/jdk/jshell/HistoryUITest.java
Normal file
@ -0,0 +1,83 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @bug 8178077
|
||||
* @summary Check the UI behavior of editing history.
|
||||
* @modules
|
||||
* jdk.compiler/com.sun.tools.javac.api
|
||||
* jdk.compiler/com.sun.tools.javac.main
|
||||
* jdk.jshell/jdk.jshell:open
|
||||
* @library /tools/lib
|
||||
* @build toolbox.ToolBox toolbox.JarTask toolbox.JavacTask
|
||||
* @build Compiler UITesting
|
||||
* @build HistoryUITest
|
||||
* @run testng HistoryUITest
|
||||
*/
|
||||
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
@Test
|
||||
public class HistoryUITest extends UITesting {
|
||||
|
||||
public void testPrevNextSnippet() throws Exception {
|
||||
doRunTest((inputSink, out) -> {
|
||||
inputSink.write("void test1() {\nSystem.err.println(1);\n}\n");
|
||||
waitOutput(out, "\u0005");
|
||||
inputSink.write("void test2() {\nSystem.err.println(2);\n}\n");
|
||||
waitOutput(out, "\u0005");
|
||||
inputSink.write(CTRL_UP);
|
||||
waitOutput(out, "^void test2\\(\\) \\{");
|
||||
inputSink.write(CTRL_UP);
|
||||
waitOutput(out, "^" + clearOut("2() {") + "1\\(\\) \\{");
|
||||
inputSink.write(CTRL_DOWN);
|
||||
waitOutput(out, "^" + clearOut("1() {") + "2\\(\\) \\{");
|
||||
inputSink.write(ENTER);
|
||||
waitOutput(out, "^\n\u0006");
|
||||
inputSink.write(UP);
|
||||
waitOutput(out, "^}");
|
||||
inputSink.write(UP);
|
||||
waitOutput(out, "^" + clearOut("}") + "System.err.println\\(2\\);");
|
||||
inputSink.write(UP);
|
||||
waitOutput(out, "^" + clearOut("System.err.println(2);") + "void test2\\(\\) \\{");
|
||||
inputSink.write(UP);
|
||||
waitOutput(out, "^\u0007");
|
||||
inputSink.write(DOWN);
|
||||
waitOutput(out, "^" + clearOut("void test2() {") + "System.err.println\\(2\\);");
|
||||
inputSink.write(DOWN);
|
||||
waitOutput(out, "^" + clearOut("System.err.println(2);") + "}");
|
||||
inputSink.write(DOWN);
|
||||
waitOutput(out, "^" + clearOut("}"));
|
||||
inputSink.write(DOWN);
|
||||
waitOutput(out, "^\u0007");
|
||||
});
|
||||
}
|
||||
//where:
|
||||
private static final String CTRL_UP = "\033[1;5A";
|
||||
private static final String CTRL_DOWN = "\033[1;5B";
|
||||
private static final String UP = "\033[A";
|
||||
private static final String DOWN = "\033[B";
|
||||
private static final String ENTER = "\n";
|
||||
|
||||
}
|
||||
@ -31,37 +31,29 @@
|
||||
* jdk.jshell/jdk.jshell:open
|
||||
* @library /tools/lib
|
||||
* @build toolbox.ToolBox toolbox.JarTask toolbox.JavacTask
|
||||
* @build Compiler
|
||||
* @build Compiler UITesting
|
||||
* @build MergedTabShiftTabTest
|
||||
* @run testng MergedTabShiftTabTest
|
||||
*/
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.PrintStream;
|
||||
import java.io.Writer;
|
||||
import java.lang.reflect.Field;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.ResourceBundle;
|
||||
import java.util.jar.JarEntry;
|
||||
import java.util.jar.JarOutputStream;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import jdk.jshell.JShell;
|
||||
import jdk.jshell.tool.JavaShellToolBuilder;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
@Test
|
||||
public class MergedTabShiftTabTest {
|
||||
public class MergedTabShiftTabTest extends UITesting {
|
||||
|
||||
public void testCommand() throws Exception {
|
||||
doRunTest((inputSink, out) -> {
|
||||
@ -281,60 +273,6 @@ public class MergedTabShiftTabTest {
|
||||
});
|
||||
}
|
||||
|
||||
private void doRunTest(Test test) throws Exception {
|
||||
PipeInputStream input = new PipeInputStream();
|
||||
StringBuilder out = new StringBuilder();
|
||||
PrintStream outS = new PrintStream(new OutputStream() {
|
||||
@Override public void write(int b) throws IOException {
|
||||
synchronized (out) {
|
||||
System.out.print((char) b);
|
||||
out.append((char) b);
|
||||
out.notifyAll();
|
||||
}
|
||||
}
|
||||
});
|
||||
Thread runner = new Thread(() -> {
|
||||
try {
|
||||
JavaShellToolBuilder.builder()
|
||||
.in(input, input)
|
||||
.out(outS)
|
||||
.err(outS)
|
||||
.promptCapture(true)
|
||||
.persistence(new HashMap<>())
|
||||
.locale(Locale.US)
|
||||
.run("--no-startup");
|
||||
} catch (Exception ex) {
|
||||
throw new IllegalStateException(ex);
|
||||
}
|
||||
});
|
||||
|
||||
Writer inputSink = new OutputStreamWriter(input.createOutput()) {
|
||||
@Override
|
||||
public void write(String str) throws IOException {
|
||||
super.write(str);
|
||||
flush();
|
||||
}
|
||||
};
|
||||
|
||||
runner.start();
|
||||
|
||||
try {
|
||||
waitOutput(out, "\u0005");
|
||||
test.test(inputSink, out);
|
||||
} finally {
|
||||
inputSink.write("\003\003/exit");
|
||||
|
||||
runner.join(1000);
|
||||
if (runner.isAlive()) {
|
||||
runner.stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
interface Test {
|
||||
public void test(Writer inputSink, StringBuilder out) throws Exception;
|
||||
}
|
||||
|
||||
private Path prepareZip() {
|
||||
String clazz1 =
|
||||
"package jshelltest;\n" +
|
||||
@ -404,162 +342,4 @@ public class MergedTabShiftTabTest {
|
||||
return MessageFormat.format(resources.getString(key), args);
|
||||
}
|
||||
|
||||
private static final long TIMEOUT;
|
||||
|
||||
static {
|
||||
long factor;
|
||||
|
||||
try {
|
||||
factor = (long) Double.parseDouble(System.getProperty("test.timeout.factor", "1"));
|
||||
} catch (NumberFormatException ex) {
|
||||
factor = 1;
|
||||
}
|
||||
TIMEOUT = 60_000 * factor;
|
||||
}
|
||||
|
||||
private void waitOutput(StringBuilder out, String expected) {
|
||||
expected = expected.replaceAll("\n", System.getProperty("line.separator"));
|
||||
Pattern expectedPattern = Pattern.compile(expected, Pattern.DOTALL);
|
||||
synchronized (out) {
|
||||
long s = System.currentTimeMillis();
|
||||
|
||||
while (true) {
|
||||
Matcher m = expectedPattern.matcher(out);
|
||||
if (m.find()) {
|
||||
out.delete(0, m.end() + 1);
|
||||
return ;
|
||||
}
|
||||
long e = System.currentTimeMillis();
|
||||
if ((e - s) > TIMEOUT) {
|
||||
throw new IllegalStateException("Timeout waiting for: " + quote(expected) + ", actual output so far: " + quote(out.toString()));
|
||||
}
|
||||
try {
|
||||
out.wait(TIMEOUT);
|
||||
} catch (InterruptedException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private String quote(String original) {
|
||||
StringBuilder output = new StringBuilder();
|
||||
|
||||
for (char c : original.toCharArray()) {
|
||||
if (c < 32) {
|
||||
output.append(String.format("\\u%04X", (int) c));
|
||||
} else {
|
||||
output.append(c);
|
||||
}
|
||||
}
|
||||
|
||||
return output.toString();
|
||||
}
|
||||
|
||||
private static class PipeInputStream extends InputStream {
|
||||
|
||||
private static final int INITIAL_SIZE = 128;
|
||||
private int[] buffer = new int[INITIAL_SIZE];
|
||||
private int start;
|
||||
private int end;
|
||||
private boolean closed;
|
||||
|
||||
@Override
|
||||
public synchronized int read() throws IOException {
|
||||
if (start == end && !closed) {
|
||||
inputNeeded();
|
||||
}
|
||||
while (start == end) {
|
||||
if (closed) {
|
||||
return -1;
|
||||
}
|
||||
try {
|
||||
wait();
|
||||
} catch (InterruptedException ex) {
|
||||
//ignore
|
||||
}
|
||||
}
|
||||
try {
|
||||
return buffer[start];
|
||||
} finally {
|
||||
start = (start + 1) % buffer.length;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized int read(byte[] b, int off, int len) throws IOException {
|
||||
if (b == null) {
|
||||
throw new NullPointerException();
|
||||
} else if (off < 0 || len < 0 || len > b.length - off) {
|
||||
throw new IndexOutOfBoundsException();
|
||||
} else if (len == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int c = read();
|
||||
if (c == -1) {
|
||||
return -1;
|
||||
}
|
||||
b[off] = (byte)c;
|
||||
|
||||
int totalRead = 1;
|
||||
while (totalRead < len && start != end) {
|
||||
int r = read();
|
||||
if (r == (-1))
|
||||
break;
|
||||
b[off + totalRead++] = (byte) r;
|
||||
}
|
||||
return totalRead;
|
||||
}
|
||||
|
||||
protected void inputNeeded() throws IOException {}
|
||||
|
||||
private synchronized void write(int b) {
|
||||
if (closed) {
|
||||
throw new IllegalStateException("Already closed.");
|
||||
}
|
||||
int newEnd = (end + 1) % buffer.length;
|
||||
if (newEnd == start) {
|
||||
//overflow:
|
||||
int[] newBuffer = new int[buffer.length * 2];
|
||||
int rightPart = (end > start ? end : buffer.length) - start;
|
||||
int leftPart = end > start ? 0 : start - 1;
|
||||
System.arraycopy(buffer, start, newBuffer, 0, rightPart);
|
||||
System.arraycopy(buffer, 0, newBuffer, rightPart, leftPart);
|
||||
buffer = newBuffer;
|
||||
start = 0;
|
||||
end = rightPart + leftPart;
|
||||
newEnd = end + 1;
|
||||
}
|
||||
buffer[end] = b;
|
||||
end = newEnd;
|
||||
notifyAll();
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void close() {
|
||||
closed = true;
|
||||
notifyAll();
|
||||
}
|
||||
|
||||
public OutputStream createOutput() {
|
||||
return new OutputStream() {
|
||||
@Override public void write(int b) throws IOException {
|
||||
PipeInputStream.this.write(b);
|
||||
}
|
||||
@Override
|
||||
public void write(byte[] b, int off, int len) throws IOException {
|
||||
for (int i = 0 ; i < len ; i++) {
|
||||
write(Byte.toUnsignedInt(b[off + i]));
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
PipeInputStream.this.close();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
272
langtools/test/jdk/jshell/UITesting.java
Normal file
272
langtools/test/jdk/jshell/UITesting.java
Normal file
@ -0,0 +1,272 @@
|
||||
/*
|
||||
* 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.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.PrintStream;
|
||||
import java.io.Writer;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import jdk.jshell.tool.JavaShellToolBuilder;
|
||||
|
||||
public class UITesting {
|
||||
|
||||
protected void doRunTest(Test test) throws Exception {
|
||||
PipeInputStream input = new PipeInputStream();
|
||||
StringBuilder out = new StringBuilder();
|
||||
PrintStream outS = new PrintStream(new OutputStream() {
|
||||
@Override public void write(int b) throws IOException {
|
||||
synchronized (out) {
|
||||
System.out.print((char) b);
|
||||
out.append((char) b);
|
||||
out.notifyAll();
|
||||
}
|
||||
}
|
||||
});
|
||||
Thread runner = new Thread(() -> {
|
||||
try {
|
||||
JavaShellToolBuilder.builder()
|
||||
.in(input, input)
|
||||
.out(outS)
|
||||
.err(outS)
|
||||
.promptCapture(true)
|
||||
.persistence(new HashMap<>())
|
||||
.locale(Locale.US)
|
||||
.run("--no-startup");
|
||||
} catch (Exception ex) {
|
||||
throw new IllegalStateException(ex);
|
||||
}
|
||||
});
|
||||
|
||||
Writer inputSink = new OutputStreamWriter(input.createOutput()) {
|
||||
@Override
|
||||
public void write(String str) throws IOException {
|
||||
super.write(str);
|
||||
flush();
|
||||
}
|
||||
};
|
||||
|
||||
runner.start();
|
||||
|
||||
try {
|
||||
waitOutput(out, "\u0005");
|
||||
test.test(inputSink, out);
|
||||
} finally {
|
||||
inputSink.write("\003\003/exit");
|
||||
|
||||
runner.join(1000);
|
||||
if (runner.isAlive()) {
|
||||
runner.stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected interface Test {
|
||||
public void test(Writer inputSink, StringBuilder out) throws Exception;
|
||||
}
|
||||
|
||||
private static final long TIMEOUT;
|
||||
|
||||
static {
|
||||
long factor;
|
||||
|
||||
try {
|
||||
factor = (long) Double.parseDouble(System.getProperty("test.timeout.factor", "1"));
|
||||
} catch (NumberFormatException ex) {
|
||||
factor = 1;
|
||||
}
|
||||
TIMEOUT = 60_000 * factor;
|
||||
}
|
||||
|
||||
protected void waitOutput(StringBuilder out, String expected) {
|
||||
expected = expected.replaceAll("\n", System.getProperty("line.separator"));
|
||||
Pattern expectedPattern = Pattern.compile(expected, Pattern.DOTALL);
|
||||
synchronized (out) {
|
||||
long s = System.currentTimeMillis();
|
||||
|
||||
while (true) {
|
||||
Matcher m = expectedPattern.matcher(out);
|
||||
if (m.find()) {
|
||||
out.delete(0, m.end() + 1);
|
||||
return ;
|
||||
}
|
||||
long e = System.currentTimeMillis();
|
||||
if ((e - s) > TIMEOUT) {
|
||||
throw new IllegalStateException("Timeout waiting for: " + quote(expected) + ", actual output so far: " + quote(out.toString()));
|
||||
}
|
||||
try {
|
||||
out.wait(TIMEOUT);
|
||||
} catch (InterruptedException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private String quote(String original) {
|
||||
StringBuilder output = new StringBuilder();
|
||||
|
||||
for (char c : original.toCharArray()) {
|
||||
if (c < 32) {
|
||||
output.append(String.format("\\u%04X", (int) c));
|
||||
} else {
|
||||
output.append(c);
|
||||
}
|
||||
}
|
||||
|
||||
return output.toString();
|
||||
}
|
||||
|
||||
protected String clearOut(String what) {
|
||||
return backspace(what.length()) + space(what.length()) + backspace(what.length());
|
||||
}
|
||||
|
||||
protected String backspace(int n) {
|
||||
return fill(n, '\010');
|
||||
}
|
||||
|
||||
protected String space(int n) {
|
||||
return fill(n, ' ');
|
||||
}
|
||||
|
||||
private String fill(int n, char c) {
|
||||
StringBuilder result = new StringBuilder(n);
|
||||
|
||||
while (n-- > 0)
|
||||
result.append(c);
|
||||
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
private static class PipeInputStream extends InputStream {
|
||||
|
||||
private static final int INITIAL_SIZE = 128;
|
||||
private int[] buffer = new int[INITIAL_SIZE];
|
||||
private int start;
|
||||
private int end;
|
||||
private boolean closed;
|
||||
|
||||
@Override
|
||||
public synchronized int read() throws IOException {
|
||||
if (start == end && !closed) {
|
||||
inputNeeded();
|
||||
}
|
||||
while (start == end) {
|
||||
if (closed) {
|
||||
return -1;
|
||||
}
|
||||
try {
|
||||
wait();
|
||||
} catch (InterruptedException ex) {
|
||||
//ignore
|
||||
}
|
||||
}
|
||||
try {
|
||||
return buffer[start];
|
||||
} finally {
|
||||
start = (start + 1) % buffer.length;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized int read(byte[] b, int off, int len) throws IOException {
|
||||
if (b == null) {
|
||||
throw new NullPointerException();
|
||||
} else if (off < 0 || len < 0 || len > b.length - off) {
|
||||
throw new IndexOutOfBoundsException();
|
||||
} else if (len == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int c = read();
|
||||
if (c == -1) {
|
||||
return -1;
|
||||
}
|
||||
b[off] = (byte)c;
|
||||
|
||||
int totalRead = 1;
|
||||
while (totalRead < len && start != end) {
|
||||
int r = read();
|
||||
if (r == (-1))
|
||||
break;
|
||||
b[off + totalRead++] = (byte) r;
|
||||
}
|
||||
return totalRead;
|
||||
}
|
||||
|
||||
protected void inputNeeded() throws IOException {}
|
||||
|
||||
private synchronized void write(int b) {
|
||||
if (closed) {
|
||||
throw new IllegalStateException("Already closed.");
|
||||
}
|
||||
int newEnd = (end + 1) % buffer.length;
|
||||
if (newEnd == start) {
|
||||
//overflow:
|
||||
int[] newBuffer = new int[buffer.length * 2];
|
||||
int rightPart = (end > start ? end : buffer.length) - start;
|
||||
int leftPart = end > start ? 0 : start - 1;
|
||||
System.arraycopy(buffer, start, newBuffer, 0, rightPart);
|
||||
System.arraycopy(buffer, 0, newBuffer, rightPart, leftPart);
|
||||
buffer = newBuffer;
|
||||
start = 0;
|
||||
end = rightPart + leftPart;
|
||||
newEnd = end + 1;
|
||||
}
|
||||
buffer[end] = b;
|
||||
end = newEnd;
|
||||
notifyAll();
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void close() {
|
||||
closed = true;
|
||||
notifyAll();
|
||||
}
|
||||
|
||||
public OutputStream createOutput() {
|
||||
return new OutputStream() {
|
||||
@Override public void write(int b) throws IOException {
|
||||
PipeInputStream.this.write(b);
|
||||
}
|
||||
@Override
|
||||
public void write(byte[] b, int off, int len) throws IOException {
|
||||
for (int i = 0 ; i < len ; i++) {
|
||||
write(Byte.toUnsignedInt(b[off + i]));
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
PipeInputStream.this.close();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
89
langtools/test/tools/javac/lambda/speculative/T8177933.java
Normal file
89
langtools/test/tools/javac/lambda/speculative/T8177933.java
Normal file
@ -0,0 +1,89 @@
|
||||
/*
|
||||
* 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. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8177933
|
||||
* @summary Stackoverflow during compilation, starting jdk-9+163
|
||||
*
|
||||
* @library /tools/javac/lib
|
||||
* @modules jdk.compiler/com.sun.tools.javac.api
|
||||
* jdk.compiler/com.sun.tools.javac.code
|
||||
* jdk.compiler/com.sun.tools.javac.comp
|
||||
* jdk.compiler/com.sun.tools.javac.main
|
||||
* jdk.compiler/com.sun.tools.javac.tree
|
||||
* jdk.compiler/com.sun.tools.javac.util
|
||||
* @build combo.ComboTestHelper
|
||||
|
||||
* @run main/othervm -Xss512K T8177933
|
||||
*/
|
||||
|
||||
import combo.ComboInstance;
|
||||
import combo.ComboParameter;
|
||||
import combo.ComboTask.Result;
|
||||
import combo.ComboTestHelper;
|
||||
|
||||
import javax.lang.model.element.Element;
|
||||
|
||||
public class T8177933 extends ComboInstance<T8177933> {
|
||||
|
||||
static final int MAX_DEPTH = 350;
|
||||
|
||||
static class CallExpr implements ComboParameter {
|
||||
@Override
|
||||
public String expand(String optParameter) {
|
||||
Integer n = Integer.parseInt(optParameter);
|
||||
if (n == MAX_DEPTH) {
|
||||
return "m()";
|
||||
} else {
|
||||
return "m().#{CALL." + (n + 1) + "}";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static final String sourceTemplate =
|
||||
"class Test {\n" +
|
||||
" Test m() { return null; }\n" +
|
||||
" void test() {\n" +
|
||||
" #{CALL.0};\n" +
|
||||
"} }\n";
|
||||
|
||||
public static void main(String[] args) {
|
||||
new ComboTestHelper<T8177933>()
|
||||
.withDimension("CALL", new CallExpr())
|
||||
.run(T8177933::new);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doWork() throws Throwable {
|
||||
Result<Iterable<? extends Element>> result = newCompilationTask()
|
||||
.withOption("-XDdev")
|
||||
.withSourceFromTemplate(sourceTemplate)
|
||||
.analyze();
|
||||
if (!result.get().iterator().hasNext()) {
|
||||
fail("Exception occurred when compiling combo. " + result.compilationInfo());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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
|
||||
@ -23,7 +23,7 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8160181
|
||||
* @bug 8160181 8176572
|
||||
* @summary Add lint warning for digits in module names
|
||||
* @library /tools/lib
|
||||
* @modules
|
||||
@ -63,6 +63,22 @@ public class PoorChoiceForModuleNameTest extends ModuleTestBase {
|
||||
Path src_m3 = src.resolve("mango100");
|
||||
tb.writeJavaFiles(src_m3, "@SuppressWarnings(\"module\") module mango100 { }");
|
||||
|
||||
// Check that there is no warning at use site.
|
||||
Path src_m4 = src.resolve("mangouser");
|
||||
tb.writeJavaFiles(src_m4, "module mangouser { requires mango19; }");
|
||||
|
||||
// Check that we warn about component names ending in digit also
|
||||
Path src_m5 = src.resolve("mango1000.mangofruit.mangomodule");
|
||||
tb.writeJavaFiles(src_m5, "module mango1000.mangofruit.mangomodule { }");
|
||||
|
||||
// Check that we warn about component names ending in digit also
|
||||
Path src_m6 = src.resolve("mangofruit.mango1000.mangomodule");
|
||||
tb.writeJavaFiles(src_m6, "module mangofruit.mango1000.mangomodule { }");
|
||||
|
||||
// Check that we warn about component names ending in digit also
|
||||
Path src_m7 = src.resolve("mangomodule.mangofruit.mango1000");
|
||||
tb.writeJavaFiles(src_m7, "module mangomodule.mangofruit.mango1000 { }");
|
||||
|
||||
Path classes = base.resolve("classes");
|
||||
tb.createDirectories(classes);
|
||||
|
||||
@ -78,9 +94,12 @@ public class PoorChoiceForModuleNameTest extends ModuleTestBase {
|
||||
.getOutput(Task.OutputKind.DIRECT);
|
||||
|
||||
if (!log.contains("module-info.java:1:8: compiler.warn.poor.choice.for.module.name: mango19") ||
|
||||
!log.contains("module-info.java:1:8: compiler.warn.poor.choice.for.module.name: mango1000") ||
|
||||
!log.contains("module-info.java:1:18: compiler.warn.poor.choice.for.module.name: mango1000") ||
|
||||
!log.contains("module-info.java:1:30: compiler.warn.poor.choice.for.module.name: mango1000") ||
|
||||
!log.contains("- compiler.err.warnings.and.werror") ||
|
||||
!log.contains("1 error") ||
|
||||
!log.contains("1 warning"))
|
||||
!log.contains("4 warning"))
|
||||
throw new Exception("expected output not found: " + log);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user