# HG changeset patch # User kizune # Date 1389726638 -14400 # Node ID 1f135528db7c12a450620265a3473125240040c7 # Parent 8712cc6441db431dc9e8822bd36ae07a18bfaa9b# Parent 4a6f853f8721992467c7963757e70dbefd811488 Merge diff -r 8712cc6441db -r 1f135528db7c src/share/classes/com/sun/javadoc/ClassDoc.java --- a/src/share/classes/com/sun/javadoc/ClassDoc.java Fri Jan 03 16:01:05 2014 -0800 +++ b/src/share/classes/com/sun/javadoc/ClassDoc.java Tue Jan 14 23:10:38 2014 +0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -66,12 +66,6 @@ boolean isExternalizable(); /** - * Return true if this class can be used as a target type of a lambda expression - * or method reference. - */ - boolean isFunctionalInterface(); - - /** * Return the serialization methods for this class or * interface. * diff -r 8712cc6441db -r 1f135528db7c src/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java --- a/src/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java Fri Jan 03 16:01:05 2014 -0800 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java Tue Jan 14 23:10:38 2014 +0400 @@ -29,6 +29,7 @@ import com.sun.javadoc.*; import com.sun.tools.javac.jvm.Profile; +import com.sun.tools.javadoc.RootDocImpl; import com.sun.tools.doclets.formats.html.markup.*; import com.sun.tools.doclets.internal.toolkit.*; import com.sun.tools.doclets.internal.toolkit.builders.*; @@ -529,7 +530,7 @@ * {@inheritDoc} */ public void addFunctionalInterfaceInfo (Content classInfoTree) { - if (classDoc.isFunctionalInterface()) { + if (isFunctionalInterface()) { Content dt = HtmlTree.DT(getResource("doclet.Functional_Interface")); Content dl = HtmlTree.DL(dt); Content dd = new HtmlTree(HtmlTag.DD); @@ -539,6 +540,19 @@ } } + public boolean isFunctionalInterface() { + if (configuration.root instanceof RootDocImpl) { + RootDocImpl root = (RootDocImpl) configuration.root; + AnnotationDesc[] annotationDescList = classDoc.annotations(); + for (AnnotationDesc annoDesc : annotationDescList) { + if (root.isFunctionalInterface(annoDesc)) { + return true; + } + } + } + return false; + } + /** * {@inheritDoc} */ diff -r 8712cc6441db -r 1f135528db7c src/share/classes/com/sun/tools/javadoc/ClassDocImpl.java --- a/src/share/classes/com/sun/tools/javadoc/ClassDocImpl.java Fri Jan 03 16:01:05 2014 -0800 +++ b/src/share/classes/com/sun/tools/javadoc/ClassDocImpl.java Tue Jan 14 23:10:38 2014 +0400 @@ -288,10 +288,6 @@ return false; } - public boolean isFunctionalInterface() { - return env.types.isFunctionalInterface(tsym) && env.source.allowLambda(); - } - /** * Return the package that this class is contained in. */ diff -r 8712cc6441db -r 1f135528db7c src/share/classes/com/sun/tools/javadoc/RootDocImpl.java --- a/src/share/classes/com/sun/tools/javadoc/RootDocImpl.java Fri Jan 03 16:01:05 2014 -0800 +++ b/src/share/classes/com/sun/tools/javadoc/RootDocImpl.java Tue Jan 14 23:10:38 2014 +0400 @@ -381,6 +381,11 @@ env.initDoclint(opts, customTagNames); } + public boolean isFunctionalInterface(AnnotationDesc annotationDesc) { + return annotationDesc.annotationType().qualifiedName().equals( + env.syms.functionalInterfaceType.toString()) && env.source.allowLambda(); + } + public boolean showTagMessages() { return env.showTagMessages(); } diff -r 8712cc6441db -r 1f135528db7c test/com/sun/javadoc/testLambdaFeature/TestLambdaFeature.java --- a/test/com/sun/javadoc/testLambdaFeature/TestLambdaFeature.java Fri Jan 03 16:01:05 2014 -0800 +++ b/test/com/sun/javadoc/testLambdaFeature/TestLambdaFeature.java Tue Jan 14 23:10:38 2014 +0400 @@ -23,7 +23,7 @@ /* * @test - * @bug 8004893 8022738 + * @bug 8004893 8022738 8029143 * @summary Make sure that the lambda feature changes work fine in * javadoc. * @author bpatel @@ -81,6 +81,11 @@ "
default default void defaultMethod()
"}, {BUG_ID + FS + "pkg" + FS + "B.html", "default void"}, + {BUG_ID + FS + "pkg1" + FS + "NotAFuncInf.html", + "
" + NL + "
Functional Interface:
" + NL + + "
This is a functional interface and can therefore be used as " + + "the assignment target for a lambda expression or method " + + "reference.
" + NL + "
"}, {BUG_ID + FS + "pkg" + FS + "B.html", "
" + NL + "
Functional Interface:
"} }; diff -r 8712cc6441db -r 1f135528db7c test/com/sun/javadoc/testLambdaFeature/pkg/A.java --- a/test/com/sun/javadoc/testLambdaFeature/pkg/A.java Fri Jan 03 16:01:05 2014 -0800 +++ b/test/com/sun/javadoc/testLambdaFeature/pkg/A.java Tue Jan 14 23:10:38 2014 +0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 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,6 +23,7 @@ package pkg; +@FunctionalInterface public interface A { public void method1(); diff -r 8712cc6441db -r 1f135528db7c test/com/sun/javadoc/testLambdaFeature/pkg1/FuncInf.java --- a/test/com/sun/javadoc/testLambdaFeature/pkg1/FuncInf.java Fri Jan 03 16:01:05 2014 -0800 +++ b/test/com/sun/javadoc/testLambdaFeature/pkg1/FuncInf.java Tue Jan 14 23:10:38 2014 +0400 @@ -23,6 +23,7 @@ package pkg1; +@FunctionalInterface public interface FuncInf { V call() throws Exception; diff -r 8712cc6441db -r 1f135528db7c test/com/sun/javadoc/testLambdaFeature/pkg1/NotAFuncInf.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/com/sun/javadoc/testLambdaFeature/pkg1/NotAFuncInf.java Tue Jan 14 23:10:38 2014 +0400 @@ -0,0 +1,29 @@ +/* + * 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. + */ + +package pkg1; + +public interface NotAFuncInf { + + V call() throws Exception; +}