# HG changeset patch # User ksrini # Date 1457045684 28800 # Node ID 37bd10863a8a3fa039f28752ce367ff1c2288868 # Parent 7d18ec07fde46e11559de73e30fa177ec9b934e2 8150130: NPE building javafx docs with new doclet Reviewed-by: jjg diff -r 7d18ec07fde4 -r 37bd10863a8a langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/DocTreeMaker.java --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/DocTreeMaker.java Thu Mar 03 12:48:19 2016 -0800 +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/DocTreeMaker.java Thu Mar 03 14:54:44 2016 -0800 @@ -50,6 +50,7 @@ import com.sun.tools.javac.parser.ParserFactory; import com.sun.tools.javac.parser.ReferenceParser; import com.sun.tools.javac.parser.Tokens.Comment; +import com.sun.tools.javac.parser.Tokens.Comment.CommentStyle; import com.sun.tools.javac.tree.DCTree.DCAttribute; import com.sun.tools.javac.tree.DCTree.DCAuthor; import com.sun.tools.javac.tree.DCTree.DCComment; @@ -206,7 +207,31 @@ lb.addAll(cast(firstSentence)); lb.addAll(cast(body)); List fullBody = lb.toList(); - DCDocComment tree = new DCDocComment(null, fullBody, cast(firstSentence), cast(body), cast(tags)); + + // A dummy comment to keep the diagnostics logic happy. + Comment c = new Comment() { + @Override + public String getText() { + return null; + } + + @Override + public int getSourcePos(int index) { + return Position.NOPOS; + } + + @Override + public CommentStyle getStyle() { + return CommentStyle.JAVADOC; + } + + @Override + public boolean isDeprecated() { + return false; + } + }; + + DCDocComment tree = new DCDocComment(c, fullBody, cast(firstSentence), cast(body), cast(tags)); return tree; } diff -r 7d18ec07fde4 -r 37bd10863a8a langtools/test/jdk/javadoc/doclet/testJavaFX/TestJavaFX.java --- a/langtools/test/jdk/javadoc/doclet/testJavaFX/TestJavaFX.java Thu Mar 03 12:48:19 2016 -0800 +++ b/langtools/test/jdk/javadoc/doclet/testJavaFX/TestJavaFX.java Thu Mar 03 14:54:44 2016 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2015, 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,7 +23,7 @@ /* * @test - * @bug 7112427 8012295 8025633 8026567 8061305 8081854 + * @bug 7112427 8012295 8025633 8026567 8061305 8081854 8150130 * @summary Test of the JavaFX doclet features. * @author jvalenta * @library ../lib @@ -137,6 +137,7 @@ + "\n" + ""); } + /* * Test without -javafx option, to ensure property getters and setters * are treated just like any other java method. @@ -181,4 +182,22 @@ + "() " ); } + + /* + * Force the doclet to emit a warning when processing a synthesized, + * DocComment, and ensure that the run succeeds. + */ + @Test + void test4() { + javadoc("-d", "out4", + "-javafx", + "-Xdoclint:none", + "-sourcepath", testSrc, + "-package", + "pkg4"); + checkExit(Exit.OK); + + // make sure the doclet indeed emits the warning + checkOutput(Output.OUT, true, "C.java:0: warning - invalid usage of tag >"); + } } diff -r 7d18ec07fde4 -r 37bd10863a8a langtools/test/jdk/javadoc/doclet/testJavaFX/pkg4/C.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/jdk/javadoc/doclet/testJavaFX/pkg4/C.java Thu Mar 03 14:54:44 2016 -0800 @@ -0,0 +1,45 @@ +/* + * 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 pkg4; + +public class C { + + /** + * Defines the number of cycles in this animation. The {@code cycleCount} + * may be {@code INDEFINITE} for animations that repeat indefinitely. + * Now we add a > to deliberately cause an Html error. + * @defaultValue 11 + * @since JavaFX 8.0 + */ + public DoubleProperty rate; + + public final void setRate(double value) {} + + public final double getRate() {return 2.0d;} + + public final DoubleProperty rateProperty() {return new DoubleProperty();} + + class DoubleProperty {} + +}