2 Replies Latest reply: May 7, 2012 6:57 PM by Cjmurray-Oracle RSS

    Java 7 Spec error

    794029
      (Mod's, please move this to the correct place if this isn't the correct place to post this)

      Within Java 7's spec, section: 8.1.2.
      It states:


      It is a compile-time error to refer to a type parameter of a generic class C anywhere in:

      - the declaration of a static member of C, or

      - the declaration of a static member of any type declaration nested within C, or

      - a static initializer of C, or

      - any class nested within C.
      However, the last line should be:
      - a static initializer of any class nested within C.
      The last Java Spec (5.0), worded it as:
      It is a compile-time error to refer to a type parameter of a class C anywhere in the declaration of a static member of C or the declaration of a static member of any type declaration nested within C. It is a compile-time error to refer to a type parameter of a class C within a static initializer of C or any class nested within C.
      And i believe whoever wrote the latest spec, took the sentence:
      It is a compile-time error to refer to a type parameter of a class C within a static initializer of C or any class nested within C.
      And interpreted:

      "within a static initializer of C or any class nested within C"

      as:
      - within a static initializer of C
      or
      - any class nested within C
      instead of:
      within a static initializer of:
      - C
      or
      - any class nested within C
        • 1. Re: Java 7 Spec error
          rukbat
          00jt wrote:
          (Mod's, please move this to the correct place if this isn't the correct place to post this)
          Moved from Java Essentials --> Training/Learning/Certification
          to the Documentation forum, hopefully for closer topic alignment.
          • 2. Re: Java 7 Spec error
            Cjmurray-Oracle
            I sent a pointer to this thread to the appropriate person, who asked me to post this in reply:

            "Thank you for spotting this mistake. Your analysis and correction are totally right. The online JLS7 will be updated as soon as possible."