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

javac allows illegal self-reference

    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:
      "
      Annotation types must not contain members of the same annotation type,
      either directly or indirectly. In other words, this is illegal:

      // Illegal self-reference!!
      @interface SelfRef {
          SelfRef value();
      }
      "
      But the compiler jdk1.5-b30 compile it successfully.
              
      The following JCK tests are failed due to this bug:
      lang/ANNOT/annot047/annot04701/annot04701.html

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

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

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

      Name: viR10068 Date: 12/08/2003


      Also for illegal circularity:
      "
      Annotation types must not contain members of the same annotation type,
      either directly or indirectly. In other words, this is illegal:

      // Illegal circularity!!
      @interface Ping {
          Pong value();
      }

      @interface Pong {
          Ping value();
      }
      "
      But the compiler jdk1.5-b30 compile it successfully.
              
      The following JCK tests are failed due to this bug:
      lang/ANNOT/annot048/annot04801/annot04801.html

      The source code:
      -------------------------- test.java ----------------------------
      @interface Ping {
          Pong value();
      }

      @interface Pong {
          Ping value();
      }
      -----------------------------------------------------------------

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


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

        Attachments

          Issue Links

            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: