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

javac does not allow shorthand for single-member annotation

    XMLWordPrintable

    Details

    • Subcomponent:
    • CPU:
      generic
    • OS:
      generic

      Description



      Name: viR10068 Date: 12/08/2003


      The spec 'A Program Annotation Facility for the Java Programming Language' says:
      "The third form of annotation, single-member annotation, is a
      shorthand designed for use with single-member annotation types:

          SingleMemberAnnotation:
              @ TypeName ( MemberValue )

      It is shorthand for the normal annotation:

              @TypeName ( value = MemberValue )
      "
      But the compiler jdk1.5-b30 reports an error for the use of
      SingleMemberAnnotation.
              
      The following JCK tests are failed due to this bug:
      lang/ANNOT/annot046/annot04601/annot04601.html

      The source code:
      -------------------------- test.java ----------------------------
      import java.io.PrintStream;
      @interface testID {
          int id();
      }

      public class test {

          @testID(1) 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:
      % jdk1.5.0-b30/solaris-sparc/bin/javac -source 1.5 -target 1.5 -version test.java
      javac 1.5.0-beta
      test.java:8: cannot find symbol
      symbol : method value()
      location: @interface testID
          @testID(1) public void m() {
                  ^
      1 error
      %

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

        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: