test/java/lang/reflect/Generics/getAnnotationTest.java

Print this page




   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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
  20  * CA 95054 USA or visit www.sun.com if you need additional information or
  21  * have any questions.
  22  */
  23 
  24 /*
  25  * @test
  26  * @bug 4979440
  27  * @summary Test for signature parsing corner case
  28  * @author Joseph D. Darcy
  29  * @compile -source 1.5 getAnnotationTest.java
  30  * @run main getAnnotationTest
  31  */
  32 
  33 import java.lang.reflect.*;
  34 import java.lang.annotation.*;
  35 
  36 /*
  37  * Make sure:
  38  * 1. getAnnotation can be called directly
  39  * 2. getAnnotation can be called reflectively
  40  * 3. generic information methods on the Method object for
  41  * getAnnotation can be called
  42  */
  43 
  44 public class getAnnotationTest {
  45     public static void main (String[] args) throws Throwable {
  46         // Base level
  47         Class c = Class.forName("java.lang.annotation.Retention");
  48         Annotation result  = c.getAnnotation(Retention.class);
  49         // System.out.println("Base result:" + result);
  50 


   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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
  20  * CA 95054 USA or visit www.sun.com if you need additional information or
  21  * have any questions.
  22  */
  23 
  24 /*
  25  * @test
  26  * @bug 4979440
  27  * @summary Test for signature parsing corner case
  28  * @author Joseph D. Darcy


  29  */
  30 
  31 import java.lang.reflect.*;
  32 import java.lang.annotation.*;
  33 
  34 /*
  35  * Make sure:
  36  * 1. getAnnotation can be called directly
  37  * 2. getAnnotation can be called reflectively
  38  * 3. generic information methods on the Method object for
  39  * getAnnotation can be called
  40  */
  41 
  42 public class getAnnotationTest {
  43     public static void main (String[] args) throws Throwable {
  44         // Base level
  45         Class c = Class.forName("java.lang.annotation.Retention");
  46         Annotation result  = c.getAnnotation(Retention.class);
  47         // System.out.println("Base result:" + result);
  48