--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/doclint/Checker.java Thu Mar 12 13:35:17 2015 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/doclint/Checker.java Thu Mar 12 21:13:42 2015 -0700
@@ -144,6 +144,7 @@
}
public Void scan(DocCommentTree tree, TreePath p) {
+ env.initTypes();
env.setCurrent(p, tree);
boolean isOverridingMethod = !env.currOverriddenMethods.isEmpty();
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/doclint/DocLint.java Thu Mar 12 13:35:17 2015 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/doclint/DocLint.java Thu Mar 12 21:13:42 2015 -0700
@@ -32,6 +32,7 @@
import java.util.LinkedList;
import java.util.List;
import java.util.Queue;
+import java.util.regex.Pattern;
import javax.lang.model.element.Name;
import javax.tools.StandardLocation;
@@ -79,7 +80,8 @@
private static final String STATS = "-stats";
public static final String XIMPLICIT_HEADERS = "-XimplicitHeaders:";
public static final String XCUSTOM_TAGS_PREFIX = "-XcustomTags:";
- public static final String TAGS_SEPARATOR = ",";
+ public static final String XCHECK_PACKAGE = "-XcheckPackage:";
+ public static final String SEPARATOR = ",";
// <editor-fold defaultstate="collapsed" desc="Command-line entry point">
public static void main(String... args) {
@@ -156,7 +158,7 @@
env.init(task);
checker = new Checker(env);
- DeclScanner ds = new DeclScanner() {
+ DeclScanner ds = new DeclScanner(env) {
@Override
void visitDecl(Tree tree, Name name) {
TreePath p = getCurrentPath();
@@ -272,6 +274,8 @@
env.setImplicitHeaders(Character.digit(ch, 10));
} else if (arg.startsWith(XCUSTOM_TAGS_PREFIX)) {
env.setCustomTags(arg.substring(arg.indexOf(":") + 1));
+ } else if (arg.startsWith(XCHECK_PACKAGE)) {
+ env.setCheckPackages(arg.substring(arg.indexOf(":") + 1));
} else
throw new IllegalArgumentException(arg);
}
@@ -280,7 +284,7 @@
checker = new Checker(env);
if (addTaskListener) {
- final DeclScanner ds = new DeclScanner() {
+ final DeclScanner ds = new DeclScanner(env) {
@Override
void visitDecl(Tree tree, Name name) {
TreePath p = getCurrentPath();
@@ -337,6 +341,9 @@
return true;
if (opt.startsWith(XMSGS_CUSTOM_PREFIX))
return Messages.Options.isValidOptions(opt.substring(XMSGS_CUSTOM_PREFIX.length()));
+ if (opt.startsWith(XCHECK_PACKAGE)) {
+ return Env.validatePackages(opt.substring(opt.indexOf(":") + 1));
+ }
return false;
}
@@ -348,6 +355,12 @@
// <editor-fold defaultstate="collapsed" desc="DeclScanner">
static abstract class DeclScanner extends TreePathScanner<Void, Void> {
+ final Env env;
+
+ public DeclScanner(Env env) {
+ this.env = env;
+ }
+
abstract void visitDecl(Tree tree, Name name);
@Override @DefinedBy(Api.COMPILER_TREE)
@@ -373,6 +386,33 @@
visitDecl(tree, tree.getName());
return super.visitVariable(tree, ignore);
}
+
+ @Override @DefinedBy(Api.COMPILER_TREE)
+ public Void visitCompilationUnit(CompilationUnitTree node, Void p) {
+ if (env.includePackages != null) {
+ String packageName = node.getPackageName() != null
+ ? node.getPackageName().toString()
+ : "";
+ if (!env.includePackages.isEmpty()) {
+ boolean included = false;
+ for (Pattern pack : env.includePackages) {
+ if (pack.matcher(packageName).matches()) {
+ included = true;
+ break;
+ }
+ }
+ if (!included)
+ return null;
+ }
+ for (Pattern pack : env.excludePackages) {
+ if (pack.matcher(packageName).matches()) {
+ return null;
+ }
+ }
+ }
+ return super.visitCompilationUnit(node, p);
+ }
+
}
// </editor-fold>
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/doclint/Env.java Thu Mar 12 13:35:17 2015 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/doclint/Env.java Thu Mar 12 21:13:42 2015 -0700
@@ -26,8 +26,12 @@
package com.sun.tools.doclint;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.LinkedHashSet;
+import java.util.List;
import java.util.Set;
-import java.util.LinkedHashSet;
+import java.util.regex.Pattern;
import javax.lang.model.element.Element;
import javax.lang.model.element.ElementKind;
@@ -36,6 +40,7 @@
import javax.lang.model.type.TypeMirror;
import javax.lang.model.util.Elements;
import javax.lang.model.util.Types;
+import javax.tools.Diagnostic.Kind;
import com.sun.source.doctree.DocCommentTree;
import com.sun.source.util.DocTrees;
@@ -44,6 +49,7 @@
import com.sun.source.util.TreePath;
import com.sun.tools.javac.model.JavacTypes;
import com.sun.tools.javac.tree.JCTree;
+import com.sun.tools.javac.util.MatchingUtils;
import com.sun.tools.javac.util.StringUtils;
/**
@@ -90,6 +96,9 @@
Set<String> customTags;
+ Set<Pattern> includePackages;
+ Set<Pattern> excludePackages;
+
// Utility classes
DocTrees trees;
Elements elements;
@@ -129,6 +138,12 @@
this.trees = trees;
this.elements = elements;
this.types = types;
+ }
+
+ void initTypes() {
+ if (java_lang_Error != null)
+ return ;
+
java_lang_Error = elements.getTypeElement("java.lang.Error").asType();
java_lang_RuntimeException = elements.getTypeElement("java.lang.RuntimeException").asType();
java_lang_Throwable = elements.getTypeElement("java.lang.Throwable").asType();
@@ -141,12 +156,43 @@
void setCustomTags(String cTags) {
customTags = new LinkedHashSet<>();
- for (String s : cTags.split(DocLint.TAGS_SEPARATOR)) {
+ for (String s : cTags.split(DocLint.SEPARATOR)) {
if (!s.isEmpty())
customTags.add(s);
}
}
+ void setCheckPackages(String packages) {
+ includePackages = new HashSet<>();
+ excludePackages = new HashSet<>();
+ for (String pack : packages.split(DocLint.SEPARATOR)) {
+ boolean excluded = false;
+ if (pack.startsWith("-")) {
+ pack = pack.substring(1);
+ excluded = true;
+ }
+ if (pack.isEmpty())
+ continue;
+ Pattern pattern = MatchingUtils.validImportStringToPattern(pack);
+ if (excluded) {
+ excludePackages.add(pattern);
+ } else {
+ includePackages.add(pattern);
+ }
+ }
+ }
+
+ static boolean validatePackages(String packages) {
+ for (String pack : packages.split(DocLint.SEPARATOR)) {
+ if (pack.startsWith("-")) {
+ pack = pack.substring(1);
+ }
+ if (!pack.isEmpty() && !MatchingUtils.isValidImportString(pack))
+ return false;
+ }
+ return true;
+ }
+
/** Set the current declaration and its doc comment. */
void setCurrent(TreePath path, DocCommentTree comment) {
currPath = path;
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/doclint/resources/doclint.properties Thu Mar 12 13:35:17 2015 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/doclint/resources/doclint.properties Thu Mar 12 21:13:42 2015 -0700
@@ -107,6 +107,13 @@
\ equivalent to -Xmsgs:all/protected, meaning that\n\
\ all messages are reported for protected and public\n\
\ declarations only. \n\
+\ -XcheckPackage:<packages>\n\
+\ Enable or disable checks in specific packages.\n\
+\ <packages> is a comma separated list of package specifiers.\n\
+\ Package specifier is either a qualified name of a package\n\
+\ or a package name prefix followed by ''.*'', which expands to\n\
+\ all sub-packages of the given package. Prefix the package specifier\n\
+\ with ''-'' to disable checks for the specified packages.\n\
\ -stats\n\
\ Report statistics on the reported issues.\n\
\ -h -help --help -usage -?\n\
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java Thu Mar 12 13:35:17 2015 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java Thu Mar 12 21:13:42 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -1211,10 +1211,8 @@
if (pattype.constValue() == null) {
log.error(c.pat.pos(),
(stringSwitch ? "string.const.req" : "const.expr.req"));
- } else if (labels.contains(pattype.constValue())) {
+ } else if (!labels.add(pattype.constValue())) {
log.error(c.pos(), "duplicate.case.label");
- } else {
- labels.add(pattype.constValue());
}
}
}
@@ -1251,19 +1249,17 @@
// where
/** Return the selected enumeration constant symbol, or null. */
private Symbol enumConstant(JCTree tree, Type enumType) {
- if (!tree.hasTag(IDENT)) {
- log.error(tree.pos(), "enum.label.must.be.unqualified.enum");
- return syms.errSymbol;
- }
- JCIdent ident = (JCIdent)tree;
- Name name = ident.name;
- for (Symbol sym : enumType.tsym.members().getSymbolsByName(name)) {
- if (sym.kind == VAR) {
- Symbol s = ident.sym = sym;
- ((VarSymbol)s).getConstValue(); // ensure initializer is evaluated
- ident.type = s.type;
- return ((s.flags_field & Flags.ENUM) == 0)
- ? null : s;
+ if (tree.hasTag(IDENT)) {
+ JCIdent ident = (JCIdent)tree;
+ Name name = ident.name;
+ for (Symbol sym : enumType.tsym.members().getSymbolsByName(name)) {
+ if (sym.kind == VAR) {
+ Symbol s = ident.sym = sym;
+ ((VarSymbol)s).getConstValue(); // ensure initializer is evaluated
+ ident.type = s.type;
+ return ((s.flags_field & Flags.ENUM) == 0)
+ ? null : s;
+ }
}
}
return null;
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Arguments.java Thu Mar 12 13:35:17 2015 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Arguments.java Thu Mar 12 21:13:42 2015 -0700
@@ -496,6 +496,14 @@
if (doclintOpts.equals(Collections.singleton(DocLint.XMSGS_CUSTOM_PREFIX + "none")))
return List.nil();
+ String checkPackages = options.get(Option.XDOCLINT_PACKAGE);
+
+ if (checkPackages != null) {
+ for (String s : checkPackages.split("\\s+")) {
+ doclintOpts.add(s.replace(Option.XDOCLINT_PACKAGE.text, DocLint.XCHECK_PACKAGE));
+ }
+ }
+
// standard doclet normally generates H1, H2,
// so for now, allow user comments to assume that
doclintOpts.add(DocLint.XIMPLICIT_HEADERS + "2");
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Option.java Thu Mar 12 13:35:17 2015 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Option.java Thu Mar 12 21:13:42 2015 -0700
@@ -129,6 +129,22 @@
}
},
+ XDOCLINT_PACKAGE("-Xdoclint/package:", "opt.Xdoclint.package.args", "opt.Xdoclint.package.desc", EXTENDED, BASIC) {
+ @Override
+ public boolean matches(String option) {
+ return DocLint.isValidOption(
+ option.replace(XDOCLINT_PACKAGE.text, DocLint.XCHECK_PACKAGE));
+ }
+
+ @Override
+ public boolean process(OptionHelper helper, String option) {
+ String prev = helper.get(XDOCLINT_PACKAGE);
+ String next = (prev == null) ? option : (prev + " " + option);
+ helper.put(XDOCLINT_PACKAGE.text, next);
+ return false;
+ }
+ },
+
// -nowarn is retained for command-line backward compatibility
NOWARN("-nowarn", "opt.nowarn", STANDARD, BASIC) {
@Override
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java Thu Mar 12 13:35:17 2015 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java Thu Mar 12 21:13:42 2015 -0700
@@ -70,6 +70,7 @@
import com.sun.tools.javac.util.JavacMessages;
import com.sun.tools.javac.util.List;
import com.sun.tools.javac.util.Log;
+import com.sun.tools.javac.util.MatchingUtils;
import com.sun.tools.javac.util.Name;
import com.sun.tools.javac.util.Names;
import com.sun.tools.javac.util.Options;
@@ -1431,7 +1432,6 @@
return specifiedPackages;
}
- private static final Pattern allMatches = Pattern.compile(".*");
public static final Pattern noMatches = Pattern.compile("(\\P{all})+");
/**
@@ -1440,8 +1440,8 @@
* import-style string, return a regex that won't match anything.
*/
private static Pattern importStringToPattern(String s, Processor p, Log log) {
- if (isValidImportString(s)) {
- return validImportStringToPattern(s);
+ if (MatchingUtils.isValidImportString(s)) {
+ return MatchingUtils.validImportStringToPattern(s);
} else {
log.warning("proc.malformed.supported.string", s, p.getClass().getName());
return noMatches; // won't match any valid identifier
@@ -1449,54 +1449,6 @@
}
/**
- * Return true if the argument string is a valid import-style
- * string specifying claimed annotations; return false otherwise.
- */
- public static boolean isValidImportString(String s) {
- if (s.equals("*"))
- return true;
-
- boolean valid = true;
- String t = s;
- int index = t.indexOf('*');
-
- if (index != -1) {
- // '*' must be last character...
- if (index == t.length() -1) {
- // ... any and preceding character must be '.'
- if ( index-1 >= 0 ) {
- valid = t.charAt(index-1) == '.';
- // Strip off ".*$" for identifier checks
- t = t.substring(0, t.length()-2);
- }
- } else
- return false;
- }
-
- // Verify string is off the form (javaId \.)+ or javaId
- if (valid) {
- String[] javaIds = t.split("\\.", t.length()+2);
- for(String javaId: javaIds)
- valid &= SourceVersion.isIdentifier(javaId);
- }
- return valid;
- }
-
- public static Pattern validImportStringToPattern(String s) {
- if (s.equals("*")) {
- return allMatches;
- } else {
- String s_prime = s.replace(".", "\\.");
-
- if (s_prime.endsWith("*")) {
- s_prime = s_prime.substring(0, s_prime.length() - 1) + ".+";
- }
-
- return Pattern.compile(s_prime);
- }
- }
-
- /**
* For internal use only. This method may be removed without warning.
*/
public Context getContext() {
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac.properties Thu Mar 12 13:35:17 2015 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac.properties Thu Mar 12 21:13:42 2015 -0700
@@ -228,6 +228,17 @@
\ Enable or disable specific checks for problems in javadoc comments,\n\
\ where <group> is one of accessibility, html, missing, reference, or syntax,\n\
\ and <access> is one of public, protected, package, or private.
+
+javac.opt.Xdoclint.package.args = \
+ ([-]<packages>)
+
+javac.opt.Xdoclint.package.desc=\n\
+\ Enable or disable checks in specific packages. <packages> is a comma separated\n\
+\ list of package specifiers. Package specifier is either a qualified name of a package\n\
+\ or a package name prefix followed by '.*', which expands to all sub-packages of\n\
+\ the given package. Prefix the package specifier with '-' to disable checks for\n\
+\ the specified packages.
+
javac.opt.Xstdout=\
Redirect standard output
javac.opt.X=\
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/MatchingUtils.java Thu Mar 12 21:13:42 2015 -0700
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.tools.javac.util;
+
+import java.util.regex.Pattern;
+import javax.lang.model.SourceVersion;
+
+/**Utilities to convert an import-like string to a regexp.
+ *
+ * <p><b>This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own risk.
+ * This code and its internal interfaces are subject to change or
+ * deletion without notice.</b>
+ */
+public class MatchingUtils {
+ private static final Pattern allMatches = Pattern.compile(".*");
+
+ /**
+ * Return true if the argument string is a valid import-style
+ * string specifying claimed annotations; return false otherwise.
+ */
+ public static boolean isValidImportString(String s) {
+ if (s.equals("*"))
+ return true;
+
+ boolean valid = true;
+ String t = s;
+ int index = t.indexOf('*');
+
+ if (index != -1) {
+ // '*' must be last character...
+ if (index == t.length() -1) {
+ // ... any and preceding character must be '.'
+ if ( index-1 >= 0 ) {
+ valid = t.charAt(index-1) == '.';
+ // Strip off ".*$" for identifier checks
+ t = t.substring(0, t.length()-2);
+ }
+ } else
+ return false;
+ }
+
+ // Verify string is off the form (javaId \.)+ or javaId
+ if (valid) {
+ String[] javaIds = t.split("\\.", t.length()+2);
+ for(String javaId: javaIds)
+ valid &= SourceVersion.isIdentifier(javaId);
+ }
+ return valid;
+ }
+
+ public static Pattern validImportStringToPattern(String s) {
+ if (s.equals("*")) {
+ return allMatches;
+ } else {
+ String s_prime = s.replace(".", "\\.");
+
+ if (s_prime.endsWith("*")) {
+ s_prime = s_prime.substring(0, s_prime.length() - 1) + ".+";
+ }
+
+ return Pattern.compile(s_prime);
+ }
+ }
+
+}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/options/Options.java Thu Mar 12 13:35:17 2015 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/options/Options.java Thu Mar 12 21:13:42 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -36,6 +36,7 @@
import java.util.HashSet;
import com.sun.tools.sjavac.Transformer;
+import com.sun.tools.sjavac.Util;
/**
* Instances of this class represent values for sjavac command line options.
@@ -358,21 +359,25 @@
@Override
public void exclude(String exclPattern) {
+ exclPattern = Util.normalizeDriveLetter(exclPattern);
excludes.add(exclPattern);
}
@Override
public void include(String inclPattern) {
+ inclPattern = Util.normalizeDriveLetter(inclPattern);
includes.add(inclPattern);
}
@Override
public void excludeFile(String exclFilePattern) {
+ exclFilePattern = Util.normalizeDriveLetter(exclFilePattern);
excludeFiles.add(exclFilePattern);
}
@Override
public void includeFile(String inclFilePattern) {
+ inclFilePattern = Util.normalizeDriveLetter(inclFilePattern);
includeFiles.add(inclFilePattern);
}
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/FrameOutputWriter.java Thu Mar 12 13:35:17 2015 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/FrameOutputWriter.java Thu Mar 12 21:13:42 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -55,8 +55,6 @@
*/
int noOfPackages;
- private final String SCROLL_YES = "yes";
-
/**
* Constructor to construct FrameOutputWriter object.
*
@@ -96,90 +94,73 @@
* as well as warning if browser is not supporting the Html frames.
*/
protected void generateFrameFile() throws IOException {
- Content frameset = getFrameDetails();
+ Content frame = getFrameDetails();
+ HtmlTree body = new HtmlTree(HtmlTag.BODY);
+ body.addContent(frame);
if (configuration.windowtitle.length() > 0) {
- printFramesetDocument(configuration.windowtitle, configuration.notimestamp,
- frameset);
+ printFramesDocument(configuration.windowtitle, configuration,
+ body);
} else {
- printFramesetDocument(configuration.getText("doclet.Generated_Docs_Untitled"),
- configuration.notimestamp, frameset);
+ printFramesDocument(configuration.getText("doclet.Generated_Docs_Untitled"),
+ configuration, body);
}
}
/**
- * Add the code for issueing the warning for a non-frame capable web
- * client. Also provide links to the non-frame version documentation.
- *
- * @param contentTree the content tree to which the non-frames information will be added
- */
- protected void addFrameWarning(Content contentTree) {
- Content noframes = new HtmlTree(HtmlTag.NOFRAMES);
- Content noScript = HtmlTree.NOSCRIPT(
- HtmlTree.DIV(getResource("doclet.No_Script_Message")));
- noframes.addContent(noScript);
- Content noframesHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
- getResource("doclet.Frame_Alert"));
- noframes.addContent(noframesHead);
- Content p = HtmlTree.P(getResource("doclet.Frame_Warning_Message",
- getHyperLink(configuration.topFile,
- configuration.getText("doclet.Non_Frame_Version"))));
- noframes.addContent(p);
- contentTree.addContent(noframes);
- }
-
- /**
* Get the frame sizes and their contents.
*
* @return a content tree for the frame details
*/
protected Content getFrameDetails() {
- HtmlTree frameset = HtmlTree.FRAMESET("20%,80%", null, "Documentation frame",
- "top.loadFrames()");
+ HtmlTree leftContainerDiv = new HtmlTree(HtmlTag.DIV);
+ HtmlTree rightContainerDiv = new HtmlTree(HtmlTag.DIV);
+ leftContainerDiv.addStyle(HtmlStyle.leftContainer);
+ rightContainerDiv.addStyle(HtmlStyle.rightContainer);
if (noOfPackages <= 1) {
- addAllClassesFrameTag(frameset);
+ addAllClassesFrameTag(leftContainerDiv);
} else if (noOfPackages > 1) {
- HtmlTree leftFrameset = HtmlTree.FRAMESET(null, "30%,70%", "Left frames",
- "top.loadFrames()");
- addAllPackagesFrameTag(leftFrameset);
- addAllClassesFrameTag(leftFrameset);
- frameset.addContent(leftFrameset);
+ addAllPackagesFrameTag(leftContainerDiv);
+ addAllClassesFrameTag(leftContainerDiv);
}
- addClassFrameTag(frameset);
- addFrameWarning(frameset);
- return frameset;
+ addClassFrameTag(rightContainerDiv);
+ HtmlTree mainContainer = HtmlTree.DIV(HtmlStyle.mainContainer, leftContainerDiv);
+ mainContainer.addContent(rightContainerDiv);
+ return mainContainer;
}
/**
- * Add the FRAME tag for the frame that lists all packages.
+ * Add the IFRAME tag for the frame that lists all packages.
*
* @param contentTree the content tree to which the information will be added
*/
private void addAllPackagesFrameTag(Content contentTree) {
- HtmlTree frame = HtmlTree.FRAME(DocPaths.OVERVIEW_FRAME.getPath(),
+ HtmlTree frame = HtmlTree.IFRAME(DocPaths.OVERVIEW_FRAME.getPath(),
"packageListFrame", configuration.getText("doclet.All_Packages"));
- contentTree.addContent(frame);
+ HtmlTree leftTop = HtmlTree.DIV(HtmlStyle.leftTop, frame);
+ contentTree.addContent(leftTop);
}
/**
- * Add the FRAME tag for the frame that lists all classes.
+ * Add the IFRAME tag for the frame that lists all classes.
*
* @param contentTree the content tree to which the information will be added
*/
private void addAllClassesFrameTag(Content contentTree) {
- HtmlTree frame = HtmlTree.FRAME(DocPaths.ALLCLASSES_FRAME.getPath(),
+ HtmlTree frame = HtmlTree.IFRAME(DocPaths.ALLCLASSES_FRAME.getPath(),
"packageFrame", configuration.getText("doclet.All_classes_and_interfaces"));
- contentTree.addContent(frame);
+ HtmlTree leftBottom = HtmlTree.DIV(HtmlStyle.leftBottom, frame);
+ contentTree.addContent(leftBottom);
}
/**
- * Add the FRAME tag for the frame that describes the class in detail.
+ * Add the IFRAME tag for the frame that describes the class in detail.
*
* @param contentTree the content tree to which the information will be added
*/
private void addClassFrameTag(Content contentTree) {
- HtmlTree frame = HtmlTree.FRAME(configuration.topFile.getPath(), "classFrame",
- configuration.getText("doclet.Package_class_and_interface_descriptions"),
- SCROLL_YES);
+ HtmlTree frame = HtmlTree.IFRAME(configuration.topFile.getPath(), "classFrame",
+ configuration.getText("doclet.Package_class_and_interface_descriptions"));
+ frame.addStyle(HtmlStyle.rightIframe);
contentTree.addContent(frame);
}
}
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/DocType.java Thu Mar 12 13:35:17 2015 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/DocType.java Thu Mar 12 21:13:42 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -48,9 +48,6 @@
public static final DocType TRANSITIONAL =
new DocType("Transitional", "http://www.w3.org/TR/html4/loose.dtd");
- public static final DocType FRAMESET =
- new DocType("Frameset", "http://www.w3.org/TR/html4/frameset.dtd");
-
/**
* Constructor to construct a DocType object.
*
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java Thu Mar 12 13:35:17 2015 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java Thu Mar 12 21:13:42 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -35,6 +35,7 @@
import com.sun.tools.doclets.internal.toolkit.util.DocFile;
import com.sun.tools.doclets.internal.toolkit.util.DocLink;
import com.sun.tools.doclets.internal.toolkit.util.DocPath;
+import com.sun.tools.doclets.internal.toolkit.util.DocPaths;
/**
@@ -56,6 +57,8 @@
public static final String CONTENT_TYPE = "text/html";
+ DocPath pathToRoot;
+
/**
* Constructor. Initializes the destination file name through the super
* class HtmlWriter.
@@ -65,6 +68,7 @@
public HtmlDocWriter(Configuration configuration, DocPath filename)
throws IOException {
super(configuration, filename);
+ this.pathToRoot = filename.parent().invert();
configuration.message.notice("doclet.Generating_0",
DocFile.createFileForOutput(configuration, filename).getPath());
}
@@ -298,33 +302,54 @@
}
/**
- * Print the frameset version of the Html file header.
- * Called only when generating an HTML frameset file.
+ * Print the frames version of the Html file header.
+ * Called only when generating an HTML frames file.
*
* @param title Title of this HTML document
- * @param noTimeStamp If true, don't print time stamp in header
- * @param frameset the frameset to be added to the HTML document
+ * @param configuration the configuration object
+ * @param frame the frame content tree to be added to the HTML document
*/
- public void printFramesetDocument(String title, boolean noTimeStamp,
- Content frameset) throws IOException {
- Content htmlDocType = DocType.FRAMESET;
+ public void printFramesDocument(String title, ConfigurationImpl configuration,
+ HtmlTree body) throws IOException {
+ Content htmlDocType = DocType.TRANSITIONAL;
Content htmlComment = new Comment(configuration.getText("doclet.New_Page"));
Content head = new HtmlTree(HtmlTag.HEAD);
- head.addContent(getGeneratedBy(!noTimeStamp));
+ head.addContent(getGeneratedBy(!configuration.notimestamp));
Content windowTitle = HtmlTree.TITLE(new StringContent(title));
head.addContent(windowTitle);
Content meta = HtmlTree.META("Content-Type", CONTENT_TYPE,
(configuration.charset.length() > 0) ?
configuration.charset : HtmlConstants.HTML_DEFAULT_CHARSET);
head.addContent(meta);
- head.addContent(getFramesetJavaScript());
+ head.addContent(getStyleSheetProperties(configuration));
+ head.addContent(getFramesJavaScript());
Content htmlTree = HtmlTree.HTML(configuration.getLocale().getLanguage(),
- head, frameset);
+ head, body);
Content htmlDocument = new HtmlDocument(htmlDocType,
htmlComment, htmlTree);
write(htmlDocument);
}
+ /**
+ * Returns a link to the stylesheet file.
+ *
+ * @return an HtmlTree for the lINK tag which provides the stylesheet location
+ */
+ public HtmlTree getStyleSheetProperties(ConfigurationImpl configuration) {
+ String stylesheetfile = configuration.stylesheetfile;
+ DocPath stylesheet;
+ if (stylesheetfile.isEmpty()) {
+ stylesheet = DocPaths.STYLESHEET;
+ } else {
+ DocFile file = DocFile.createFileForInput(configuration, stylesheetfile);
+ stylesheet = DocPath.create(file.getName());
+ }
+ HtmlTree link = HtmlTree.LINK("stylesheet", "text/css",
+ pathToRoot.resolve(stylesheet).getPath(),
+ "Style");
+ return link;
+ }
+
protected Comment getGeneratedBy(boolean timestamp) {
String text = "Generated by javadoc"; // marker string, deliberately not localized
if (timestamp) {
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlStyle.java Thu Mar 12 13:35:17 2015 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlStyle.java Thu Mar 12 21:13:42 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -67,7 +67,11 @@
indexHeader,
inheritance,
interfaceName,
+ leftContainer,
+ leftTop,
+ leftBottom,
legalCopy,
+ mainContainer,
memberNameLabel,
memberNameLink,
memberSummary,
@@ -79,6 +83,8 @@
packageHierarchyLabel,
paramLabel,
returnLabel,
+ rightContainer,
+ rightIframe,
rowColor,
seeLabel,
serializedFormContainer,
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTag.java Thu Mar 12 13:35:17 2015 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTag.java Thu Mar 12 21:13:42 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -52,8 +52,6 @@
DT,
EM(BlockType.INLINE, EndTag.END),
FONT(BlockType.INLINE, EndTag.END),
- FRAME(BlockType.OTHER, EndTag.NOEND),
- FRAMESET(BlockType.OTHER, EndTag.END),
H1,
H2,
H3,
@@ -64,6 +62,7 @@
HR(BlockType.BLOCK, EndTag.NOEND),
HTML(BlockType.OTHER, EndTag.END),
I(BlockType.INLINE, EndTag.END),
+ IFRAME(BlockType.OTHER, EndTag.END),
IMG(BlockType.INLINE, EndTag.NOEND),
LI,
LISTING,
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java Thu Mar 12 13:35:17 2015 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java Thu Mar 12 21:13:42 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -326,53 +326,18 @@
}
/**
- * Generates a FRAME tag.
- *
- * @param src the url of the document to be shown in the frame
- * @param name specifies the name of the frame
- * @param title the title for the frame
- * @param scrolling specifies whether to display scrollbars in the frame
- * @return an HtmlTree object for the FRAME tag
- */
- public static HtmlTree FRAME(String src, String name, String title, String scrolling) {
- HtmlTree htmltree = new HtmlTree(HtmlTag.FRAME);
- htmltree.addAttr(HtmlAttr.SRC, nullCheck(src));
- htmltree.addAttr(HtmlAttr.NAME, nullCheck(name));
- htmltree.addAttr(HtmlAttr.TITLE, nullCheck(title));
- if (scrolling != null)
- htmltree.addAttr(HtmlAttr.SCROLLING, scrolling);
- return htmltree;
- }
-
- /**
- * Generates a Frame tag.
+ * Generates a IFRAME tag.
*
* @param src the url of the document to be shown in the frame
* @param name specifies the name of the frame
* @param title the title for the frame
- * @return an HtmlTree object for the SPAN tag
+ * @return an HtmlTree object for the IFRAME tag
*/
- public static HtmlTree FRAME(String src, String name, String title) {
- return FRAME(src, name, title, null);
- }
-
- /**
- * Generates a FRAMESET tag.
- *
- * @param cols the size of columns in the frameset
- * @param rows the size of rows in the frameset
- * @param title the title for the frameset
- * @param onload the script to run when the document loads
- * @return an HtmlTree object for the FRAMESET tag
- */
- public static HtmlTree FRAMESET(String cols, String rows, String title, String onload) {
- HtmlTree htmltree = new HtmlTree(HtmlTag.FRAMESET);
- if (cols != null)
- htmltree.addAttr(HtmlAttr.COLS, cols);
- if (rows != null)
- htmltree.addAttr(HtmlAttr.ROWS, rows);
+ public static HtmlTree IFRAME(String src, String name, String title) {
+ HtmlTree htmltree = new HtmlTree(HtmlTag.IFRAME);
+ htmltree.addAttr(HtmlAttr.SRC, nullCheck(src));
+ htmltree.addAttr(HtmlAttr.NAME, nullCheck(name));
htmltree.addAttr(HtmlAttr.TITLE, nullCheck(title));
- htmltree.addAttr(HtmlAttr.ONLOAD, nullCheck(onload));
return htmltree;
}
@@ -779,7 +744,7 @@
return (hasAttr(HtmlAttr.NAME) || (hasAttr(HtmlAttr.HREF) && hasContent()));
case BR :
return (!hasContent() && (!hasAttrs() || hasAttr(HtmlAttr.CLEAR)));
- case FRAME :
+ case IFRAME :
return (hasAttr(HtmlAttr.SRC) && !hasContent());
case HR :
return (!hasContent());
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java Thu Mar 12 13:35:17 2015 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java Thu Mar 12 21:13:42 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -376,7 +376,7 @@
*
* @return a content for the SCRIPT tag
*/
- protected Content getFramesetJavaScript() {
+ protected Content getFramesJavaScript() {
HtmlTree script = new HtmlTree(HtmlTag.SCRIPT);
script.addAttr(HtmlAttr.TYPE, "text/javascript");
String scriptCode = DocletConstants.NL +
@@ -425,10 +425,6 @@
" }" + DocletConstants.NL +
" }" + DocletConstants.NL +
" return true;" + DocletConstants.NL +
- " }" + DocletConstants.NL +
- " function loadFrames() {" + DocletConstants.NL +
- " if (targetPage != \"\" && targetPage != \"undefined\")" + DocletConstants.NL +
- " top.classFrame.location = top.targetPage;" + DocletConstants.NL +
" }" + DocletConstants.NL;
RawHtml scriptContent = new RawHtml(scriptCode);
script.addContent(scriptContent);
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/resources/standard.properties Thu Mar 12 13:35:17 2015 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/resources/standard.properties Thu Mar 12 21:13:42 2015 -0700
@@ -104,10 +104,7 @@
doclet.Package_Hierarchies=Package Hierarchies:
doclet.Hierarchy_For_Package=Hierarchy For Package {0}
doclet.Hierarchy_For_All_Packages=Hierarchy For All Packages
-doclet.Frame_Alert=Frame Alert
-doclet.Frame_Warning_Message=This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to {0}.
doclet.No_Script_Message=JavaScript is disabled on your browser.
-doclet.Non_Frame_Version=Non-frame version
doclet.Description_From_Interface=Description copied from interface:
doclet.Description_From_Class=Description copied from class:
doclet.No_Non_Deprecated_Classes_To_Document=No non-deprecated classes found to document.
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/resources/stylesheet.css Thu Mar 12 13:35:17 2015 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/resources/stylesheet.css Thu Mar 12 21:13:42 2015 -0700
@@ -11,6 +11,17 @@
font-family:'DejaVu Sans', Arial, Helvetica, sans-serif;
font-size:14px;
margin:0;
+ padding:0;
+ height:100%;
+ width:100%;
+}
+iframe {
+ margin:0;
+ padding:0;
+ height:100%;
+ width:100%;
+ overflow-y:scroll;
+ border:none;
}
a:link, a:visited {
text-decoration:none;
@@ -463,7 +474,6 @@
.useSummary td, .constantsSummary td, .deprecatedSummary td {
text-align:left;
padding:0px 0px 12px 10px;
- width:100%;
}
th.colOne, th.colFirst, th.colLast, .useSummary th, .constantsSummary th,
td.colOne, td.colFirst, td.colLast, .useSummary td, .constantsSummary td{
@@ -488,6 +498,7 @@
font-size:13px;
}
.overviewSummary td.colFirst, .overviewSummary th.colFirst,
+.useSummary td.colFirst, .useSummary th.colFirst,
.overviewSummary td.colOne, .overviewSummary th.colOne,
.memberSummary td.colFirst, .memberSummary th.colFirst,
.memberSummary td.colOne, .memberSummary th.colOne,
@@ -569,6 +580,61 @@
font-style:normal;
}
-div.contentContainer ul.blockList li.blockList h2{
+div.contentContainer ul.blockList li.blockList h2 {
padding-bottom:0px;
}
+/*
+IFRAME specific styles
+*/
+.mainContainer {
+ margin:0 auto;
+ padding:0;
+ height:100%;
+ width:100%;
+ position:fixed;
+ top:0;
+ left:0;
+}
+.leftContainer {
+ height:100%;
+ position:fixed;
+ width:320px;
+}
+.leftTop {
+ position:relative;
+ float:left;
+ width:315px;
+ top:0;
+ left:0;
+ height:30%;
+ border-right:6px solid #ccc;
+ border-bottom:6px solid #ccc;
+}
+.leftBottom {
+ position:relative;
+ float:left;
+ width:315px;
+ bottom:0;
+ left:0;
+ height:70%;
+ border-right:6px solid #ccc;
+ border-top:1px solid #000;
+}
+.rightContainer {
+ position:absolute;
+ left:320px;
+ top:0;
+ bottom:0;
+ height:100%;
+ right:0;
+ border-left:1px solid #000;
+}
+.rightIframe {
+ margin:0;
+ padding:0;
+ height:100%;
+ right:30px;
+ width:100%;
+ overflow:visible;
+ margin-bottom:30px;
+}
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/DocEnv.java Thu Mar 12 13:35:17 2015 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/DocEnv.java Thu Mar 12 21:13:42 2015 -0700
@@ -833,7 +833,7 @@
for (String customTag : customTagNames) {
customTags.append(sep);
customTags.append(customTag);
- sep = DocLint.TAGS_SEPARATOR;
+ sep = DocLint.SEPARATOR;
}
doclintOpts.add(DocLint.XCUSTOM_TAGS_PREFIX + customTags.toString());
--- a/langtools/test/com/sun/javadoc/ValidHtml/ValidHtml.java Thu Mar 12 13:35:17 2015 -0700
+++ b/langtools/test/com/sun/javadoc/ValidHtml/ValidHtml.java Thu Mar 12 21:13:42 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -23,11 +23,10 @@
/*
* @test
- * @bug 4275630 4749453 4625400 4753048 4415270
- * @summary Generated HTML is invalid with frameset DTD.
+ * @bug 4275630 4749453 4625400 4753048 4415270 8074521
+ * @summary Generated HTML is invalid with frames.
* Displays unnecessary horizontal scroll bars.
* Missing whitespace in DOCTYPE declaration
- * <NOFRAMES> not allowed outside <FRAMESET> element
* HTML table tags inserted in wrong place in pakcage use page
* @author dkramer
* @library ../lib
@@ -55,7 +54,7 @@
checkExit(Exit.OK);
// Test the proper DOCTYPE element are present:
- checkOutput("index.html", true, FRAMESET);
+ checkOutput("index.html", true, LOOSE);
checkOutput("overview-summary.html", true, LOOSE);
checkOutput("p1/package-summary.html", true, LOOSE);
checkOutput("p1/C.html", true, LOOSE);
@@ -63,10 +62,9 @@
checkOutput("allclasses-frame.html", true, LOOSE);
checkOutput("p1/package-frame.html", true, LOOSE);
- // Test that <NOFRAMES> is inside <FRAMESET> element:
+ // Test for IFRAME element:
checkOutput("index.html", true,
- "</noframes>\n"
- + "</frameset>");
+ "<iframe");
// Test the table elements are in the correct order:
checkOutput("p1/package-use.html", true,
@@ -74,8 +72,6 @@
+ "</tr>");
}
- private static final String FRAMESET =
- "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Frameset//EN\" \"http://www.w3.org/TR/html4/frameset.dtd\">";
private static final String LOOSE =
"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">";
}
--- a/langtools/test/com/sun/javadoc/testIndex/TestIndex.java Thu Mar 12 13:35:17 2015 -0700
+++ b/langtools/test/com/sun/javadoc/testIndex/TestIndex.java Thu Mar 12 21:13:42 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -47,10 +47,9 @@
"pkg", testSrc("NoPackage.java"));
checkExit(Exit.OK);
- //Make sure the horizontal scroll bar does not appear in class frame.
checkOutput("index.html", true,
- "<frame src=\"overview-summary.html\" name=\"classFrame\" title=\""
- + "Package, class and interface descriptions\" scrolling=\"yes\">");
+ "<iframe src=\"overview-summary.html\" name=\"classFrame\" title=\""
+ + "Package, class and interface descriptions\" class=\"rightIframe\">");
//Test index-all.html
checkOutput("index-all.html", true,
--- a/langtools/test/com/sun/javadoc/testJavascript/TestJavascript.java Thu Mar 12 13:35:17 2015 -0700
+++ b/langtools/test/com/sun/javadoc/testJavascript/TestJavascript.java Thu Mar 12 21:13:42 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -99,10 +99,6 @@
+ " }\n"
+ " return true;\n"
+ " }\n"
- + " function loadFrames() {\n"
- + " if (targetPage != \"\" && targetPage != \"undefined\")\n"
- + " top.classFrame.location = top.targetPage;\n"
- + " }\n"
+ "</script>");
//Make sure title javascript only runs if is-external is not true
--- a/langtools/test/com/sun/javadoc/testNonFrameWarning/TestNonFrameWarning.java Thu Mar 12 13:35:17 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @bug 7001086
- * @summary Test Non-frame warning.
- * @author Bhavesh Patel
- * @library ../lib
- * @build JavadocTester
- * @run main TestNonFrameWarning
- */
-
-public class TestNonFrameWarning extends JavadocTester {
-
- public static void main(String... args) throws Exception {
- TestNonFrameWarning tester = new TestNonFrameWarning();
- tester.runTests();
- }
-
- @Test
- void test() {
- javadoc("-d", "out",
- "-sourcepath", testSrc,
- "pkg");
- checkExit(Exit.OK);
-
- checkOutput("index.html", true,
- "<p>This document is designed to be viewed using the frames feature. "
- + "If you see this message, you are using a non-frame-capable web client. "
- + "Link to <a href=\"pkg/package-summary.html\">Non-frame version</a>.</p>");
- }
-}
--- a/langtools/test/com/sun/javadoc/testNonFrameWarning/pkg/C.java Thu Mar 12 13:35:17 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package pkg;
-
-/**
- * Source file for C
- */
-public class C {
-}
--- a/langtools/test/com/sun/javadoc/testProfiles/TestProfiles.java Thu Mar 12 13:35:17 2015 -0700
+++ b/langtools/test/com/sun/javadoc/testProfiles/TestProfiles.java Thu Mar 12 21:13:42 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -112,7 +112,7 @@
"<div class=\"subTitle\">compact1, compact2, compact3</div>");
checkOutput("index.html", true,
- "<frame src=\"overview-frame.html\" name=\"packageListFrame\" "
+ "<iframe src=\"overview-frame.html\" name=\"packageListFrame\" "
+ "title=\"All Packages\">");
// Test for "overview-summary.html" showing the profile list.
--- a/langtools/test/com/sun/javadoc/testStylesheet/TestStylesheet.java Thu Mar 12 13:35:17 2015 -0700
+++ b/langtools/test/com/sun/javadoc/testStylesheet/TestStylesheet.java Thu Mar 12 21:13:42 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 4494033 7028815 7052425 8007338 8023608 8008164 8016549
+ * @bug 4494033 7028815 7052425 8007338 8023608 8008164 8016549 8072461
* @summary Run tests on doclet stylesheet.
* @author jamieh
* @library ../lib
@@ -64,6 +64,17 @@
+ " font-family:'DejaVu Sans', Arial, Helvetica, sans-serif;\n"
+ " font-size:14px;\n"
+ " margin:0;\n"
+ + " padding:0;\n"
+ + " height:100%;\n"
+ + " width:100%;\n"
+ + "}",
+ "iframe {\n"
+ + " margin:0;\n"
+ + " padding:0;\n"
+ + " height:100%;\n"
+ + " width:100%;\n"
+ + " overflow-y:scroll;\n"
+ + " border:none;\n"
+ "}",
"ul {\n"
+ " list-style-type:disc;\n"
@@ -118,6 +129,21 @@
+ " background-color:#4D7A97;\n"
+ " height:16px;\n"
+ "}",
+ // Test the formatting styles for proper content display in use and constant values pages.
+ ".overviewSummary td.colFirst, .overviewSummary th.colFirst,\n"
+ + ".useSummary td.colFirst, .useSummary th.colFirst,\n"
+ + ".overviewSummary td.colOne, .overviewSummary th.colOne,\n"
+ + ".memberSummary td.colFirst, .memberSummary th.colFirst,\n"
+ + ".memberSummary td.colOne, .memberSummary th.colOne,\n"
+ + ".typeSummary td.colFirst{\n"
+ + " width:25%;\n"
+ + " vertical-align:top;\n"
+ + "}",
+ ".overviewSummary td, .memberSummary td, .typeSummary td,\n"
+ + ".useSummary td, .constantsSummary td, .deprecatedSummary td {\n"
+ + " text-align:left;\n"
+ + " padding:0px 0px 12px 10px;\n"
+ + "}",
".memberSummary caption span.tableTab, .memberSummary caption span.activeTableTab {\n"
+ " padding-top:0px;\n"
+ " padding-left:0px;\n"
@@ -134,6 +160,9 @@
"<link rel=\"stylesheet\" type=\"text/css\" "
+ "href=\"../stylesheet.css\" title=\"Style\">");
+ checkOutput("index.html", true,
+ "<link rel=\"stylesheet\" type=\"text/css\" href=\"stylesheet.css\" title=\"Style\">");
+
checkOutput("stylesheet.css", false,
"* {\n"
+ " margin:0;\n"
--- a/langtools/test/tools/doclint/tool/HelpTest.out Thu Mar 12 13:35:17 2015 -0700
+++ b/langtools/test/tools/doclint/tool/HelpTest.out Thu Mar 12 21:13:42 2015 -0700
@@ -30,6 +30,13 @@
equivalent to -Xmsgs:all/protected, meaning that
all messages are reported for protected and public
declarations only.
+ -XcheckPackage:<packages>
+ Enable or disable checks in specific packages.
+ <packages> is a comma separated list of package specifiers.
+ Package specifier is either a qualified name of a package
+ or a package name prefix followed by '.*', which expands to
+ all sub-packages of the given package. Prefix the package specifier
+ with '-' to disable checks for the specified packages.
-stats
Report statistics on the reported issues.
-h -help --help -usage -?
--- a/langtools/test/tools/javac/8074306/TestSyntheticNullChecks.java Thu Mar 12 13:35:17 2015 -0700
+++ b/langtools/test/tools/javac/8074306/TestSyntheticNullChecks.java Thu Mar 12 21:13:42 2015 -0700
@@ -25,7 +25,7 @@
/*
* @test
- * @bug 8074306
+ * @bug 8074306 8073432 8074501
* @summary NULLCHK is emitted as Object.getClass
* @compile -source 6 -target 6 TestSyntheticNullChecks.java
* @run main TestSyntheticNullChecks 6
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/doclint/IncludePackagesTest.java Thu Mar 12 21:13:42 2015 -0700
@@ -0,0 +1,248 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8071851
+ * @summary Test the -Xdoclint/package option
+ */
+
+import java.io.File;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.net.URI;
+import java.util.Arrays;
+import java.util.List;
+
+import javax.tools.Diagnostic;
+import javax.tools.JavaCompiler;
+import javax.tools.JavaFileObject;
+import javax.tools.SimpleJavaFileObject;
+import javax.tools.StandardJavaFileManager;
+import javax.tools.StandardLocation;
+import javax.tools.ToolProvider;
+import static javax.tools.Diagnostic.Kind.*;
+
+import com.sun.source.util.JavacTask;
+import com.sun.tools.javac.main.Main;
+import java.util.ArrayList;
+import java.util.EnumSet;
+import java.util.Set;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+public class IncludePackagesTest {
+ public static void main(String... args) throws Exception {
+ new IncludePackagesTest().run();
+ }
+
+ JavaCompiler javac;
+ StandardJavaFileManager fm;
+ List<JavaFileObject> files;
+
+ final String[] sources = new String[] {
+ "p1/p1T.java",
+ "package p1;\n" +
+ "/** Syntax < error. */\n" +
+ "public class p1T {\n" +
+ "}\n",
+ "p1/sp1/p1sp1T.java",
+ "package p1.sp1;\n" +
+ "/** Syntax < error. */\n" +
+ "public class p1sp1T {\n" +
+ "}\n",
+ "p1/sp1/sp2/p1sp1sp2T.java",
+ "package p1.sp1.sp2;\n" +
+ "/** Syntax < error. */\n" +
+ "public class p1sp1sp2T {\n" +
+ "}\n",
+ "p2/p2T.java",
+ "package p2;\n" +
+ "/** Syntax < error. */\n" +
+ "public class p2T {\n" +
+ "}\n",
+ "Default.java",
+ "/** Syntax < error. */\n" +
+ "public class Default {\n" +
+ "}\n",
+ };
+
+ final String rawDiags = "-XDrawDiagnostics";
+ private enum Message {
+ // doclint messages
+ p1T(ERROR, "p1T.java:2:12: compiler.err.proc.messager: malformed HTML"),
+ p1sp1T(ERROR, "p1sp1T.java:2:12: compiler.err.proc.messager: malformed HTML"),
+ p1sp1sp2T(ERROR, "p1sp1sp2T.java:2:12: compiler.err.proc.messager: malformed HTML"),
+ p2T(ERROR, "p2T.java:2:12: compiler.err.proc.messager: malformed HTML"),
+ Default(ERROR, "Default.java:1:12: compiler.err.proc.messager: malformed HTML"),
+ INVALID_PACKAGE_ERROR(ERROR, "invalid flag: -Xdoclint/package:wrong+package");
+
+ final Diagnostic.Kind kind;
+ final String text;
+
+ static Message get(String text) {
+ for (Message m: values()) {
+ if (m.text.equals(text))
+ return m;
+ }
+ return null;
+ }
+
+ Message(Diagnostic.Kind kind, String text) {
+ this.kind = kind;
+ this.text = text;
+ }
+
+ @Override
+ public String toString() {
+ return "[" + kind + ",\"" + text + "\"]";
+ }
+ }
+ void run() throws Exception {
+ javac = ToolProvider.getSystemJavaCompiler();
+ fm = javac.getStandardFileManager(null, null, null);
+ try {
+ fm.setLocation(StandardLocation.CLASS_OUTPUT, Arrays.asList(new File(".")));
+ files = new ArrayList<>();
+
+ for (int si = 0; si < sources.length; si += 2) {
+ files.add(new JFOImpl(sources[si], sources[si + 1]));
+ }
+
+ test(Arrays.asList(rawDiags, "-Xdoclint"),
+ Main.Result.ERROR,
+ EnumSet.of(Message.p1T, Message.p1sp1T, Message.p1sp1sp2T,
+ Message.p2T, Message.Default));
+
+ test(Arrays.asList(rawDiags, "-Xdoclint", "-Xdoclint/package:p1"),
+ Main.Result.ERROR,
+ EnumSet.of(Message.p1T));
+
+ test(Arrays.asList(rawDiags, "-Xdoclint", "-Xdoclint/package:p1.*"),
+ Main.Result.ERROR,
+ EnumSet.of(Message.p1sp1T, Message.p1sp1sp2T));
+
+ test(Arrays.asList(rawDiags, "-Xdoclint", "-Xdoclint/package:p1.*,-p1.sp1"),
+ Main.Result.ERROR,
+ EnumSet.of(Message.p1sp1sp2T));
+
+ test(Arrays.asList(rawDiags, "-Xdoclint", "-Xdoclint/package:-p1.sp1"),
+ Main.Result.ERROR,
+ EnumSet.of(Message.p1T, Message.p1sp1sp2T, Message.p2T, Message.Default));
+
+ test(Arrays.asList(rawDiags, "-Xdoclint", "-Xdoclint/package:wrong+package"),
+ Main.Result.CMDERR,
+ EnumSet.of(Message.INVALID_PACKAGE_ERROR));
+
+ if (errors > 0)
+ throw new Exception(errors + " errors occurred");
+ } finally {
+ fm.close();
+ }
+ }
+
+ void test(List<String> opts, Main.Result expectResult, Set<Message> expectMessages) {
+ System.err.println("test: " + opts);
+ StringWriter sw = new StringWriter();
+ PrintWriter pw = new PrintWriter(sw);
+ try {
+ JavacTask t = (JavacTask) javac.getTask(pw, fm, null, opts, null, files);
+ boolean ok = t.call();
+ pw.close();
+ String out = sw.toString().replaceAll("[\r\n]+", "\n");
+ if (!out.isEmpty())
+ System.err.println(out);
+ if (ok && expectResult != Main.Result.OK) {
+ error("Compilation succeeded unexpectedly");
+ } else if (!ok && expectResult != Main.Result.ERROR) {
+ error("Compilation failed unexpectedly");
+ } else
+ check(out, expectMessages);
+ } catch (IllegalArgumentException e) {
+ System.err.println(e);
+ String expectOut = expectMessages.iterator().next().text;
+ if (expectResult != Main.Result.CMDERR)
+ error("unexpected exception caught");
+ else if (!e.getMessage().equals(expectOut)) {
+ error("unexpected exception message: "
+ + e.getMessage()
+ + " expected: " + expectOut);
+ }
+ }
+ }
+
+ private void check(String out, Set<Message> expect) {
+ Pattern stats = Pattern.compile("^([1-9]+) (error|warning)(s?)");
+ Set<Message> found = EnumSet.noneOf(Message.class);
+ int e = 0, w = 0;
+ if (!out.isEmpty()) {
+ for (String line: out.split("[\r\n]+")) {
+ Matcher s = stats.matcher(line);
+ if (s.matches()) {
+ int i = Integer.valueOf(s.group(1));
+ if (s.group(2).equals("error"))
+ e++;
+ else
+ w++;
+ continue;
+ }
+
+ Message m = Message.get(line);
+ if (m == null)
+ error("Unexpected line: " + line);
+ else
+ found.add(m);
+ }
+ }
+ for (Message m: expect) {
+ if (!found.contains(m))
+ error("expected message not found: " + m.text);
+ }
+ for (Message m: found) {
+ if (!expect.contains(m))
+ error("unexpected message found: " + m.text);
+ }
+ }
+
+ void error(String msg) {
+ System.err.println("Error: " + msg);
+ errors++;
+ }
+
+ int errors;
+
+ class JFOImpl extends SimpleJavaFileObject {
+
+ private final String code;
+
+ public JFOImpl(String fileName, String code) {
+ super(URI.create(fileName), JavaFileObject.Kind.SOURCE);
+ this.code = code;
+ }
+
+ @Override
+ public CharSequence getCharContent(boolean ignoreEncoding) {
+ return code;
+ }
+ }
+}
--- a/langtools/test/tools/javac/enum/EnumSwitch2.java Thu Mar 12 13:35:17 2015 -0700
+++ b/langtools/test/tools/javac/enum/EnumSwitch2.java Thu Mar 12 21:13:42 2015 -0700
@@ -1,6 +1,6 @@
/*
* @test /nodynamiccopyright/
- * @bug 4936393
+ * @bug 4936393 8050021
* @summary enum switch case labels required to be unqualified.
* @author gafter
* @compile/fail/ref=EnumSwitch2.out -XDrawDiagnostics EnumSwitch2.java
--- a/langtools/test/tools/javac/enum/EnumSwitch2.out Thu Mar 12 13:35:17 2015 -0700
+++ b/langtools/test/tools/javac/enum/EnumSwitch2.out Thu Mar 12 21:13:42 2015 -0700
@@ -1,4 +1,3 @@
EnumSwitch2.java:14:16: compiler.err.enum.label.must.be.unqualified.enum
EnumSwitch2.java:15:16: compiler.err.enum.label.must.be.unqualified.enum
-EnumSwitch2.java:15:9: compiler.err.duplicate.case.label
-3 errors
+2 errors