the whole point in the final keyword on member variables is that we can trust in that variable never being null.
There are two ways to handle this situation:
- don't pass c to the constructor but the value returned by the method call.
- a) don't handle the exception thrown by the method call.
b) wrap the caught exception in a RuntimeException and throw that.
The "work around" you found is dangerous because other programmers will not expect this member being null so NPEs will occure often...
If you want us to comment on code constructs you need to post the actual code.
The code you posted is incomplete so it can't possiblly give the error you say it does.
Post the actual code that supports your statements.