Is there ever a reason to not use the final keyword when catching an exception?

后端 未结 5 914
萌比男神i
萌比男神i 2020-12-16 12:03

I\'ve seen some code as below in some example BlackBerry Java classes:

try
{
    // stuff that will throw an exception
}
catch(final Exception e)
{
    // de         


        
5条回答
  •  自闭症患者
    2020-12-16 12:09

    I've seen a couple of projects where everything what is not modified must be final (e.g. parameters, fields, local vars etc).

    There's also a correspondent style check in PMD code analyzer, which verifies that everything what possible is declared as final.

提交回复
热议问题