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

Compiler issues wrong error message when we declare Enumerated Type within a Local Nested Class

    XMLWordPrintable

Details

    • generic
    • generic

    Description

      Tried on Solaris JDK build 1.6.0-ea-b38

      <Code>
      class TestEnum {
      static class StaticClazz {
      void method() {
      class LocalClazz {
      enum {MONDAY}
      }
      }
      }
      }
      </Code>
      Output when compiled:
      <Output>
      java2:/home/rg157576 20 % javac -Xlint TestEnum.java
      TestEnum.java:7: enum declarations allowed only in static contexts
                                       enum Days {MONDAY};
                                       ^
      error: non-static variable this cannot be referenced from a static context
      TestEnum.java:7: inner classes cannot have static declarations
                                       enum Days {MONDAY};
      </Output>

        Here Second error message doesn't contain line Number,Description and error message seems to be wrong.

      ###@###.### 2005-06-04 10:29:32 GMT
      ###@###.### 2005-06-06 05:17:05 GMT

      Attachments

        Activity

          People

            jjg Jonathan Gibbons
            rgutupalsunw Rajendra Gutupalli (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: