1 /*
   2  * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /*
  25  * @test
  26  * @bug     5040830
  27  * @summary Verify information annotation strings with exception proxies
  28  * @compile -source 8 version1/Utopia.java version1/DangerousAnnotation.java version1/Fleeting.java 
  29  * @compile  AnnotationHost.java
  30  * @build ExceptionalToStringTest
  31  * @run main ExceptionalToStringTest
  32  * @clean Utopia DangerousAnnotation
  33  * @compile -source 8 -implicit:none version2/Utopia.java
  34  * @compile -source 8 -implicit:none version2/DangerousAnnotation.java
  35  * @clean Fleeting
  36  * @run main ExceptionalToStringTest
  37  */
  38 
  39 // Version 1 of the source, extra enum constant, 
  40 
  41 // EnumConstantNotPresentException - "Thrown when an application tries
  42 // to access an enum constant by name and the enum type contains no
  43 // constant with the specified name."
  44 
  45 // AnnotationTypeMismatchException - "Thrown to indicate that a
  46 // program has attempted to access an element of an annotation whose
  47 // type has changed after the annotation was compiled (or serialized)"
  48 
  49 // TypeNotPresentException - "Thrown when an application tries to
  50 // access a type using a string representing the type's name, but no
  51 // definition for the type with the specified name can be found."
  52 
  53 public class ExceptionalToStringTest {
  54     public static void main(String... args) {
  55         System.out.println(AnnotationHost.class.getAnnotation(DangerousAnnotation.class));
  56     }
  57 }