diff --git a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/MemberSummaryBuilder.java b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/MemberSummaryBuilder.java index 886c31ff9d4..61ed4327cc9 100644 --- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/MemberSummaryBuilder.java +++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/MemberSummaryBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2017, 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 @@ -32,6 +32,12 @@ import javax.lang.model.element.Element; import javax.lang.model.element.ExecutableElement; import javax.lang.model.element.TypeElement; import javax.lang.model.element.VariableElement; +import javax.lang.model.type.ArrayType; +import javax.lang.model.type.DeclaredType; +import javax.lang.model.type.ExecutableType; +import javax.lang.model.type.PrimitiveType; +import javax.lang.model.type.TypeMirror; +import javax.lang.model.util.SimpleTypeVisitor9; import com.sun.source.doctree.DocTree; import com.sun.source.doctree.DocTree.Kind; @@ -440,16 +446,10 @@ public class MemberSummaryBuilder extends AbstractMemberBuilder { if (null != setter) { VariableElement param = setter.getParameters().get(0); - String typeName = utils.getTypeName(param.asType(), false); - // Removal of type parameters and package information. - typeName = typeName.split("<")[0]; - if (typeName.contains(".")) { - typeName = typeName.substring(typeName.lastIndexOf(".") + 1); - } StringBuilder sb = new StringBuilder("#"); sb.append(utils.getSimpleName(setter)); if (!utils.isTypeVariable(param.asType())) { - sb.append("(").append(typeName).append(")"); + sb.append("(").append(utils.getTypeSignature(param.asType(), false, true)).append(")"); } blockTags.add(cmtutils.makeSeeTree(sb.toString(), setter)); } diff --git a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java index 8c4eb8a56d6..9143002db3b 100644 --- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java +++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java @@ -725,7 +725,7 @@ public class Utils { return result.toString(); } - private String getTypeSignature(TypeMirror t, boolean qualifiedName, boolean noTypeParameters) { + public String getTypeSignature(TypeMirror t, boolean qualifiedName, boolean noTypeParameters) { return new SimpleTypeVisitor9() { final StringBuilder sb = new StringBuilder(); diff --git a/langtools/test/jdk/javadoc/doclet/testProperty/TestProperty.java b/langtools/test/jdk/javadoc/doclet/testProperty/TestProperty.java new file mode 100644 index 00000000000..69eec3a504c --- /dev/null +++ b/langtools/test/jdk/javadoc/doclet/testProperty/TestProperty.java @@ -0,0 +1,95 @@ +/* + * Copyright (c) 2017, 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 8176231 + * @summary Test JavaFX property. + * @library ../lib/ + * @modules jdk.javadoc/jdk.javadoc.internal.tool + * @build JavadocTester TestProperty + * @run main TestProperty + */ + +public class TestProperty extends JavadocTester { + + public static void main(String... args) throws Exception { + TestProperty tester = new TestProperty(); + tester.runTests(); + } + + @Test + void testArrays() { + javadoc("-d", "out", + "-javafx", + "-sourcepath", testSrc, + "pkg"); + checkExit(Exit.OK); + + checkOutput("pkg/MyClass.html", true, + "
public final ObjectProperty"
+                + "<MyObj> goodProperty
\n" + + "
This is an Object property where the " + + "Object is a single Object.
\n" + + "
\n" + + "
See Also:
\n" + + "
getGood(), \n" + + "" + + "setGood(MyObj)
\n" + + "
", + + "
public final ObjectProperty"
+                + "<MyObj[]> badProperty
\n" + + "
This is an Object property where the " + + "Object is an array.
\n" + + "
\n" + + "
See Also:
\n" + + "
getBad(), \n" + + "" + + "setBad(MyObj[])
\n" + + "
" + ); + + checkOutput("pkg/MyClassT.html", true, + "
public final ObjectProperty"
+                + "<java.util.List<T>> "
+                + "listProperty
\n" + + "
This is an Object property where the " + + "Object is a single List<T>.
\n" + + "
\n" + + "
See Also:
\n" + + "
" + + "getList(), \n" + + "" + + "setList(List)
\n" + + "
" + ); + } +} + diff --git a/langtools/test/jdk/javadoc/doclet/testProperty/pkg/MyClass.java b/langtools/test/jdk/javadoc/doclet/testProperty/pkg/MyClass.java new file mode 100644 index 00000000000..429977f221f --- /dev/null +++ b/langtools/test/jdk/javadoc/doclet/testProperty/pkg/MyClass.java @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2017, 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 pkg; + +/** + * Test program for javadoc properties. + */ +public class MyClass { + + private SimpleObjectProperty good + = new SimpleObjectProperty(); + + /** + * This is an Object property where the Object is a single Object. + * + * @return the good + */ + public final ObjectProperty goodProperty() { + return good; + } + + public final void setGood(MyObj good) { + } + + public final MyObj getGood() { + return good.get(); + } + + + private SimpleObjectProperty bad + = new SimpleObjectProperty(); + + /** + * This is an Object property where the Object is an array. + * + * @return the bad + */ + public final ObjectProperty badProperty() { + return bad; + } + + public final void setBad(MyObj[] bad) { + } + + public final MyObj[] getBad() { + return bad.get(); + } + +} + diff --git a/langtools/test/jdk/javadoc/doclet/testProperty/pkg/MyClassT.java b/langtools/test/jdk/javadoc/doclet/testProperty/pkg/MyClassT.java new file mode 100644 index 00000000000..c428d5b1a2d --- /dev/null +++ b/langtools/test/jdk/javadoc/doclet/testProperty/pkg/MyClassT.java @@ -0,0 +1,32 @@ +package pkg; + +import java.util.List; + +//import javafx.beans.property.*; + +/** + * Test program for javadoc properties. + */ +public class MyClassT { + + private SimpleObjectProperty> list + = new SimpleObjectProperty>(); + + /** + * This is an Object property where the Object is a single {@code List}. + * + * @return the list + */ + public final ObjectProperty> listProperty() { + return list; + } + + public final void setList(List list) { + } + + public final List getList() { + return list.get(); + } + + +} diff --git a/langtools/test/jdk/javadoc/doclet/testProperty/pkg/MyObj.java b/langtools/test/jdk/javadoc/doclet/testProperty/pkg/MyObj.java new file mode 100644 index 00000000000..564f4c76702 --- /dev/null +++ b/langtools/test/jdk/javadoc/doclet/testProperty/pkg/MyObj.java @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2017, 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 pkg; + +public class MyObj { +} + diff --git a/langtools/test/jdk/javadoc/doclet/testProperty/pkg/ObjectProperty.java b/langtools/test/jdk/javadoc/doclet/testProperty/pkg/ObjectProperty.java new file mode 100644 index 00000000000..eecf8c336b8 --- /dev/null +++ b/langtools/test/jdk/javadoc/doclet/testProperty/pkg/ObjectProperty.java @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2017, 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 pkg; + +public class ObjectProperty { } + diff --git a/langtools/test/jdk/javadoc/doclet/testProperty/pkg/SimpleObjectProperty.java b/langtools/test/jdk/javadoc/doclet/testProperty/pkg/SimpleObjectProperty.java new file mode 100644 index 00000000000..3d64a9ee279 --- /dev/null +++ b/langtools/test/jdk/javadoc/doclet/testProperty/pkg/SimpleObjectProperty.java @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2017, 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 pkg; + +public class SimpleObjectProperty { } +