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

JSR175 1.0prd allows "ConstantDeclaration" but compilder doesn't accept it

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 :
      The metadata-1_0-prd-spec/metadata-public-draft.html document allows "AnnotationTypeMemberDeclaration" to contain a "ConstantDeclaration", but the following code will not compile.

      (is this is what is ment by ConstantDeclaration?)

      public @interface Annot1 {
          String value();
          int CONSTANT = 3;
      }



      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      Annot1.java:5: an @interface may not contain a field
          int CONSTANT = 3;
              ^
      1 error


      REPRODUCIBILITY :
      This bug can be reproduced always.

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

      public @interface Annot1 {
          String value();
          int CONSTANT = 3;
      }

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

            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: