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

Class Literals: interfaceI{Class c=I.class;}, causes errors and should not

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.1.3, 1.1.4, 1.1.5
    • tools
    • None
    • generic, x86
    • solaris_2.5.1, windows_nt

      The Inner Classes spec has NO restrictions in this area on the ".class"
       expression syntax, this should just WORK.

      cruella<104> cat I.java
      interface I {
          Class c = I.class;
      }
      cruella<105> javac I.java
      I.java:1: Interface methods can't be native, static, synchronized, final, private, or protected : java.lang.Class class$(java.lang.String)
      interface I {
                ^
      I.java:2: Can't make static reference to method java.lang.Class class$(java.lang.String) in interface I.
          Class c = I.class;
                     ^
      2 errors

      ---------------------------

      There is no spec basis for this failure.

      -kto

            wmaddoxsunw William Maddox (Inactive)
            ohair Kelly Ohair (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: