TestExceptions.java revision 553
215N/A/*
553N/A * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
215N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
215N/A *
215N/A * This code is free software; you can redistribute it and/or modify it
215N/A * under the terms of the GNU General Public License version 2 only, as
215N/A * published by the Free Software Foundation.
215N/A *
215N/A * This code is distributed in the hope that it will be useful, but WITHOUT
215N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
215N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
215N/A * version 2 for more details (a copy is included in the LICENSE file that
215N/A * accompanied this code).
215N/A *
215N/A * You should have received a copy of the GNU General Public License version
215N/A * 2 along with this work; if not, write to the Free Software Foundation,
215N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
215N/A *
553N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
553N/A * or visit www.oracle.com if you need additional information or have any
553N/A * questions.
215N/A */
215N/A
215N/A/*
215N/A * @test
215N/A * @bug 6794071
215N/A * @summary Test that exceptions have a proper parent class
215N/A * @author Joseph D. Darcy
215N/A */
215N/A
215N/Aimport javax.lang.model.UnknownEntityException;
215N/Aimport javax.lang.model.element.*;
215N/Aimport javax.lang.model.type.*;
215N/A
215N/A/*
215N/A * Verify UnknownFooExceptions can be caught with a common parent
215N/A * exception.
215N/A */
215N/Apublic class TestExceptions {
215N/A public static void main(String... args) {
215N/A RuntimeException[] exceptions = {
215N/A new UnknownElementException((Element)null, (Object)null),
215N/A new UnknownAnnotationValueException((AnnotationValue) null, (Object) null),
215N/A new UnknownTypeException((TypeMirror)null, (Object)null)
215N/A };
215N/A
215N/A for(RuntimeException exception : exceptions) {
215N/A try {
215N/A throw exception;
215N/A } catch (UnknownEntityException uee) {
215N/A ;
215N/A }
215N/A }
215N/A }
215N/A}