-
Bug
-
Resolution: Fixed
-
P2
-
8
-
b13
-
Verified
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8041958 | 9 | Paul Govereau | P2 | Closed | Fixed | b12 |
JDK-8045155 | 8u25 | Paul Govereau | P2 | Resolved | Fixed | b01 |
JDK-8052594 | emb-8u26 | Paul Govereau | P2 | Resolved | Fixed | b17 |
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.
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.
- backported by
-
JDK-8045155 Definitely unassigned field can be accessed
- Resolved
-
JDK-8052594 Definitely unassigned field can be accessed
- Resolved
-
JDK-8041958 Definitely unassigned field can be accessed
- Closed
- duplicates
-
JDK-6583592 Read access to uninitialized final member is allowed before initialization.
- Closed
-
JDK-8042405 Can't compile Lambda referencing final variable initialized on constructor
- Closed
- relates to
-
JDK-7004835 Different handling for final in constructor
- Closed
(1 relates to)