--- a/langtools/src/java.compiler/share/classes/javax/lang/model/element/ModuleElement.java Thu Apr 27 16:07:59 2017 +0000
+++ b/langtools/src/java.compiler/share/classes/javax/lang/model/element/ModuleElement.java Thu Apr 27 21:16:07 2017 +0000
@@ -154,7 +154,7 @@
* pattern. Classes implementing this interface are used to operate
* on a directive when the kind of directive is unknown at compile time.
* When a visitor is passed to a directive's {@link Directive#accept
- * accept} method, the <tt>visit<i>Xyz</i></tt> method applicable
+ * accept} method, the <code>visit<i>Xyz</i></code> method applicable
* to that directive is invoked.
*
* <p> Classes implementing this interface may or may not throw a
--- a/langtools/src/java.compiler/share/classes/javax/tools/JavaFileManager.java Thu Apr 27 16:07:59 2017 +0000
+++ b/langtools/src/java.compiler/share/classes/javax/tools/JavaFileManager.java Thu Apr 27 21:16:07 2017 +0000
@@ -70,7 +70,7 @@
* java.io.File#getCanonicalFile} or similar means. If the system is
* not case-aware, file objects must use other means to preserve case.
*
- * <p><em><a name="relative_name">Relative names</a>:</em> some
+ * <p><em><a id="relative_name">Relative names</a>:</em> some
* methods in this interface use relative names. A relative name is a
* non-null, non-empty sequence of path segments separated by '/'.
* '.' or '..' are invalid path segments. A valid relative name must
--- a/langtools/src/jdk.compiler/share/classes/com/sun/source/doctree/DocTreeVisitor.java Thu Apr 27 16:07:59 2017 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/source/doctree/DocTreeVisitor.java Thu Apr 27 21:16:07 2017 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -31,7 +31,7 @@
* Classes implementing this interface are used to operate
* on a tree when the kind of tree is unknown at compile time.
* When a visitor is passed to an tree's {@link DocTree#accept
- * accept} method, the <tt>visit<i>XYZ</i></tt> method most applicable
+ * accept} method, the <code>visit<i>Xyz</i></code> method most applicable
* to that tree is invoked.
*
* <p> Classes implementing this interface may or may not throw a
--- a/langtools/src/jdk.compiler/share/classes/com/sun/source/tree/LambdaExpressionTree.java Thu Apr 27 16:07:59 2017 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/source/tree/LambdaExpressionTree.java Thu Apr 27 21:16:07 2017 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -41,7 +41,7 @@
/**
* Lambda expressions come in two forms:
- * <ul compact>
+ * <ul>
* <li> expression lambdas, whose body is an expression, and
* <li> statement lambdas, whose body is a block
* </ul>
--- a/langtools/src/jdk.compiler/share/classes/com/sun/source/tree/TreeVisitor.java Thu Apr 27 16:07:59 2017 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/source/tree/TreeVisitor.java Thu Apr 27 21:16:07 2017 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -30,7 +30,7 @@
* Classes implementing this interface are used to operate
* on a tree when the kind of tree is unknown at compile time.
* When a visitor is passed to an tree's {@link Tree#accept
- * accept} method, the <tt>visit<i>XYZ</i></tt> method most applicable
+ * accept} method, the <code>visit<i>Xyz</i></code> method most applicable
* to that tree is invoked.
*
* <p> Classes implementing this interface may or may not throw a
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/javadoc/FieldDoc.java Thu Apr 27 16:07:59 2017 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/javadoc/FieldDoc.java Thu Apr 27 21:16:07 2017 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -65,7 +65,7 @@
/**
* Return the serialField tags in this FieldDoc item.
*
- * @return an array of <tt>SerialFieldTag</tt> objects containing
+ * @return an array of {@code SerialFieldTag} objects containing
* all {@code @serialField} tags.
*/
SerialFieldTag[] serialFieldTags();
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/javadoc/MethodDoc.java Thu Apr 27 16:07:59 2017 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/javadoc/MethodDoc.java Thu Apr 27 21:16:07 2017 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -102,7 +102,7 @@
* also said to <i>implement</i> the other.
*
* @param meth the other method to examine
- * @return <tt>true</tt> if this method overrides the other
+ * @return {@code true} if this method overrides the other
* @since 1.5
*/
boolean overrides(MethodDoc meth);
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/javadoc/Tag.java Thu Apr 27 16:07:59 2017 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/javadoc/Tag.java Thu Apr 27 21:16:07 2017 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -78,7 +78,8 @@
* the following table lists those cases where there is more
* than one tag of a given kind:
*
- * <table border="1" cellpadding="4" cellspacing="0" summary="related tags">
+ * <table border="1">
+ * <caption>Related Tags</caption>
* <tr><th>{@code kind() }</th> <th>{@code name() }</th></tr>
* <tr><td>{@code @throws }</td> <td>{@code @throws }</td></tr>
* <tr><td>{@code @throws }</td> <td>{@code @exception }</td></tr>
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/javadoc/package-info.java Thu Apr 27 16:07:59 2017 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/javadoc/package-info.java Thu Apr 27 21:16:07 2017 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -52,10 +52,10 @@
information can be extracted.
<p>
-<a name="terminology"></a>
+<a id="terminology"></a>
<h3>Terminology</h3>
-<a name="included"></a>
+<a id="included"></a>
When calling javadoc, you pass in package names and source file names --
these are called the <em>specified</em> packages and classes.
You also pass in Javadoc options; the <em>access control</em> Javadoc options
@@ -66,7 +66,7 @@
{@link com.sun.javadoc.PackageDoc#allClasses(boolean) allClasses(false)}.)
<p>
-<a name="class"></a>
+<a id="class"></a>
Throughout this API, the term <em>class</em> is normally a
shorthand for "class or interface", as in: {@link com.sun.javadoc.ClassDoc},
{@link com.sun.javadoc.PackageDoc#allClasses() allClasses()}, and
@@ -82,13 +82,13 @@
describes explicitly which meaning is being used.
<p>
-<a name="qualified"></a>
+<a id="qualified"></a>
A <em>qualified</em> class or interface name is one that has its package
name prepended to it, such as {@code java.lang.String}. A non-qualified
name has no package name, such as {@code String}.
<p>
-<a name="example"></a>
+<a id="example"></a>
<h3>Example</h3>
The following is an example doclet that
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/doclet/package-info.java Thu Apr 27 16:07:59 2017 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/doclet/package-info.java Thu Apr 27 21:16:07 2017 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -61,24 +61,24 @@
* described by {@link javax.lang.model Language Model API} to query Elements and Types.
* <p>
*
- * <a name="terminology"></a>
+ * <a id="terminology"></a>
* <h3>Terminology</h3>
*
* <dl>
- * <dt><a name="selected"></a>Selected</dt>
+ * <dt><a id="selected"></a>Selected</dt>
* <dd>An element is considered to be <em>selected</em>, if the
* <em>selection controls</em> <a href="#options">allow</a> it
* to be documented. (Note that synthetic elements are never
* selected.)
* </dd>
*
- * <dt><a name="specified"></a>Specified</dt>
+ * <dt><a id="specified"></a>Specified</dt>
* <dd>The set of elements specified by the user are considered to be <em>specified
* elements</em>. Specified elements provide the starting points
* for determining the <em>included elements</em> to be documented.
* </dd>
*
- * <dt><a name="included"></a>Included</dt>
+ * <dt><a id="included"></a>Included</dt>
* <dd>An element is considered to be <em>included</em>, if it is
* <em>specified</em> if it contains a <em>specified</em> element,
* or it is enclosed in a <em>specified</em> element, and is <em>selected</em>.
@@ -87,7 +87,7 @@
*
* </dl>
* <p>
- * <a name="options"></a>
+ * <a id="options"></a>
* <h3>Options</h3>
* Javadoc <em>selection control</em> can be specified with these options
* as follows:
@@ -131,7 +131,7 @@
* <li>{@code sourcefilenames} can be used to specify source file names.
* </ul>
* <p>
- * <a name="legacy-interactions"></a>
+ * <a id="legacy-interactions"></a>
* <h4>Interactions with older options.</h4>
*
* The new {@code --show-*} options provide a more detailed replacement
@@ -148,13 +148,13 @@
<tr><td>{@code -private}<td>private<td>private<td>all<td>all
</table>
* <p>
- * <a name="qualified"></a>
+ * <a id="qualified"></a>
* A <em>qualified</em> element name is one that has its package
* name prepended to it, such as {@code java.lang.String}. A non-qualified
* name has no package name, such as {@code String}.
* <p>
*
- * <a name="example"></a>
+ * <a id="example"></a>
* <h3>Example</h3>
*
* The following is an example doclet that displays information of a class
@@ -274,7 +274,7 @@
* source-location/Example.java
* </pre>
*
- * <h3><a name="migration">Migration Guide</a></h3>
+ * <h3><a id="migration">Migration Guide</a></h3>
*
* <p>Many of the types in the old {@code com.sun.javadoc} API do not have equivalents in this
* package. Instead, types in the {@code javax.lang.model} and {@code com.sun.source} APIs
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractPackageIndexWriter.java Thu Apr 27 16:07:59 2017 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractPackageIndexWriter.java Thu Apr 27 21:16:07 2017 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -160,7 +160,7 @@
htmlTree.addStyle(HtmlStyle.indexNav);
HtmlTree ul = new HtmlTree(HtmlTag.UL);
addAllClassesLink(ul);
- if (configuration.showModules) {
+ if (configuration.showModules && configuration.modules.size() > 1) {
addAllModulesLink(ul);
}
htmlTree.addContent(ul);
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDoclet.java Thu Apr 27 16:07:59 2017 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDoclet.java Thu Apr 27 21:16:07 2017 +0000
@@ -271,14 +271,14 @@
@Override // defined by AbstractDoclet
protected void generateModuleFiles() throws DocletException {
if (configuration.showModules) {
- if (configuration.frames) {
+ if (configuration.frames && configuration.modules.size() > 1) {
ModuleIndexFrameWriter.generate(configuration);
}
ModuleElement prevModule = null, nextModule;
List<ModuleElement> mdles = new ArrayList<>(configuration.modulePackages.keySet());
int i = 0;
for (ModuleElement mdle : mdles) {
- if (configuration.frames) {
+ if (configuration.frames && configuration.modules.size() > 1) {
ModulePackageIndexFrameWriter.generate(configuration, mdle);
ModuleFrameWriter.generate(configuration, mdle);
}
--- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/scan/Scan.java Thu Apr 27 16:07:59 2017 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/scan/Scan.java Thu Apr 27 21:16:07 2017 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -34,7 +34,9 @@
import java.util.ArrayDeque;
import java.util.Deque;
import java.util.Enumeration;
+import java.util.HashSet;
import java.util.List;
+import java.util.Set;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import java.util.regex.Matcher;
@@ -63,6 +65,7 @@
final boolean verbose;
final ClassFinder finder;
+ final Set<String> classesNotFound = new HashSet<>();
boolean errorOccurred = false;
public Scan(PrintStream out,
@@ -97,21 +100,70 @@
finder = f;
}
- Pattern typePattern = Pattern.compile("\\[*L(.*);");
-
- // "flattens" an array type name to its component type
- // and a reference type "Lpkg/pkg/pkg/name;" to its base name
- // "pkg/pkg/pkg/name".
- // TODO: deal with primitive types
- String flatten(String typeName) {
- Matcher matcher = typePattern.matcher(typeName);
+ /**
+ * Given a descriptor type, extracts and returns the class name from it, if any.
+ * These types are obtained from field descriptors (JVMS 4.3.2) and method
+ * descriptors (JVMS 4.3.3). They have one of the following forms:
+ *
+ * I // or any other primitive, or V for void
+ * [I // array of primitives, including multi-dimensional
+ * Lname; // the named class
+ * [Lname; // array whose component is the named class (also multi-d)
+ *
+ * This method extracts and returns the class name, or returns empty for primitives, void,
+ * or array of primitives.
+ *
+ * Returns nullable reference instead of Optional because downstream
+ * processing can throw checked exceptions.
+ *
+ * @param descType the type from a descriptor
+ * @return the extracted class name, or null
+ */
+ String nameFromDescType(String descType) {
+ Matcher matcher = descTypePattern.matcher(descType);
if (matcher.matches()) {
return matcher.group(1);
} else {
- return typeName;
+ return null;
}
}
+ Pattern descTypePattern = Pattern.compile("\\[*L(.*);");
+
+ /**
+ * Given a ref type name, extracts and returns the class name from it, if any.
+ * Ref type names are obtained from a Class_info structure (JVMS 4.4.1) and from
+ * Fieldref_info, Methodref_info, and InterfaceMethodref_info structures (JVMS 4.4.2).
+ * They represent named classes or array classes mentioned by name, and they
+ * represent class or interface types that have the referenced field or method
+ * as a member. They have one of the following forms:
+ *
+ * [I // array of primitives, including multi-dimensional
+ * name // the named class
+ * [Lname; // array whose component is the named class (also multi-d)
+ *
+ * Notably, a plain class name doesn't have the L prefix and ; suffix, and
+ * primitives and void do not occur.
+ *
+ * Returns nullable reference instead of Optional because downstream
+ * processing can throw checked exceptions.
+ *
+ * @param refType a reference type name
+ * @return the extracted class name, or null
+ */
+ String nameFromRefType(String refType) {
+ Matcher matcher = refTypePattern.matcher(refType);
+ if (matcher.matches()) {
+ return matcher.group(1);
+ } else if (refType.startsWith("[")) {
+ return null;
+ } else {
+ return refType;
+ }
+ }
+
+ Pattern refTypePattern = Pattern.compile("\\[+L(.*);");
+
String typeKind(ClassFile cf) {
AccessFlags flags = cf.access_flags;
if (flags.is(ACC_ENUM)) {
@@ -180,7 +232,10 @@
void errorNoClass(String className) {
errorOccurred = true;
- err.println(Messages.get("scan.err.noclass", className));
+ if (classesNotFound.add(className)) {
+ // print message only first time the class can't be found
+ err.println(Messages.get("scan.err.noclass", className));
+ }
}
void errorNoFile(String fileName) {
@@ -381,10 +436,12 @@
*/
void checkClasses(ClassFile cf, CPEntries entries) throws ConstantPoolException {
for (ConstantPool.CONSTANT_Class_info ci : entries.classes) {
- String className = ci.getName();
- DeprData dd = db.getTypeDeprecated(flatten(className));
- if (dd != null) {
- printType("scan.out.usesclass", cf, className, dd.isForRemoval());
+ String name = nameFromRefType(ci.getName());
+ if (name != null) {
+ DeprData dd = db.getTypeDeprecated(name);
+ if (dd != null) {
+ printType("scan.out.usesclass", cf, name, dd.isForRemoval());
+ }
}
}
}
@@ -393,8 +450,8 @@
* Checks methods referred to from the constant pool.
*
* @param cf the ClassFile of this class
+ * @param clname the class name
* @param nti the NameAndType_info from a MethodRef or InterfaceMethodRef entry
- * @param clname the class name
* @param msgKey message key for localization
* @throws ConstantPoolException if a constant pool entry cannot be found
*/
@@ -404,10 +461,13 @@
String msgKey) throws ConstantPoolException {
String name = nti.getName();
String type = nti.getType();
- clname = resolveMember(cf, flatten(clname), name, type, true, true);
- DeprData dd = db.getMethodDeprecated(clname, name, type);
- if (dd != null) {
- printMethod(msgKey, cf, clname, name, type, dd.isForRemoval());
+ clname = nameFromRefType(clname);
+ if (clname != null) {
+ clname = resolveMember(cf, clname, name, type, true, true);
+ DeprData dd = db.getMethodDeprecated(clname, name, type);
+ if (dd != null) {
+ printMethod(msgKey, cf, clname, name, type, dd.isForRemoval());
+ }
}
}
@@ -419,15 +479,17 @@
*/
void checkFieldRef(ClassFile cf,
ConstantPool.CONSTANT_Fieldref_info fri) throws ConstantPoolException {
- String clname = fri.getClassName();
+ String clname = nameFromRefType(fri.getClassName());
CONSTANT_NameAndType_info nti = fri.getNameAndTypeInfo();
String name = nti.getName();
String type = nti.getType();
- clname = resolveMember(cf, flatten(clname), name, type, false, true);
- DeprData dd = db.getFieldDeprecated(clname, name);
- if (dd != null) {
- printField("scan.out.usesfield", cf, clname, name, dd.isForRemoval());
+ if (clname != null) {
+ clname = resolveMember(cf, clname, name, type, false, true);
+ DeprData dd = db.getFieldDeprecated(clname, name);
+ if (dd != null) {
+ printField("scan.out.usesfield", cf, clname, name, dd.isForRemoval());
+ }
}
}
@@ -439,10 +501,12 @@
*/
void checkFields(ClassFile cf) throws ConstantPoolException {
for (Field f : cf.fields) {
- String type = cf.constant_pool.getUTF8Value(f.descriptor.index);
- DeprData dd = db.getTypeDeprecated(flatten(type));
- if (dd != null) {
- printHasField(cf, f.getName(cf.constant_pool), type, dd.isForRemoval());
+ String type = nameFromDescType(cf.constant_pool.getUTF8Value(f.descriptor.index));
+ if (type != null) {
+ DeprData dd = db.getTypeDeprecated(type);
+ if (dd != null) {
+ printHasField(cf, f.getName(cf.constant_pool), type, dd.isForRemoval());
+ }
}
}
}
@@ -461,16 +525,21 @@
DeprData dd;
for (String parm : sig.getParameters()) {
- dd = db.getTypeDeprecated(flatten(parm));
- if (dd != null) {
- printHasMethodParmType(cf, mname, parm, dd.isForRemoval());
+ parm = nameFromDescType(parm);
+ if (parm != null) {
+ dd = db.getTypeDeprecated(parm);
+ if (dd != null) {
+ printHasMethodParmType(cf, mname, parm, dd.isForRemoval());
+ }
}
}
- String ret = sig.getReturnType();
- dd = db.getTypeDeprecated(flatten(ret));
- if (dd != null) {
- printHasMethodRetType(cf, mname, ret, dd.isForRemoval());
+ String ret = nameFromDescType(sig.getReturnType());
+ if (ret != null) {
+ dd = db.getTypeDeprecated(ret);
+ if (dd != null) {
+ printHasMethodRetType(cf, mname, ret, dd.isForRemoval());
+ }
}
// check overrides
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/JdiExecutionControlProvider.java Thu Apr 27 16:07:59 2017 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/JdiExecutionControlProvider.java Thu Apr 27 21:16:07 2017 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -90,7 +90,8 @@
* {@code ExecutionControlProvider}. The map can optionally be modified;
* Modified or unmodified it can be passed to
* {@link #generate(jdk.jshell.spi.ExecutionEnv, java.util.Map) }.
- * <table summary="Parameters">
+ * <table>
+ * <caption>Parameters</caption>
* <tr>
* <th>Parameter</th>
* <th>Description</th>
--- a/langtools/test/jdk/javadoc/doclet/testModules/TestModules.java Thu Apr 27 16:07:59 2017 +0000
+++ b/langtools/test/jdk/javadoc/doclet/testModules/TestModules.java Thu Apr 27 21:16:07 2017 +0000
@@ -24,7 +24,7 @@
/*
* @test
* @bug 8154119 8154262 8156077 8157987 8154261 8154817 8135291 8155995 8162363
- * 8168766 8168688 8162674 8160196 8175799 8174974 8176778 8177562 8175218 8175823
+ * 8168766 8168688 8162674 8160196 8175799 8174974 8176778 8177562 8175218 8175823 8166306
* @summary Test modules support in javadoc.
* @author bpatel
* @library ../lib
@@ -251,6 +251,8 @@
checkModuleModeCommon();
checkModuleModeApi(true);
checkModuleModeAll(false);
+ checkModuleFrameFiles(true);
+ checkAllModulesLink(true);
}
/**
@@ -268,6 +270,8 @@
checkModuleModeCommon();
checkModuleModeApi(false);
checkModuleModeAll(true);
+ checkModuleFrameFiles(true);
+ checkAllModulesLink(true);
}
/**
@@ -296,6 +300,32 @@
checkModuleSummaryNoExported(false);
}
+ /**
+ * Test generated module pages for javadoc run for a single module having a single package.
+ */
+ @Test
+ void testSingleModuleSinglePkg() {
+ javadoc("-d", "out-singlemod",
+ "--module-source-path", testSrc,
+ "--module", "moduleC",
+ "testpkgmdlC");
+ checkExit(Exit.OK);
+ checkModuleFrameFiles(false);
+ }
+
+ /**
+ * Test generated module pages for javadoc run for a single module having multiple packages.
+ */
+ @Test
+ void testSingleModuleMultiplePkg() {
+ javadoc("-d", "out-singlemodmultiplepkg", "--show-module-contents=all",
+ "--module-source-path", testSrc,
+ "--module", "moduleB",
+ "testpkg2mdlB", "testpkgmdlB");
+ checkExit(Exit.OK);
+ checkAllModulesLink(false);
+ }
+
void checkDescription(boolean found) {
checkOutput("moduleA-summary.html", found,
"<!-- ============ MODULE DESCRIPTION =========== -->\n"
@@ -710,6 +740,22 @@
"module-overview-frame.html");
}
+ void checkModuleFrameFiles(boolean found) {
+ checkFiles(found,
+ "moduleC-frame.html",
+ "moduleC-type-frame.html",
+ "module-overview-frame.html");
+ checkFiles(true,
+ "moduleC-summary.html",
+ "allclasses-frame.html",
+ "allclasses-noframe.html");
+ }
+
+ void checkAllModulesLink(boolean found) {
+ checkOutput("overview-frame.html", found,
+ "<li><a href=\"module-overview-frame.html\" target=\"packageListFrame\">All Modules</a></li>");
+ }
+
void checkModulesInSearch(boolean found) {
checkOutput("index-all.html", found,
"<dl>\n"
--- a/langtools/test/tools/jdeprscan/tests/jdk/jdeprscan/TestLoadExpected.csv Thu Apr 27 16:07:59 2017 +0000
+++ b/langtools/test/tools/jdeprscan/tests/jdk/jdeprscan/TestLoadExpected.csv Thu Apr 27 21:16:07 2017 +0000
@@ -1,4 +1,4 @@
-#jdepr 1
+#jdepr1
METHOD,jdk/deprcases/members/ExampleAnnotation,name()Ljava/lang/String;,,false
FIELD,jdk/deprcases/members/ExampleClass,field1,,false
FIELD,jdk/deprcases/members/ExampleClass,field2,,false
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeprscan/tests/jdk/jdeprscan/TestNotFound.java Thu Apr 27 21:16:07 2017 +0000
@@ -0,0 +1,111 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8168444
+ * @summary Test of jdeprscan handling of primitives and primitive arrays.
+ * @modules jdk.jdeps/com.sun.tools.jdeprscan
+ * @run main jdk.jdeprscan.TestNotFound
+ */
+
+package jdk.jdeprscan;
+
+import com.sun.tools.jdeprscan.Main;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.IOException;
+import java.io.PrintStream;
+import java.util.Scanner;
+
+public class TestNotFound {
+
+ public static void main(String[] args) throws IOException {
+ final String SEP = File.separator;
+ final String TESTCLASSES = System.getProperty("test.classes");
+ final String THISCLASS =
+ TESTCLASSES + SEP + "jdk" + SEP + "jdeprscan" + SEP + "TestNotFound.class";
+
+ ByteArrayOutputStream outBaos = new ByteArrayOutputStream();
+ ByteArrayOutputStream errBaos = new ByteArrayOutputStream();
+ boolean mainResult;
+
+ // Causes 5 Methodrefs to be generated, thus 5 occurrences
+ // of the Target class not being found. But only one message
+ // should be emitted.
+
+ Target.method1();
+ Target.method2();
+ Target.method3();
+ Target.method4();
+ Target.method5();
+
+ try (PrintStream out = new PrintStream(outBaos, false, "UTF-8");
+ PrintStream err = new PrintStream(errBaos, false, "UTF-8")) {
+ // Call jdeprscan without the proper classpath, so Target isn't found.
+ // Result is checked below after output is dumped.
+ mainResult = Main.call(out, err, THISCLASS);
+ }
+
+ byte[] outBytes = outBaos.toByteArray();
+ byte[] errBytes = errBaos.toByteArray();
+ ByteArrayInputStream outbais = new ByteArrayInputStream(outBytes);
+ ByteArrayInputStream errbais = new ByteArrayInputStream(errBytes);
+
+ System.out.println("--- stdout ---");
+ outbais.transferTo(System.out);
+ System.out.println("--- end stdout ---");
+
+ System.out.println("--- stderr ---");
+ errbais.transferTo(System.out);
+ System.out.println("--- end stderr ---");
+
+ long errCount = new Scanner(new String(errBytes, "UTF-8")).findAll("error:").count();
+
+ System.out.println("mainResult = " + mainResult);
+ System.out.println("errCount = " + errCount);
+
+ if (!mainResult) {
+ System.out.println("FAIL: mainResult should be true");
+ }
+
+ if (errCount != 1L) {
+ System.out.println("FAIL: errCount should equal 1");
+ }
+
+ if (!mainResult || errCount != 1L) {
+ throw new AssertionError("Test failed.");
+ } else {
+ System.out.println("Test passed.");
+ }
+ }
+
+ static class Target {
+ static void method1() { }
+ static void method2() { }
+ static void method3() { }
+ static void method4() { }
+ static void method5() { }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeprscan/tests/jdk/jdeprscan/TestPrims.csv Thu Apr 27 21:16:07 2017 +0000
@@ -0,0 +1,18 @@
+#jdepr1
+CLASS,V,,,false
+CLASS,Z,,,false
+CLASS,B,,,false
+CLASS,S,,,false
+CLASS,C,,,false
+CLASS,I,,,false
+CLASS,J,,,false
+CLASS,F,,,false
+CLASS,D,,,false
+CLASS,[Z,,,false
+CLASS,[B,,,false
+CLASS,[S,,,false
+CLASS,[C,,,false
+CLASS,[I,,,false
+CLASS,[J,,,false
+CLASS,[F,,,false
+CLASS,[D,,,false
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeprscan/tests/jdk/jdeprscan/TestPrims.java Thu Apr 27 21:16:07 2017 +0000
@@ -0,0 +1,145 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8168444
+ * @summary Test of jdeprscan handling of primitives and primitive arrays.
+ * @modules jdk.jdeps/com.sun.tools.jdeprscan
+ * @build jdk.jdeprscan.TestPrims
+ * @run testng jdk.jdeprscan.TestPrims
+ */
+
+package jdk.jdeprscan;
+
+import com.sun.tools.jdeprscan.Main;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.IOException;
+import java.io.PrintStream;
+import java.util.regex.Pattern;
+import org.testng.annotations.Test;
+
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+
+public class TestPrims {
+
+ @Test
+ public void test() throws IOException {
+ final String TESTSRC = System.getProperty("test.src");
+ final String TESTCLASSPATH = System.getProperty("test.class.path");
+ String CSV_FILE = TESTSRC + File.separator + "TestPrims.csv";
+
+ ByteArrayOutputStream outBaos = new ByteArrayOutputStream();
+ ByteArrayOutputStream errBaos = new ByteArrayOutputStream();
+ boolean mainResult;
+
+ try (PrintStream out = new PrintStream(outBaos, false, "UTF-8");
+ PrintStream err = new PrintStream(errBaos, false, "UTF-8")) {
+ mainResult = Main.call(
+ out, err,
+ "--class-path", TESTCLASSPATH,
+ "--Xload-csv", CSV_FILE,
+ "jdk.jdeprscan.TestPrims$Usage");
+ // assertion is checked below after output is dumped
+ }
+
+ byte[] outBytes = outBaos.toByteArray();
+ byte[] errBytes = errBaos.toByteArray();
+ ByteArrayInputStream outbais = new ByteArrayInputStream(outBytes);
+ ByteArrayInputStream errbais = new ByteArrayInputStream(errBytes);
+
+ System.out.println("--- stdout ---");
+ outbais.transferTo(System.out);
+ System.out.println("--- end stdout ---");
+
+ System.out.println("--- stderr ---");
+ errbais.transferTo(System.out);
+ System.out.println("--- end stderr ---");
+
+ String outString = new String(outBytes, "UTF-8");
+ String errString = new String(errBytes, "UTF-8");
+
+ // matches message "class <classname> uses deprecated class [I"
+ boolean outMatch = Pattern.compile("^class ").matcher(outString).find();
+
+ // matches message "error: cannot find class [I"
+ boolean errMatch = Pattern.compile("^error: ").matcher(errString).find();
+
+ if (!mainResult) {
+ System.out.println("FAIL: Main.call returned false");
+ }
+
+ if (outMatch) {
+ System.out.println("FAIL: stdout contains unexpected error message");
+ }
+
+ if (errMatch) {
+ System.out.println("FAIL: stderr contains unexpected error message");
+ }
+
+ assertTrue(mainResult && !outMatch && !errMatch);
+ }
+
+ static class Usage {
+ void prims(boolean z, byte b, short s, char c,
+ int i, long j, float f, double d) { }
+
+ void primsArrays(boolean[] z, byte[] b, short[] s, char[] c,
+ int[] i, long[] j, float[] f, double[] d) { }
+
+ boolean zfield;
+ byte bfield;
+ short sfield;
+ char cfield;
+ int ifield;
+ long jfield;
+ float ffield;
+ double dfield;
+
+ boolean[] azfield;
+ byte[] abfield;
+ short[] asfield;
+ char[] acfield;
+ int[] aifield;
+ long[] ajfield;
+ float[] affield;
+ double[] adfield;
+
+
+ Object[] clones() {
+ return new Object[] {
+ azfield.clone(),
+ abfield.clone(),
+ asfield.clone(),
+ acfield.clone(),
+ aifield.clone(),
+ ajfield.clone(),
+ affield.clone(),
+ adfield.clone()
+ };
+ }
+ }
+}