Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4991749

(metadata) AnnotationTypeMemberDeclarations allows ClassDeclaration and others

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • None
    • 5.0
    • tools
    • x86
    • windows_2000



      Name: rmT116609 Date: 02/09/2004


      FULL PRODUCT VERSION :
      java version "1.5.0-beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta-b32c)
      Java HotSpot(TM) Client VM (build 1.5.0-beta-b32c, mixed mode)

      A DESCRIPTION OF THE PROBLEM :
      in the jsr175 spec (metadata-1_0-prd-spec/metadata-public-draft.html), the AnnotationTypeMemberDeclaration production allows:
              ConstantDeclaration
              ClassDeclaration
              InterfaceDeclaration
              EnumDeclaration
              AnnotationTypeDeclaration

      but the compile doesn't want to seem to have a bar of it.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      compile the following code


      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      foo\metadata\Annot2.java:6: an @interface may not contain a type declaration
          public class InnerClass
                 ^
      foo\metadata\Annot2.java:13: an @interface may not contain a type declaration
          public enum InnerEnum {
                 ^


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      package foo.metadata;

      public @interface Annot2 {
          String value();
          
          public class InnerClass
          {
              public void foo() {
                  System.out.println("Annot2.InnerClass.foo");
              }
          }

          public enum InnerEnum {
              RED, GREEN, BLUE;
              public void foo() {
                  System.out.println("Annot2.InnerEnum.foo");
              }
          }
          
      }

      ---------- END SOURCE ----------
      (Incident Review ID: 238054)
      ======================================================================

            gafter Neal Gafter (Inactive)
            rmandalasunw Ranjith Mandala (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: