# HG changeset patch # User lana # Date 1386268489 28800 # Node ID b3d7e86a06474fe5100a7b15a95eaa10d41509a6 # Parent 1670108bec258634e98b2a944dd454b237e2ec9a# Parent 4a2ed1900428e3cfb789dee76c70096a073d349f Merge diff -r 1670108bec25 -r b3d7e86a0647 src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java --- a/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java Wed Dec 04 23:11:45 2013 -0800 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java Thu Dec 05 10:34:49 2013 -0800 @@ -148,43 +148,28 @@ 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 @@ 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; diff -r 1670108bec25 -r b3d7e86a0647 src/share/classes/com/sun/tools/doclets/formats/html/TagletWriterImpl.java --- a/src/share/classes/com/sun/tools/doclets/formats/html/TagletWriterImpl.java Wed Dec 04 23:11:45 2013 -0800 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/TagletWriterImpl.java Thu Dec 05 10:34:49 2013 -0800 @@ -80,9 +80,7 @@ */ 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(); diff -r 1670108bec25 -r b3d7e86a0647 src/share/classes/com/sun/tools/javac/comp/Attr.java --- a/src/share/classes/com/sun/tools/javac/comp/Attr.java Wed Dec 04 23:11:45 2013 -0800 +++ b/src/share/classes/com/sun/tools/javac/comp/Attr.java Thu Dec 05 10:34:49 2013 -0800 @@ -28,7 +28,6 @@ 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 @@ 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 @@ } } - private void checkForDeclarationAnnotations(List 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 @@ 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 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 @@ 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 @@ scan(member); } } - - @Override public void visitBlock(JCBlock tree) { if (!sigOnly) { scan(tree.stats); @@ -4590,6 +4574,20 @@ } } } + + private void checkForDeclarationAnnotations(List 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"); + } + } + } }; // diff -r 1670108bec25 -r b3d7e86a0647 src/share/classes/com/sun/tools/javac/comp/Check.java --- a/src/share/classes/com/sun/tools/javac/comp/Check.java Wed Dec 04 23:11:45 2013 -0800 +++ b/src/share/classes/com/sun/tools/javac/comp/Check.java Thu Dec 05 10:34:49 2013 -0800 @@ -2985,6 +2985,7 @@ 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 @@ } 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) diff -r 1670108bec25 -r b3d7e86a0647 src/share/classes/com/sun/tools/javac/parser/JavacParser.java --- a/src/share/classes/com/sun/tools/javac/parser/JavacParser.java Wed Dec 04 23:11:45 2013 -0800 +++ b/src/share/classes/com/sun/tools/javac/parser/JavacParser.java Thu Dec 05 10:34:49 2013 -0800 @@ -1596,6 +1596,7 @@ // Identifier, ')' '->' -> implicit lambda return ParensResult.IMPLICIT_LAMBDA; } + type = false; break; case FINAL: case ELLIPSIS: diff -r 1670108bec25 -r b3d7e86a0647 src/share/classes/com/sun/tools/jdeps/JdepsTask.java --- a/src/share/classes/com/sun/tools/jdeps/JdepsTask.java Wed Dec 04 23:11:45 2013 -0800 +++ b/src/share/classes/com/sun/tools/jdeps/JdepsTask.java Thu Dec 05 10:34:49 2013 -0800 @@ -180,6 +180,15 @@ 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 @@ 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 @@ boolean wildcard; boolean apiOnly; boolean showLabel; + boolean findJDKInternals; String dotOutputDir; String classpath = ""; int depth = 1; @@ -681,11 +696,22 @@ @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; } - writer.format(" -> %-50s %s%n", target, getProfileArchiveInfo(archive, profile)); + 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)); + } } @Override @@ -717,6 +743,11 @@ @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); diff -r 1670108bec25 -r b3d7e86a0647 src/share/classes/com/sun/tools/jdeps/resources/jdeps.properties --- a/src/share/classes/com/sun/tools/jdeps/resources/jdeps.properties Wed Dec 04 23:11:45 2013 -0800 +++ b/src/share/classes/com/sun/tools/jdeps/resources/jdeps.properties Thu Dec 05 10:34:49 2013 -0800 @@ -59,10 +59,19 @@ main.opt.dotoutput=\ \ -dotoutput 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= 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} diff -r 1670108bec25 -r b3d7e86a0647 test/com/sun/javadoc/testDocRootLink/TestDocRootLink.java --- a/test/com/sun/javadoc/testDocRootLink/TestDocRootLink.java Wed Dec 04 23:11:45 2013 -0800 +++ b/test/com/sun/javadoc/testDocRootLink/TestDocRootLink.java Thu Dec 05 10:34:49 2013 -0800 @@ -1,5 +1,5 @@ /* - * 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 @@ private static final String BUG_ID = "6553182"; private static final String[][] TEST1 = { {BUG_ID + FS + "pkg1" + FS + "C1.html", - "" + "Refer Here" + }, + {BUG_ID + FS + "pkg1" + FS + "C1.html", + "This Here should not be replaced" + NL + + " with an absolute link." + }, + {BUG_ID + FS + "pkg1" + FS + "C1.html", + "Testing Link 1 and" + NL + + " Link 2." }, {BUG_ID + FS + "pkg1" + FS + "package-summary.html", - "" + "" + NL + + " Test document 1" + }, + {BUG_ID + FS + "pkg1" + FS + "package-summary.html", + "" + NL + + " Another Test document 1" + }, + {BUG_ID + FS + "pkg1" + FS + "package-summary.html", + "" + NL + + " Another Test document 2." } }; private static final String[][] NEGATED_TEST1 = { {BUG_ID + FS + "pkg1" + FS + "C1.html", "" }, + {BUG_ID + FS + "pkg1" + FS + "C1.html", + "" + }, {BUG_ID + FS + "pkg1" + FS + "package-summary.html", "" + }, + {BUG_ID + FS + "pkg1" + FS + "package-summary.html", + "" } }; private static final String[][] TEST2 = { - {BUG_ID + FS + "pkg2" + FS + "C2.html", - "" + {BUG_ID + "-1" + FS + "pkg2" + FS + "C2.html", + "Refer Here" + }, + {BUG_ID + "-1" + FS + "pkg2" + FS + "C2.html", + "This Here should not be replaced" + NL + + " with an absolute link." }, - {BUG_ID + FS + "pkg2" + FS + "package-summary.html", - "" + {BUG_ID + "-1" + FS + "pkg2" + FS + "C2.html", + "Testing Link 1 and" + NL + + " Link 2." + }, + {BUG_ID + "-1" + FS + "pkg2" + FS + "package-summary.html", + "" + NL + + " Test document 1" + }, + {BUG_ID + "-1" + FS + "pkg2" + FS + "package-summary.html", + "" + NL + " Another Test document 1" + }, + {BUG_ID + "-1" + FS + "pkg2" + FS + "package-summary.html", + "" + NL + " Another Test document 2." } }; private static final String[][] NEGATED_TEST2 = { - {BUG_ID + FS + "pkg2" + FS + "C2.html", + {BUG_ID + "-1" + FS + "pkg2" + FS + "C2.html", "" }, - {BUG_ID + FS + "pkg2" + FS + "package-summary.html", + {BUG_ID + "-1" + FS + "pkg2" + FS + "C2.html", + "" + }, + {BUG_ID + "-1" + FS + "pkg2" + FS + "package-summary.html", "" + }, + {BUG_ID + "-1" + FS + "pkg2" + FS + "package-summary.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" }; /** diff -r 1670108bec25 -r b3d7e86a0647 test/com/sun/javadoc/testDocRootLink/pkg1/C1.java --- a/test/com/sun/javadoc/testDocRootLink/pkg1/C1.java Wed Dec 04 23:11:45 2013 -0800 +++ b/test/com/sun/javadoc/testDocRootLink/pkg1/C1.java Thu Dec 05 10:34:49 2013 -0800 @@ -25,7 +25,12 @@ /** * Class 1. This is a test. - * Refer Here. Lets see if this works - * or not. + * Refer Here. This link should + * not be replaced with an absolute link. + * This Here should not be replaced + * with an absolute link. + * Testing Link 1 and + * Link 2. 2 back-to-back links using + * docroot. These should not be replaced with an absolute link. */ public class C1 {} diff -r 1670108bec25 -r b3d7e86a0647 test/com/sun/javadoc/testDocRootLink/pkg1/package.html --- a/test/com/sun/javadoc/testDocRootLink/pkg1/package.html Wed Dec 04 23:11:45 2013 -0800 +++ b/test/com/sun/javadoc/testDocRootLink/pkg1/package.html Thu Dec 05 10:34:49 2013 -0800 @@ -3,16 +3,16 @@ javax.management package -This is a test. -

- @see - Test document 1 - in particular the - + This is a test. +

+ @see + Test document 1 should not be replaced with an absolute link. + @see + Another Test document 1 which should not be replaced with an absolute link. + + Another Test document 2. which should not be replaced with an absolute link. - Test document 2. - - @since 1.5 + @since 1.5 diff -r 1670108bec25 -r b3d7e86a0647 test/com/sun/javadoc/testDocRootLink/pkg2/C2.java --- a/test/com/sun/javadoc/testDocRootLink/pkg2/C2.java Wed Dec 04 23:11:45 2013 -0800 +++ b/test/com/sun/javadoc/testDocRootLink/pkg2/C2.java Thu Dec 05 10:34:49 2013 -0800 @@ -24,8 +24,13 @@ package pkg2; /** - * Class 1. This is a test. - * Refer Here. Lets see if this works - * or not. + * Class 2. This is a test. + * Refer Here should be + * replaced with an absolute link. + * This Here should not be replaced + * with an absolute link. + * Testing Link 1 and + * Link 2. Both should not be replaced with + * an absolute link. */ public class C2 {} diff -r 1670108bec25 -r b3d7e86a0647 test/com/sun/javadoc/testDocRootLink/pkg2/package.html --- a/test/com/sun/javadoc/testDocRootLink/pkg2/package.html Wed Dec 04 23:11:45 2013 -0800 +++ b/test/com/sun/javadoc/testDocRootLink/pkg2/package.html Thu Dec 05 10:34:49 2013 -0800 @@ -3,16 +3,16 @@ javax.management package -This is a test. -

- @see - Test document 1 - in particular the - + This is a test. +

+ @see + Test document 1 should be replaced with an absolute link. + @see + Another Test document 1 which should not be replaced with an absolute link. + + Another Test document 2. which should not be replaced with an absolute link. - Test document 2. - - @since 1.5 + @since 1.5 diff -r 1670108bec25 -r b3d7e86a0647 test/tools/javac/T8029179/CompileErrorForValidBooleanExpTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/T8029179/CompileErrorForValidBooleanExpTest.java Thu Dec 05 10:34:49 2013 -0800 @@ -0,0 +1,56 @@ +/* + * 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; + } +} diff -r 1670108bec25 -r b3d7e86a0647 test/tools/javac/annotations/typeAnnotations/failures/CheckForDeclAnnoNPE.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/annotations/typeAnnotations/failures/CheckForDeclAnnoNPE.java Thu Dec 05 10:34:49 2013 -0800 @@ -0,0 +1,43 @@ +/* + * 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 {} diff -r 1670108bec25 -r b3d7e86a0647 test/tools/javac/annotations/typeAnnotations/failures/common/arrays/DeclarationAnnotation.java --- a/test/tools/javac/annotations/typeAnnotations/failures/common/arrays/DeclarationAnnotation.java Wed Dec 04 23:11:45 2013 -0800 +++ b/test/tools/javac/annotations/typeAnnotations/failures/common/arrays/DeclarationAnnotation.java Thu Dec 05 10:34:49 2013 -0800 @@ -10,9 +10,6 @@ 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() { }; } diff -r 1670108bec25 -r b3d7e86a0647 test/tools/javac/annotations/typeAnnotations/failures/common/arrays/DeclarationAnnotation.out --- a/test/tools/javac/annotations/typeAnnotations/failures/common/arrays/DeclarationAnnotation.out Wed Dec 04 23:11:45 2013 -0800 +++ b/test/tools/javac/annotations/typeAnnotations/failures/common/arrays/DeclarationAnnotation.out Thu Dec 05 10:34:49 2013 -0800 @@ -1,5 +1,5 @@ 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 diff -r 1670108bec25 -r b3d7e86a0647 test/tools/jdeps/APIDeps.java --- a/test/tools/jdeps/APIDeps.java Wed Dec 04 23:11:45 2013 -0800 +++ b/test/tools/jdeps/APIDeps.java Thu Dec 05 10:34:49 2013 -0800 @@ -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 @@ 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",