jdk-24/test/langtools/tools/javac/DefiniteAssignment/DefAssignAfterThis_1.java

23 lines
501 B
Java
Raw Normal View History

2007-12-01 00:00:00 +00:00
/*
* @test /nodynamiccopyright/
2007-12-01 00:00:00 +00:00
* @bug 4087865 4277291
* @summary Verify definite assignment of blank finals after 'this(...)'
* @author William Maddox (maddox)
*
* @compile/fail/ref=DefAssignAfterThis_1.out -XDrawDiagnostics DefAssignAfterThis_1.java
2007-12-01 00:00:00 +00:00
*/
public class DefAssignAfterThis_1 {
final int x;
DefAssignAfterThis_1() {
this(0);
x = 1; // ERROR -- duplicate assignment to blank final
}
DefAssignAfterThis_1(int i) {
x = 1;
}
}