--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java Thu Feb 18 11:30:21 2016 -0800
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java Thu Feb 18 13:42:59 2016 -0800
@@ -212,13 +212,6 @@
* used.Default is don't show version information.
*/
public boolean showversion = false;
-
- /**
- * Sourcepath from where to read the source files. Default is classpath.
- *
- */
- public String sourcepath = "";
-
/**
* Argument for command line option "-Xprofilespath".
*/
@@ -492,11 +485,6 @@
showversion = true;
} else if (opt.equals("-nodeprecated")) {
nodeprecated = true;
- } else if (opt.equals("-sourcepath")) {
- sourcepath = os[1];
- } else if ((opt.equals("-classpath") || opt.equals("-cp")) &&
- sourcepath.length() == 0) {
- sourcepath = os[1];
} else if (opt.equals("-excludedocfilessubdir")) {
addToSet(excludedDocFileDirs, os[1]);
} else if (opt.equals("-noqualifier")) {
@@ -541,10 +529,6 @@
extern.link(url, pkglisturl, root, true);
}
}
- if (sourcepath.length() == 0) {
- sourcepath = System.getProperty("env.class.path") == null ? "" :
- System.getProperty("env.class.path");
- }
if (docencoding == null) {
docencoding = encoding;
}
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/resources/doclets.properties Thu Feb 18 11:30:21 2016 -0800
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/resources/doclets.properties Thu Feb 18 13:42:59 2016 -0800
@@ -23,7 +23,6 @@
doclet.Copying_File_0_To_Dir_1=Copying file {0} to directory {1}...
doclet.Copying_File_0_To_File_1=Copying file {0} to file {1}...
doclet.No_Public_Classes_To_Document=No public or protected classes found to document.
-doclet.Unable_to_create_directory_0=Unable to create directory {0}
doclet.destination_directory_not_directory_0=Destination directory is not a directory {0}
doclet.destination_directory_not_writable_0=Destination directory not writable {0}
doclet.Encoding_not_supported=Encoding not supported: {0}
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/util/Extern.java Thu Feb 18 11:30:21 2016 -0800
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/util/Extern.java Thu Feb 18 13:42:59 2016 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -257,8 +257,8 @@
try {
if (file.exists() && file.canRead()) {
boolean pathIsRelative =
- !DocFile.createFileForInput(configuration, path).isAbsolute()
- && !isUrl(path);
+ !isUrl(path)
+ && !DocFile.createFileForInput(configuration, path).isAbsolute();
readPackageList(file.openInputStream(), path, pathIsRelative);
} else {
throw new Fault(configuration.getText("doclet.File_error", file.getPath()), null);
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/util/SimpleDocFileFactory.java Thu Feb 18 11:30:21 2016 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,292 +0,0 @@
-/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.doclets.internal.toolkit.util;
-
-import java.io.BufferedInputStream;
-import java.io.BufferedOutputStream;
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.io.UnsupportedEncodingException;
-import java.io.Writer;
-import java.util.ArrayList;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Set;
-
-import javax.tools.DocumentationTool;
-import javax.tools.JavaFileManager.Location;
-import javax.tools.StandardLocation;
-
-import com.sun.tools.doclets.internal.toolkit.Configuration;
-
-/**
- * Implementation of DocFileFactory that just uses java.io.File API,
- * and does not use a JavaFileManager..
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- *
- * @since 1.8
- */
-class SimpleDocFileFactory extends DocFileFactory {
-
- public SimpleDocFileFactory(Configuration configuration) {
- super(configuration);
- }
-
- public DocFile createFileForDirectory(String file) {
- return new SimpleDocFile(new File(file));
- }
-
- public DocFile createFileForInput(String file) {
- return new SimpleDocFile(new File(file));
- }
-
- public DocFile createFileForOutput(DocPath path) {
- return new SimpleDocFile(DocumentationTool.Location.DOCUMENTATION_OUTPUT, path);
- }
-
- @Override
- Iterable<DocFile> list(Location location, DocPath path) {
- if (location != StandardLocation.SOURCE_PATH)
- throw new IllegalArgumentException();
-
- Set<DocFile> files = new LinkedHashSet<>();
- for (String s : configuration.sourcepath.split(File.pathSeparator)) {
- if (s.isEmpty())
- continue;
- File f = new File(s);
- if (f.isDirectory()) {
- f = new File(f, path.getPath());
- if (f.exists())
- files.add(new SimpleDocFile(f));
- }
- }
- return files;
- }
-
- class SimpleDocFile extends DocFile {
- private File file;
-
- /** Create a DocFile for a given file. */
- private SimpleDocFile(File file) {
- super(configuration);
- this.file = file;
- }
-
- /** Create a DocFile for a given location and relative path. */
- private SimpleDocFile(Location location, DocPath path) {
- super(configuration, location, path);
- String destDirName = configuration.destDirName;
- this.file = destDirName.isEmpty() ? new File(path.getPath())
- : new File(destDirName, path.getPath());
- }
-
- /** Open an input stream for the file. */
- public InputStream openInputStream() throws FileNotFoundException {
- return new BufferedInputStream(new FileInputStream(file));
- }
-
- /**
- * Open an output stream for the file.
- * The file must have been created with a location of
- * {@link DocumentationTool.Location#DOCUMENTATION_OUTPUT} and a corresponding relative path.
- */
- public OutputStream openOutputStream() throws IOException, UnsupportedEncodingException {
- if (location != DocumentationTool.Location.DOCUMENTATION_OUTPUT)
- throw new IllegalStateException();
-
- createDirectoryForFile(file);
- return new BufferedOutputStream(new FileOutputStream(file));
- }
-
- /**
- * Open an writer for the file, using the encoding (if any) given in the
- * doclet configuration.
- * The file must have been created with a location of
- * {@link DocumentationTool.Location#DOCUMENTATION_OUTPUT} and a corresponding relative path.
- */
- public Writer openWriter() throws IOException, UnsupportedEncodingException {
- if (location != DocumentationTool.Location.DOCUMENTATION_OUTPUT)
- throw new IllegalStateException();
-
- createDirectoryForFile(file);
- FileOutputStream fos = new FileOutputStream(file);
- if (configuration.docencoding == null) {
- return new BufferedWriter(new OutputStreamWriter(fos));
- } else {
- return new BufferedWriter(new OutputStreamWriter(fos, configuration.docencoding));
- }
- }
-
- /** Return true if the file can be read. */
- public boolean canRead() {
- return file.canRead();
- }
-
- /** Return true if the file can be written. */
- public boolean canWrite() {
- return file.canRead();
- }
-
- /** Return true if the file exists. */
- public boolean exists() {
- return file.exists();
- }
-
- /** Return the base name (last component) of the file name. */
- public String getName() {
- return file.getName();
- }
-
- /** Return the file system path for this file. */
- public String getPath() {
- return file.getPath();
- }
-
- /** Return true is file has an absolute path name. */
- public boolean isAbsolute() {
- return file.isAbsolute();
- }
-
- /** Return true is file identifies a directory. */
- public boolean isDirectory() {
- return file.isDirectory();
- }
-
- /** Return true is file identifies a file. */
- public boolean isFile() {
- return file.isFile();
- }
-
- /** Return true if this file is the same as another. */
- public boolean isSameFile(DocFile other) {
- if (!(other instanceof SimpleDocFile))
- return false;
-
- try {
- return file.exists()
- && file.getCanonicalFile().equals(((SimpleDocFile)other).file.getCanonicalFile());
- } catch (IOException e) {
- return false;
- }
- }
-
- /** If the file is a directory, list its contents. */
- public Iterable<DocFile> list() {
- List<DocFile> files = new ArrayList<>();
- for (File f: file.listFiles()) {
- files.add(new SimpleDocFile(f));
- }
- return files;
- }
-
- /** Create the file as a directory, including any parent directories. */
- public boolean mkdirs() {
- return file.mkdirs();
- }
-
- /**
- * Derive a new file by resolving a relative path against this file.
- * The new file will inherit the configuration and location of this file
- * If this file has a path set, the new file will have a corresponding
- * new path.
- */
- public DocFile resolve(DocPath p) {
- return resolve(p.getPath());
- }
-
- /**
- * Derive a new file by resolving a relative path against this file.
- * The new file will inherit the configuration and location of this file
- * If this file has a path set, the new file will have a corresponding
- * new path.
- */
- public DocFile resolve(String p) {
- if (location == null && path == null) {
- return new SimpleDocFile(new File(file, p));
- } else {
- return new SimpleDocFile(location, path.resolve(p));
- }
- }
-
- /**
- * Resolve a relative file against the given output location.
- * @param locn Currently, only
- * {@link DocumentationTool.Location#DOCUMENTATION_OUTPUT} is supported.
- */
- public DocFile resolveAgainst(Location locn) {
- if (locn != DocumentationTool.Location.DOCUMENTATION_OUTPUT)
- throw new IllegalArgumentException();
- return new SimpleDocFile(
- new File(configuration.destDirName, file.getPath()));
- }
-
- /**
- * Given a path string create all the directories in the path. For example,
- * if the path string is "java/applet", the method will create directory
- * "java" and then "java/applet" if they don't exist. The file separator
- * string "/" is platform dependent system property.
- *
- * @param path Directory path string.
- */
- private void createDirectoryForFile(File file) {
- File dir = file.getParentFile();
- if (dir == null || dir.exists() || dir.mkdirs())
- return;
-
- configuration.message.error(
- "doclet.Unable_to_create_directory_0", dir.getPath());
- throw new DocletAbortException("can't create directory");
- }
-
- /** Return a string to identify the contents of this object,
- * for debugging purposes.
- */
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder();
- sb.append("DocFile[");
- if (location != null)
- sb.append("locn:").append(location).append(",");
- if (path != null)
- sb.append("path:").append(path.getPath()).append(",");
- sb.append("file:").append(file);
- sb.append("]");
- return sb.toString();
- }
-
- }
-}
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/util/StandardDocFileFactory.java Thu Feb 18 11:30:21 2016 -0800
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/util/StandardDocFileFactory.java Thu Feb 18 13:42:59 2016 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -28,13 +28,16 @@
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.BufferedWriter;
-import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.UnsupportedEncodingException;
import java.io.Writer;
+import java.nio.file.DirectoryStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashSet;
@@ -63,37 +66,37 @@
*/
class StandardDocFileFactory extends DocFileFactory {
private final StandardJavaFileManager fileManager;
- private File destDir;
+ private Path destDir;
public StandardDocFileFactory(Configuration configuration) {
super(configuration);
fileManager = (StandardJavaFileManager) configuration.getFileManager();
}
- private File getDestDir() {
+ private Path getDestDir() {
if (destDir == null) {
if (!configuration.destDirName.isEmpty()
|| !fileManager.hasLocation(DocumentationTool.Location.DOCUMENTATION_OUTPUT)) {
try {
String dirName = configuration.destDirName.isEmpty() ? "." : configuration.destDirName;
- File dir = new File(dirName);
- fileManager.setLocation(DocumentationTool.Location.DOCUMENTATION_OUTPUT, Arrays.asList(dir));
+ Path dir = Paths.get(dirName);
+ fileManager.setLocationFromPaths(DocumentationTool.Location.DOCUMENTATION_OUTPUT, Arrays.asList(dir));
} catch (IOException e) {
throw new DocletAbortException(e);
}
}
- destDir = fileManager.getLocation(DocumentationTool.Location.DOCUMENTATION_OUTPUT).iterator().next();
+ destDir = fileManager.getLocationAsPaths(DocumentationTool.Location.DOCUMENTATION_OUTPUT).iterator().next();
}
return destDir;
}
public DocFile createFileForDirectory(String file) {
- return new StandardDocFile(new File(file));
+ return new StandardDocFile(Paths.get(file));
}
public DocFile createFileForInput(String file) {
- return new StandardDocFile(new File(file));
+ return new StandardDocFile(Paths.get(file));
}
public DocFile createFileForOutput(DocPath path) {
@@ -108,26 +111,25 @@
Set<DocFile> files = new LinkedHashSet<>();
Location l = fileManager.hasLocation(StandardLocation.SOURCE_PATH)
? StandardLocation.SOURCE_PATH : StandardLocation.CLASS_PATH;
- for (File f: fileManager.getLocation(l)) {
- if (f.isDirectory()) {
- f = new File(f, path.getPath());
- if (f.exists())
+ for (Path f: fileManager.getLocationAsPaths(l)) {
+ if (Files.isDirectory(f)) {
+ f = f.resolve(path.getPath());
+ if (Files.exists(f))
files.add(new StandardDocFile(f));
}
}
return files;
}
- private static File newFile(File dir, String path) {
- return (dir == null) ? new File(path) : new File(dir, path);
+ private static Path newFile(Path dir, String path) {
+ return (dir == null) ? Paths.get(path) : dir.resolve(path);
}
class StandardDocFile extends DocFile {
- private File file;
-
+ private Path file;
/** Create a StandardDocFile for a given file. */
- private StandardDocFile(File file) {
+ private StandardDocFile(Path file) {
super(configuration);
this.file = file;
}
@@ -178,27 +180,27 @@
/** Return true if the file can be read. */
public boolean canRead() {
- return file.canRead();
+ return Files.isReadable(file);
}
/** Return true if the file can be written. */
public boolean canWrite() {
- return file.canWrite();
+ return Files.isWritable(file);
}
/** Return true if the file exists. */
public boolean exists() {
- return file.exists();
+ return Files.exists(file);
}
/** Return the base name (last component) of the file name. */
public String getName() {
- return file.getName();
+ return file.getFileName().toString();
}
/** Return the file system path for this file. */
public String getPath() {
- return file.getPath();
+ return file.toString();
}
/** Return true is file has an absolute path name. */
@@ -208,12 +210,12 @@
/** Return true is file identifies a directory. */
public boolean isDirectory() {
- return file.isDirectory();
+ return Files.isDirectory(file);
}
/** Return true is file identifies a file. */
public boolean isFile() {
- return file.isFile();
+ return Files.isRegularFile(file);
}
/** Return true if this file is the same as another. */
@@ -222,25 +224,31 @@
return false;
try {
- return file.exists()
- && file.getCanonicalFile().equals(((StandardDocFile) other).file.getCanonicalFile());
+ return Files.isSameFile(file, ((StandardDocFile) other).file);
} catch (IOException e) {
return false;
}
}
/** If the file is a directory, list its contents. */
- public Iterable<DocFile> list() {
- List<DocFile> files = new ArrayList<>();
- for (File f: file.listFiles()) {
- files.add(new StandardDocFile(f));
+ public Iterable<DocFile> list() throws IOException {
+ List<DocFile> files = new ArrayList<DocFile>();
+ try (DirectoryStream<Path> ds = Files.newDirectoryStream(file)) {
+ for (Path f: ds) {
+ files.add(new StandardDocFile(f));
+ }
}
return files;
}
/** Create the file as a directory, including any parent directories. */
public boolean mkdirs() {
- return file.mkdirs();
+ try {
+ Files.createDirectories(file);
+ return true;
+ } catch (IOException e) {
+ return false;
+ }
}
/**
@@ -261,7 +269,7 @@
*/
public DocFile resolve(String p) {
if (location == null && path == null) {
- return new StandardDocFile(new File(file, p));
+ return new StandardDocFile(file.resolve(p));
} else {
return new StandardDocFile(location, path.resolve(p));
}
@@ -270,12 +278,12 @@
/**
* Resolve a relative file against the given output location.
* @param locn Currently, only
- * {@link DocumentationTool.Location#DOCUMENTATION_OUTPUT} is supported.
+ * {@link DocumentationTool.Location.DOCUMENTATION_OUTPUT} is supported.
*/
public DocFile resolveAgainst(Location locn) {
if (locn != DocumentationTool.Location.DOCUMENTATION_OUTPUT)
throw new IllegalArgumentException();
- return new StandardDocFile(newFile(getDestDir(), file.getPath()));
+ return new StandardDocFile(getDestDir().resolve(file));
}
/** Return a string to identify the contents of this object,
@@ -284,7 +292,7 @@
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
- sb.append("StandardDocFile[");
+ sb.append("PathDocFile[");
if (location != null)
sb.append("locn:").append(location).append(",");
if (path != null)
@@ -294,7 +302,7 @@
return sb.toString();
}
- private JavaFileObject getJavaFileObjectForInput(File file) {
+ private JavaFileObject getJavaFileObjectForInput(Path file) {
return fileManager.getJavaFileObjects(file).iterator().next();
}
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractMemberWriter.java Thu Feb 18 11:30:21 2016 -0800
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractMemberWriter.java Thu Feb 18 13:42:59 2016 -0800
@@ -261,10 +261,13 @@
// According to JLS, we should not be showing public modifier for
// interface methods.
if ((utils.isField(member) || utils.isMethod(member))
- && writer instanceof ClassWriterImpl
- && utils.isInterface(((ClassWriterImpl) writer).getTypeElement())) {
+ && ((writer instanceof ClassWriterImpl
+ && utils.isInterface(((ClassWriterImpl) writer).getTypeElement()) ||
+ writer instanceof AnnotationTypeWriterImpl) )) {
// Remove the implicit abstract and public modifiers
- if (utils.isMethod(member) && utils.isInterface(member.getEnclosingElement())) {
+ if (utils.isMethod(member) &&
+ (utils.isInterface(member.getEnclosingElement()) ||
+ utils.isAnnotationType(member.getEnclosingElement()))) {
set.remove(ABSTRACT);
set.remove(PUBLIC);
}
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java Thu Feb 18 11:30:21 2016 -0800
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java Thu Feb 18 13:42:59 2016 -0800
@@ -2363,7 +2363,9 @@
if (!map.isEmpty()) {
annotation.addContent("(");
boolean isFirst = true;
- for (ExecutableElement element : map.keySet()) {
+ Set<? extends ExecutableElement> keys = map.keySet();
+ boolean multipleValues = keys.size() > 1;
+ for (ExecutableElement element : keys) {
if (isFirst) {
isFirst = false;
} else {
@@ -2376,9 +2378,12 @@
}
}
}
- annotation.addContent(getDocLink(LinkInfoImpl.Kind.ANNOTATION,
- element, element.getSimpleName().toString(), false));
- annotation.addContent("=");
+ String simpleName = element.getSimpleName().toString();
+ if (multipleValues || !"value".equals(simpleName)) { // Omit "value=" where unnecessary
+ annotation.addContent(getDocLink(LinkInfoImpl.Kind.ANNOTATION,
+ element, simpleName, false));
+ annotation.addContent("=");
+ }
AnnotationValue annotationValue = map.get(element);
List<AnnotationValue> annotationTypeValues = new ArrayList<>();
new SimpleAnnotationValueVisitor9<Void, AnnotationValue>() {
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/Configuration.java Thu Feb 18 11:30:21 2016 -0800
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/Configuration.java Thu Feb 18 13:42:59 2016 -0800
@@ -240,12 +240,6 @@
public boolean showversion = false;
/**
- * Sourcepath from where to read the source files. Default is classpath.
- *
- */
- public String sourcepath = "";
-
- /**
* Don't generate deprecated API information at all, if -nodeprecated
* option is used. <code>nodepracted</code> is set to true if
* -nodeprecated option is used. Default is generate deprected API
@@ -389,26 +383,6 @@
return true;
}
},
- new Hidden(this, "classpath", 1) {
- @Override
- public boolean process(String opt, ListIterator<String> args) {
- if (sourcepath.length() == 0) {
- optionsProcessed.add(this);
- sourcepath = args.next();
- }
- return true;
- }
- },
- new Hidden(this, "cp", 1) {
- @Override
- public boolean process(String opt, ListIterator<String> args) {
- if (sourcepath.length() == 0) {
- optionsProcessed.add(this);
- sourcepath = args.next();
- }
- return true;
- }
- },
new Option(this, "d", 1) {
@Override
public boolean process(String opt, ListIterator<String> args) {
@@ -555,14 +529,6 @@
return true;
}
},
- new Hidden(this, "sourcepath", 1) {
- @Override
- public boolean process(String opt, ListIterator<String> args) {
- optionsProcessed.add(this);
- sourcepath = args.next();
- return true;
- }
- },
new Option(this, "sourcetab", 1) {
@Override
public boolean process(String opt, ListIterator<String> args) {
@@ -638,9 +604,6 @@
extern.link(urlForLink, pkglistUrlForLink, reporter, false);
if (urlForLinkOffline != null && pkglistUrlForLinkOffline != null)
extern.link(urlForLinkOffline, pkglistUrlForLinkOffline, reporter, true);
- if (sourcepath.length() == 0) {
- sourcepath = System.getProperty("env.class.path", "");
- }
if (docencoding == null) {
docencoding = encoding;
}
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets.properties Thu Feb 18 11:30:21 2016 -0800
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets.properties Thu Feb 18 13:42:59 2016 -0800
@@ -23,7 +23,6 @@
doclet.Copying_File_0_To_Dir_1=Copying file {0} to directory {1}...
doclet.Copying_File_0_To_File_1=Copying file {0} to file {1}...
doclet.No_Public_Classes_To_Document=No public or protected classes found to document.
-doclet.Unable_to_create_directory_0=Unable to create directory {0}
doclet.destination_directory_not_directory_0=Destination directory is not a directory {0}
doclet.destination_directory_not_writable_0=Destination directory not writable {0}
doclet.Encoding_not_supported=Encoding not supported: {0}
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Extern.java Thu Feb 18 11:30:21 2016 -0800
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Extern.java Thu Feb 18 13:42:59 2016 -0800
@@ -261,8 +261,8 @@
try {
if (file.exists() && file.canRead()) {
boolean pathIsRelative =
- !DocFile.createFileForInput(configuration, path).isAbsolute()
- && !isUrl(path);
+ !isUrl(path)
+ && !DocFile.createFileForInput(configuration, path).isAbsolute();
readPackageList(file.openInputStream(), path, pathIsRelative);
} else {
throw new Fault(configuration.getText("doclet.File_error", file.getPath()), null);
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/SimpleDocFileFactory.java Thu Feb 18 11:30:21 2016 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,291 +0,0 @@
-/*
- * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package jdk.javadoc.internal.doclets.toolkit.util;
-
-import java.io.BufferedInputStream;
-import java.io.BufferedOutputStream;
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.io.UnsupportedEncodingException;
-import java.io.Writer;
-import java.util.ArrayList;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Set;
-
-import javax.tools.DocumentationTool;
-import javax.tools.JavaFileManager.Location;
-import javax.tools.StandardLocation;
-
-import jdk.javadoc.internal.doclets.toolkit.Configuration;
-
-/**
- * Implementation of DocFileFactory that just uses java.io.File API,
- * and does not use a JavaFileManager..
- *
- * <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>
- *
- */
-class SimpleDocFileFactory extends DocFileFactory {
-
- public SimpleDocFileFactory(Configuration configuration) {
- super(configuration);
- }
-
- public DocFile createFileForDirectory(String file) {
- return new SimpleDocFile(new File(file));
- }
-
- public DocFile createFileForInput(String file) {
- return new SimpleDocFile(new File(file));
- }
-
- public DocFile createFileForOutput(DocPath path) {
- return new SimpleDocFile(DocumentationTool.Location.DOCUMENTATION_OUTPUT, path);
- }
-
- @Override
- Iterable<DocFile> list(Location location, DocPath path) {
- if (location != StandardLocation.SOURCE_PATH)
- throw new IllegalArgumentException();
-
- Set<DocFile> files = new LinkedHashSet<>();
- for (String s : configuration.sourcepath.split(File.pathSeparator)) {
- if (s.isEmpty())
- continue;
- File f = new File(s);
- if (f.isDirectory()) {
- f = new File(f, path.getPath());
- if (f.exists())
- files.add(new SimpleDocFile(f));
- }
- }
- return files;
- }
-
- class SimpleDocFile extends DocFile {
- private File file;
-
- /** Create a DocFile for a given file. */
- private SimpleDocFile(File file) {
- super(configuration);
- this.file = file;
- }
-
- /** Create a DocFile for a given location and relative path. */
- private SimpleDocFile(Location location, DocPath path) {
- super(configuration, location, path);
- String destDirName = configuration.destDirName;
- this.file = destDirName.isEmpty() ? new File(path.getPath())
- : new File(destDirName, path.getPath());
- }
-
- /** Open an input stream for the file. */
- public InputStream openInputStream() throws FileNotFoundException {
- return new BufferedInputStream(new FileInputStream(file));
- }
-
- /**
- * Open an output stream for the file.
- * The file must have been created with a location of
- * {@link DocumentationTool.Location#DOCUMENTATION_OUTPUT} and a corresponding relative path.
- */
- public OutputStream openOutputStream() throws IOException, UnsupportedEncodingException {
- if (location != DocumentationTool.Location.DOCUMENTATION_OUTPUT)
- throw new IllegalStateException();
-
- createDirectoryForFile(file);
- return new BufferedOutputStream(new FileOutputStream(file));
- }
-
- /**
- * Open an writer for the file, using the encoding (if any) given in the
- * doclet configuration.
- * The file must have been created with a location of
- * {@link DocumentationTool.Location#DOCUMENTATION_OUTPUT} and a corresponding relative path.
- */
- public Writer openWriter() throws IOException, UnsupportedEncodingException {
- if (location != DocumentationTool.Location.DOCUMENTATION_OUTPUT)
- throw new IllegalStateException();
-
- createDirectoryForFile(file);
- FileOutputStream fos = new FileOutputStream(file);
- if (configuration.docencoding == null) {
- return new BufferedWriter(new OutputStreamWriter(fos));
- } else {
- return new BufferedWriter(new OutputStreamWriter(fos, configuration.docencoding));
- }
- }
-
- /** Return true if the file can be read. */
- public boolean canRead() {
- return file.canRead();
- }
-
- /** Return true if the file can be written. */
- public boolean canWrite() {
- return file.canRead();
- }
-
- /** Return true if the file exists. */
- public boolean exists() {
- return file.exists();
- }
-
- /** Return the base name (last component) of the file name. */
- public String getName() {
- return file.getName();
- }
-
- /** Return the file system path for this file. */
- public String getPath() {
- return file.getPath();
- }
-
- /** Return true is file has an absolute path name. */
- public boolean isAbsolute() {
- return file.isAbsolute();
- }
-
- /** Return true is file identifies a directory. */
- public boolean isDirectory() {
- return file.isDirectory();
- }
-
- /** Return true is file identifies a file. */
- public boolean isFile() {
- return file.isFile();
- }
-
- /** Return true if this file is the same as another. */
- public boolean isSameFile(DocFile other) {
- if (!(other instanceof SimpleDocFile))
- return false;
-
- try {
- return file.exists()
- && file.getCanonicalFile().equals(((SimpleDocFile)other).file.getCanonicalFile());
- } catch (IOException e) {
- return false;
- }
- }
-
- /** If the file is a directory, list its contents. */
- public Iterable<DocFile> list() {
- List<DocFile> files = new ArrayList<>();
- for (File f: file.listFiles()) {
- files.add(new SimpleDocFile(f));
- }
- return files;
- }
-
- /** Create the file as a directory, including any parent directories. */
- public boolean mkdirs() {
- return file.mkdirs();
- }
-
- /**
- * Derive a new file by resolving a relative path against this file.
- * The new file will inherit the configuration and location of this file
- * If this file has a path set, the new file will have a corresponding
- * new path.
- */
- public DocFile resolve(DocPath p) {
- return resolve(p.getPath());
- }
-
- /**
- * Derive a new file by resolving a relative path against this file.
- * The new file will inherit the configuration and location of this file
- * If this file has a path set, the new file will have a corresponding
- * new path.
- */
- public DocFile resolve(String p) {
- if (location == null && path == null) {
- return new SimpleDocFile(new File(file, p));
- } else {
- return new SimpleDocFile(location, path.resolve(p));
- }
- }
-
- /**
- * Resolve a relative file against the given output location.
- * @param locn Currently, only
- * {@link DocumentationTool.Location#DOCUMENTATION_OUTPUT} is supported.
- */
- public DocFile resolveAgainst(Location locn) {
- if (locn != DocumentationTool.Location.DOCUMENTATION_OUTPUT)
- throw new IllegalArgumentException();
- return new SimpleDocFile(
- new File(configuration.destDirName, file.getPath()));
- }
-
- /**
- * Given a path string create all the directories in the path. For example,
- * if the path string is "java/applet", the method will create directory
- * "java" and then "java/applet" if they don't exist. The file separator
- * string "/" is platform dependent system property.
- *
- * @param path Directory path string.
- */
- private void createDirectoryForFile(File file) {
- File dir = file.getParentFile();
- if (dir == null || dir.exists() || dir.mkdirs())
- return;
-
- configuration.message.error(
- "doclet.Unable_to_create_directory_0", dir.getPath());
- throw new DocletAbortException("can't create directory");
- }
-
- /** Return a string to identify the contents of this object,
- * for debugging purposes.
- */
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder();
- sb.append("DocFile[");
- if (location != null)
- sb.append("locn:").append(location).append(",");
- if (path != null)
- sb.append("path:").append(path.getPath()).append(",");
- sb.append("file:").append(file);
- sb.append("]");
- return sb.toString();
- }
-
- }
-}
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/StandardDocFileFactory.java Thu Feb 18 11:30:21 2016 -0800
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/StandardDocFileFactory.java Thu Feb 18 13:42:59 2016 -0800
@@ -28,13 +28,16 @@
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.BufferedWriter;
-import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.UnsupportedEncodingException;
import java.io.Writer;
+import java.nio.file.DirectoryStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashSet;
@@ -48,6 +51,7 @@
import javax.tools.StandardJavaFileManager;
import javax.tools.StandardLocation;
+import com.sun.tools.javac.util.Assert;
import jdk.javadoc.internal.doclets.toolkit.Configuration;
/**
@@ -61,37 +65,37 @@
*/
class StandardDocFileFactory extends DocFileFactory {
private final StandardJavaFileManager fileManager;
- private File destDir;
+ private Path destDir;
public StandardDocFileFactory(Configuration configuration) {
super(configuration);
fileManager = (StandardJavaFileManager) configuration.getFileManager();
}
- private File getDestDir() {
+ private Path getDestDir() {
if (destDir == null) {
if (!configuration.destDirName.isEmpty()
|| !fileManager.hasLocation(DocumentationTool.Location.DOCUMENTATION_OUTPUT)) {
try {
String dirName = configuration.destDirName.isEmpty() ? "." : configuration.destDirName;
- File dir = new File(dirName);
- fileManager.setLocation(DocumentationTool.Location.DOCUMENTATION_OUTPUT, Arrays.asList(dir));
+ Path dir = Paths.get(dirName);
+ fileManager.setLocationFromPaths(DocumentationTool.Location.DOCUMENTATION_OUTPUT, Arrays.asList(dir));
} catch (IOException e) {
throw new DocletAbortException(e);
}
}
- destDir = fileManager.getLocation(DocumentationTool.Location.DOCUMENTATION_OUTPUT).iterator().next();
+ destDir = fileManager.getLocationAsPaths(DocumentationTool.Location.DOCUMENTATION_OUTPUT).iterator().next();
}
return destDir;
}
public DocFile createFileForDirectory(String file) {
- return new StandardDocFile(new File(file));
+ return new StandardDocFile(Paths.get(file));
}
public DocFile createFileForInput(String file) {
- return new StandardDocFile(new File(file));
+ return new StandardDocFile(Paths.get(file));
}
public DocFile createFileForOutput(DocPath path) {
@@ -106,26 +110,25 @@
Set<DocFile> files = new LinkedHashSet<>();
Location l = fileManager.hasLocation(StandardLocation.SOURCE_PATH)
? StandardLocation.SOURCE_PATH : StandardLocation.CLASS_PATH;
- for (File f: fileManager.getLocation(l)) {
- if (f.isDirectory()) {
- f = new File(f, path.getPath());
- if (f.exists())
+ for (Path f: fileManager.getLocationAsPaths(l)) {
+ if (Files.isDirectory(f)) {
+ f = f.resolve(path.getPath());
+ if (Files.exists(f))
files.add(new StandardDocFile(f));
}
}
return files;
}
- private static File newFile(File dir, String path) {
- return (dir == null) ? new File(path) : new File(dir, path);
+ private static Path newFile(Path dir, String path) {
+ return (dir == null) ? Paths.get(path) : dir.resolve(path);
}
class StandardDocFile extends DocFile {
- private File file;
-
+ private Path file;
/** Create a StandardDocFile for a given file. */
- private StandardDocFile(File file) {
+ private StandardDocFile(Path file) {
super(configuration);
this.file = file;
}
@@ -133,9 +136,7 @@
/** Create a StandardDocFile for a given location and relative path. */
private StandardDocFile(Location location, DocPath path) {
super(configuration, location, path);
- if (location != DocumentationTool.Location.DOCUMENTATION_OUTPUT) {
- throw new AssertionError("invalid location output");
- }
+ Assert.check(location == DocumentationTool.Location.DOCUMENTATION_OUTPUT);
this.file = newFile(getDestDir(), path.getPath());
}
@@ -178,27 +179,27 @@
/** Return true if the file can be read. */
public boolean canRead() {
- return file.canRead();
+ return Files.isReadable(file);
}
/** Return true if the file can be written. */
public boolean canWrite() {
- return file.canWrite();
+ return Files.isWritable(file);
}
/** Return true if the file exists. */
public boolean exists() {
- return file.exists();
+ return Files.exists(file);
}
/** Return the base name (last component) of the file name. */
public String getName() {
- return file.getName();
+ return file.getFileName().toString();
}
/** Return the file system path for this file. */
public String getPath() {
- return file.getPath();
+ return file.toString();
}
/** Return true is file has an absolute path name. */
@@ -208,12 +209,12 @@
/** Return true is file identifies a directory. */
public boolean isDirectory() {
- return file.isDirectory();
+ return Files.isDirectory(file);
}
/** Return true is file identifies a file. */
public boolean isFile() {
- return file.isFile();
+ return Files.isRegularFile(file);
}
/** Return true if this file is the same as another. */
@@ -222,25 +223,31 @@
return false;
try {
- return file.exists()
- && file.getCanonicalFile().equals(((StandardDocFile) other).file.getCanonicalFile());
+ return Files.isSameFile(file, ((StandardDocFile) other).file);
} catch (IOException e) {
return false;
}
}
/** If the file is a directory, list its contents. */
- public Iterable<DocFile> list() {
- List<DocFile> files = new ArrayList<>();
- for (File f: file.listFiles()) {
- files.add(new StandardDocFile(f));
+ public Iterable<DocFile> list() throws IOException {
+ List<DocFile> files = new ArrayList<DocFile>();
+ try (DirectoryStream<Path> ds = Files.newDirectoryStream(file)) {
+ for (Path f: ds) {
+ files.add(new StandardDocFile(f));
+ }
}
return files;
}
/** Create the file as a directory, including any parent directories. */
public boolean mkdirs() {
- return file.mkdirs();
+ try {
+ Files.createDirectories(file);
+ return true;
+ } catch (IOException e) {
+ return false;
+ }
}
/**
@@ -261,7 +268,7 @@
*/
public DocFile resolve(String p) {
if (location == null && path == null) {
- return new StandardDocFile(new File(file, p));
+ return new StandardDocFile(file.resolve(p));
} else {
return new StandardDocFile(location, path.resolve(p));
}
@@ -270,12 +277,12 @@
/**
* Resolve a relative file against the given output location.
* @param locn Currently, only
- * {@link DocumentationTool.Location#DOCUMENTATION_OUTPUT} is supported.
+ * {@link DocumentationTool.Location.DOCUMENTATION_OUTPUT} is supported.
*/
public DocFile resolveAgainst(Location locn) {
if (locn != DocumentationTool.Location.DOCUMENTATION_OUTPUT)
throw new IllegalArgumentException();
- return new StandardDocFile(newFile(getDestDir(), file.getPath()));
+ return new StandardDocFile(getDestDir().resolve(file));
}
/** Return a string to identify the contents of this object,
@@ -294,7 +301,7 @@
return sb.toString();
}
- private JavaFileObject getJavaFileObjectForInput(File file) {
+ private JavaFileObject getJavaFileObjectForInput(Path file) {
return fileManager.getJavaFileObjects(file).iterator().next();
}
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java Thu Feb 18 11:30:21 2016 -0800
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java Thu Feb 18 13:42:59 2016 -0800
@@ -176,7 +176,7 @@
List<Element> excludeList = members.stream()
.filter((member) -> (!isDeprecated(member)))
.sorted(makeGeneralPurposeComparator())
- .collect(Collectors.toCollection(ArrayList::new));
+ .collect(Collectors.<Element, List<Element>>toCollection(ArrayList::new));
return excludeList;
}
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/DocEnv.java Thu Feb 18 11:30:21 2016 -0800
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/DocEnv.java Thu Feb 18 13:42:59 2016 -0800
@@ -706,21 +706,18 @@
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
- public Boolean defaultAction(Element e, Void p) {
- if (includedSet.contains(e) || shouldDocument(e)) {
- return true;
- }
- return false;
- }
-
- @Override @DefinedBy(Api.LANGUAGE_MODEL)
public Boolean visitPackage(PackageElement e, Void p) {
return includedSet.contains(e);
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
public Boolean visitUnknown(Element e, Void p) {
- throw new AssertionError("got element: " + e);
+ throw new AssertionError("unknown element: " + e);
+ }
+
+ @Override @DefinedBy(Api.LANGUAGE_MODEL)
+ public Boolean defaultAction(Element e, Void p) {
+ return visit(e.getEnclosingElement()) && shouldDocument(e);
}
};
}
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/RootDocImpl.java Thu Feb 18 11:30:21 2016 -0800
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/RootDocImpl.java Thu Feb 18 13:42:59 2016 -0800
@@ -272,7 +272,7 @@
public List<Element> getSelectedElements(List<? extends Element> elements) {
return elements.stream()
.filter(e -> isIncluded(e))
- .collect(Collectors.toList());
+ .collect(Collectors.<Element>toList());
}
@Override
--- a/langtools/test/jdk/javadoc/doclet/testAnnotationTypes/TestAnnotationTypes.java Thu Feb 18 11:30:21 2016 -0800
+++ b/langtools/test/jdk/javadoc/doclet/testAnnotationTypes/TestAnnotationTypes.java Thu Feb 18 13:42:59 2016 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 4973609 8015249 8025633 8026567
+ * @bug 4973609 8015249 8025633 8026567 6469561
* @summary Make sure that annotation types with 0 members does not have
* extra HR tags.
* @author jamieh
@@ -61,7 +61,7 @@
+ "</code> </td>",
"<!-- ============ ANNOTATION TYPE FIELD DETAIL =========== -->",
"<h4>DEFAULT_NAME</h4>\n"
- + "<pre>public static final java."
+ + "<pre>static final java."
+ "lang.String DEFAULT_NAME</pre>");
checkOutput("pkg/AnnotationType.html", true,
@@ -70,6 +70,21 @@
"<li>Detail: </li>\n"
+ "<li>Field | </li>");
+ checkOutput("pkg/AnnotationType.html", true,
+ "<!-- ============ ANNOTATION TYPE MEMBER DETAIL =========== -->",
+ "<ul class=\"blockList\">",
+ "<li class=\"blockList\"><a name=\"annotation.type.element.detail\">",
+ "<!-- -->",
+ "</a>",
+ "<h3>Element Detail</h3>",
+ "<a name=\"value--\">",
+ "<!-- -->",
+ "</a>",
+ "<ul class=\"blockListLast\">",
+ "<li class=\"blockList\">",
+ "<h4>value</h4>",
+ "<pre>int value</pre>" );
+
checkOutput("pkg/AnnotationType.html", false,
"<HR>\n\n"
+ "<P>\n\n"
--- a/langtools/test/jdk/javadoc/doclet/testAnnotationTypes/pkg/AnnotationType.java Thu Feb 18 11:30:21 2016 -0800
+++ b/langtools/test/jdk/javadoc/doclet/testAnnotationTypes/pkg/AnnotationType.java Thu Feb 18 13:42:59 2016 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -32,5 +32,5 @@
* @since 1.5
*/
@Documented public @interface AnnotationType {
-
+ int value();
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/jdk/javadoc/doclet/testIncluded/TestIncluded.java Thu Feb 18 13:42:59 2016 -0800
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8149468
+ * @summary Verify that non included classes are not inspected.
+ * @library ../lib
+ * @modules jdk.javadoc/jdk.javadoc.internal.tool
+ * @build JavadocTester
+ * @run main TestIncluded
+ */
+
+public class TestIncluded extends JavadocTester {
+
+ public static void main(String... args) throws Exception {
+ TestIncluded tester = new TestIncluded();
+ tester.runTests();
+ }
+
+ /*
+ * The arguments specify only "pkg" but "parent" sources are on the path.
+ * The class parent.A utilizes a non existent taglet, that will trigger
+ * an error, if doc comments are inspected.
+ */
+ @Test
+ void test() {
+ javadoc("-d", "out",
+ "-Xdoclint:all",
+ "-sourcepath", testSrc,
+ "pkg");
+ checkExit(Exit.OK);
+ checkFiles(false, "parent/A.html");
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/jdk/javadoc/doclet/testIncluded/parent/A.java Thu Feb 18 13:42:59 2016 -0800
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package parent;
+public class A {
+ /**
+ * Does nothing. Uses an non existent taglet {@enoexist no errors please}.
+ */
+ public void method(){}
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/jdk/javadoc/doclet/testIncluded/pkg/B.java Thu Feb 18 13:42:59 2016 -0800
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package pkg;
+
+/**
+ * Just a lonesome class.
+ */
+public class B extends parent.A {
+ /**
+ * The main method.
+ * @param args the aaaaargs
+ */
+ public static void main(String... args) {}
+}
--- a/langtools/test/jdk/javadoc/doclet/testRepeatedAnnotations/TestRepeatedAnnotations.java Thu Feb 18 11:30:21 2016 -0800
+++ b/langtools/test/jdk/javadoc/doclet/testRepeatedAnnotations/TestRepeatedAnnotations.java Thu Feb 18 13:42:59 2016 -0800
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 8005092
+ * @bug 8005092 6469562
* @summary Test repeated annotations output.
* @author bpatel
* @library ../lib
@@ -57,7 +57,7 @@
+ "title=\"annotation in pkg\">@ContaineeRegDoc</a>",
"<a href=\"../pkg/RegContainerDoc.html\" "
+ "title=\"annotation in pkg\">@RegContainerDoc</a>"
- + "(<a href=\"../pkg/RegContainerDoc.html#value--\">value</a>={"
+ + "({"
+ "<a href=\"../pkg/RegContaineeNotDoc.html\" "
+ "title=\"annotation in pkg\">@RegContaineeNotDoc</a>,"
+ "<a href=\"../pkg/RegContaineeNotDoc.html\" "
@@ -70,7 +70,7 @@
+ "title=\"annotation in pkg\">@ContaineeSynthDoc</a>",
"<a href=\"../pkg/ContainerSynthDoc.html\" "
+ "title=\"annotation in pkg\">@ContainerSynthDoc</a>("
- + "<a href=\"../pkg/ContainerSynthDoc.html#value--\">value</a>="
+ + ""
+ "<a href=\"../pkg/ContaineeSynthDoc.html\" "
+ "title=\"annotation in pkg\">@ContaineeSynthDoc</a>)",
"<a href=\"../pkg/ContaineeSynthDoc.html\" "
@@ -87,7 +87,7 @@
+ "(<a href=\"../pkg/RegArryDoc.html#y--\">y</a>={1,2})",
"<a href=\"../pkg/NonSynthDocContainer.html\" "
+ "title=\"annotation in pkg\">@NonSynthDocContainer</a>"
- + "(<a href=\"../pkg/NonSynthDocContainer.html#value--\">value</a>="
+ + "("
+ "<a href=\"../pkg/RegArryDoc.html\" title=\"annotation in pkg\">@RegArryDoc</a>)");
checkOutput("pkg1/C.html", true,
--- a/langtools/test/jdk/javadoc/doclet/testRepeatedAnnotations/pkg/C.java Thu Feb 18 11:30:21 2016 -0800
+++ b/langtools/test/jdk/javadoc/doclet/testRepeatedAnnotations/pkg/C.java Thu Feb 18 13:42:59 2016 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -23,15 +23,15 @@
package pkg;
-@ContainerSynthDoc(value={@ContaineeSynthDoc,@ContaineeSynthDoc})
-@ContainerRegDoc(value={@ContaineeRegDoc,@ContaineeRegDoc})
-@RegContainerDoc(value={@RegContaineeNotDoc,@RegContaineeNotDoc})
-@ContainerRegNotDoc(value={@RegContaineeDoc,@RegContaineeDoc})
-@RegContainerNotDoc(value={@RegContaineeNotDoc,@RegContaineeNotDoc})
+@ContainerSynthDoc({@ContaineeSynthDoc,@ContaineeSynthDoc})
+@ContainerRegDoc({@ContaineeRegDoc,@ContaineeRegDoc})
+@RegContainerDoc({@RegContaineeNotDoc,@RegContaineeNotDoc})
+@ContainerRegNotDoc({@RegContaineeDoc,@RegContaineeDoc})
+@RegContainerNotDoc({@RegContaineeNotDoc,@RegContaineeNotDoc})
@ContaineeSynthDoc @ContaineeSynthDoc @ContaineeSynthDoc
public class C {
- @ContainerSynthDoc(value={@ContaineeSynthDoc})
+ @ContainerSynthDoc({@ContaineeSynthDoc})
public void test1() {}
@ContaineeSynthDoc @ContaineeSynthDoc
--- a/langtools/test/jdk/javadoc/doclet/testRepeatedAnnotations/pkg/D.java Thu Feb 18 11:30:21 2016 -0800
+++ b/langtools/test/jdk/javadoc/doclet/testRepeatedAnnotations/pkg/D.java Thu Feb 18 13:42:59 2016 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -32,6 +32,6 @@
@RegArryDoc(y={1,2})
public void test2() {}
- @NonSynthDocContainer(value={@RegArryDoc})
+ @NonSynthDocContainer({@RegArryDoc})
public void test3() {}
}
--- a/langtools/test/jdk/javadoc/doclet/testTypeAnnotations/TestTypeAnnotations.java Thu Feb 18 11:30:21 2016 -0800
+++ b/langtools/test/jdk/javadoc/doclet/testTypeAnnotations/TestTypeAnnotations.java Thu Feb 18 13:42:59 2016 -0800
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 8005091 8009686 8025633 8026567
+ * @bug 8005091 8009686 8025633 8026567 6469562
* @summary Make sure that type annotations are displayed correctly
* @author Bhavesh Patel
* @library ../lib
@@ -260,13 +260,13 @@
checkOutput("typeannos/ThrWithValue.html", true,
"<pre>void oneException()\n"
+ " throws <a href=\"../typeannos/ThrB.html\" title=\""
- + "annotation in typeannos\">@ThrB</a>(<a href=\"../typeannos/"
- + "ThrB.html#value--\">value</a>=\"m\") java.lang.Exception</pre>",
+ + "annotation in typeannos\">@ThrB</a>("
+ + "\"m\") java.lang.Exception</pre>",
"<pre>void twoExceptions()\n"
+ " throws <a href=\"../typeannos/ThrB.html\" title=\""
- + "annotation in typeannos\">@ThrB</a>(<a href=\"../typeannos/"
- + "ThrB.html#value--\">value</a>=\"m\") java.lang.RuntimeException,\n"
+ + "annotation in typeannos\">@ThrB</a>("
+ + "\"m\") java.lang.RuntimeException,\n"
+ " <a href=\"../typeannos/ThrA.html\" title=\""
+ "annotation in typeannos\">@ThrA</a> java.lang.Exception</pre>");
@@ -293,14 +293,14 @@
checkOutput("typeannos/BoundWithValue.html", true,
"<pre>void wcSuper(<a href=\"../typeannos/MyList.html\" title=\""
+ "class in typeannos\">MyList</a><? super <a href=\"../typeannos/"
- + "WldB.html\" title=\"annotation in typeannos\">@WldB</a>(<a href=\""
- + "../typeannos/WldB.html#value--\">value</a>=\"m\") java.lang."
+ + "WldB.html\" title=\"annotation in typeannos\">@WldB</a>("
+ + "\"m\") java.lang."
+ "String> l)</pre>",
"<pre><a href=\"../typeannos/MyList.html\" title=\"class in "
+ "typeannos\">MyList</a><? extends <a href=\"../typeannos/WldB."
- + "html\" title=\"annotation in typeannos\">@WldB</a>(<a href=\"../"
- + "typeannos/WldB.html#value--\">value</a>=\"m\") java.lang.String"
+ + "html\" title=\"annotation in typeannos\">@WldB</a>("
+ + "\"m\") java.lang.String"
+ "> returnWcExtends()</pre>");
// Test for receiver annotations (Receivers.java).
@@ -314,7 +314,7 @@
"<pre>java.lang.String nonVoid(<a href=\"../typeannos/RcvrA."
+ "html\" title=\"annotation in typeannos\">@RcvrA</a> <a href=\"../"
+ "typeannos/RcvrB.html\" title=\"annotation in typeannos\">@RcvrB"
- + "</a>(<a href=\"../typeannos/RcvrB.html#value--\">value</a>=\"m\")"
+ + "</a>(\"m\")"
+ " DefaultUnmodified this)</pre>",
"<pre><T extends java.lang.Runnable> void accept("
@@ -337,15 +337,15 @@
checkOutput("typeannos/WithValue.html", true,
"<pre><T extends java.lang.Runnable> void accept("
+ "<a href=\"../typeannos/RcvrB.html\" title=\"annotation in "
- + "typeannos\">@RcvrB</a>(<a href=\"../typeannos/RcvrB.html#value--\">"
- + "value</a>=\"m\") WithValue this,\n"
+ + "typeannos\">@RcvrB</a>("
+ + "\"m\") WithValue this,\n"
+ " T r)\n"
+ " throws java.lang.Exception</pre>");
checkOutput("typeannos/WithFinal.html", true,
"<pre>java.lang.String nonVoid(<a href=\"../typeannos/RcvrB."
- + "html\" title=\"annotation in typeannos\">@RcvrB</a>(<a href=\"../"
- + "typeannos/RcvrB.html#value--\">value</a>=\"m\") WithFinal"
+ + "html\" title=\"annotation in typeannos\">@RcvrB</a>("
+ + "\"m\") WithFinal"
+ " this)</pre>");
checkOutput("typeannos/WithBody.html", true,
--- a/langtools/test/jdk/javadoc/doclet/testTypeAnnotations/typeannos/Throws.java Thu Feb 18 11:30:21 2016 -0800
+++ b/langtools/test/jdk/javadoc/doclet/testTypeAnnotations/typeannos/Throws.java Thu Feb 18 13:42:59 2016 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -40,7 +40,7 @@
class ThrWithValue {
void oneException() throws @ThrB("m") Exception {}
- void twoExceptions() throws @ThrB(value="m") RuntimeException, @ThrA Exception {}
+ void twoExceptions() throws @ThrB("m") RuntimeException, @ThrA Exception {}
}
@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
--- a/langtools/test/jdk/javadoc/doclet/testTypeAnnotations/typeannos/Wildcards.java Thu Feb 18 11:30:21 2016 -0800
+++ b/langtools/test/jdk/javadoc/doclet/testTypeAnnotations/typeannos/Wildcards.java Thu Feb 18 13:42:59 2016 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -39,10 +39,10 @@
class BoundWithValue {
void wcExtends(MyList<? extends @WldB("m") String> l) { }
- void wcSuper(MyList<? super @WldB(value="m") String> l) { }
+ void wcSuper(MyList<? super @WldB("m") String> l) { }
MyList<? extends @WldB("m") String> returnWcExtends() { return null; }
- MyList<? super @WldB(value="m") String> returnWcSuper() { return null; }
+ MyList<? super @WldB("m") String> returnWcSuper() { return null; }
MyList<? extends @WldB("m") MyList<? super @WldB("m") String>> complex() { return null; }
}
@@ -57,10 +57,10 @@
class SelfWithValue {
void wcExtends(MyList<@WldB("m") ?> l) { }
- void wcSuper(MyList<@WldB(value="m") ?> l) { }
+ void wcSuper(MyList<@WldB("m") ?> l) { }
MyList<@WldB("m") ?> returnWcExtends() { return null; }
- MyList<@WldB(value="m") ?> returnWcSuper() { return null; }
+ MyList<@WldB("m") ?> returnWcSuper() { return null; }
MyList<@WldB("m") ? extends MyList<@WldB("m") ? super String>> complex() { return null; }
}
--- a/langtools/test/tools/javac/TestIndyStringConcat.java Thu Feb 18 11:30:21 2016 -0800
+++ b/langtools/test/tools/javac/TestIndyStringConcat.java Thu Feb 18 13:42:59 2016 -0800
@@ -60,7 +60,7 @@
boolean indifiedStringConcat = false;
ex.printStackTrace();
for (StackTraceElement e : ex.getStackTrace()) {
- if (e.getClassName().startsWith("java.lang.String$Concat") &&
+ if (e.getClassName().contains("$$StringConcat") &&
e.getMethodName().equals("concat")) {
indifiedStringConcat = true;
break;