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

javac allows incorrect value for array initializer in annotation

    XMLWordPrintable

    Details

    • Subcomponent:
    • CPU:
      generic
    • OS:
      generic

      Description



      Name: viR10068 Date: 12/01/2003


      The spec 'A Program Annotation Facility for the Java Programming Language
      Version 0.41' says:
      " NormalAnnotation:
      ....
          MemberValueArrayInitializer:
              { MemberValues<opt> ,<opt> }
      "
      But the compiler jdk1.5-b29 allows single int values for the
      array initializer.
              
      The following JCK tests are failed due to this bug:
      lang/ANNOT/annot029/annot02902m2/annot02902m2.html

      The source code:
      -------------------------- test.java ----------------------------
      import java.io.PrintStream;
      @interface testID {
          int [] id() default {0, 0};
          boolean [] bVal() default {true};
      }

      public class test {

          @testID (id = (123)) public void m() {
          }

          public static void main(String args[]) {
              System.exit(run(args, System.out) + 95/*STATUS_TEMP*/);
          }

          public static int run(String args[],PrintStream out) {
              return 0;/*STATUS_PASSED*/
          }
      }
      -----------------------------------------------------------------

      Execution log (no errors reported):
      %jdk1.5.0-b29/solaris-sparc/bin/javac -source 1.5 -target 1.5 -version test.java
      javac 1.5.0-beta
      %

      ======================================================================

        Attachments

          Activity

            People

            Assignee:
            gafter Neal Gafter
            Reporter:
            vivsunw Viv Viv (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: