PMD规则之Finalizer Rules

来源:互联网 发布:行星减速器传动比算法 编辑:程序博客网 时间:2024/04/29 13:23

·  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()是由垃圾收集器发现没有引用指向这个对象的时候调用的,应尽量避免人为调用