Code analyzers: PMD & FindBugs

前端 未结 2 446
终归单人心
终归单人心 2021-02-06 07:30

1. Regarding PMD:

1.1 How do I set the PMD checks, to ignore some of them, like \"Variable name is too short, or too long\", \"Remove empty constructor,

2条回答
  •  再見小時候
    2021-02-06 07:46

    Here some idea / answer

    1.4 What is the reason to assign null to a object? If you reuse the same variable, there's not reason to set it to null before.

    2.1 The reason about this warning, is to be sure that all your instance of the class Main have the same static fields. In your Main class, you could have static Calendar appCalendar = Calendar.getInstance() ;

    about your 2.2 you're right, with the null check, you are sure that you'll not have any NullPointerException. We never know when your BufferedReader can block/trash, this doesn't happen often (in my experience) but we never know when a hard drive crash.

提交回复
热议问题