8173804: javadoc throws UnsupportedOperationException: should not happen

Reviewed-by: jjg
This commit is contained in:
Kumar Srinivasan 2017-02-15 11:23:52 -08:00
parent 388550d1a4
commit dfa7ec7ad8
3 changed files with 85 additions and 7 deletions

View File

@ -1885,11 +1885,6 @@ public class Utils {
return visit(t.getComponentType());
}
@Override
public String visitPrimitive(PrimitiveType t, Void p) {
return t.toString();
}
@Override
public String visitTypeVariable(javax.lang.model.type.TypeVariable t, Void p) {
// The knee jerk reaction is to do this but don't!, as we would like
@ -1900,9 +1895,10 @@ public class Utils {
}
@Override
protected String defaultAction(TypeMirror e, Void p) {
throw new UnsupportedOperationException("should not happen");
protected String defaultAction(TypeMirror t, Void p) {
return t.toString();
}
}.visit(t);
}

View File

@ -0,0 +1,50 @@
/*
* 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 8173804
* @summary make sure doclet can handle missing types
* @library ../lib
* @modules jdk.javadoc/jdk.javadoc.internal.tool
* @build JavadocTester
* @run main TestMissingType
*/
public class TestMissingType extends JavadocTester {
public static void main(String... args) throws Exception {
TestMissingType tester = new TestMissingType();
tester.runTests();
}
@Test
void test() {
javadoc("-d", "out",
"-use",
"-sourcepath", testSrc,
"p");
checkExit(Exit.OK);
checkFiles(true, "p/class-use/MissingType.html");
}
}

View File

@ -0,0 +1,32 @@
/*
* 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 p;
public final class MissingType {
/**
* Do something with a missing type.
*
* @param out use the missing type
*/
public void encode(MissingMe out) {}
}