📄 bugdescriptions.html
字号:
to use '!= 0' instead of '> 0'.</p><p><em>Boris Bokowski</em></p> <h3><a name="CN_IDIOM">CN: Class implements Cloneable but does not define or use clone method (CN_IDIOM)</a></h3><p> Class implements Cloneable but does not define or use the clone method.</p> <h3><a name="CN_IDIOM_NO_SUPER_CALL">CN: clone method does not call super.clone() (CN_IDIOM_NO_SUPER_CALL)</a></h3><p> This non-final class defines a clone() method that does not call super.clone().If this class ("<i>A</i>") is extended by a subclass ("<i>B</i>"),and the subclass <i>B</i> calls super.clone(), then it is likely that<i>B</i>'s clone() method will return an object of type <i>A</i>,which violates the standard contract for clone().</p><p> If all clone() methods call super.clone(), then they are guaranteedto use Object.clone(), which always returns an object of the correct type.</p> <h3><a name="CN_IMPLEMENTS_CLONE_BUT_NOT_CLONEABLE">CN: Class defines clone() but doesn't implement Cloneable (CN_IMPLEMENTS_CLONE_BUT_NOT_CLONEABLE)</a></h3><p> This class defines a clone() method but the class doesn't implement Cloneable.There are some situations in which this is OK (e.g., you want to control how subclasses can clone themselves), but just make sure that this is what you intended.</p> <h3><a name="CO_ABSTRACT_SELF">Co: Abstract class defines covariant compareTo() method (CO_ABSTRACT_SELF)</a></h3> <p> This class defines a covariant version of <code>compareTo()</code>. To correctly override the <code>compareTo()</code> method in the <code>Comparable</code> interface, the parameter of <code>compareTo()</code> must have type <code>java.lang.Object</code>.</p> <h3><a name="CO_SELF_NO_OBJECT">Co: Covariant compareTo() method defined (CO_SELF_NO_OBJECT)</a></h3> <p> This class defines a covariant version of <code>compareTo()</code>. To correctly override the <code>compareTo()</code> method in the <code>Comparable</code> interface, the parameter of <code>compareTo()</code> must have type <code>java.lang.Object</code>.</p> <h3><a name="DE_MIGHT_DROP">DE: Method might drop exception (DE_MIGHT_DROP)</a></h3> <p> This method might drop an exception. In general, exceptions should be handled or reported in some way, or they should be thrown out of the method.</p> <h3><a name="DE_MIGHT_IGNORE">DE: Method might ignore exception (DE_MIGHT_IGNORE)</a></h3> <p> This method might ignore an exception. In general, exceptions should be handled or reported in some way, or they should be thrown out of the method.</p> <h3><a name="DP_CREATE_CLASSLOADER_INSIDE_DO_PRIVILEGED">DP: Classloaders should only be created inside doPrivileged block (DP_CREATE_CLASSLOADER_INSIDE_DO_PRIVILEGED)</a></h3> <p> This code creates a classloader, which requires a security manager. If this code will be granted security permissions, but might be invoked by code that does not have security permissions, then the classloader creation needs to occur inside a doPrivileged block.</p> <h3><a name="DP_DO_INSIDE_DO_PRIVILEGED">DP: Method invoked that should be only be invoked inside a doPrivileged block (DP_DO_INSIDE_DO_PRIVILEGED)</a></h3> <p> This code invokes a method that requires a security permission check. If this code will be granted security permissions, but might be invoked by code that does not have security permissions, then the invocation needs to occur inside a doPrivileged block.</p> <h3><a name="DM_EXIT">Dm: Method invokes System.exit(...) (DM_EXIT)</a></h3> <p> Invoking System.exit shuts down the entire Java virtual machine. This should only been done when it is appropriate. Such calls make it hard or impossible for your code to be invoked by other code. Consider throwing a RuntimeException instead.</p> <h3><a name="DM_RUN_FINALIZERS_ON_EXIT">Dm: Method invokes dangerous method runFinalizersOnExit (DM_RUN_FINALIZERS_ON_EXIT)</a></h3> <p> <em>Never call System.runFinalizersOnExitor Runtime.runFinalizersOnExit for any reason: they are among the mostdangerous methods in the Java libraries.</em> -- Joshua Bloch</p> <h3><a name="ES_COMPARING_PARAMETER_STRING_WITH_EQ">ES: Comparison of String parameter using == or != (ES_COMPARING_PARAMETER_STRING_WITH_EQ)</a></h3> <p>This code compares a <code>java.lang.String</code> parameter for referenceequality using the == or != operators. Requiring callers to pass only String constants or interned strings to a method is unnecessarilyfragile, and rarely leads to measurable performance gains. Considerusing the <code>equals(Object)</code> method instead.</p> <h3><a name="ES_COMPARING_STRINGS_WITH_EQ">ES: Comparison of String objects using == or != (ES_COMPARING_STRINGS_WITH_EQ)</a
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -