Name: tb29552 Date: 07/30/97
Reported by: "Roly Perera" <###@###.###>
In the following code, x is a blank final. Javac allows it to
be assigned twice:
void f() {
final int x;
try {
x = 4;
throw new Exception();
}
catch (Exception e) {
x = 5; // ???
}
}
See a longer example in the Comments section.
======================================================================
Another example (final variable is also static), from 4094677:
class X {
static final int i ;
static {
try{
i = 3;
throw new Throwable();
}catch(Throwable thb) { i = 4;}
}
public static void main( String[] argv ) {
X ox = new X();
System.out.println(ox.i);
}
}
william.maddox@Eng 1997-11-21
- duplicates
-
JDK-4094677 Static blank final variables can be assigned twice in try/catch blocks.
- Closed