Thu, 21 Feb 2013 15:27:05 +0000
8008444: Inherited generic functional descriptors are merged incorrectly
Summary: Missing call to Types.createMethodWithThrownTypes
Reviewed-by: jjg
jjg@912 | 1 | /* |
jjg@1490 | 2 | * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. |
jjg@912 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
jjg@912 | 4 | * |
jjg@912 | 5 | * This code is free software; you can redistribute it and/or modify it |
jjg@912 | 6 | * under the terms of the GNU General Public License version 2 only, as |
jjg@912 | 7 | * published by the Free Software Foundation. |
jjg@912 | 8 | * |
jjg@912 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
jjg@912 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
jjg@912 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
jjg@912 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
jjg@912 | 13 | * accompanied this code). |
jjg@912 | 14 | * |
jjg@912 | 15 | * You should have received a copy of the GNU General Public License version |
jjg@912 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
jjg@912 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
jjg@912 | 18 | * |
jjg@912 | 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
jjg@912 | 20 | * or visit www.oracle.com if you need additional information or have any |
jjg@912 | 21 | * questions. |
jjg@912 | 22 | */ |
jjg@912 | 23 | |
jjg@912 | 24 | /* |
jjg@912 | 25 | * @test |
jjg@912 | 26 | * @bug 6964914 |
jjg@912 | 27 | * @summary javadoc does not output number of warnings using user written doclet |
jjg@912 | 28 | */ |
jjg@912 | 29 | |
jjg@912 | 30 | import java.io.*; |
jjg@912 | 31 | |
jjg@912 | 32 | /** |
jjg@912 | 33 | * Dummy javadoc comment. |
jjg@912 | 34 | * @author jjg |
jjg@912 | 35 | * @see DoesNotExist |
jjg@912 | 36 | */ |
jjg@912 | 37 | public class TestStdDoclet { |
jjg@912 | 38 | public static void main(String... args) throws Exception { |
jjg@912 | 39 | new TestStdDoclet().run(); |
jjg@912 | 40 | } |
jjg@912 | 41 | |
jjg@912 | 42 | /** |
jjg@912 | 43 | * More dummy comments. |
jjg@912 | 44 | * @throws DoesNotExist oops, javadoc does not see this |
jjg@912 | 45 | * @see DoesNotExist |
jjg@912 | 46 | */ |
jjg@912 | 47 | void run() throws Exception { |
jjg@912 | 48 | File javaHome = new File(System.getProperty("java.home")); |
jjg@912 | 49 | if (javaHome.getName().equals("jre")) |
jjg@912 | 50 | javaHome = javaHome.getParentFile(); |
jjg@912 | 51 | File javadoc = new File(new File(javaHome, "bin"), "javadoc"); |
jjg@912 | 52 | File testSrc = new File(System.getProperty("test.src")); |
jjg@912 | 53 | |
jjg@912 | 54 | // run javadoc in separate process to ensure doclet executed under |
jjg@912 | 55 | // normal user conditions w.r.t. classloader |
jjg@912 | 56 | String thisClassName = TestStdDoclet.class.getName(); |
jjg@912 | 57 | Process p = new ProcessBuilder() |
jjg@912 | 58 | .command(javadoc.getPath(), |
jjg@912 | 59 | "-J-Xbootclasspath:" + System.getProperty("sun.boot.class.path"), |
jjg@1490 | 60 | "-Xdoclint:none", |
jjg@912 | 61 | "-package", |
jjg@912 | 62 | new File(testSrc, thisClassName + ".java").getPath()) |
jjg@912 | 63 | .redirectErrorStream(true) |
jjg@912 | 64 | .start(); |
jjg@912 | 65 | |
jjg@912 | 66 | int actualDocletWarnCount = 0; |
jjg@912 | 67 | int reportedDocletWarnCount = 0; |
jjg@912 | 68 | BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream())); |
jjg@912 | 69 | try { |
jjg@912 | 70 | String line; |
jjg@912 | 71 | while ((line = in.readLine()) != null) { |
jjg@912 | 72 | System.err.println(line); |
jjg@912 | 73 | if (line.contains("DoesNotExist")) |
jjg@912 | 74 | actualDocletWarnCount++; |
jjg@912 | 75 | if (line.matches("[0-9]+ warning(s)?")) |
jjg@912 | 76 | reportedDocletWarnCount = |
jjg@912 | 77 | Integer.valueOf(line.substring(0, line.indexOf(" "))); |
jjg@912 | 78 | } |
jjg@912 | 79 | } finally { |
jjg@912 | 80 | in.close(); |
jjg@912 | 81 | } |
jjg@912 | 82 | int rc = p.waitFor(); |
jjg@912 | 83 | if (rc != 0) |
jjg@912 | 84 | System.err.println("javadoc failed, rc:" + rc); |
jjg@912 | 85 | |
jjg@912 | 86 | int expectedDocletWarnCount = 2; |
jjg@912 | 87 | checkEqual("actual", actualDocletWarnCount, "expected", expectedDocletWarnCount); |
jjg@912 | 88 | checkEqual("actual", actualDocletWarnCount, "reported", reportedDocletWarnCount); |
jjg@912 | 89 | } |
jjg@912 | 90 | |
jjg@912 | 91 | /** |
jjg@912 | 92 | * Private method should not cause a warning. |
jjg@912 | 93 | * @see DoesNotExist |
jjg@912 | 94 | */ |
jjg@912 | 95 | private void checkEqual(String l1, int i1, String l2, int i2) throws Exception { |
jjg@912 | 96 | if (i1 != i2) |
jjg@912 | 97 | throw new Exception(l1 + " warn count, " + i1 + ", does not match " |
jjg@912 | 98 | + l2 + " warn count, " + i2); |
jjg@912 | 99 | } |
jjg@912 | 100 | |
jjg@912 | 101 | } |