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

Definitely unassigned field can be accessed

    Details

    • Subcomponent:
    • Resolved In Build:
      b13
    • Verification:
      Verified

      Backports

        Description

        The following erroneous code compiles on JDK8:

        public class Test {
          final int y;
          final int z = this.y;
          { y = 1; }
        }

        If z is instead initialized to 'y', then the appropriate error is given ("variable y might not have been initialized").

        This may be related to a javac change for 7004835, whereby 'this.y' (not just 'y') is an "access" to a variable. Of course, since 'this.y' is an access, and the y variable is definitely unassigned at that point, an error is due.

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  pgovereau Paul Govereau (Inactive)
                  Reporter:
                  abuckley Alex Buckley
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  6 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: