5047N/A/*
5047N/A * Copyright (c) 2002, 2008, Oracle and/or its affiliates. All rights reserved.
5047N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5047N/A *
5047N/A * This code is free software; you can redistribute it and/or modify it
5047N/A * under the terms of the GNU General Public License version 2 only, as
5047N/A * published by the Free Software Foundation.
5047N/A *
5047N/A * This code is distributed in the hope that it will be useful, but WITHOUT
5047N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
5047N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
5047N/A * version 2 for more details (a copy is included in the LICENSE file that
5047N/A * accompanied this code).
5047N/A *
5047N/A * You should have received a copy of the GNU General Public License version
5047N/A * 2 along with this work; if not, write to the Free Software Foundation,
5047N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
5047N/A *
5047N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
5047N/A * or visit www.oracle.com if you need additional information or have any
5047N/A * questions.
5047N/A */
5047N/A
5047N/A/*
5047N/A * @test
5047N/A * @bug 4628281
5383N/A * @summary Int. links missing from return/param types when .java files passd in
5385N/A * @author gafter
5047N/A * @run main MethodLinks
5047N/A */
5047N/A
5047N/Aimport com.sun.javadoc.*;
5047N/Aimport java.util.*;
5047N/A
5047N/Apublic class MethodLinks extends Doclet
5047N/A{
5047N/A public static void main(String[] args) {
5383N/A if (com.sun.tools.javadoc.Main.
5383N/A execute("javadoc", "MethodLinks", MethodLinks.class.getClassLoader(),
5383N/A new String[] {System.getProperty("test.src", ".") +
5383N/A java.io.File.separatorChar + "MethodLinks.java"}
5383N/A ) != 0)
5047N/A throw new Error();
5047N/A }
5047N/A
5047N/A /** The parameter type and return type should link to the current
5047N/A * class. */
5047N/A public MethodLinks SAMPLE(MethodLinks x) {
5047N/A return x;
5047N/A }
5047N/A
5047N/A public static boolean start(com.sun.javadoc.RootDoc root) {
5047N/A ClassDoc[] classes = root.classes();
5047N/A if (classes.length != 1)
5047N/A throw new Error("1 " + Arrays.asList(classes));
5047N/A ClassDoc self = classes[0];
5047N/A MethodDoc[] allMethods = self.methods();
5047N/A MethodDoc SAMPLE = null;
5047N/A for (int i=0; i<allMethods.length; i++)
5047N/A if (allMethods[i].name().equals("SAMPLE"))
5047N/A SAMPLE = allMethods[i];
5047N/A return
5047N/A self == SAMPLE.parameters()[0].type().asClassDoc()
5047N/A &&
5047N/A self == SAMPLE.returnType().asClassDoc()
5047N/A ;
5047N/A }
5047N/A}
5047N/A