test/tools/javac/annotations/pos/Primitives.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 5034991 5040842 5040853
  27  * @summary Modify class-file representation of Class-valued annotation elements
  28  * @author gafter
  29  *
  30  * @compile -source 1.5 Primitives.java
  31  * @run main Primitives
  32  */
  33 
  34 public class Primitives {
  35     @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.RUNTIME)
  36     @interface A {
  37         Class value() default void.class;
  38     }
  39 
  40     @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.RUNTIME)
  41     @interface B {
  42         Class[] value() default { void.class };
  43     }
  44 
  45     @A()
  46     @B()
  47     static class T1 {}
  48 
  49     @A(int.class)
  50     @B({void.class, byte.class, char.class, short.class, int.class, long.class,
  51         boolean.class, float.class, double.class, A[].class, int[].class})




   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 5034991 5040842 5040853
  27  * @summary Modify class-file representation of Class-valued annotation elements
  28  * @author gafter



  29  */
  30 
  31 public class Primitives {
  32     @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.RUNTIME)
  33     @interface A {
  34         Class value() default void.class;
  35     }
  36 
  37     @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.RUNTIME)
  38     @interface B {
  39         Class[] value() default { void.class };
  40     }
  41 
  42     @A()
  43     @B()
  44     static class T1 {}
  45 
  46     @A(int.class)
  47     @B({void.class, byte.class, char.class, short.class, int.class, long.class,
  48         boolean.class, float.class, double.class, A[].class, int[].class})