T6551367.java revision 3233:b5d08bc0d224
1197383Sdelphij/*
2197571Sdelphij * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
3205297Sjkim * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4197571Sdelphij *
5197571Sdelphij * This code is free software; you can redistribute it and/or modify it
6197571Sdelphij * under the terms of the GNU General Public License version 2 only, as
7197571Sdelphij * published by the Free Software Foundation.
8197571Sdelphij *
9197571Sdelphij * This code is distributed in the hope that it will be useful, but WITHOUT
10197571Sdelphij * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11197571Sdelphij * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12197571Sdelphij * version 2 for more details (a copy is included in the LICENSE file that
13197571Sdelphij * accompanied this code).
14197571Sdelphij *
15197571Sdelphij * You should have received a copy of the GNU General Public License version
16197571Sdelphij * 2 along with this work; if not, write to the Free Software Foundation,
17197571Sdelphij * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18197571Sdelphij *
19197571Sdelphij * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20197571Sdelphij * or visit www.oracle.com if you need additional information or have any
21197571Sdelphij * questions.
22197571Sdelphij */
23197571Sdelphij
24197571Sdelphij/**
25197571Sdelphij * @test
26197383Sdelphij * @bug     6551367
27197383Sdelphij * @summary javadoc throws ClassCastException when an link tag tries to reference constructor.
28197383Sdelphij * @author  A. Sundararajan
29197383Sdelphij * @modules jdk.javadoc/com.sun.tools.doclets.standard
30197383Sdelphij * @run main T6551367 T6551367.java
31197383Sdelphij */
32197383Sdelphij
33197383Sdelphijimport java.io.File;
34198251Sjkim
35197383Sdelphijimport jdk.javadoc.doclet.DocletEnvironment;
36197442Sjkim
37198251Sjkimimport static jdk.javadoc.internal.tool.Main.execute;
38197383Sdelphij
39197383Sdelphijpublic class T6551367 extends jdk.javadoc.internal.doclets.standard.Standard {
40200591Sjkim    public T6551367() {}
41197383Sdelphij    public boolean run(DocletEnvironment root) {
42198251Sjkim        return true;
43198251Sjkim    }
44198251Sjkim    /** Here, in the javadoc for this method, I try to link to
45198251Sjkim     *  {@link #<init> a constructor}.
46198251Sjkim     */
47198251Sjkim    public static void main(String... args) {
48198251Sjkim        File testSrc = new File(System.getProperty("test.src", "."));
49197383Sdelphij        File destDir = new File(System.getProperty("user.dir", "."));
50197383Sdelphij        for (String file : args) {
51197383Sdelphij            File source = new File(testSrc, file);
52210877Sjkim            String[] array = {
53207456Sjkim                "-docletpath", System.getProperty("test.classes", "."),
54207456Sjkim                "-doclet", "T6551367",
55210877Sjkim                "-Xdoclint:none",
56210877Sjkim                source.getPath(),
57210877Sjkim                "-d",
58207456Sjkim                destDir.getAbsolutePath()
59210877Sjkim            };
60210877Sjkim
61211120Sjkim            int rc = execute(array);
62211120Sjkim            if (rc != 0)
63211120Sjkim                throw new Error("unexpected exit from javadoc: " + rc);
64211120Sjkim        }
65211120Sjkim    }
66211120Sjkim}
67211120Sjkim