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

javac mistakenly reports static use error for enclosing type parameter

XMLWordPrintable

    • b49
    • generic
    • solaris_8

      Date: Sun, 01 Feb 2004 14:32:33 -0500 (EST)
      From: "C. Scott Ananian" <###@###.###>
      Subject: Type variable scope error.
      To: Neal M Gafter <###@###.###>
      Reply-to: "C. Scott Ananian" <###@###.###>

      In the following code:
      ----
      import java.util.Set;
      public class JBug<T> {
          abstract class Inner1 implements Set<T> { }
          static class Inner2<U> {
              class Inner3 { U z; }

              abstract class Inner4 implements Set<U> { }
          }
      }
      ----
      the current 2.4a1 compiler gives the following error:
      ----
      JBug.java:7: non-static class U cannot be referenced from a static context
              abstract class Inner4 implements Set<U> { }
                                                   ^
      1 error
      ----

      This is incorrect, I think. We're no longer in a static context, although
      I suspect that the compiler is getting confused because the parent context
      is static.
       --scott

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

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: