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

Regression: invalid resolution of supertype for local class

    Details

    • Subcomponent:
    • Introduced In Build:
      b03
    • Introduced In Version:
      7
    • Resolved In Build:
      b109
    • CPU:
      unknown
    • OS:
      generic
    • Verification:
      Verified

      Description

      Hi,
         recently, we have recieved a report about an incorrectly compiled class (http://netbeans.org/bugzilla/show_bug.cgi?id=187452). Consider the following code:
      ---------------------------------------------------------
      public class p1 {

          public static void resolve() {
              class b {
                  int x = 1;
              }
              class c extends b {}

              System.out.println(new c().x);
          }

          static class b {}
      }
      ---------------------------------------------------------

      Using a recent JDK7 javac, there is a compilation error that "x" cannot be resolved on the line with "new c().x". This compilation error does not seem correct to me. JDK6 javac accepts that code. I tried to find out the cause, and it seems that this was introduced by a fix for bug 5060485.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                mcimadamore Maurizio Cimadamore
                Reporter:
                mcimadamore Maurizio Cimadamore
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: