PMD規則之Finalizer Rules

·  EmptyFinalizer: If the finalize() method is empty, then it does not need to exist.

翻譯  空的finalize():如果finalize()方法是空的,那麼它就不需要存在。

·  FinalizeOnlyCallsSuperFinalize: If the finalize() is implemented, it should do something besides just calling super.finalize().

翻譯  finalize方法調用父類finalize:如果finalize()被實現,它應該除了調用super.finalize()之外還應該做點別的。

·  FinalizeOverloaded: Methods named finalize() should not have parameters. It is confusing and probably a bug to overload finalize(). It will not be called by the VM.

翻譯  finalize重載:方法名是finalize()的方法應該具有參數。因爲不帶參數容易令人迷惑且可能是一個bug,那樣就不會被JVM調用。

·  FinalizeDoesNotCallSuperFinalize: If the finalize() is implemented, its last action should be to call super.finalize.

翻譯  finalize沒有調用父類的finalize:如果finalize()方法被重新實現,它最後一個動作應該是調用super.finalize();

·  FinalizeShouldBeProtected: If you override finalize(), make it protected. If you make it public, other classes may call it.

翻譯  finalize應該是受保護的:如果你覆蓋finalize(),使他是protected的,如果作爲public的,其它類就可以調用了。

·  AvoidCallingFinalize: Object.finalize() is called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

翻譯  避免調用finalize:Object.finalize()是由垃圾收集器發現沒有引用指向這個對象的時候調用的,應儘量避免人爲調用

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章