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

annotation syntax allows extra ',' in paramater list.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 5.0
    • 5.0
    • tools
    • b40
    • sparc
    • solaris_2.1

      Define an Attribute with a N fields and after specifying N values for them the compiler allows to add a one more ','. The java code compiles with out throwing any error.
      The following is code and console.

      <code>
      public @ann1(isStatic=false,type="class" ,)
          class TestM4 {
          @ann1(type="class",isStatic=false,) public void myMethod() {
      System.out.println(" In side the myMethod");
          }

          public static void main(String arg[]) {
          }
      }

      @interface ann1 {
          String type();
          boolean isStatic();
      }
      </code>
      <console>
      vishalb:/home/vv145429/tiger/src/metadata/bugs 19 % \rm *.class
      vishalb:/home/vv145429/tiger/src/metadata/bugs 20 % c
      vishalb:/home/vv145429/tiger/src/metadata/bugs 21 % ls
      ./ TestM4.java
      ../ Test1.java TestM4.java~
      vishalb:/home/vv145429/tiger/src/metadata/bugs 22 % javac -source 1.5 TestM4.java
      vishalb:/home/vv145429/tiger/src/metadata/bugs 24 %
      </console>

            gafter Neal Gafter (Inactive)
            vvegurusunw Viswadeep Veguru (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: