The spec specifically disallows assigning to a final parameter or a final exception variable, but javac allows it in certain cases. Here is an example:
public class T {
public static void main(final String[] args) {
if (true ? true : (args = null) == null);
}
}
public class T {
public static void main(final String[] args) {
if (true ? true : (args = null) == null);
}
}
- duplicates
-
JDK-4533915 javac should not analyze final parameters for definite assignment status
- Closed