Thu, 16 Jan 2014 23:52:44 +0000
Merge
1.1 --- a/src/share/classes/com/sun/javadoc/ClassDoc.java Thu Jan 16 20:13:51 2014 +0000 1.2 +++ b/src/share/classes/com/sun/javadoc/ClassDoc.java Thu Jan 16 23:52:44 2014 +0000 1.3 @@ -1,5 +1,5 @@ 1.4 /* 1.5 - * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. 1.6 + * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. 1.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 * 1.9 * This code is free software; you can redistribute it and/or modify it 1.10 @@ -66,12 +66,6 @@ 1.11 boolean isExternalizable(); 1.12 1.13 /** 1.14 - * Return true if this class can be used as a target type of a lambda expression 1.15 - * or method reference. 1.16 - */ 1.17 - boolean isFunctionalInterface(); 1.18 - 1.19 - /** 1.20 * Return the serialization methods for this class or 1.21 * interface. 1.22 *
2.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java Thu Jan 16 20:13:51 2014 +0000 2.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java Thu Jan 16 23:52:44 2014 +0000 2.3 @@ -29,6 +29,7 @@ 2.4 2.5 import com.sun.javadoc.*; 2.6 import com.sun.tools.javac.jvm.Profile; 2.7 +import com.sun.tools.javadoc.RootDocImpl; 2.8 import com.sun.tools.doclets.formats.html.markup.*; 2.9 import com.sun.tools.doclets.internal.toolkit.*; 2.10 import com.sun.tools.doclets.internal.toolkit.builders.*; 2.11 @@ -529,7 +530,7 @@ 2.12 * {@inheritDoc} 2.13 */ 2.14 public void addFunctionalInterfaceInfo (Content classInfoTree) { 2.15 - if (classDoc.isFunctionalInterface()) { 2.16 + if (isFunctionalInterface()) { 2.17 Content dt = HtmlTree.DT(getResource("doclet.Functional_Interface")); 2.18 Content dl = HtmlTree.DL(dt); 2.19 Content dd = new HtmlTree(HtmlTag.DD); 2.20 @@ -539,6 +540,19 @@ 2.21 } 2.22 } 2.23 2.24 + public boolean isFunctionalInterface() { 2.25 + if (configuration.root instanceof RootDocImpl) { 2.26 + RootDocImpl root = (RootDocImpl) configuration.root; 2.27 + AnnotationDesc[] annotationDescList = classDoc.annotations(); 2.28 + for (AnnotationDesc annoDesc : annotationDescList) { 2.29 + if (root.isFunctionalInterface(annoDesc)) { 2.30 + return true; 2.31 + } 2.32 + } 2.33 + } 2.34 + return false; 2.35 + } 2.36 + 2.37 /** 2.38 * {@inheritDoc} 2.39 */
3.1 --- a/src/share/classes/com/sun/tools/javadoc/ClassDocImpl.java Thu Jan 16 20:13:51 2014 +0000 3.2 +++ b/src/share/classes/com/sun/tools/javadoc/ClassDocImpl.java Thu Jan 16 23:52:44 2014 +0000 3.3 @@ -288,10 +288,6 @@ 3.4 return false; 3.5 } 3.6 3.7 - public boolean isFunctionalInterface() { 3.8 - return env.types.isFunctionalInterface(tsym) && env.source.allowLambda(); 3.9 - } 3.10 - 3.11 /** 3.12 * Return the package that this class is contained in. 3.13 */
4.1 --- a/src/share/classes/com/sun/tools/javadoc/RootDocImpl.java Thu Jan 16 20:13:51 2014 +0000 4.2 +++ b/src/share/classes/com/sun/tools/javadoc/RootDocImpl.java Thu Jan 16 23:52:44 2014 +0000 4.3 @@ -381,6 +381,11 @@ 4.4 env.initDoclint(opts, customTagNames); 4.5 } 4.6 4.7 + public boolean isFunctionalInterface(AnnotationDesc annotationDesc) { 4.8 + return annotationDesc.annotationType().qualifiedName().equals( 4.9 + env.syms.functionalInterfaceType.toString()) && env.source.allowLambda(); 4.10 + } 4.11 + 4.12 public boolean showTagMessages() { 4.13 return env.showTagMessages(); 4.14 }
5.1 --- a/test/com/sun/javadoc/testLambdaFeature/TestLambdaFeature.java Thu Jan 16 20:13:51 2014 +0000 5.2 +++ b/test/com/sun/javadoc/testLambdaFeature/TestLambdaFeature.java Thu Jan 16 23:52:44 2014 +0000 5.3 @@ -23,7 +23,7 @@ 5.4 5.5 /* 5.6 * @test 5.7 - * @bug 8004893 8022738 5.8 + * @bug 8004893 8022738 8029143 5.9 * @summary Make sure that the lambda feature changes work fine in 5.10 * javadoc. 5.11 * @author bpatel 5.12 @@ -81,6 +81,11 @@ 5.13 "<pre>default default void defaultMethod()</pre>"}, 5.14 {BUG_ID + FS + "pkg" + FS + "B.html", 5.15 "<td class=\"colFirst\"><code>default void</code></td>"}, 5.16 + {BUG_ID + FS + "pkg1" + FS + "NotAFuncInf.html", 5.17 + "<dl>" + NL + "<dt>Functional Interface:</dt>" + NL + 5.18 + "<dd>This is a functional interface and can therefore be used as " + 5.19 + "the assignment target for a lambda expression or method " + 5.20 + "reference.</dd>" + NL + "</dl>"}, 5.21 {BUG_ID + FS + "pkg" + FS + "B.html", 5.22 "<dl>" + NL + "<dt>Functional Interface:</dt>"} 5.23 };
6.1 --- a/test/com/sun/javadoc/testLambdaFeature/pkg/A.java Thu Jan 16 20:13:51 2014 +0000 6.2 +++ b/test/com/sun/javadoc/testLambdaFeature/pkg/A.java Thu Jan 16 23:52:44 2014 +0000 6.3 @@ -1,5 +1,5 @@ 6.4 /* 6.5 - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. 6.6 + * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. 6.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6.8 * 6.9 * This code is free software; you can redistribute it and/or modify it 6.10 @@ -23,6 +23,7 @@ 6.11 6.12 package pkg; 6.13 6.14 +@FunctionalInterface 6.15 public interface A { 6.16 6.17 public void method1();
7.1 --- a/test/com/sun/javadoc/testLambdaFeature/pkg1/FuncInf.java Thu Jan 16 20:13:51 2014 +0000 7.2 +++ b/test/com/sun/javadoc/testLambdaFeature/pkg1/FuncInf.java Thu Jan 16 23:52:44 2014 +0000 7.3 @@ -23,6 +23,7 @@ 7.4 7.5 package pkg1; 7.6 7.7 +@FunctionalInterface 7.8 public interface FuncInf<V> { 7.9 7.10 V call() throws Exception;
8.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 8.2 +++ b/test/com/sun/javadoc/testLambdaFeature/pkg1/NotAFuncInf.java Thu Jan 16 23:52:44 2014 +0000 8.3 @@ -0,0 +1,29 @@ 8.4 +/* 8.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 8.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 8.7 + * 8.8 + * This code is free software; you can redistribute it and/or modify it 8.9 + * under the terms of the GNU General Public License version 2 only, as 8.10 + * published by the Free Software Foundation. 8.11 + * 8.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 8.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 8.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 8.15 + * version 2 for more details (a copy is included in the LICENSE file that 8.16 + * accompanied this code). 8.17 + * 8.18 + * You should have received a copy of the GNU General Public License version 8.19 + * 2 along with this work; if not, write to the Free Software Foundation, 8.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 8.21 + * 8.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 8.23 + * or visit www.oracle.com if you need additional information or have any 8.24 + * questions. 8.25 + */ 8.26 + 8.27 +package pkg1; 8.28 + 8.29 +public interface NotAFuncInf<V> { 8.30 + 8.31 + V call() throws Exception; 8.32 +}