提交 3e1c3de5 编写于 作者: K kizune

Merge

......@@ -241,3 +241,4 @@ af6244ba81b6b8d1bf4ab06587a2067e021e4570 jdk8-b111
19de039a03a619b99f1a8b454e1618c9fa9dae66 jdk8-b117
4fd6a7ff8c068eceaaaf8bf12a394195203b99b3 jdk8-b118
43a80d75d06ed22d6942f25f067587a3be3a129d jdk8-b119
b3d7e86a06474fe5100a7b15a95eaa10d41509a6 jdk8-b120
......@@ -148,43 +148,28 @@ public class HtmlDocletWriter extends HtmlDocWriter {
StringBuilder buf = new StringBuilder();
int previndex = 0;
while (true) {
if (configuration.docrootparent.length() > 0) {
final String docroot_parent = "{@docroot}/..";
// Search for lowercase version of {@docRoot}/..
index = lowerHtml.indexOf(docroot_parent, previndex);
// If next {@docRoot}/.. pattern not found, append rest of htmlstr and exit loop
if (index < 0) {
buf.append(htmlstr.substring(previndex));
break;
}
// If next {@docroot}/.. pattern found, append htmlstr up to start of tag
buf.append(htmlstr.substring(previndex, index));
previndex = index + docroot_parent.length();
// Insert docrootparent absolute path where {@docRoot}/.. was located
final String docroot = "{@docroot}";
// Search for lowercase version of {@docRoot}
index = lowerHtml.indexOf(docroot, previndex);
// If next {@docRoot} tag not found, append rest of htmlstr and exit loop
if (index < 0) {
buf.append(htmlstr.substring(previndex));
break;
}
// If next {@docroot} tag found, append htmlstr up to start of tag
buf.append(htmlstr.substring(previndex, index));
previndex = index + docroot.length();
if (configuration.docrootparent.length() > 0 && htmlstr.startsWith("/..", previndex)) {
// Insert the absolute link if {@docRoot} is followed by "/..".
buf.append(configuration.docrootparent);
// Append slash if next character is not a slash
if (previndex < htmlstr.length() && htmlstr.charAt(previndex) != '/') {
buf.append('/');
}
previndex += 3;
} else {
final String docroot = "{@docroot}";
// Search for lowercase version of {@docRoot}
index = lowerHtml.indexOf(docroot, previndex);
// If next {@docRoot} tag not found, append rest of htmlstr and exit loop
if (index < 0) {
buf.append(htmlstr.substring(previndex));
break;
}
// If next {@docroot} tag found, append htmlstr up to start of tag
buf.append(htmlstr.substring(previndex, index));
previndex = index + docroot.length();
// Insert relative path where {@docRoot} was located
buf.append(pathToRoot.isEmpty() ? "." : pathToRoot.getPath());
// Append slash if next character is not a slash
if (previndex < htmlstr.length() && htmlstr.charAt(previndex) != '/') {
buf.append('/');
}
}
// Append slash if next character is not a slash
if (previndex < htmlstr.length() && htmlstr.charAt(previndex) != '/') {
buf.append('/');
}
}
return buf.toString();
......@@ -1604,26 +1589,30 @@ public class HtmlDocletWriter extends HtmlDocWriter {
result.addContent(seeTagToContent((SeeTag) tagelem));
} else if (! tagName.equals("Text")) {
boolean wasEmpty = result.isEmpty();
Content output = TagletWriter.getInlineTagOuput(
configuration.tagletManager, holderTag,
tagelem, getTagletWriterInstance(isFirstSentence));
Content output;
if (configuration.docrootparent.length() > 0
&& tagelem.name().equals("@docRoot")
&& ((tags[i + 1]).text()).startsWith("/..")) {
// If Xdocrootparent switch ON, set the flag to remove the /.. occurrence after
// {@docRoot} tag in the very next Text tag.
textTagChange = true;
// Replace the occurrence of {@docRoot}/.. with the absolute link.
output = new StringContent(configuration.docrootparent);
} else {
output = TagletWriter.getInlineTagOuput(
configuration.tagletManager, holderTag,
tagelem, getTagletWriterInstance(isFirstSentence));
}
if (output != null)
result.addContent(output);
if (wasEmpty && isFirstSentence && tagelem.name().equals("@inheritDoc") && !result.isEmpty()) {
break;
} else if (configuration.docrootparent.length() > 0 &&
tagelem.name().equals("@docRoot") &&
((tags[i + 1]).text()).startsWith("/..")) {
//If Xdocrootparent switch ON, set the flag to remove the /.. occurance after
//{@docRoot} tag in the very next Text tag.
textTagChange = true;
continue;
} else {
continue;
}
} else {
String text = tagelem.text();
//If Xdocrootparent switch ON, remove the /.. occurance after {@docRoot} tag.
//If Xdocrootparent switch ON, remove the /.. occurrence after {@docRoot} tag.
if (textTagChange) {
text = text.replaceFirst("/..", "");
textTagChange = false;
......
......@@ -80,9 +80,7 @@ public class TagletWriterImpl extends TagletWriter {
*/
public Content getDocRootOutput() {
String path;
if (configuration.docrootparent.length() > 0)
path = configuration.docrootparent;
else if (htmlWriter.pathToRoot.isEmpty())
if (htmlWriter.pathToRoot.isEmpty())
path = ".";
else
path = htmlWriter.pathToRoot.getPath();
......
......@@ -28,7 +28,6 @@ package com.sun.tools.javac.comp;
import java.util.*;
import javax.lang.model.element.ElementKind;
import javax.lang.model.type.TypeKind;
import javax.tools.JavaFileObject;
import com.sun.source.tree.IdentifierTree;
......@@ -2164,11 +2163,6 @@ public class Attr extends JCTree.Visitor {
tree.constructor,
localEnv,
new ResultInfo(pkind, newMethodTemplate(syms.voidType, argtypes, typeargtypes)));
} else {
if (tree.clazz.hasTag(ANNOTATED_TYPE)) {
checkForDeclarationAnnotations(((JCAnnotatedType) tree.clazz).annotations,
tree.clazz.type.tsym);
}
}
if (tree.constructor != null && tree.constructor.kind == MTH)
......@@ -2230,21 +2224,6 @@ public class Attr extends JCTree.Visitor {
}
}
private void checkForDeclarationAnnotations(List<? extends JCAnnotation> annotations,
Symbol sym) {
// Ensure that no declaration annotations are present.
// Note that a tree type might be an AnnotatedType with
// empty annotations, if only declaration annotations were given.
// This method will raise an error for such a type.
for (JCAnnotation ai : annotations) {
if (!ai.type.isErroneous() &&
typeAnnotations.annotationType(ai.attribute, sym) == TypeAnnotations.AnnotationType.DECLARATION) {
log.error(ai.pos(), "annotation.type.not.applicable");
}
}
}
/** Make an attributed null check tree.
*/
public JCExpression makeNullCheck(JCExpression arg) {
......@@ -2271,10 +2250,6 @@ public class Attr extends JCTree.Visitor {
attribExpr(l.head, localEnv, syms.intType);
owntype = new ArrayType(owntype, syms.arrayClass);
}
if (tree.elemtype.hasTag(ANNOTATED_TYPE)) {
checkForDeclarationAnnotations(((JCAnnotatedType) tree.elemtype).annotations,
tree.elemtype.type.tsym);
}
} else {
// we are seeing an untyped aggregate { ... }
// this is allowed only if the prototype is an array
......@@ -4419,7 +4394,7 @@ public class Attr extends JCTree.Visitor {
}
public void visitMethodDef(JCMethodDecl tree) {
if (tree.recvparam != null &&
tree.recvparam.vartype.type.getKind() != TypeKind.ERROR) {
!tree.recvparam.vartype.type.isErroneous()) {
checkForDeclarationAnnotations(tree.recvparam.mods.annotations,
tree.recvparam.vartype.type.tsym);
}
......@@ -4458,17 +4433,28 @@ public class Attr extends JCTree.Visitor {
super.visitTypeTest(tree);
}
public void visitNewClass(JCNewClass tree) {
if (tree.clazz.type != null)
if (tree.clazz.hasTag(ANNOTATED_TYPE)) {
checkForDeclarationAnnotations(((JCAnnotatedType) tree.clazz).annotations,
tree.clazz.type.tsym);
}
if (tree.def != null) {
checkForDeclarationAnnotations(tree.def.mods.annotations, tree.clazz.type.tsym);
}
if (tree.clazz.type != null) {
validateAnnotatedType(tree.clazz, tree.clazz.type);
}
super.visitNewClass(tree);
}
public void visitNewArray(JCNewArray tree) {
if (tree.elemtype != null && tree.elemtype.type != null)
if (tree.elemtype != null && tree.elemtype.type != null) {
if (tree.elemtype.hasTag(ANNOTATED_TYPE)) {
checkForDeclarationAnnotations(((JCAnnotatedType) tree.elemtype).annotations,
tree.elemtype.type.tsym);
}
validateAnnotatedType(tree.elemtype, tree.elemtype.type);
}
super.visitNewArray(tree);
}
@Override
public void visitClassDef(JCClassDecl tree) {
if (sigOnly) {
scan(tree.mods);
......@@ -4483,8 +4469,6 @@ public class Attr extends JCTree.Visitor {
scan(member);
}
}
@Override
public void visitBlock(JCBlock tree) {
if (!sigOnly) {
scan(tree.stats);
......@@ -4590,6 +4574,20 @@ public class Attr extends JCTree.Visitor {
}
}
}
private void checkForDeclarationAnnotations(List<? extends JCAnnotation> annotations,
Symbol sym) {
// Ensure that no declaration annotations are present.
// Note that a tree type might be an AnnotatedType with
// empty annotations, if only declaration annotations were given.
// This method will raise an error for such a type.
for (JCAnnotation ai : annotations) {
if (!ai.type.isErroneous() &&
typeAnnotations.annotationType(ai.attribute, sym) == TypeAnnotations.AnnotationType.DECLARATION) {
log.error(ai.pos(), "annotation.type.not.applicable");
}
}
}
};
// <editor-fold desc="post-attribution visitor">
......
......@@ -2985,6 +2985,7 @@ public class Check {
boolean annotationApplicable(JCAnnotation a, Symbol s) {
Attribute.Array arr = getAttributeTargetAttribute(a.annotationType.type.tsym);
Name[] targets;
if (arr == null) {
targets = defaultTargetMetaInfo(a, s);
} else {
......@@ -3001,7 +3002,7 @@ public class Check {
}
for (Name target : targets) {
if (target == names.TYPE)
{ if (s.kind == TYP && !s.isAnonymous()) return true; }
{ if (s.kind == TYP) return true; }
else if (target == names.FIELD)
{ if (s.kind == VAR && s.owner.kind != MTH) return true; }
else if (target == names.METHOD)
......
......@@ -1596,6 +1596,7 @@ public class JavacParser implements Parser {
// Identifier, ')' '->' -> implicit lambda
return ParensResult.IMPLICIT_LAMBDA;
}
type = false;
break;
case FINAL:
case ELLIPSIS:
......
......@@ -180,6 +180,15 @@ class JdepsTask {
task.options.depth = 0;
}
},
new Option(false, "-jdkinternals") {
void process(JdepsTask task, String opt, String arg) {
task.options.findJDKInternals = true;
task.options.verbose = Analyzer.Type.CLASS;
if (task.options.includePattern == null) {
task.options.includePattern = Pattern.compile(".*");
}
}
},
new Option(false, "-version") {
void process(JdepsTask task, String opt, String arg) {
task.options.version = true;
......@@ -248,6 +257,11 @@ class JdepsTask {
showHelp();
return EXIT_CMDERR;
}
if (options.findJDKInternals &&
(options.regex != null || options.packageNames.size() > 0 || options.showSummary)) {
showHelp();
return EXIT_CMDERR;
}
if (options.showSummary && options.verbose != Analyzer.Type.SUMMARY) {
showHelp();
return EXIT_CMDERR;
......@@ -571,6 +585,7 @@ class JdepsTask {
boolean wildcard;
boolean apiOnly;
boolean showLabel;
boolean findJDKInternals;
String dotOutputDir;
String classpath = "";
int depth = 1;
......@@ -681,11 +696,22 @@ class JdepsTask {
@Override
public void visitDependence(String origin, Archive source,
String target, Archive archive, Profile profile) {
if (!origin.equals(pkg)) {
pkg = origin;
writer.format(" %s (%s)%n", origin, source.getFileName());
if (options.findJDKInternals &&
!(archive instanceof JDKArchive && profile == null)) {
// filter dependences other than JDK internal APIs
return;
}
if (options.verbose == Analyzer.Type.VERBOSE) {
writer.format(" %-50s -> %-50s %s%n",
origin, target, getProfileArchiveInfo(archive, profile));
} else {
if (!origin.equals(pkg)) {
pkg = origin;
writer.format(" %s (%s)%n", origin, source.getFileName());
}
writer.format(" -> %-50s %s%n",
target, getProfileArchiveInfo(archive, profile));
}
writer.format(" -> %-50s %s%n", target, getProfileArchiveInfo(archive, profile));
}
@Override
......@@ -717,6 +743,11 @@ class JdepsTask {
@Override
public void visitDependence(String origin, Archive source,
String target, Archive archive, Profile profile) {
if (options.findJDKInternals &&
!(archive instanceof JDKArchive && profile == null)) {
// filter dependences other than JDK internal APIs
return;
}
// if -P option is specified, package name -> profile will
// be shown and filter out multiple same edges.
String name = getProfileArchiveInfo(archive, profile);
......
......@@ -59,10 +59,19 @@ main.opt.apionly=\
main.opt.dotoutput=\
\ -dotoutput <dir> Destination directory for DOT file output
main.opt.jdkinternals=\
\ -jdkinternals Finds class-level dependences on JDK internal APIs.\n\
\ By default, it analyzes all classes on -classpath\n\
\ and input files unless -include option is specified.\n\
\ This option cannot be used with -p, -e and -s options.\n\
\ WARNING: JDK internal APIs may not be accessible in\n\
\ the next release.
main.opt.depth=\
\ -depth=<depth> Specify the depth of the transitive\n\
\ dependency analysis
err.unknown.option=unknown option: {0}
err.missing.arg=no value given for {0}
err.internal.error=internal error: {0} {1} {2}
......
/*
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 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
......@@ -23,7 +23,7 @@
/*
* @test
* @bug 6553182
* @bug 6553182 8025416
* @summary This test verifies the -Xdocrootparent option.
* @author Bhavesh Patel
* @library ../lib/
......@@ -35,43 +35,87 @@ public class TestDocRootLink extends JavadocTester {
private static final String BUG_ID = "6553182";
private static final String[][] TEST1 = {
{BUG_ID + FS + "pkg1" + FS + "C1.html",
"<a href=\"../../technotes/guides/index.html\">"
"Refer <a href=\"../../technotes/guides/index.html\">Here</a>"
},
{BUG_ID + FS + "pkg1" + FS + "C1.html",
"This <a href=\"../pkg2/C2.html\">Here</a> should not be replaced" + NL +
" with an absolute link."
},
{BUG_ID + FS + "pkg1" + FS + "C1.html",
"Testing <a href=\"../technotes/guides/index.html\">Link 1</a> and" + NL +
" <a href=\"../pkg2/C2.html\">Link 2</a>."
},
{BUG_ID + FS + "pkg1" + FS + "package-summary.html",
"<a href=\"../../technotes/guides/index.html\">"
"<a href=\"../../technotes/guides/index.html\">" + NL +
" Test document 1</a>"
},
{BUG_ID + FS + "pkg1" + FS + "package-summary.html",
"<a href=\"../pkg2/C2.html\">" + NL +
" Another Test document 1</a>"
},
{BUG_ID + FS + "pkg1" + FS + "package-summary.html",
"<a href=\"../technotes/guides/index.html\">" + NL +
" Another Test document 2.</a>"
}
};
private static final String[][] NEGATED_TEST1 = {
{BUG_ID + FS + "pkg1" + FS + "C1.html",
"<a href=\"http://download.oracle.com/javase/7/docs/technotes/guides/index.html\">"
},
{BUG_ID + FS + "pkg1" + FS + "C1.html",
"<a href=\"http://download.oracle.com/javase/7/docs/pkg2/C2.html\">"
},
{BUG_ID + FS + "pkg1" + FS + "package-summary.html",
"<a href=\"http://download.oracle.com/javase/7/docs/technotes/guides/index.html\">"
},
{BUG_ID + FS + "pkg1" + FS + "package-summary.html",
"<a href=\"http://download.oracle.com/javase/7/docs/pkg2/C2.html\">"
}
};
private static final String[][] TEST2 = {
{BUG_ID + FS + "pkg2" + FS + "C2.html",
"<a href=\"http://download.oracle.com/javase/7/docs/technotes/guides/index.html\">"
{BUG_ID + "-1" + FS + "pkg2" + FS + "C2.html",
"Refer <a href=\"http://download.oracle.com/javase/7/docs/technotes/guides/index.html\">Here</a>"
},
{BUG_ID + FS + "pkg2" + FS + "package-summary.html",
"<a href=\"http://download.oracle.com/javase/7/docs/technotes/guides/index.html\">"
{BUG_ID + "-1" + FS + "pkg2" + FS + "C2.html",
"This <a href=\"../pkg1/C1.html\">Here</a> should not be replaced" + NL +
" with an absolute link."
},
{BUG_ID + "-1" + FS + "pkg2" + FS + "C2.html",
"Testing <a href=\"../technotes/guides/index.html\">Link 1</a> and" + NL +
" <a href=\"../pkg1/C1.html\">Link 2</a>."
},
{BUG_ID + "-1" + FS + "pkg2" + FS + "package-summary.html",
"<a href=\"http://download.oracle.com/javase/7/docs/technotes/guides/index.html\">" + NL +
" Test document 1</a>"
},
{BUG_ID + "-1" + FS + "pkg2" + FS + "package-summary.html",
"<a href=\"../pkg1/C1.html\">" + NL + " Another Test document 1</a>"
},
{BUG_ID + "-1" + FS + "pkg2" + FS + "package-summary.html",
"<a href=\"../technotes/guides/index.html\">" + NL + " Another Test document 2.</a>"
}
};
private static final String[][] NEGATED_TEST2 = {
{BUG_ID + FS + "pkg2" + FS + "C2.html",
{BUG_ID + "-1" + FS + "pkg2" + FS + "C2.html",
"<a href=\"../../technotes/guides/index.html\">"
},
{BUG_ID + FS + "pkg2" + FS + "package-summary.html",
{BUG_ID + "-1" + FS + "pkg2" + FS + "C2.html",
"<a href=\"http://download.oracle.com/javase/7/docs/pkg1/C1.html\">"
},
{BUG_ID + "-1" + FS + "pkg2" + FS + "package-summary.html",
"<a href=\"../../technotes/guides/index.html\">"
},
{BUG_ID + "-1" + FS + "pkg2" + FS + "package-summary.html",
"<a href=\"http://download.oracle.com/javase/7/docs/pkg1/C1.html\">"
}
};
private static final String[] ARGS1 =
new String[]{
"-d", BUG_ID, "-sourcepath", SRC_DIR, "pkg1"
"-d", BUG_ID, "-sourcepath", SRC_DIR, "pkg1", "pkg2"
};
private static final String[] ARGS2 =
new String[]{
"-d", BUG_ID, "-Xdocrootparent", "http://download.oracle.com/javase/7/docs", "-sourcepath", SRC_DIR, "pkg2"
"-d", BUG_ID + "-1", "-Xdocrootparent", "http://download.oracle.com/javase/7/docs", "-sourcepath", SRC_DIR, "pkg1", "pkg2"
};
/**
......
......@@ -25,7 +25,12 @@ package pkg1;
/**
* Class 1. This is a test.
* Refer <a href="{@docRoot}/../technotes/guides/index.html">Here</a>. Lets see if this works
* or not.
* Refer <a href="{@docRoot}/../technotes/guides/index.html">Here</a>. This link should
* not be replaced with an absolute link.
* This <a href="{@docRoot}/pkg2/C2.html">Here</a> should not be replaced
* with an absolute link.
* Testing <a href="{@docRoot}/technotes/guides/index.html">Link 1</a> and
* <a href="{@docRoot}/pkg2/C2.html">Link 2</a>. 2 back-to-back links using
* docroot. These should not be replaced with an absolute link.
*/
public class C1 {}
......@@ -3,16 +3,16 @@
<title>javax.management package</title>
</head>
<body bgcolor="white">
This is a test.
<p id="spec">
@see <a href="{@docRoot}/../technotes/guides/index.html">
Test document 1</a>
in particular the
<a href="{@docRoot}/../technotes/guides/index.html">
This is a test.
<p id="spec">
@see <a href="{@docRoot}/../technotes/guides/index.html">
Test document 1</a> should not be replaced with an absolute link.
@see <a href="{@docRoot}/pkg2/C2.html">
Another Test document 1</a> which should not be replaced with an absolute link.
<a href="{@docRoot}/technotes/guides/index.html">
Another Test document 2.</a> which should not be replaced with an absolute link.
Test document 2.</a>
@since 1.5
@since 1.5
</body>
</html>
......@@ -24,8 +24,13 @@
package pkg2;
/**
* Class 1. This is a test.
* Refer <a href="{@docRoot}/../technotes/guides/index.html">Here</a>. Lets see if this works
* or not.
* Class 2. This is a test.
* Refer <a href="{@docRoot}/../technotes/guides/index.html">Here</a> should be
* replaced with an absolute link.
* This <a href="{@docRoot}/pkg1/C1.html">Here</a> should not be replaced
* with an absolute link.
* Testing <a href="{@docRoot}/technotes/guides/index.html">Link 1</a> and
* <a href="{@docRoot}/pkg1/C1.html">Link 2</a>. Both should not be replaced with
* an absolute link.
*/
public class C2 {}
......@@ -3,16 +3,16 @@
<title>javax.management package</title>
</head>
<body bgcolor="white">
This is a test.
<p id="spec">
@see <a href="{@docRoot}/../technotes/guides/index.html">
Test document 1</a>
in particular the
<a href="{@docRoot}/../technotes/guides/index.html">
This is a test.
<p id="spec">
@see <a href="{@docRoot}/../technotes/guides/index.html">
Test document 1</a> should be replaced with an absolute link.
@see <a href="{@docRoot}/pkg1/C1.html">
Another Test document 1</a> which should not be replaced with an absolute link.
<a href="{@docRoot}/technotes/guides/index.html">
Another Test document 2.</a> which should not be replaced with an absolute link.
Test document 2.</a>
@since 1.5
@since 1.5
</body>
</html>
/*
* Copyright (c) 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.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please 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 8029179
* @summary javac produces a compile error for valid boolean expressions
* @compile CompileErrorForValidBooleanExpTest.java
*/
public class CompileErrorForValidBooleanExpTest {
static int a, b, c, d;
static void m() {
boolean cond1 = (a < b & c > d);
boolean cond2 = (f1() < f2() & c > d);
boolean cond3 = (f1() < b & f3() > d);
boolean cond4 = (f1() < b & f3() > 1);
}
static int f1() {
return 0;
}
static int f2() {
return 0;
}
static int f3() {
return 0;
}
static int f4() {
return 0;
}
}
/*
* Copyright (c) 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.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please 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 8028699
* @summary Ensure there is no NPE in checking for decl. annotations in this example
* @author Werner Dietl
* @compile -doe CheckForDeclAnnoNPE.java
*/
import java.lang.annotation.ElementType;
import java.lang.annotation.Target;
class CheckForDeclAnnoNPE {
void test(String s) {
test(new @TA String().toString());
}
}
@Target(ElementType.TYPE_USE)
@interface TA {}
......@@ -10,9 +10,6 @@ class DeclarationAnnotation {
Object e1 = new @DA int[5];
Object e2 = new @DA String[42];
Object e3 = new @DA Object();
// The declaration annotation is only allowed for
// an anonymous class creation.
Object ok = new @DA Object() { };
}
......
DeclarationAnnotation.java:10:21: compiler.err.annotation.type.not.applicable
DeclarationAnnotation.java:11:21: compiler.err.annotation.type.not.applicable
DeclarationAnnotation.java:12:21: compiler.err.annotation.type.not.applicable
DeclarationAnnotation.java:16:21: compiler.err.annotation.type.not.applicable
DeclarationAnnotation.java:13:21: compiler.err.annotation.type.not.applicable
4 errors
......@@ -23,8 +23,8 @@
/*
* @test
* @bug 8015912
* @summary find API dependencies
* @bug 8015912 8029216
* @summary Test -apionly and -jdkinternals options
* @build m.Bar m.Foo m.Gee b.B c.C c.I d.D e.E f.F g.G
* @run main APIDeps
*/
......@@ -88,6 +88,19 @@ public class APIDeps {
new String[] {"g.G", "sun.misc.Lock"},
new String[] {testDirBasename, "JDK internal API"},
new String[] {"-classpath", testDir.getPath(), "-verbose"});
// -jdkinternals
test(new File(mDir, "Gee.class"),
new String[] {"sun.misc.Lock"},
new String[] {"JDK internal API"},
new String[] {"-jdkinternals"});
// -jdkinternals parses all classes on -classpath and the input arguments
test(new File(mDir, "Gee.class"),
new String[] {"sun.misc.Lock", "sun.misc.Unsafe"},
new String[] {"JDK internal API"},
new String[] {"-classpath", testDir.getPath(), "-jdkinternals"});
// parse only APIs
// parse only APIs
test(mDir,
new String[] {"java.lang.Object", "java.lang.String",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册