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

Parser regression in JDK 8 when compiling super.x

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P3
    • 8
    • 8, 8-repo-lambda
    • tools
    • b93
    • Verified

    Description

      The following code will fail to compile:

      class A {
        int b = 1;
      }

      class B extends A {
        int b = 12;

        int m() { return(super.b); } //<------------

        public static void main(String[] args) {
            System.out.println(new B().m());
        }
      }

      Output:

      Bug.java:8: error: illegal start of type
        int m() { return(super.b); }
                         ^
      Bug.java:8: error: illegal start of expression
        int m() { return(super.b); }
                              ^
      Bug.java:8: error: ';' expected
        int m() { return(super.b); }
                               ^
      Bug.java:8: error: illegal start of expression
        int m() { return(super.b); }
                                ^
      4 errors

      Attachments

        Activity

          People

            mcimadamore Maurizio Cimadamore
            mcimadamore Maurizio Cimadamore
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: