OLD | NEW |
| 1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.or
g/TR/html4/loose.dtd"> |
1 <html><head><title>FindBugs Bug Descriptions</title> | 2 <html><head><title>FindBugs Bug Descriptions</title> |
2 <link rel="stylesheet" type="text/css" href="findbugs.css"/> | 3 <link rel="stylesheet" type="text/css" href="findbugs.css"/> |
3 <link rel="shortcut icon" href="favicon.ico" type="image/x-icon"/> | 4 <link rel="shortcut icon" href="favicon.ico" type="image/x-icon"/> |
4 </head><body> | 5 </head><body> |
5 | 6 |
6 <table width="100%"><tr> | 7 <table width="100%"><tr> |
7 | 8 |
8 <td bgcolor="#b9b9fe" valign="top" align="left" width="20%"> | 9 <td bgcolor="#b9b9fe" valign="top" align="left" width="20%"> |
9 <table width="100%" cellspacing="0" border="0"> | 10 <table width="100%" cellspacing="0" border="0"> |
10 <tr><td><a class="sidebar" href="index.html"><img src="umdFindbugs.png" alt="Fin
dBugs"></a></td></tr> | 11 <tr><td><a class="sidebar" href="index.html"><img src="umdFindbugs.png" alt="Fin
dBugs"></a></td></tr> |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 <tr><td><font size="-1"><a class="sidebar" href="api/index.html">API</a> <a clas
s="sidebar" href="api/overview-summary.html">[no frames]</a></font></td></tr> | 44 <tr><td><font size="-1"><a class="sidebar" href="api/index.html">API</a> <a clas
s="sidebar" href="api/overview-summary.html">[no frames]</a></font></td></tr> |
44 <tr><td><font size="-1"><a class="sidebar" href="Changes.html">Change log</a></f
ont></td></tr> | 45 <tr><td><font size="-1"><a class="sidebar" href="Changes.html">Change log</a></f
ont></td></tr> |
45 <tr><td><font size="-1"><a class="sidebar" href="http://sourceforge.net/projects
/findbugs">SF project page</a></font></td></tr> | 46 <tr><td><font size="-1"><a class="sidebar" href="http://sourceforge.net/projects
/findbugs">SF project page</a></font></td></tr> |
46 <tr><td><font size="-1"><a class="sidebar" href="http://code.google.com/p/findbu
gs/source/browse/">Browse source</a></font></td></tr> | 47 <tr><td><font size="-1"><a class="sidebar" href="http://code.google.com/p/findbu
gs/source/browse/">Browse source</a></font></td></tr> |
47 <tr><td><font size="-1"><a class="sidebar" href="http://code.google.com/p/findbu
gs/source/list">Latest code changes</a></font></td></tr> | 48 <tr><td><font size="-1"><a class="sidebar" href="http://code.google.com/p/findbu
gs/source/list">Latest code changes</a></font></td></tr> |
48 </table> | 49 </table> |
49 </td> | 50 </td> |
50 <td align="left" valign="top"> | 51 <td align="left" valign="top"> |
51 <h1>FindBugs Bug Descriptions</h1> | 52 <h1>FindBugs Bug Descriptions</h1> |
52 <p>This document lists the standard bug patterns reported by | 53 <p>This document lists the standard bug patterns reported by |
53 <a href="http://findbugs.sourceforge.net">FindBugs</a> version 2.0.1.</p> | 54 <a href="http://findbugs.sourceforge.net">FindBugs</a> version 2.0.3.</p> |
54 <h2>Summary</h2> | 55 <h2>Summary</h2> |
55 <table width="100%"> | 56 <table width="100%"> |
56 <tr bgcolor="#b9b9fe"><th>Description</th><th>Category</th></tr> | 57 <tr bgcolor="#b9b9fe"><th>Description</th><th>Category</th></tr> |
57 <tr bgcolor="#eeeeee"><td><a href="#AM_CREATES_EMPTY_JAR_FILE_ENTRY">AM: Creates
an empty jar file entry</a></td><td>Bad practice</td></tr> | |
58 <tr bgcolor="#ffffff"><td><a href="#AM_CREATES_EMPTY_ZIP_FILE_ENTRY">AM: Creates
an empty zip file entry</a></td><td>Bad practice</td></tr> | |
59 <tr bgcolor="#eeeeee"><td><a href="#BC_EQUALS_METHOD_SHOULD_WORK_FOR_ALL_OBJECTS
">BC: Equals method should not assume anything about the type of its argument</a
></td><td>Bad practice</td></tr> | 58 <tr bgcolor="#eeeeee"><td><a href="#BC_EQUALS_METHOD_SHOULD_WORK_FOR_ALL_OBJECTS
">BC: Equals method should not assume anything about the type of its argument</a
></td><td>Bad practice</td></tr> |
60 <tr bgcolor="#ffffff"><td><a href="#BIT_SIGNED_CHECK">BIT: Check for sign of bit
wise operation</a></td><td>Bad practice</td></tr> | 59 <tr bgcolor="#ffffff"><td><a href="#BIT_SIGNED_CHECK">BIT: Check for sign of bit
wise operation</a></td><td>Bad practice</td></tr> |
61 <tr bgcolor="#eeeeee"><td><a href="#CN_IDIOM">CN: Class implements Cloneable but
does not define or use clone method</a></td><td>Bad practice</td></tr> | 60 <tr bgcolor="#eeeeee"><td><a href="#CN_IDIOM">CN: Class implements Cloneable but
does not define or use clone method</a></td><td>Bad practice</td></tr> |
62 <tr bgcolor="#ffffff"><td><a href="#CN_IDIOM_NO_SUPER_CALL">CN: clone method doe
s not call super.clone()</a></td><td>Bad practice</td></tr> | 61 <tr bgcolor="#ffffff"><td><a href="#CN_IDIOM_NO_SUPER_CALL">CN: clone method doe
s not call super.clone()</a></td><td>Bad practice</td></tr> |
63 <tr bgcolor="#eeeeee"><td><a href="#CN_IMPLEMENTS_CLONE_BUT_NOT_CLONEABLE">CN: C
lass defines clone() but doesn't implement Cloneable</a></td><td>Bad practice</t
d></tr> | 62 <tr bgcolor="#eeeeee"><td><a href="#CN_IMPLEMENTS_CLONE_BUT_NOT_CLONEABLE">CN: C
lass defines clone() but doesn't implement Cloneable</a></td><td>Bad practice</t
d></tr> |
64 <tr bgcolor="#ffffff"><td><a href="#CO_ABSTRACT_SELF">Co: Abstract class defines
covariant compareTo() method</a></td><td>Bad practice</td></tr> | 63 <tr bgcolor="#ffffff"><td><a href="#CO_ABSTRACT_SELF">Co: Abstract class defines
covariant compareTo() method</a></td><td>Bad practice</td></tr> |
65 <tr bgcolor="#eeeeee"><td><a href="#CO_SELF_NO_OBJECT">Co: Covariant compareTo()
method defined</a></td><td>Bad practice</td></tr> | 64 <tr bgcolor="#eeeeee"><td><a href="#CO_SELF_NO_OBJECT">Co: Covariant compareTo()
method defined</a></td><td>Bad practice</td></tr> |
66 <tr bgcolor="#ffffff"><td><a href="#DE_MIGHT_DROP">DE: Method might drop excepti
on</a></td><td>Bad practice</td></tr> | 65 <tr bgcolor="#ffffff"><td><a href="#DE_MIGHT_DROP">DE: Method might drop excepti
on</a></td><td>Bad practice</td></tr> |
67 <tr bgcolor="#eeeeee"><td><a href="#DE_MIGHT_IGNORE">DE: Method might ignore exc
eption</a></td><td>Bad practice</td></tr> | 66 <tr bgcolor="#eeeeee"><td><a href="#DE_MIGHT_IGNORE">DE: Method might ignore exc
eption</a></td><td>Bad practice</td></tr> |
68 <tr bgcolor="#ffffff"><td><a href="#DMI_ENTRY_SETS_MAY_REUSE_ENTRY_OBJECTS">DMI:
Adding elements of an entry set may fail due to reuse of Entry objects</a></td>
<td>Bad practice</td></tr> | 67 <tr bgcolor="#ffffff"><td><a href="#DMI_ENTRY_SETS_MAY_REUSE_ENTRY_OBJECTS">DMI:
Adding elements of an entry set may fail due to reuse of Entry objects</a></td>
<td>Bad practice</td></tr> |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 <tr bgcolor="#eeeeee"><td><a href="#BC_IMPOSSIBLE_DOWNCAST">BC: Impossible downc
ast</a></td><td>Correctness</td></tr> | 142 <tr bgcolor="#eeeeee"><td><a href="#BC_IMPOSSIBLE_DOWNCAST">BC: Impossible downc
ast</a></td><td>Correctness</td></tr> |
144 <tr bgcolor="#ffffff"><td><a href="#BC_IMPOSSIBLE_DOWNCAST_OF_TOARRAY">BC: Impos
sible downcast of toArray() result</a></td><td>Correctness</td></tr> | 143 <tr bgcolor="#ffffff"><td><a href="#BC_IMPOSSIBLE_DOWNCAST_OF_TOARRAY">BC: Impos
sible downcast of toArray() result</a></td><td>Correctness</td></tr> |
145 <tr bgcolor="#eeeeee"><td><a href="#BC_IMPOSSIBLE_INSTANCEOF">BC: instanceof wil
l always return false</a></td><td>Correctness</td></tr> | 144 <tr bgcolor="#eeeeee"><td><a href="#BC_IMPOSSIBLE_INSTANCEOF">BC: instanceof wil
l always return false</a></td><td>Correctness</td></tr> |
146 <tr bgcolor="#ffffff"><td><a href="#BIT_ADD_OF_SIGNED_BYTE">BIT: Bitwise add of
signed byte value</a></td><td>Correctness</td></tr> | 145 <tr bgcolor="#ffffff"><td><a href="#BIT_ADD_OF_SIGNED_BYTE">BIT: Bitwise add of
signed byte value</a></td><td>Correctness</td></tr> |
147 <tr bgcolor="#eeeeee"><td><a href="#BIT_AND">BIT: Incompatible bit masks</a></td
><td>Correctness</td></tr> | 146 <tr bgcolor="#eeeeee"><td><a href="#BIT_AND">BIT: Incompatible bit masks</a></td
><td>Correctness</td></tr> |
148 <tr bgcolor="#ffffff"><td><a href="#BIT_AND_ZZ">BIT: Check to see if ((...) & 0)
== 0</a></td><td>Correctness</td></tr> | 147 <tr bgcolor="#ffffff"><td><a href="#BIT_AND_ZZ">BIT: Check to see if ((...) & 0)
== 0</a></td><td>Correctness</td></tr> |
149 <tr bgcolor="#eeeeee"><td><a href="#BIT_IOR">BIT: Incompatible bit masks</a></td
><td>Correctness</td></tr> | 148 <tr bgcolor="#eeeeee"><td><a href="#BIT_IOR">BIT: Incompatible bit masks</a></td
><td>Correctness</td></tr> |
150 <tr bgcolor="#ffffff"><td><a href="#BIT_IOR_OF_SIGNED_BYTE">BIT: Bitwise OR of s
igned byte value</a></td><td>Correctness</td></tr> | 149 <tr bgcolor="#ffffff"><td><a href="#BIT_IOR_OF_SIGNED_BYTE">BIT: Bitwise OR of s
igned byte value</a></td><td>Correctness</td></tr> |
151 <tr bgcolor="#eeeeee"><td><a href="#BIT_SIGNED_CHECK_HIGH_BIT">BIT: Check for si
gn of bitwise operation</a></td><td>Correctness</td></tr> | 150 <tr bgcolor="#eeeeee"><td><a href="#BIT_SIGNED_CHECK_HIGH_BIT">BIT: Check for si
gn of bitwise operation</a></td><td>Correctness</td></tr> |
152 <tr bgcolor="#ffffff"><td><a href="#BOA_BADLY_OVERRIDDEN_ADAPTER">BOA: Class ove
rrides a method implemented in super class Adapter wrongly</a></td><td>Correctne
ss</td></tr> | 151 <tr bgcolor="#ffffff"><td><a href="#BOA_BADLY_OVERRIDDEN_ADAPTER">BOA: Class ove
rrides a method implemented in super class Adapter wrongly</a></td><td>Correctne
ss</td></tr> |
153 <tr bgcolor="#eeeeee"><td><a href="#ICAST_BAD_SHIFT_AMOUNT">BSHIFT: 32 bit int s
hifted by an amount not in the range 0..31</a></td><td>Correctness</td></tr> | 152 <tr bgcolor="#eeeeee"><td><a href="#ICAST_BAD_SHIFT_AMOUNT">BSHIFT: 32 bit int s
hifted by an amount not in the range -31..31</a></td><td>Correctness</td></tr> |
154 <tr bgcolor="#ffffff"><td><a href="#BX_UNBOXED_AND_COERCED_FOR_TERNARY_OPERATOR"
>Bx: Primitive value is unboxed and coerced for ternary operator</a></td><td>Cor
rectness</td></tr> | 153 <tr bgcolor="#ffffff"><td><a href="#BX_UNBOXED_AND_COERCED_FOR_TERNARY_OPERATOR"
>Bx: Primitive value is unboxed and coerced for ternary operator</a></td><td>Cor
rectness</td></tr> |
155 <tr bgcolor="#eeeeee"><td><a href="#CO_COMPARETO_RESULTS_MIN_VALUE">Co: compareT
o()/compare() returns Integer.MIN_VALUE</a></td><td>Correctness</td></tr> | 154 <tr bgcolor="#eeeeee"><td><a href="#CO_COMPARETO_RESULTS_MIN_VALUE">Co: compareT
o()/compare() returns Integer.MIN_VALUE</a></td><td>Correctness</td></tr> |
156 <tr bgcolor="#ffffff"><td><a href="#DLS_DEAD_STORE_OF_CLASS_LITERAL">DLS: Dead s
tore of class literal</a></td><td>Correctness</td></tr> | 155 <tr bgcolor="#ffffff"><td><a href="#DLS_DEAD_LOCAL_INCREMENT_IN_RETURN">DLS: Use
less increment in return statement</a></td><td>Correctness</td></tr> |
157 <tr bgcolor="#eeeeee"><td><a href="#DLS_OVERWRITTEN_INCREMENT">DLS: Overwritten
increment</a></td><td>Correctness</td></tr> | 156 <tr bgcolor="#eeeeee"><td><a href="#DLS_DEAD_STORE_OF_CLASS_LITERAL">DLS: Dead s
tore of class literal</a></td><td>Correctness</td></tr> |
158 <tr bgcolor="#ffffff"><td><a href="#DMI_ARGUMENTS_WRONG_ORDER">DMI: Reversed met
hod arguments</a></td><td>Correctness</td></tr> | 157 <tr bgcolor="#ffffff"><td><a href="#DLS_OVERWRITTEN_INCREMENT">DLS: Overwritten
increment</a></td><td>Correctness</td></tr> |
159 <tr bgcolor="#eeeeee"><td><a href="#DMI_BAD_MONTH">DMI: Bad constant value for m
onth</a></td><td>Correctness</td></tr> | 158 <tr bgcolor="#eeeeee"><td><a href="#DMI_ARGUMENTS_WRONG_ORDER">DMI: Reversed met
hod arguments</a></td><td>Correctness</td></tr> |
160 <tr bgcolor="#ffffff"><td><a href="#DMI_BIGDECIMAL_CONSTRUCTED_FROM_DOUBLE">DMI:
BigDecimal constructed from double that isn't represented precisely</a></td><td
>Correctness</td></tr> | 159 <tr bgcolor="#ffffff"><td><a href="#DMI_BAD_MONTH">DMI: Bad constant value for m
onth</a></td><td>Correctness</td></tr> |
161 <tr bgcolor="#eeeeee"><td><a href="#DMI_CALLING_NEXT_FROM_HASNEXT">DMI: hasNext
method invokes next</a></td><td>Correctness</td></tr> | 160 <tr bgcolor="#eeeeee"><td><a href="#DMI_BIGDECIMAL_CONSTRUCTED_FROM_DOUBLE">DMI:
BigDecimal constructed from double that isn't represented precisely</a></td><td
>Correctness</td></tr> |
162 <tr bgcolor="#ffffff"><td><a href="#DMI_COLLECTIONS_SHOULD_NOT_CONTAIN_THEMSELVE
S">DMI: Collections should not contain themselves</a></td><td>Correctness</td></
tr> | 161 <tr bgcolor="#ffffff"><td><a href="#DMI_CALLING_NEXT_FROM_HASNEXT">DMI: hasNext
method invokes next</a></td><td>Correctness</td></tr> |
163 <tr bgcolor="#eeeeee"><td><a href="#DMI_DOH">DMI: D'oh! A nonsensical method inv
ocation</a></td><td>Correctness</td></tr> | 162 <tr bgcolor="#eeeeee"><td><a href="#DMI_COLLECTIONS_SHOULD_NOT_CONTAIN_THEMSELVE
S">DMI: Collections should not contain themselves</a></td><td>Correctness</td></
tr> |
164 <tr bgcolor="#ffffff"><td><a href="#DMI_INVOKING_HASHCODE_ON_ARRAY">DMI: Invocat
ion of hashCode on an array</a></td><td>Correctness</td></tr> | 163 <tr bgcolor="#ffffff"><td><a href="#DMI_DOH">DMI: D'oh! A nonsensical method inv
ocation</a></td><td>Correctness</td></tr> |
165 <tr bgcolor="#eeeeee"><td><a href="#DMI_LONG_BITS_TO_DOUBLE_INVOKED_ON_INT">DMI:
Double.longBitsToDouble invoked on an int</a></td><td>Correctness</td></tr> | 164 <tr bgcolor="#eeeeee"><td><a href="#DMI_INVOKING_HASHCODE_ON_ARRAY">DMI: Invocat
ion of hashCode on an array</a></td><td>Correctness</td></tr> |
166 <tr bgcolor="#ffffff"><td><a href="#DMI_VACUOUS_SELF_COLLECTION_CALL">DMI: Vacuo
us call to collections</a></td><td>Correctness</td></tr> | 165 <tr bgcolor="#ffffff"><td><a href="#DMI_LONG_BITS_TO_DOUBLE_INVOKED_ON_INT">DMI:
Double.longBitsToDouble invoked on an int</a></td><td>Correctness</td></tr> |
167 <tr bgcolor="#eeeeee"><td><a href="#DMI_ANNOTATION_IS_NOT_VISIBLE_TO_REFLECTION"
>Dm: Can't use reflection to check for presence of annotation without runtime re
tention</a></td><td>Correctness</td></tr> | 166 <tr bgcolor="#eeeeee"><td><a href="#DMI_VACUOUS_SELF_COLLECTION_CALL">DMI: Vacuo
us call to collections</a></td><td>Correctness</td></tr> |
168 <tr bgcolor="#ffffff"><td><a href="#DMI_FUTILE_ATTEMPT_TO_CHANGE_MAXPOOL_SIZE_OF
_SCHEDULED_THREAD_POOL_EXECUTOR">Dm: Futile attempt to change max pool size of S
cheduledThreadPoolExecutor</a></td><td>Correctness</td></tr> | 167 <tr bgcolor="#ffffff"><td><a href="#DMI_ANNOTATION_IS_NOT_VISIBLE_TO_REFLECTION"
>Dm: Can't use reflection to check for presence of annotation without runtime re
tention</a></td><td>Correctness</td></tr> |
169 <tr bgcolor="#eeeeee"><td><a href="#DMI_SCHEDULED_THREAD_POOL_EXECUTOR_WITH_ZERO
_CORE_THREADS">Dm: Creation of ScheduledThreadPoolExecutor with zero core thread
s</a></td><td>Correctness</td></tr> | 168 <tr bgcolor="#eeeeee"><td><a href="#DMI_FUTILE_ATTEMPT_TO_CHANGE_MAXPOOL_SIZE_OF
_SCHEDULED_THREAD_POOL_EXECUTOR">Dm: Futile attempt to change max pool size of S
cheduledThreadPoolExecutor</a></td><td>Correctness</td></tr> |
170 <tr bgcolor="#ffffff"><td><a href="#DMI_VACUOUS_CALL_TO_EASYMOCK_METHOD">Dm: Use
less/vacuous call to EasyMock method</a></td><td>Correctness</td></tr> | 169 <tr bgcolor="#ffffff"><td><a href="#DMI_SCHEDULED_THREAD_POOL_EXECUTOR_WITH_ZERO
_CORE_THREADS">Dm: Creation of ScheduledThreadPoolExecutor with zero core thread
s</a></td><td>Correctness</td></tr> |
171 <tr bgcolor="#eeeeee"><td><a href="#EC_ARRAY_AND_NONARRAY">EC: equals() used to
compare array and nonarray</a></td><td>Correctness</td></tr> | 170 <tr bgcolor="#eeeeee"><td><a href="#DMI_VACUOUS_CALL_TO_EASYMOCK_METHOD">Dm: Use
less/vacuous call to EasyMock method</a></td><td>Correctness</td></tr> |
172 <tr bgcolor="#ffffff"><td><a href="#EC_BAD_ARRAY_COMPARE">EC: Invocation of equa
ls() on an array, which is equivalent to ==</a></td><td>Correctness</td></tr> | 171 <tr bgcolor="#ffffff"><td><a href="#EC_ARRAY_AND_NONARRAY">EC: equals() used to
compare array and nonarray</a></td><td>Correctness</td></tr> |
173 <tr bgcolor="#eeeeee"><td><a href="#EC_INCOMPATIBLE_ARRAY_COMPARE">EC: equals(..
.) used to compare incompatible arrays</a></td><td>Correctness</td></tr> | 172 <tr bgcolor="#eeeeee"><td><a href="#EC_BAD_ARRAY_COMPARE">EC: Invocation of equa
ls() on an array, which is equivalent to ==</a></td><td>Correctness</td></tr> |
174 <tr bgcolor="#ffffff"><td><a href="#EC_NULL_ARG">EC: Call to equals(null)</a></t
d><td>Correctness</td></tr> | 173 <tr bgcolor="#ffffff"><td><a href="#EC_INCOMPATIBLE_ARRAY_COMPARE">EC: equals(..
.) used to compare incompatible arrays</a></td><td>Correctness</td></tr> |
175 <tr bgcolor="#eeeeee"><td><a href="#EC_UNRELATED_CLASS_AND_INTERFACE">EC: Call t
o equals() comparing unrelated class and interface</a></td><td>Correctness</td><
/tr> | 174 <tr bgcolor="#eeeeee"><td><a href="#EC_NULL_ARG">EC: Call to equals(null)</a></t
d><td>Correctness</td></tr> |
176 <tr bgcolor="#ffffff"><td><a href="#EC_UNRELATED_INTERFACES">EC: Call to equals(
) comparing different interface types</a></td><td>Correctness</td></tr> | 175 <tr bgcolor="#ffffff"><td><a href="#EC_UNRELATED_CLASS_AND_INTERFACE">EC: Call t
o equals() comparing unrelated class and interface</a></td><td>Correctness</td><
/tr> |
177 <tr bgcolor="#eeeeee"><td><a href="#EC_UNRELATED_TYPES">EC: Call to equals() com
paring different types</a></td><td>Correctness</td></tr> | 176 <tr bgcolor="#eeeeee"><td><a href="#EC_UNRELATED_INTERFACES">EC: Call to equals(
) comparing different interface types</a></td><td>Correctness</td></tr> |
178 <tr bgcolor="#ffffff"><td><a href="#EC_UNRELATED_TYPES_USING_POINTER_EQUALITY">E
C: Using pointer equality to compare different types</a></td><td>Correctness</td
></tr> | 177 <tr bgcolor="#ffffff"><td><a href="#EC_UNRELATED_TYPES">EC: Call to equals() com
paring different types</a></td><td>Correctness</td></tr> |
179 <tr bgcolor="#eeeeee"><td><a href="#EQ_ALWAYS_FALSE">Eq: equals method always re
turns false</a></td><td>Correctness</td></tr> | 178 <tr bgcolor="#eeeeee"><td><a href="#EC_UNRELATED_TYPES_USING_POINTER_EQUALITY">E
C: Using pointer equality to compare different types</a></td><td>Correctness</td
></tr> |
180 <tr bgcolor="#ffffff"><td><a href="#EQ_ALWAYS_TRUE">Eq: equals method always ret
urns true</a></td><td>Correctness</td></tr> | 179 <tr bgcolor="#ffffff"><td><a href="#EQ_ALWAYS_FALSE">Eq: equals method always re
turns false</a></td><td>Correctness</td></tr> |
181 <tr bgcolor="#eeeeee"><td><a href="#EQ_COMPARING_CLASS_NAMES">Eq: equals method
compares class names rather than class objects</a></td><td>Correctness</td></tr> | 180 <tr bgcolor="#eeeeee"><td><a href="#EQ_ALWAYS_TRUE">Eq: equals method always ret
urns true</a></td><td>Correctness</td></tr> |
182 <tr bgcolor="#ffffff"><td><a href="#EQ_DONT_DEFINE_EQUALS_FOR_ENUM">Eq: Covarian
t equals() method defined for enum</a></td><td>Correctness</td></tr> | 181 <tr bgcolor="#ffffff"><td><a href="#EQ_COMPARING_CLASS_NAMES">Eq: equals method
compares class names rather than class objects</a></td><td>Correctness</td></tr> |
183 <tr bgcolor="#eeeeee"><td><a href="#EQ_OTHER_NO_OBJECT">Eq: equals() method defi
ned that doesn't override equals(Object)</a></td><td>Correctness</td></tr> | 182 <tr bgcolor="#eeeeee"><td><a href="#EQ_DONT_DEFINE_EQUALS_FOR_ENUM">Eq: Covarian
t equals() method defined for enum</a></td><td>Correctness</td></tr> |
184 <tr bgcolor="#ffffff"><td><a href="#EQ_OTHER_USE_OBJECT">Eq: equals() method def
ined that doesn't override Object.equals(Object)</a></td><td>Correctness</td></t
r> | 183 <tr bgcolor="#ffffff"><td><a href="#EQ_OTHER_NO_OBJECT">Eq: equals() method defi
ned that doesn't override equals(Object)</a></td><td>Correctness</td></tr> |
185 <tr bgcolor="#eeeeee"><td><a href="#EQ_OVERRIDING_EQUALS_NOT_SYMMETRIC">Eq: equa
ls method overrides equals in superclass and may not be symmetric</a></td><td>Co
rrectness</td></tr> | 184 <tr bgcolor="#eeeeee"><td><a href="#EQ_OTHER_USE_OBJECT">Eq: equals() method def
ined that doesn't override Object.equals(Object)</a></td><td>Correctness</td></t
r> |
186 <tr bgcolor="#ffffff"><td><a href="#EQ_SELF_USE_OBJECT">Eq: Covariant equals() m
ethod defined, Object.equals(Object) inherited</a></td><td>Correctness</td></tr> | 185 <tr bgcolor="#ffffff"><td><a href="#EQ_OVERRIDING_EQUALS_NOT_SYMMETRIC">Eq: equa
ls method overrides equals in superclass and may not be symmetric</a></td><td>Co
rrectness</td></tr> |
187 <tr bgcolor="#eeeeee"><td><a href="#FE_TEST_IF_EQUAL_TO_NOT_A_NUMBER">FE: Doomed
test for equality to NaN</a></td><td>Correctness</td></tr> | 186 <tr bgcolor="#eeeeee"><td><a href="#EQ_SELF_USE_OBJECT">Eq: Covariant equals() m
ethod defined, Object.equals(Object) inherited</a></td><td>Correctness</td></tr> |
188 <tr bgcolor="#ffffff"><td><a href="#VA_FORMAT_STRING_BAD_ARGUMENT">FS: Format st
ring placeholder incompatible with passed argument</a></td><td>Correctness</td><
/tr> | 187 <tr bgcolor="#ffffff"><td><a href="#FE_TEST_IF_EQUAL_TO_NOT_A_NUMBER">FE: Doomed
test for equality to NaN</a></td><td>Correctness</td></tr> |
189 <tr bgcolor="#eeeeee"><td><a href="#VA_FORMAT_STRING_BAD_CONVERSION">FS: The typ
e of a supplied argument doesn't match format specifier</a></td><td>Correctness<
/td></tr> | 188 <tr bgcolor="#eeeeee"><td><a href="#VA_FORMAT_STRING_BAD_ARGUMENT">FS: Format st
ring placeholder incompatible with passed argument</a></td><td>Correctness</td><
/tr> |
190 <tr bgcolor="#ffffff"><td><a href="#VA_FORMAT_STRING_EXPECTED_MESSAGE_FORMAT_SUP
PLIED">FS: MessageFormat supplied where printf style format expected</a></td><td
>Correctness</td></tr> | 189 <tr bgcolor="#ffffff"><td><a href="#VA_FORMAT_STRING_BAD_CONVERSION">FS: The typ
e of a supplied argument doesn't match format specifier</a></td><td>Correctness<
/td></tr> |
191 <tr bgcolor="#eeeeee"><td><a href="#VA_FORMAT_STRING_EXTRA_ARGUMENTS_PASSED">FS:
More arguments are passed than are actually used in the format string</a></td><
td>Correctness</td></tr> | 190 <tr bgcolor="#eeeeee"><td><a href="#VA_FORMAT_STRING_EXPECTED_MESSAGE_FORMAT_SUP
PLIED">FS: MessageFormat supplied where printf style format expected</a></td><td
>Correctness</td></tr> |
192 <tr bgcolor="#ffffff"><td><a href="#VA_FORMAT_STRING_ILLEGAL">FS: Illegal format
string</a></td><td>Correctness</td></tr> | 191 <tr bgcolor="#ffffff"><td><a href="#VA_FORMAT_STRING_EXTRA_ARGUMENTS_PASSED">FS:
More arguments are passed than are actually used in the format string</a></td><
td>Correctness</td></tr> |
193 <tr bgcolor="#eeeeee"><td><a href="#VA_FORMAT_STRING_MISSING_ARGUMENT">FS: Forma
t string references missing argument</a></td><td>Correctness</td></tr> | 192 <tr bgcolor="#eeeeee"><td><a href="#VA_FORMAT_STRING_ILLEGAL">FS: Illegal format
string</a></td><td>Correctness</td></tr> |
194 <tr bgcolor="#ffffff"><td><a href="#VA_FORMAT_STRING_NO_PREVIOUS_ARGUMENT">FS: N
o previous argument for format string</a></td><td>Correctness</td></tr> | 193 <tr bgcolor="#ffffff"><td><a href="#VA_FORMAT_STRING_MISSING_ARGUMENT">FS: Forma
t string references missing argument</a></td><td>Correctness</td></tr> |
195 <tr bgcolor="#eeeeee"><td><a href="#GC_UNRELATED_TYPES">GC: No relationship betw
een generic parameter and method argument</a></td><td>Correctness</td></tr> | 194 <tr bgcolor="#eeeeee"><td><a href="#VA_FORMAT_STRING_NO_PREVIOUS_ARGUMENT">FS: N
o previous argument for format string</a></td><td>Correctness</td></tr> |
196 <tr bgcolor="#ffffff"><td><a href="#HE_SIGNATURE_DECLARES_HASHING_OF_UNHASHABLE_
CLASS">HE: Signature declares use of unhashable class in hashed construct</a></t
d><td>Correctness</td></tr> | 195 <tr bgcolor="#ffffff"><td><a href="#GC_UNRELATED_TYPES">GC: No relationship betw
een generic parameter and method argument</a></td><td>Correctness</td></tr> |
197 <tr bgcolor="#eeeeee"><td><a href="#HE_USE_OF_UNHASHABLE_CLASS">HE: Use of class
without a hashCode() method in a hashed data structure</a></td><td>Correctness<
/td></tr> | 196 <tr bgcolor="#eeeeee"><td><a href="#HE_SIGNATURE_DECLARES_HASHING_OF_UNHASHABLE_
CLASS">HE: Signature declares use of unhashable class in hashed construct</a></t
d><td>Correctness</td></tr> |
198 <tr bgcolor="#ffffff"><td><a href="#ICAST_INT_2_LONG_AS_INSTANT">ICAST: int valu
e converted to long and used as absolute time</a></td><td>Correctness</td></tr> | 197 <tr bgcolor="#ffffff"><td><a href="#HE_USE_OF_UNHASHABLE_CLASS">HE: Use of class
without a hashCode() method in a hashed data structure</a></td><td>Correctness<
/td></tr> |
199 <tr bgcolor="#eeeeee"><td><a href="#ICAST_INT_CAST_TO_DOUBLE_PASSED_TO_CEIL">ICA
ST: integral value cast to double and then passed to Math.ceil</a></td><td>Corre
ctness</td></tr> | 198 <tr bgcolor="#eeeeee"><td><a href="#ICAST_INT_2_LONG_AS_INSTANT">ICAST: int valu
e converted to long and used as absolute time</a></td><td>Correctness</td></tr> |
200 <tr bgcolor="#ffffff"><td><a href="#ICAST_INT_CAST_TO_FLOAT_PASSED_TO_ROUND">ICA
ST: int value cast to float and then passed to Math.round</a></td><td>Correctnes
s</td></tr> | 199 <tr bgcolor="#ffffff"><td><a href="#ICAST_INT_CAST_TO_DOUBLE_PASSED_TO_CEIL">ICA
ST: Integral value cast to double and then passed to Math.ceil</a></td><td>Corre
ctness</td></tr> |
201 <tr bgcolor="#eeeeee"><td><a href="#IJU_ASSERT_METHOD_INVOKED_FROM_RUN_METHOD">I
JU: JUnit assertion in run method will not be noticed by JUnit</a></td><td>Corre
ctness</td></tr> | 200 <tr bgcolor="#eeeeee"><td><a href="#ICAST_INT_CAST_TO_FLOAT_PASSED_TO_ROUND">ICA
ST: int value cast to float and then passed to Math.round</a></td><td>Correctnes
s</td></tr> |
202 <tr bgcolor="#ffffff"><td><a href="#IJU_BAD_SUITE_METHOD">IJU: TestCase declares
a bad suite method </a></td><td>Correctness</td></tr> | 201 <tr bgcolor="#ffffff"><td><a href="#IJU_ASSERT_METHOD_INVOKED_FROM_RUN_METHOD">I
JU: JUnit assertion in run method will not be noticed by JUnit</a></td><td>Corre
ctness</td></tr> |
203 <tr bgcolor="#eeeeee"><td><a href="#IJU_NO_TESTS">IJU: TestCase has no tests</a>
</td><td>Correctness</td></tr> | 202 <tr bgcolor="#eeeeee"><td><a href="#IJU_BAD_SUITE_METHOD">IJU: TestCase declares
a bad suite method </a></td><td>Correctness</td></tr> |
204 <tr bgcolor="#ffffff"><td><a href="#IJU_SETUP_NO_SUPER">IJU: TestCase defines se
tUp that doesn't call super.setUp()</a></td><td>Correctness</td></tr> | 203 <tr bgcolor="#ffffff"><td><a href="#IJU_NO_TESTS">IJU: TestCase has no tests</a>
</td><td>Correctness</td></tr> |
205 <tr bgcolor="#eeeeee"><td><a href="#IJU_SUITE_NOT_STATIC">IJU: TestCase implemen
ts a non-static suite method </a></td><td>Correctness</td></tr> | 204 <tr bgcolor="#eeeeee"><td><a href="#IJU_SETUP_NO_SUPER">IJU: TestCase defines se
tUp that doesn't call super.setUp()</a></td><td>Correctness</td></tr> |
206 <tr bgcolor="#ffffff"><td><a href="#IJU_TEARDOWN_NO_SUPER">IJU: TestCase defines
tearDown that doesn't call super.tearDown()</a></td><td>Correctness</td></tr> | 205 <tr bgcolor="#ffffff"><td><a href="#IJU_SUITE_NOT_STATIC">IJU: TestCase implemen
ts a non-static suite method </a></td><td>Correctness</td></tr> |
207 <tr bgcolor="#eeeeee"><td><a href="#IL_CONTAINER_ADDED_TO_ITSELF">IL: A collecti
on is added to itself</a></td><td>Correctness</td></tr> | 206 <tr bgcolor="#eeeeee"><td><a href="#IJU_TEARDOWN_NO_SUPER">IJU: TestCase defines
tearDown that doesn't call super.tearDown()</a></td><td>Correctness</td></tr> |
208 <tr bgcolor="#ffffff"><td><a href="#IL_INFINITE_LOOP">IL: An apparent infinite l
oop</a></td><td>Correctness</td></tr> | 207 <tr bgcolor="#ffffff"><td><a href="#IL_CONTAINER_ADDED_TO_ITSELF">IL: A collecti
on is added to itself</a></td><td>Correctness</td></tr> |
209 <tr bgcolor="#eeeeee"><td><a href="#IL_INFINITE_RECURSIVE_LOOP">IL: An apparent
infinite recursive loop</a></td><td>Correctness</td></tr> | 208 <tr bgcolor="#eeeeee"><td><a href="#IL_INFINITE_LOOP">IL: An apparent infinite l
oop</a></td><td>Correctness</td></tr> |
210 <tr bgcolor="#ffffff"><td><a href="#IM_MULTIPLYING_RESULT_OF_IREM">IM: Integer m
ultiply of result of integer remainder</a></td><td>Correctness</td></tr> | 209 <tr bgcolor="#ffffff"><td><a href="#IL_INFINITE_RECURSIVE_LOOP">IL: An apparent
infinite recursive loop</a></td><td>Correctness</td></tr> |
211 <tr bgcolor="#eeeeee"><td><a href="#INT_BAD_COMPARISON_WITH_INT_VALUE">INT: Bad
comparison of int value with long constant</a></td><td>Correctness</td></tr> | 210 <tr bgcolor="#eeeeee"><td><a href="#IM_MULTIPLYING_RESULT_OF_IREM">IM: Integer m
ultiply of result of integer remainder</a></td><td>Correctness</td></tr> |
212 <tr bgcolor="#ffffff"><td><a href="#INT_BAD_COMPARISON_WITH_NONNEGATIVE_VALUE">I
NT: Bad comparison of nonnegative value with negative constant</a></td><td>Corre
ctness</td></tr> | 211 <tr bgcolor="#ffffff"><td><a href="#INT_BAD_COMPARISON_WITH_INT_VALUE">INT: Bad
comparison of int value with long constant</a></td><td>Correctness</td></tr> |
213 <tr bgcolor="#eeeeee"><td><a href="#INT_BAD_COMPARISON_WITH_SIGNED_BYTE">INT: Ba
d comparison of signed byte</a></td><td>Correctness</td></tr> | 212 <tr bgcolor="#eeeeee"><td><a href="#INT_BAD_COMPARISON_WITH_NONNEGATIVE_VALUE">I
NT: Bad comparison of nonnegative value with negative constant</a></td><td>Corre
ctness</td></tr> |
214 <tr bgcolor="#ffffff"><td><a href="#IO_APPENDING_TO_OBJECT_OUTPUT_STREAM">IO: Do
omed attempt to append to an object output stream</a></td><td>Correctness</td></
tr> | 213 <tr bgcolor="#ffffff"><td><a href="#INT_BAD_COMPARISON_WITH_SIGNED_BYTE">INT: Ba
d comparison of signed byte</a></td><td>Correctness</td></tr> |
215 <tr bgcolor="#eeeeee"><td><a href="#IP_PARAMETER_IS_DEAD_BUT_OVERWRITTEN">IP: A
parameter is dead upon entry to a method but overwritten</a></td><td>Correctness
</td></tr> | 214 <tr bgcolor="#eeeeee"><td><a href="#IO_APPENDING_TO_OBJECT_OUTPUT_STREAM">IO: Do
omed attempt to append to an object output stream</a></td><td>Correctness</td></
tr> |
216 <tr bgcolor="#ffffff"><td><a href="#MF_CLASS_MASKS_FIELD">MF: Class defines fiel
d that masks a superclass field</a></td><td>Correctness</td></tr> | 215 <tr bgcolor="#ffffff"><td><a href="#IP_PARAMETER_IS_DEAD_BUT_OVERWRITTEN">IP: A
parameter is dead upon entry to a method but overwritten</a></td><td>Correctness
</td></tr> |
217 <tr bgcolor="#eeeeee"><td><a href="#MF_METHOD_MASKS_FIELD">MF: Method defines a
variable that obscures a field</a></td><td>Correctness</td></tr> | 216 <tr bgcolor="#eeeeee"><td><a href="#MF_CLASS_MASKS_FIELD">MF: Class defines fiel
d that masks a superclass field</a></td><td>Correctness</td></tr> |
218 <tr bgcolor="#ffffff"><td><a href="#NP_ALWAYS_NULL">NP: Null pointer dereference
</a></td><td>Correctness</td></tr> | 217 <tr bgcolor="#ffffff"><td><a href="#MF_METHOD_MASKS_FIELD">MF: Method defines a
variable that obscures a field</a></td><td>Correctness</td></tr> |
219 <tr bgcolor="#eeeeee"><td><a href="#NP_ALWAYS_NULL_EXCEPTION">NP: Null pointer d
ereference in method on exception path</a></td><td>Correctness</td></tr> | 218 <tr bgcolor="#eeeeee"><td><a href="#NP_ALWAYS_NULL">NP: Null pointer dereference
</a></td><td>Correctness</td></tr> |
220 <tr bgcolor="#ffffff"><td><a href="#NP_ARGUMENT_MIGHT_BE_NULL">NP: Method does n
ot check for null argument</a></td><td>Correctness</td></tr> | 219 <tr bgcolor="#ffffff"><td><a href="#NP_ALWAYS_NULL_EXCEPTION">NP: Null pointer d
ereference in method on exception path</a></td><td>Correctness</td></tr> |
221 <tr bgcolor="#eeeeee"><td><a href="#NP_CLOSING_NULL">NP: close() invoked on a va
lue that is always null</a></td><td>Correctness</td></tr> | 220 <tr bgcolor="#eeeeee"><td><a href="#NP_ARGUMENT_MIGHT_BE_NULL">NP: Method does n
ot check for null argument</a></td><td>Correctness</td></tr> |
222 <tr bgcolor="#ffffff"><td><a href="#NP_GUARANTEED_DEREF">NP: Null value is guara
nteed to be dereferenced</a></td><td>Correctness</td></tr> | 221 <tr bgcolor="#ffffff"><td><a href="#NP_CLOSING_NULL">NP: close() invoked on a va
lue that is always null</a></td><td>Correctness</td></tr> |
223 <tr bgcolor="#eeeeee"><td><a href="#NP_GUARANTEED_DEREF_ON_EXCEPTION_PATH">NP: V
alue is null and guaranteed to be dereferenced on exception path</a></td><td>Cor
rectness</td></tr> | 222 <tr bgcolor="#eeeeee"><td><a href="#NP_GUARANTEED_DEREF">NP: Null value is guara
nteed to be dereferenced</a></td><td>Correctness</td></tr> |
224 <tr bgcolor="#ffffff"><td><a href="#NP_NONNULL_FIELD_NOT_INITIALIZED_IN_CONSTRUC
TOR">NP: Nonnull field is not initialized</a></td><td>Correctness</td></tr> | 223 <tr bgcolor="#ffffff"><td><a href="#NP_GUARANTEED_DEREF_ON_EXCEPTION_PATH">NP: V
alue is null and guaranteed to be dereferenced on exception path</a></td><td>Cor
rectness</td></tr> |
225 <tr bgcolor="#eeeeee"><td><a href="#NP_NONNULL_PARAM_VIOLATION">NP: Method call
passes null to a nonnull parameter </a></td><td>Correctness</td></tr> | 224 <tr bgcolor="#eeeeee"><td><a href="#NP_NONNULL_FIELD_NOT_INITIALIZED_IN_CONSTRUC
TOR">NP: Nonnull field is not initialized</a></td><td>Correctness</td></tr> |
226 <tr bgcolor="#ffffff"><td><a href="#NP_NONNULL_RETURN_VIOLATION">NP: Method may
return null, but is declared @NonNull</a></td><td>Correctness</td></tr> | 225 <tr bgcolor="#ffffff"><td><a href="#NP_NONNULL_PARAM_VIOLATION">NP: Method call
passes null to a nonnull parameter </a></td><td>Correctness</td></tr> |
227 <tr bgcolor="#eeeeee"><td><a href="#NP_NULL_INSTANCEOF">NP: A known null value i
s checked to see if it is an instance of a type</a></td><td>Correctness</td></tr
> | 226 <tr bgcolor="#eeeeee"><td><a href="#NP_NONNULL_RETURN_VIOLATION">NP: Method may
return null, but is declared @NonNull</a></td><td>Correctness</td></tr> |
228 <tr bgcolor="#ffffff"><td><a href="#NP_NULL_ON_SOME_PATH">NP: Possible null poin
ter dereference</a></td><td>Correctness</td></tr> | 227 <tr bgcolor="#ffffff"><td><a href="#NP_NULL_INSTANCEOF">NP: A known null value i
s checked to see if it is an instance of a type</a></td><td>Correctness</td></tr
> |
229 <tr bgcolor="#eeeeee"><td><a href="#NP_NULL_ON_SOME_PATH_EXCEPTION">NP: Possible
null pointer dereference in method on exception path</a></td><td>Correctness</t
d></tr> | 228 <tr bgcolor="#eeeeee"><td><a href="#NP_NULL_ON_SOME_PATH">NP: Possible null poin
ter dereference</a></td><td>Correctness</td></tr> |
230 <tr bgcolor="#ffffff"><td><a href="#NP_NULL_PARAM_DEREF">NP: Method call passes
null for nonnull parameter</a></td><td>Correctness</td></tr> | 229 <tr bgcolor="#ffffff"><td><a href="#NP_NULL_ON_SOME_PATH_EXCEPTION">NP: Possible
null pointer dereference in method on exception path</a></td><td>Correctness</t
d></tr> |
231 <tr bgcolor="#eeeeee"><td><a href="#NP_NULL_PARAM_DEREF_ALL_TARGETS_DANGEROUS">N
P: Method call passes null for nonnull parameter</a></td><td>Correctness</td></t
r> | 230 <tr bgcolor="#eeeeee"><td><a href="#NP_NULL_PARAM_DEREF">NP: Method call passes
null for nonnull parameter</a></td><td>Correctness</td></tr> |
232 <tr bgcolor="#ffffff"><td><a href="#NP_NULL_PARAM_DEREF_NONVIRTUAL">NP: Non-virt
ual method call passes null for nonnull parameter</a></td><td>Correctness</td></
tr> | 231 <tr bgcolor="#ffffff"><td><a href="#NP_NULL_PARAM_DEREF_ALL_TARGETS_DANGEROUS">N
P: Method call passes null for nonnull parameter</a></td><td>Correctness</td></t
r> |
233 <tr bgcolor="#eeeeee"><td><a href="#NP_STORE_INTO_NONNULL_FIELD">NP: Store of nu
ll value into field annotated NonNull</a></td><td>Correctness</td></tr> | 232 <tr bgcolor="#eeeeee"><td><a href="#NP_NULL_PARAM_DEREF_NONVIRTUAL">NP: Non-virt
ual method call passes null for nonnull parameter</a></td><td>Correctness</td></
tr> |
234 <tr bgcolor="#ffffff"><td><a href="#NP_UNWRITTEN_FIELD">NP: Read of unwritten fi
eld</a></td><td>Correctness</td></tr> | 233 <tr bgcolor="#ffffff"><td><a href="#NP_STORE_INTO_NONNULL_FIELD">NP: Store of nu
ll value into field annotated NonNull</a></td><td>Correctness</td></tr> |
235 <tr bgcolor="#eeeeee"><td><a href="#NM_BAD_EQUAL">Nm: Class defines equal(Object
); should it be equals(Object)?</a></td><td>Correctness</td></tr> | 234 <tr bgcolor="#eeeeee"><td><a href="#NP_UNWRITTEN_FIELD">NP: Read of unwritten fi
eld</a></td><td>Correctness</td></tr> |
236 <tr bgcolor="#ffffff"><td><a href="#NM_LCASE_HASHCODE">Nm: Class defines hashcod
e(); should it be hashCode()?</a></td><td>Correctness</td></tr> | 235 <tr bgcolor="#ffffff"><td><a href="#NM_BAD_EQUAL">Nm: Class defines equal(Object
); should it be equals(Object)?</a></td><td>Correctness</td></tr> |
237 <tr bgcolor="#eeeeee"><td><a href="#NM_LCASE_TOSTRING">Nm: Class defines tostrin
g(); should it be toString()?</a></td><td>Correctness</td></tr> | 236 <tr bgcolor="#eeeeee"><td><a href="#NM_LCASE_HASHCODE">Nm: Class defines hashcod
e(); should it be hashCode()?</a></td><td>Correctness</td></tr> |
238 <tr bgcolor="#ffffff"><td><a href="#NM_METHOD_CONSTRUCTOR_CONFUSION">Nm: Apparen
t method/constructor confusion</a></td><td>Correctness</td></tr> | 237 <tr bgcolor="#ffffff"><td><a href="#NM_LCASE_TOSTRING">Nm: Class defines tostrin
g(); should it be toString()?</a></td><td>Correctness</td></tr> |
239 <tr bgcolor="#eeeeee"><td><a href="#NM_VERY_CONFUSING">Nm: Very confusing method
names</a></td><td>Correctness</td></tr> | 238 <tr bgcolor="#eeeeee"><td><a href="#NM_METHOD_CONSTRUCTOR_CONFUSION">Nm: Apparen
t method/constructor confusion</a></td><td>Correctness</td></tr> |
240 <tr bgcolor="#ffffff"><td><a href="#NM_WRONG_PACKAGE">Nm: Method doesn't overrid
e method in superclass due to wrong package for parameter</a></td><td>Correctnes
s</td></tr> | 239 <tr bgcolor="#ffffff"><td><a href="#NM_VERY_CONFUSING">Nm: Very confusing method
names</a></td><td>Correctness</td></tr> |
241 <tr bgcolor="#eeeeee"><td><a href="#QBA_QUESTIONABLE_BOOLEAN_ASSIGNMENT">QBA: Me
thod assigns boolean literal in boolean expression</a></td><td>Correctness</td><
/tr> | 240 <tr bgcolor="#eeeeee"><td><a href="#NM_WRONG_PACKAGE">Nm: Method doesn't overrid
e method in superclass due to wrong package for parameter</a></td><td>Correctnes
s</td></tr> |
242 <tr bgcolor="#ffffff"><td><a href="#RC_REF_COMPARISON">RC: Suspicious reference
comparison</a></td><td>Correctness</td></tr> | 241 <tr bgcolor="#ffffff"><td><a href="#QBA_QUESTIONABLE_BOOLEAN_ASSIGNMENT">QBA: Me
thod assigns boolean literal in boolean expression</a></td><td>Correctness</td><
/tr> |
243 <tr bgcolor="#eeeeee"><td><a href="#RCN_REDUNDANT_NULLCHECK_WOULD_HAVE_BEEN_A_NP
E">RCN: Nullcheck of value previously dereferenced</a></td><td>Correctness</td><
/tr> | 242 <tr bgcolor="#eeeeee"><td><a href="#RC_REF_COMPARISON">RC: Suspicious reference
comparison</a></td><td>Correctness</td></tr> |
244 <tr bgcolor="#ffffff"><td><a href="#RE_BAD_SYNTAX_FOR_REGULAR_EXPRESSION">RE: In
valid syntax for regular expression</a></td><td>Correctness</td></tr> | 243 <tr bgcolor="#ffffff"><td><a href="#RCN_REDUNDANT_NULLCHECK_WOULD_HAVE_BEEN_A_NP
E">RCN: Nullcheck of value previously dereferenced</a></td><td>Correctness</td><
/tr> |
245 <tr bgcolor="#eeeeee"><td><a href="#RE_CANT_USE_FILE_SEPARATOR_AS_REGULAR_EXPRES
SION">RE: File.separator used for regular expression</a></td><td>Correctness</td
></tr> | 244 <tr bgcolor="#eeeeee"><td><a href="#RE_BAD_SYNTAX_FOR_REGULAR_EXPRESSION">RE: In
valid syntax for regular expression</a></td><td>Correctness</td></tr> |
246 <tr bgcolor="#ffffff"><td><a href="#RE_POSSIBLE_UNINTENDED_PATTERN">RE: "." used
for regular expression</a></td><td>Correctness</td></tr> | 245 <tr bgcolor="#ffffff"><td><a href="#RE_CANT_USE_FILE_SEPARATOR_AS_REGULAR_EXPRES
SION">RE: File.separator used for regular expression</a></td><td>Correctness</td
></tr> |
247 <tr bgcolor="#eeeeee"><td><a href="#RV_01_TO_INT">RV: Random value from 0 to 1 i
s coerced to the integer 0</a></td><td>Correctness</td></tr> | 246 <tr bgcolor="#eeeeee"><td><a href="#RE_POSSIBLE_UNINTENDED_PATTERN">RE: "." or "
|" used for regular expression</a></td><td>Correctness</td></tr> |
248 <tr bgcolor="#ffffff"><td><a href="#RV_ABSOLUTE_VALUE_OF_HASHCODE">RV: Bad attem
pt to compute absolute value of signed 32-bit hashcode </a></td><td>Correctness<
/td></tr> | 247 <tr bgcolor="#ffffff"><td><a href="#RV_01_TO_INT">RV: Random value from 0 to 1 i
s coerced to the integer 0</a></td><td>Correctness</td></tr> |
249 <tr bgcolor="#eeeeee"><td><a href="#RV_ABSOLUTE_VALUE_OF_RANDOM_INT">RV: Bad att
empt to compute absolute value of signed random integer</a></td><td>Correctness<
/td></tr> | 248 <tr bgcolor="#eeeeee"><td><a href="#RV_ABSOLUTE_VALUE_OF_HASHCODE">RV: Bad attem
pt to compute absolute value of signed 32-bit hashcode </a></td><td>Correctness<
/td></tr> |
250 <tr bgcolor="#ffffff"><td><a href="#RV_CHECK_COMPARETO_FOR_SPECIFIC_RETURN_VALUE
">RV: Code checks for specific values returned by compareTo</a></td><td>Correctn
ess</td></tr> | 249 <tr bgcolor="#ffffff"><td><a href="#RV_ABSOLUTE_VALUE_OF_RANDOM_INT">RV: Bad att
empt to compute absolute value of signed random integer</a></td><td>Correctness<
/td></tr> |
251 <tr bgcolor="#eeeeee"><td><a href="#RV_EXCEPTION_NOT_THROWN">RV: Exception creat
ed and dropped rather than thrown</a></td><td>Correctness</td></tr> | 250 <tr bgcolor="#eeeeee"><td><a href="#RV_CHECK_COMPARETO_FOR_SPECIFIC_RETURN_VALUE
">RV: Code checks for specific values returned by compareTo</a></td><td>Correctn
ess</td></tr> |
252 <tr bgcolor="#ffffff"><td><a href="#RV_RETURN_VALUE_IGNORED">RV: Method ignores
return value</a></td><td>Correctness</td></tr> | 251 <tr bgcolor="#ffffff"><td><a href="#RV_EXCEPTION_NOT_THROWN">RV: Exception creat
ed and dropped rather than thrown</a></td><td>Correctness</td></tr> |
253 <tr bgcolor="#eeeeee"><td><a href="#RpC_REPEATED_CONDITIONAL_TEST">RpC: Repeated
conditional tests</a></td><td>Correctness</td></tr> | 252 <tr bgcolor="#eeeeee"><td><a href="#RV_RETURN_VALUE_IGNORED">RV: Method ignores
return value</a></td><td>Correctness</td></tr> |
254 <tr bgcolor="#ffffff"><td><a href="#SA_FIELD_SELF_ASSIGNMENT">SA: Self assignmen
t of field</a></td><td>Correctness</td></tr> | 253 <tr bgcolor="#ffffff"><td><a href="#RpC_REPEATED_CONDITIONAL_TEST">RpC: Repeated
conditional tests</a></td><td>Correctness</td></tr> |
255 <tr bgcolor="#eeeeee"><td><a href="#SA_FIELD_SELF_COMPARISON">SA: Self compariso
n of field with itself</a></td><td>Correctness</td></tr> | 254 <tr bgcolor="#eeeeee"><td><a href="#SA_FIELD_SELF_ASSIGNMENT">SA: Self assignmen
t of field</a></td><td>Correctness</td></tr> |
256 <tr bgcolor="#ffffff"><td><a href="#SA_FIELD_SELF_COMPUTATION">SA: Nonsensical s
elf computation involving a field (e.g., x & x)</a></td><td>Correctness</td></tr
> | 255 <tr bgcolor="#ffffff"><td><a href="#SA_FIELD_SELF_COMPARISON">SA: Self compariso
n of field with itself</a></td><td>Correctness</td></tr> |
257 <tr bgcolor="#eeeeee"><td><a href="#SA_LOCAL_SELF_ASSIGNMENT_INSTEAD_OF_FIELD">S
A: Self assignment of local rather than assignment to field</a></td><td>Correctn
ess</td></tr> | 256 <tr bgcolor="#eeeeee"><td><a href="#SA_FIELD_SELF_COMPUTATION">SA: Nonsensical s
elf computation involving a field (e.g., x & x)</a></td><td>Correctness</td></tr
> |
258 <tr bgcolor="#ffffff"><td><a href="#SA_LOCAL_SELF_COMPARISON">SA: Self compariso
n of value with itself</a></td><td>Correctness</td></tr> | 257 <tr bgcolor="#ffffff"><td><a href="#SA_LOCAL_SELF_ASSIGNMENT_INSTEAD_OF_FIELD">S
A: Self assignment of local rather than assignment to field</a></td><td>Correctn
ess</td></tr> |
259 <tr bgcolor="#eeeeee"><td><a href="#SA_LOCAL_SELF_COMPUTATION">SA: Nonsensical s
elf computation involving a variable (e.g., x & x)</a></td><td>Correctness</td><
/tr> | 258 <tr bgcolor="#eeeeee"><td><a href="#SA_LOCAL_SELF_COMPARISON">SA: Self compariso
n of value with itself</a></td><td>Correctness</td></tr> |
260 <tr bgcolor="#ffffff"><td><a href="#SF_DEAD_STORE_DUE_TO_SWITCH_FALLTHROUGH">SF:
Dead store due to switch statement fall through</a></td><td>Correctness</td></t
r> | 259 <tr bgcolor="#ffffff"><td><a href="#SA_LOCAL_SELF_COMPUTATION">SA: Nonsensical s
elf computation involving a variable (e.g., x & x)</a></td><td>Correctness</td><
/tr> |
261 <tr bgcolor="#eeeeee"><td><a href="#SF_DEAD_STORE_DUE_TO_SWITCH_FALLTHROUGH_TO_T
HROW">SF: Dead store due to switch statement fall through to throw</a></td><td>C
orrectness</td></tr> | 260 <tr bgcolor="#eeeeee"><td><a href="#SF_DEAD_STORE_DUE_TO_SWITCH_FALLTHROUGH">SF:
Dead store due to switch statement fall through</a></td><td>Correctness</td></t
r> |
262 <tr bgcolor="#ffffff"><td><a href="#SIC_THREADLOCAL_DEADLY_EMBRACE">SIC: Deadly
embrace of non-static inner class and thread local</a></td><td>Correctness</td><
/tr> | 261 <tr bgcolor="#ffffff"><td><a href="#SF_DEAD_STORE_DUE_TO_SWITCH_FALLTHROUGH_TO_T
HROW">SF: Dead store due to switch statement fall through to throw</a></td><td>C
orrectness</td></tr> |
263 <tr bgcolor="#eeeeee"><td><a href="#SIO_SUPERFLUOUS_INSTANCEOF">SIO: Unnecessary
type check done using instanceof operator</a></td><td>Correctness</td></tr> | 262 <tr bgcolor="#eeeeee"><td><a href="#SIC_THREADLOCAL_DEADLY_EMBRACE">SIC: Deadly
embrace of non-static inner class and thread local</a></td><td>Correctness</td><
/tr> |
264 <tr bgcolor="#ffffff"><td><a href="#SQL_BAD_PREPARED_STATEMENT_ACCESS">SQL: Meth
od attempts to access a prepared statement parameter with index 0</a></td><td>Co
rrectness</td></tr> | 263 <tr bgcolor="#ffffff"><td><a href="#SIO_SUPERFLUOUS_INSTANCEOF">SIO: Unnecessary
type check done using instanceof operator</a></td><td>Correctness</td></tr> |
265 <tr bgcolor="#eeeeee"><td><a href="#SQL_BAD_RESULTSET_ACCESS">SQL: Method attemp
ts to access a result set field with index 0</a></td><td>Correctness</td></tr> | 264 <tr bgcolor="#eeeeee"><td><a href="#SQL_BAD_PREPARED_STATEMENT_ACCESS">SQL: Meth
od attempts to access a prepared statement parameter with index 0</a></td><td>Co
rrectness</td></tr> |
266 <tr bgcolor="#ffffff"><td><a href="#STI_INTERRUPTED_ON_CURRENTTHREAD">STI: Unnee
ded use of currentThread() call, to call interrupted() </a></td><td>Correctness<
/td></tr> | 265 <tr bgcolor="#ffffff"><td><a href="#SQL_BAD_RESULTSET_ACCESS">SQL: Method attemp
ts to access a result set field with index 0</a></td><td>Correctness</td></tr> |
267 <tr bgcolor="#eeeeee"><td><a href="#STI_INTERRUPTED_ON_UNKNOWNTHREAD">STI: Stati
c Thread.interrupted() method invoked on thread instance</a></td><td>Correctness
</td></tr> | 266 <tr bgcolor="#eeeeee"><td><a href="#STI_INTERRUPTED_ON_CURRENTTHREAD">STI: Unnee
ded use of currentThread() call, to call interrupted() </a></td><td>Correctness<
/td></tr> |
268 <tr bgcolor="#ffffff"><td><a href="#SE_METHOD_MUST_BE_PRIVATE">Se: Method must b
e private in order for serialization to work</a></td><td>Correctness</td></tr> | 267 <tr bgcolor="#ffffff"><td><a href="#STI_INTERRUPTED_ON_UNKNOWNTHREAD">STI: Stati
c Thread.interrupted() method invoked on thread instance</a></td><td>Correctness
</td></tr> |
269 <tr bgcolor="#eeeeee"><td><a href="#SE_READ_RESOLVE_IS_STATIC">Se: The readResol
ve method must not be declared as a static method. </a></td><td>Correctness</td
></tr> | 268 <tr bgcolor="#eeeeee"><td><a href="#SE_METHOD_MUST_BE_PRIVATE">Se: Method must b
e private in order for serialization to work</a></td><td>Correctness</td></tr> |
270 <tr bgcolor="#ffffff"><td><a href="#TQ_ALWAYS_VALUE_USED_WHERE_NEVER_REQUIRED">T
Q: Value annotated as carrying a type qualifier used where a value that must not
carry that qualifier is required</a></td><td>Correctness</td></tr> | 269 <tr bgcolor="#ffffff"><td><a href="#SE_READ_RESOLVE_IS_STATIC">Se: The readResol
ve method must not be declared as a static method. </a></td><td>Correctness</td
></tr> |
271 <tr bgcolor="#eeeeee"><td><a href="#TQ_COMPARING_VALUES_WITH_INCOMPATIBLE_TYPE_Q
UALIFIERS">TQ: Comparing values with incompatible type qualifiers</a></td><td>Co
rrectness</td></tr> | 270 <tr bgcolor="#eeeeee"><td><a href="#TQ_ALWAYS_VALUE_USED_WHERE_NEVER_REQUIRED">T
Q: Value annotated as carrying a type qualifier used where a value that must not
carry that qualifier is required</a></td><td>Correctness</td></tr> |
272 <tr bgcolor="#ffffff"><td><a href="#TQ_MAYBE_SOURCE_VALUE_REACHES_ALWAYS_SINK">T
Q: Value that might not carry a type qualifier is always used in a way requires
that type qualifier</a></td><td>Correctness</td></tr> | 271 <tr bgcolor="#ffffff"><td><a href="#TQ_COMPARING_VALUES_WITH_INCOMPATIBLE_TYPE_Q
UALIFIERS">TQ: Comparing values with incompatible type qualifiers</a></td><td>Co
rrectness</td></tr> |
273 <tr bgcolor="#eeeeee"><td><a href="#TQ_MAYBE_SOURCE_VALUE_REACHES_NEVER_SINK">TQ
: Value that might carry a type qualifier is always used in a way prohibits it f
rom having that type qualifier</a></td><td>Correctness</td></tr> | 272 <tr bgcolor="#eeeeee"><td><a href="#TQ_MAYBE_SOURCE_VALUE_REACHES_ALWAYS_SINK">T
Q: Value that might not carry a type qualifier is always used in a way requires
that type qualifier</a></td><td>Correctness</td></tr> |
274 <tr bgcolor="#ffffff"><td><a href="#TQ_NEVER_VALUE_USED_WHERE_ALWAYS_REQUIRED">T
Q: Value annotated as never carrying a type qualifier used where value carrying
that qualifier is required</a></td><td>Correctness</td></tr> | 273 <tr bgcolor="#ffffff"><td><a href="#TQ_MAYBE_SOURCE_VALUE_REACHES_NEVER_SINK">TQ
: Value that might carry a type qualifier is always used in a way prohibits it f
rom having that type qualifier</a></td><td>Correctness</td></tr> |
| 274 <tr bgcolor="#eeeeee"><td><a href="#TQ_NEVER_VALUE_USED_WHERE_ALWAYS_REQUIRED">T
Q: Value annotated as never carrying a type qualifier used where value carrying
that qualifier is required</a></td><td>Correctness</td></tr> |
| 275 <tr bgcolor="#ffffff"><td><a href="#TQ_UNKNOWN_VALUE_USED_WHERE_ALWAYS_STRICTLY_
REQUIRED">TQ: Value without a type qualifier used where a value is required to h
ave that qualifier</a></td><td>Correctness</td></tr> |
275 <tr bgcolor="#eeeeee"><td><a href="#UMAC_UNCALLABLE_METHOD_OF_ANONYMOUS_CLASS">U
MAC: Uncallable method defined in anonymous class</a></td><td>Correctness</td></
tr> | 276 <tr bgcolor="#eeeeee"><td><a href="#UMAC_UNCALLABLE_METHOD_OF_ANONYMOUS_CLASS">U
MAC: Uncallable method defined in anonymous class</a></td><td>Correctness</td></
tr> |
276 <tr bgcolor="#ffffff"><td><a href="#UR_UNINIT_READ">UR: Uninitialized read of fi
eld in constructor</a></td><td>Correctness</td></tr> | 277 <tr bgcolor="#ffffff"><td><a href="#UR_UNINIT_READ">UR: Uninitialized read of fi
eld in constructor</a></td><td>Correctness</td></tr> |
277 <tr bgcolor="#eeeeee"><td><a href="#UR_UNINIT_READ_CALLED_FROM_SUPER_CONSTRUCTOR
">UR: Uninitialized read of field method called from constructor of superclass</
a></td><td>Correctness</td></tr> | 278 <tr bgcolor="#eeeeee"><td><a href="#UR_UNINIT_READ_CALLED_FROM_SUPER_CONSTRUCTOR
">UR: Uninitialized read of field method called from constructor of superclass</
a></td><td>Correctness</td></tr> |
278 <tr bgcolor="#ffffff"><td><a href="#DMI_INVOKING_TOSTRING_ON_ANONYMOUS_ARRAY">US
ELESS_STRING: Invocation of toString on an array</a></td><td>Correctness</td></t
r> | 279 <tr bgcolor="#ffffff"><td><a href="#DMI_INVOKING_TOSTRING_ON_ANONYMOUS_ARRAY">US
ELESS_STRING: Invocation of toString on an unnamed array</a></td><td>Correctness
</td></tr> |
279 <tr bgcolor="#eeeeee"><td><a href="#DMI_INVOKING_TOSTRING_ON_ARRAY">USELESS_STRI
NG: Invocation of toString on an array</a></td><td>Correctness</td></tr> | 280 <tr bgcolor="#eeeeee"><td><a href="#DMI_INVOKING_TOSTRING_ON_ARRAY">USELESS_STRI
NG: Invocation of toString on an array</a></td><td>Correctness</td></tr> |
280 <tr bgcolor="#ffffff"><td><a href="#VA_FORMAT_STRING_BAD_CONVERSION_FROM_ARRAY">
USELESS_STRING: Array formatted in useless way using format string</a></td><td>C
orrectness</td></tr> | 281 <tr bgcolor="#ffffff"><td><a href="#VA_FORMAT_STRING_BAD_CONVERSION_FROM_ARRAY">
USELESS_STRING: Array formatted in useless way using format string</a></td><td>C
orrectness</td></tr> |
281 <tr bgcolor="#eeeeee"><td><a href="#UWF_NULL_FIELD">UwF: Field only ever set to
null</a></td><td>Correctness</td></tr> | 282 <tr bgcolor="#eeeeee"><td><a href="#UWF_NULL_FIELD">UwF: Field only ever set to
null</a></td><td>Correctness</td></tr> |
282 <tr bgcolor="#ffffff"><td><a href="#UWF_UNWRITTEN_FIELD">UwF: Unwritten field</a
></td><td>Correctness</td></tr> | 283 <tr bgcolor="#ffffff"><td><a href="#UWF_UNWRITTEN_FIELD">UwF: Unwritten field</a
></td><td>Correctness</td></tr> |
283 <tr bgcolor="#eeeeee"><td><a href="#VA_PRIMITIVE_ARRAY_PASSED_TO_OBJECT_VARARG">
VA: Primitive array passed to function expecting a variable number of object arg
uments</a></td><td>Correctness</td></tr> | 284 <tr bgcolor="#eeeeee"><td><a href="#VA_PRIMITIVE_ARRAY_PASSED_TO_OBJECT_VARARG">
VA: Primitive array passed to function expecting a variable number of object arg
uments</a></td><td>Correctness</td></tr> |
284 <tr bgcolor="#ffffff"><td><a href="#LG_LOST_LOGGER_DUE_TO_WEAK_REFERENCE">LG: Po
tential lost logger changes due to weak reference in OpenJDK</a></td><td>Experim
ental</td></tr> | 285 <tr bgcolor="#ffffff"><td><a href="#LG_LOST_LOGGER_DUE_TO_WEAK_REFERENCE">LG: Po
tential lost logger changes due to weak reference in OpenJDK</a></td><td>Experim
ental</td></tr> |
285 <tr bgcolor="#eeeeee"><td><a href="#OBL_UNSATISFIED_OBLIGATION">OBL: Method may
fail to clean up stream or resource</a></td><td>Experimental</td></tr> | 286 <tr bgcolor="#eeeeee"><td><a href="#OBL_UNSATISFIED_OBLIGATION">OBL: Method may
fail to clean up stream or resource</a></td><td>Experimental</td></tr> |
286 <tr bgcolor="#ffffff"><td><a href="#OBL_UNSATISFIED_OBLIGATION_EXCEPTION_EDGE">O
BL: Method may fail to clean up stream or resource on checked exception</a></td>
<td>Experimental</td></tr> | 287 <tr bgcolor="#ffffff"><td><a href="#OBL_UNSATISFIED_OBLIGATION_EXCEPTION_EDGE">O
BL: Method may fail to clean up stream or resource on checked exception</a></td>
<td>Experimental</td></tr> |
287 <tr bgcolor="#eeeeee"><td><a href="#DM_CONVERT_CASE">Dm: Consider using Locale p
arameterized version of invoked method</a></td><td>Internationalization</td></tr
> | 288 <tr bgcolor="#eeeeee"><td><a href="#DM_CONVERT_CASE">Dm: Consider using Locale p
arameterized version of invoked method</a></td><td>Internationalization</td></tr
> |
288 <tr bgcolor="#ffffff"><td><a href="#DM_DEFAULT_ENCODING">Dm: Reliance on default
encoding</a></td><td>Internationalization</td></tr> | 289 <tr bgcolor="#ffffff"><td><a href="#DM_DEFAULT_ENCODING">Dm: Reliance on default
encoding</a></td><td>Internationalization</td></tr> |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 <tr bgcolor="#ffffff"><td><a href="#UW_UNCOND_WAIT">UW: Unconditional wait</a></
td><td>Multithreaded correctness</td></tr> | 343 <tr bgcolor="#ffffff"><td><a href="#UW_UNCOND_WAIT">UW: Unconditional wait</a></
td><td>Multithreaded correctness</td></tr> |
343 <tr bgcolor="#eeeeee"><td><a href="#VO_VOLATILE_INCREMENT">VO: An increment to a
volatile field isn't atomic</a></td><td>Multithreaded correctness</td></tr> | 344 <tr bgcolor="#eeeeee"><td><a href="#VO_VOLATILE_INCREMENT">VO: An increment to a
volatile field isn't atomic</a></td><td>Multithreaded correctness</td></tr> |
344 <tr bgcolor="#ffffff"><td><a href="#VO_VOLATILE_REFERENCE_TO_ARRAY">VO: A volati
le reference to an array doesn't treat the array elements as volatile</a></td><t
d>Multithreaded correctness</td></tr> | 345 <tr bgcolor="#ffffff"><td><a href="#VO_VOLATILE_REFERENCE_TO_ARRAY">VO: A volati
le reference to an array doesn't treat the array elements as volatile</a></td><t
d>Multithreaded correctness</td></tr> |
345 <tr bgcolor="#eeeeee"><td><a href="#WL_USING_GETCLASS_RATHER_THAN_CLASS_LITERAL"
>WL: Synchronization on getClass rather than class literal</a></td><td>Multithre
aded correctness</td></tr> | 346 <tr bgcolor="#eeeeee"><td><a href="#WL_USING_GETCLASS_RATHER_THAN_CLASS_LITERAL"
>WL: Synchronization on getClass rather than class literal</a></td><td>Multithre
aded correctness</td></tr> |
346 <tr bgcolor="#ffffff"><td><a href="#WS_WRITEOBJECT_SYNC">WS: Class's writeObject
() method is synchronized but nothing else is</a></td><td>Multithreaded correctn
ess</td></tr> | 347 <tr bgcolor="#ffffff"><td><a href="#WS_WRITEOBJECT_SYNC">WS: Class's writeObject
() method is synchronized but nothing else is</a></td><td>Multithreaded correctn
ess</td></tr> |
347 <tr bgcolor="#eeeeee"><td><a href="#WA_AWAIT_NOT_IN_LOOP">Wa: Condition.await()
not in loop </a></td><td>Multithreaded correctness</td></tr> | 348 <tr bgcolor="#eeeeee"><td><a href="#WA_AWAIT_NOT_IN_LOOP">Wa: Condition.await()
not in loop </a></td><td>Multithreaded correctness</td></tr> |
348 <tr bgcolor="#ffffff"><td><a href="#WA_NOT_IN_LOOP">Wa: Wait not in loop </a></t
d><td>Multithreaded correctness</td></tr> | 349 <tr bgcolor="#ffffff"><td><a href="#WA_NOT_IN_LOOP">Wa: Wait not in loop </a></t
d><td>Multithreaded correctness</td></tr> |
349 <tr bgcolor="#eeeeee"><td><a href="#BX_BOXING_IMMEDIATELY_UNBOXED">Bx: Primitive
value is boxed and then immediately unboxed</a></td><td>Performance</td></tr> | 350 <tr bgcolor="#eeeeee"><td><a href="#BX_BOXING_IMMEDIATELY_UNBOXED">Bx: Primitive
value is boxed and then immediately unboxed</a></td><td>Performance</td></tr> |
350 <tr bgcolor="#ffffff"><td><a href="#BX_BOXING_IMMEDIATELY_UNBOXED_TO_PERFORM_COE
RCION">Bx: Primitive value is boxed then unboxed to perform primitive coercion</
a></td><td>Performance</td></tr> | 351 <tr bgcolor="#ffffff"><td><a href="#BX_BOXING_IMMEDIATELY_UNBOXED_TO_PERFORM_COE
RCION">Bx: Primitive value is boxed then unboxed to perform primitive coercion</
a></td><td>Performance</td></tr> |
351 <tr bgcolor="#eeeeee"><td><a href="#BX_UNBOXING_IMMEDIATELY_REBOXED">Bx: Boxed v
alue is unboxed and then immediately reboxed</a></td><td>Performance</td></tr> | 352 <tr bgcolor="#eeeeee"><td><a href="#BX_UNBOXING_IMMEDIATELY_REBOXED">Bx: Boxed v
alue is unboxed and then immediately reboxed</a></td><td>Performance</td></tr> |
352 <tr bgcolor="#ffffff"><td><a href="#DM_BOXED_PRIMITIVE_TOSTRING">Bx: Method allo
cates a boxed primitive just to call toString</a></td><td>Performance</td></tr> | 353 <tr bgcolor="#ffffff"><td><a href="#DM_BOXED_PRIMITIVE_FOR_PARSING">Bx: Boxing/u
nboxing to parse a primitive</a></td><td>Performance</td></tr> |
353 <tr bgcolor="#eeeeee"><td><a href="#DM_FP_NUMBER_CTOR">Bx: Method invokes ineffi
cient floating-point Number constructor; use static valueOf instead</a></td><td>
Performance</td></tr> | 354 <tr bgcolor="#eeeeee"><td><a href="#DM_BOXED_PRIMITIVE_TOSTRING">Bx: Method allo
cates a boxed primitive just to call toString</a></td><td>Performance</td></tr> |
354 <tr bgcolor="#ffffff"><td><a href="#DM_NUMBER_CTOR">Bx: Method invokes inefficie
nt Number constructor; use static valueOf instead</a></td><td>Performance</td></
tr> | 355 <tr bgcolor="#ffffff"><td><a href="#DM_FP_NUMBER_CTOR">Bx: Method invokes ineffi
cient floating-point Number constructor; use static valueOf instead</a></td><td>
Performance</td></tr> |
355 <tr bgcolor="#eeeeee"><td><a href="#DMI_BLOCKING_METHODS_ON_URL">Dm: The equals
and hashCode methods of URL are blocking</a></td><td>Performance</td></tr> | 356 <tr bgcolor="#eeeeee"><td><a href="#DM_NUMBER_CTOR">Bx: Method invokes inefficie
nt Number constructor; use static valueOf instead</a></td><td>Performance</td></
tr> |
356 <tr bgcolor="#ffffff"><td><a href="#DMI_COLLECTION_OF_URLS">Dm: Maps and sets of
URLs can be performance hogs</a></td><td>Performance</td></tr> | 357 <tr bgcolor="#ffffff"><td><a href="#DMI_BLOCKING_METHODS_ON_URL">Dm: The equals
and hashCode methods of URL are blocking</a></td><td>Performance</td></tr> |
357 <tr bgcolor="#eeeeee"><td><a href="#DM_BOOLEAN_CTOR">Dm: Method invokes ineffici
ent Boolean constructor; use Boolean.valueOf(...) instead</a></td><td>Performanc
e</td></tr> | 358 <tr bgcolor="#eeeeee"><td><a href="#DMI_COLLECTION_OF_URLS">Dm: Maps and sets of
URLs can be performance hogs</a></td><td>Performance</td></tr> |
358 <tr bgcolor="#ffffff"><td><a href="#DM_GC">Dm: Explicit garbage collection; extr
emely dubious except in benchmarking code</a></td><td>Performance</td></tr> | 359 <tr bgcolor="#ffffff"><td><a href="#DM_BOOLEAN_CTOR">Dm: Method invokes ineffici
ent Boolean constructor; use Boolean.valueOf(...) instead</a></td><td>Performanc
e</td></tr> |
359 <tr bgcolor="#eeeeee"><td><a href="#DM_NEW_FOR_GETCLASS">Dm: Method allocates an
object, only to get the class object</a></td><td>Performance</td></tr> | 360 <tr bgcolor="#eeeeee"><td><a href="#DM_GC">Dm: Explicit garbage collection; extr
emely dubious except in benchmarking code</a></td><td>Performance</td></tr> |
360 <tr bgcolor="#ffffff"><td><a href="#DM_NEXTINT_VIA_NEXTDOUBLE">Dm: Use the nextI
nt method of Random rather than nextDouble to generate a random integer</a></td>
<td>Performance</td></tr> | 361 <tr bgcolor="#ffffff"><td><a href="#DM_NEW_FOR_GETCLASS">Dm: Method allocates an
object, only to get the class object</a></td><td>Performance</td></tr> |
361 <tr bgcolor="#eeeeee"><td><a href="#DM_STRING_CTOR">Dm: Method invokes inefficie
nt new String(String) constructor</a></td><td>Performance</td></tr> | 362 <tr bgcolor="#eeeeee"><td><a href="#DM_NEXTINT_VIA_NEXTDOUBLE">Dm: Use the nextI
nt method of Random rather than nextDouble to generate a random integer</a></td>
<td>Performance</td></tr> |
362 <tr bgcolor="#ffffff"><td><a href="#DM_STRING_TOSTRING">Dm: Method invokes toStr
ing() method on a String</a></td><td>Performance</td></tr> | 363 <tr bgcolor="#ffffff"><td><a href="#DM_STRING_CTOR">Dm: Method invokes inefficie
nt new String(String) constructor</a></td><td>Performance</td></tr> |
363 <tr bgcolor="#eeeeee"><td><a href="#DM_STRING_VOID_CTOR">Dm: Method invokes inef
ficient new String() constructor</a></td><td>Performance</td></tr> | 364 <tr bgcolor="#eeeeee"><td><a href="#DM_STRING_TOSTRING">Dm: Method invokes toStr
ing() method on a String</a></td><td>Performance</td></tr> |
364 <tr bgcolor="#ffffff"><td><a href="#HSC_HUGE_SHARED_STRING_CONSTANT">HSC: Huge s
tring constants is duplicated across multiple class files</a></td><td>Performanc
e</td></tr> | 365 <tr bgcolor="#ffffff"><td><a href="#DM_STRING_VOID_CTOR">Dm: Method invokes inef
ficient new String() constructor</a></td><td>Performance</td></tr> |
365 <tr bgcolor="#eeeeee"><td><a href="#ITA_INEFFICIENT_TO_ARRAY">ITA: Method uses t
oArray() with zero-length array argument</a></td><td>Performance</td></tr> | 366 <tr bgcolor="#eeeeee"><td><a href="#HSC_HUGE_SHARED_STRING_CONSTANT">HSC: Huge s
tring constants is duplicated across multiple class files</a></td><td>Performanc
e</td></tr> |
366 <tr bgcolor="#ffffff"><td><a href="#SBSC_USE_STRINGBUFFER_CONCATENATION">SBSC: M
ethod concatenates strings using + in a loop</a></td><td>Performance</td></tr> | 367 <tr bgcolor="#ffffff"><td><a href="#ITA_INEFFICIENT_TO_ARRAY">ITA: Method uses t
oArray() with zero-length array argument</a></td><td>Performance</td></tr> |
367 <tr bgcolor="#eeeeee"><td><a href="#SIC_INNER_SHOULD_BE_STATIC">SIC: Should be a
static inner class</a></td><td>Performance</td></tr> | 368 <tr bgcolor="#eeeeee"><td><a href="#SBSC_USE_STRINGBUFFER_CONCATENATION">SBSC: M
ethod concatenates strings using + in a loop</a></td><td>Performance</td></tr> |
368 <tr bgcolor="#ffffff"><td><a href="#SIC_INNER_SHOULD_BE_STATIC_ANON">SIC: Could
be refactored into a named static inner class</a></td><td>Performance</td></tr> | 369 <tr bgcolor="#ffffff"><td><a href="#SIC_INNER_SHOULD_BE_STATIC">SIC: Should be a
static inner class</a></td><td>Performance</td></tr> |
369 <tr bgcolor="#eeeeee"><td><a href="#SIC_INNER_SHOULD_BE_STATIC_NEEDS_THIS">SIC:
Could be refactored into a static inner class</a></td><td>Performance</td></tr> | 370 <tr bgcolor="#eeeeee"><td><a href="#SIC_INNER_SHOULD_BE_STATIC_ANON">SIC: Could
be refactored into a named static inner class</a></td><td>Performance</td></tr> |
370 <tr bgcolor="#ffffff"><td><a href="#SS_SHOULD_BE_STATIC">SS: Unread field: shoul
d this field be static?</a></td><td>Performance</td></tr> | 371 <tr bgcolor="#ffffff"><td><a href="#SIC_INNER_SHOULD_BE_STATIC_NEEDS_THIS">SIC:
Could be refactored into a static inner class</a></td><td>Performance</td></tr> |
371 <tr bgcolor="#eeeeee"><td><a href="#UM_UNNECESSARY_MATH">UM: Method calls static
Math class method on a constant value</a></td><td>Performance</td></tr> | 372 <tr bgcolor="#eeeeee"><td><a href="#SS_SHOULD_BE_STATIC">SS: Unread field: shoul
d this field be static?</a></td><td>Performance</td></tr> |
372 <tr bgcolor="#ffffff"><td><a href="#UPM_UNCALLED_PRIVATE_METHOD">UPM: Private me
thod is never called</a></td><td>Performance</td></tr> | 373 <tr bgcolor="#ffffff"><td><a href="#UM_UNNECESSARY_MATH">UM: Method calls static
Math class method on a constant value</a></td><td>Performance</td></tr> |
373 <tr bgcolor="#eeeeee"><td><a href="#URF_UNREAD_FIELD">UrF: Unread field</a></td>
<td>Performance</td></tr> | 374 <tr bgcolor="#eeeeee"><td><a href="#UPM_UNCALLED_PRIVATE_METHOD">UPM: Private me
thod is never called</a></td><td>Performance</td></tr> |
374 <tr bgcolor="#ffffff"><td><a href="#UUF_UNUSED_FIELD">UuF: Unused field</a></td>
<td>Performance</td></tr> | 375 <tr bgcolor="#ffffff"><td><a href="#URF_UNREAD_FIELD">UrF: Unread field</a></td>
<td>Performance</td></tr> |
375 <tr bgcolor="#eeeeee"><td><a href="#WMI_WRONG_MAP_ITERATOR">WMI: Inefficient use
of keySet iterator instead of entrySet iterator</a></td><td>Performance</td></t
r> | 376 <tr bgcolor="#eeeeee"><td><a href="#UUF_UNUSED_FIELD">UuF: Unused field</a></td>
<td>Performance</td></tr> |
376 <tr bgcolor="#ffffff"><td><a href="#DMI_CONSTANT_DB_PASSWORD">Dm: Hardcoded cons
tant database password</a></td><td>Security</td></tr> | 377 <tr bgcolor="#ffffff"><td><a href="#WMI_WRONG_MAP_ITERATOR">WMI: Inefficient use
of keySet iterator instead of entrySet iterator</a></td><td>Performance</td></t
r> |
377 <tr bgcolor="#eeeeee"><td><a href="#DMI_EMPTY_DB_PASSWORD">Dm: Empty database pa
ssword</a></td><td>Security</td></tr> | 378 <tr bgcolor="#eeeeee"><td><a href="#DMI_CONSTANT_DB_PASSWORD">Dm: Hardcoded cons
tant database password</a></td><td>Security</td></tr> |
378 <tr bgcolor="#ffffff"><td><a href="#HRS_REQUEST_PARAMETER_TO_COOKIE">HRS: HTTP c
ookie formed from untrusted input</a></td><td>Security</td></tr> | 379 <tr bgcolor="#ffffff"><td><a href="#DMI_EMPTY_DB_PASSWORD">Dm: Empty database pa
ssword</a></td><td>Security</td></tr> |
379 <tr bgcolor="#eeeeee"><td><a href="#HRS_REQUEST_PARAMETER_TO_HTTP_HEADER">HRS: H
TTP Response splitting vulnerability</a></td><td>Security</td></tr> | 380 <tr bgcolor="#eeeeee"><td><a href="#HRS_REQUEST_PARAMETER_TO_COOKIE">HRS: HTTP c
ookie formed from untrusted input</a></td><td>Security</td></tr> |
380 <tr bgcolor="#ffffff"><td><a href="#PT_ABSOLUTE_PATH_TRAVERSAL">PT: Absolute pat
h traversal in servlet</a></td><td>Security</td></tr> | 381 <tr bgcolor="#ffffff"><td><a href="#HRS_REQUEST_PARAMETER_TO_HTTP_HEADER">HRS: H
TTP Response splitting vulnerability</a></td><td>Security</td></tr> |
381 <tr bgcolor="#eeeeee"><td><a href="#PT_RELATIVE_PATH_TRAVERSAL">PT: Relative pat
h traversal in servlet</a></td><td>Security</td></tr> | 382 <tr bgcolor="#eeeeee"><td><a href="#PT_ABSOLUTE_PATH_TRAVERSAL">PT: Absolute pat
h traversal in servlet</a></td><td>Security</td></tr> |
382 <tr bgcolor="#ffffff"><td><a href="#SQL_NONCONSTANT_STRING_PASSED_TO_EXECUTE">SQ
L: Nonconstant string passed to execute method on an SQL statement</a></td><td>S
ecurity</td></tr> | 383 <tr bgcolor="#ffffff"><td><a href="#PT_RELATIVE_PATH_TRAVERSAL">PT: Relative pat
h traversal in servlet</a></td><td>Security</td></tr> |
383 <tr bgcolor="#eeeeee"><td><a href="#SQL_PREPARED_STATEMENT_GENERATED_FROM_NONCON
STANT_STRING">SQL: A prepared statement is generated from a nonconstant String</
a></td><td>Security</td></tr> | 384 <tr bgcolor="#eeeeee"><td><a href="#SQL_NONCONSTANT_STRING_PASSED_TO_EXECUTE">SQ
L: Nonconstant string passed to execute method on an SQL statement</a></td><td>S
ecurity</td></tr> |
384 <tr bgcolor="#ffffff"><td><a href="#XSS_REQUEST_PARAMETER_TO_JSP_WRITER">XSS: JS
P reflected cross site scripting vulnerability</a></td><td>Security</td></tr> | 385 <tr bgcolor="#ffffff"><td><a href="#SQL_PREPARED_STATEMENT_GENERATED_FROM_NONCON
STANT_STRING">SQL: A prepared statement is generated from a nonconstant String</
a></td><td>Security</td></tr> |
385 <tr bgcolor="#eeeeee"><td><a href="#XSS_REQUEST_PARAMETER_TO_SEND_ERROR">XSS: Se
rvlet reflected cross site scripting vulnerability in error page</a></td><td>Sec
urity</td></tr> | 386 <tr bgcolor="#eeeeee"><td><a href="#XSS_REQUEST_PARAMETER_TO_JSP_WRITER">XSS: JS
P reflected cross site scripting vulnerability</a></td><td>Security</td></tr> |
386 <tr bgcolor="#ffffff"><td><a href="#XSS_REQUEST_PARAMETER_TO_SERVLET_WRITER">XSS
: Servlet reflected cross site scripting vulnerability</a></td><td>Security</td>
</tr> | 387 <tr bgcolor="#ffffff"><td><a href="#XSS_REQUEST_PARAMETER_TO_SEND_ERROR">XSS: Se
rvlet reflected cross site scripting vulnerability in error page</a></td><td>Sec
urity</td></tr> |
387 <tr bgcolor="#eeeeee"><td><a href="#BC_BAD_CAST_TO_ABSTRACT_COLLECTION">BC: Ques
tionable cast to abstract collection </a></td><td>Dodgy code</td></tr> | 388 <tr bgcolor="#eeeeee"><td><a href="#XSS_REQUEST_PARAMETER_TO_SERVLET_WRITER">XSS
: Servlet reflected cross site scripting vulnerability</a></td><td>Security</td>
</tr> |
388 <tr bgcolor="#ffffff"><td><a href="#BC_BAD_CAST_TO_CONCRETE_COLLECTION">BC: Ques
tionable cast to concrete collection</a></td><td>Dodgy code</td></tr> | 389 <tr bgcolor="#ffffff"><td><a href="#BC_BAD_CAST_TO_ABSTRACT_COLLECTION">BC: Ques
tionable cast to abstract collection </a></td><td>Dodgy code</td></tr> |
389 <tr bgcolor="#eeeeee"><td><a href="#BC_UNCONFIRMED_CAST">BC: Unchecked/unconfirm
ed cast</a></td><td>Dodgy code</td></tr> | 390 <tr bgcolor="#eeeeee"><td><a href="#BC_BAD_CAST_TO_CONCRETE_COLLECTION">BC: Ques
tionable cast to concrete collection</a></td><td>Dodgy code</td></tr> |
390 <tr bgcolor="#ffffff"><td><a href="#BC_UNCONFIRMED_CAST_OF_RETURN_VALUE">BC: Unc
hecked/unconfirmed cast of return value from method</a></td><td>Dodgy code</td><
/tr> | 391 <tr bgcolor="#ffffff"><td><a href="#BC_UNCONFIRMED_CAST">BC: Unchecked/unconfirm
ed cast</a></td><td>Dodgy code</td></tr> |
391 <tr bgcolor="#eeeeee"><td><a href="#BC_VACUOUS_INSTANCEOF">BC: instanceof will a
lways return true</a></td><td>Dodgy code</td></tr> | 392 <tr bgcolor="#eeeeee"><td><a href="#BC_UNCONFIRMED_CAST_OF_RETURN_VALUE">BC: Unc
hecked/unconfirmed cast of return value from method</a></td><td>Dodgy code</td><
/tr> |
392 <tr bgcolor="#ffffff"><td><a href="#ICAST_QUESTIONABLE_UNSIGNED_RIGHT_SHIFT">BSH
IFT: Unsigned right shift cast to short/byte</a></td><td>Dodgy code</td></tr> | 393 <tr bgcolor="#ffffff"><td><a href="#BC_VACUOUS_INSTANCEOF">BC: instanceof will a
lways return true</a></td><td>Dodgy code</td></tr> |
393 <tr bgcolor="#eeeeee"><td><a href="#CI_CONFUSED_INHERITANCE">CI: Class is final
but declares protected field</a></td><td>Dodgy code</td></tr> | 394 <tr bgcolor="#eeeeee"><td><a href="#ICAST_QUESTIONABLE_UNSIGNED_RIGHT_SHIFT">BSH
IFT: Unsigned right shift cast to short/byte</a></td><td>Dodgy code</td></tr> |
394 <tr bgcolor="#ffffff"><td><a href="#DB_DUPLICATE_BRANCHES">DB: Method uses the s
ame code for two branches</a></td><td>Dodgy code</td></tr> | 395 <tr bgcolor="#ffffff"><td><a href="#CI_CONFUSED_INHERITANCE">CI: Class is final
but declares protected field</a></td><td>Dodgy code</td></tr> |
395 <tr bgcolor="#eeeeee"><td><a href="#DB_DUPLICATE_SWITCH_CLAUSES">DB: Method uses
the same code for two switch clauses</a></td><td>Dodgy code</td></tr> | 396 <tr bgcolor="#eeeeee"><td><a href="#DB_DUPLICATE_BRANCHES">DB: Method uses the s
ame code for two branches</a></td><td>Dodgy code</td></tr> |
396 <tr bgcolor="#ffffff"><td><a href="#DLS_DEAD_LOCAL_STORE">DLS: Dead store to loc
al variable</a></td><td>Dodgy code</td></tr> | 397 <tr bgcolor="#ffffff"><td><a href="#DB_DUPLICATE_SWITCH_CLAUSES">DB: Method uses
the same code for two switch clauses</a></td><td>Dodgy code</td></tr> |
397 <tr bgcolor="#eeeeee"><td><a href="#DLS_DEAD_LOCAL_STORE_IN_RETURN">DLS: Useless
assignment in return statement</a></td><td>Dodgy code</td></tr> | 398 <tr bgcolor="#eeeeee"><td><a href="#DLS_DEAD_LOCAL_STORE">DLS: Dead store to loc
al variable</a></td><td>Dodgy code</td></tr> |
398 <tr bgcolor="#ffffff"><td><a href="#DLS_DEAD_LOCAL_STORE_OF_NULL">DLS: Dead stor
e of null to local variable</a></td><td>Dodgy code</td></tr> | 399 <tr bgcolor="#ffffff"><td><a href="#DLS_DEAD_LOCAL_STORE_IN_RETURN">DLS: Useless
assignment in return statement</a></td><td>Dodgy code</td></tr> |
399 <tr bgcolor="#eeeeee"><td><a href="#DLS_DEAD_LOCAL_STORE_SHADOWS_FIELD">DLS: Dea
d store to local variable that shadows field</a></td><td>Dodgy code</td></tr> | 400 <tr bgcolor="#eeeeee"><td><a href="#DLS_DEAD_LOCAL_STORE_OF_NULL">DLS: Dead stor
e of null to local variable</a></td><td>Dodgy code</td></tr> |
400 <tr bgcolor="#ffffff"><td><a href="#DMI_HARDCODED_ABSOLUTE_FILENAME">DMI: Code c
ontains a hard coded reference to an absolute pathname</a></td><td>Dodgy code</t
d></tr> | 401 <tr bgcolor="#ffffff"><td><a href="#DLS_DEAD_LOCAL_STORE_SHADOWS_FIELD">DLS: Dea
d store to local variable that shadows field</a></td><td>Dodgy code</td></tr> |
401 <tr bgcolor="#eeeeee"><td><a href="#DMI_NONSERIALIZABLE_OBJECT_WRITTEN">DMI: Non
serializable object written to ObjectOutput</a></td><td>Dodgy code</td></tr> | 402 <tr bgcolor="#eeeeee"><td><a href="#DMI_HARDCODED_ABSOLUTE_FILENAME">DMI: Code c
ontains a hard coded reference to an absolute pathname</a></td><td>Dodgy code</t
d></tr> |
402 <tr bgcolor="#ffffff"><td><a href="#DMI_USELESS_SUBSTRING">DMI: Invocation of su
bstring(0), which returns the original value</a></td><td>Dodgy code</td></tr> | 403 <tr bgcolor="#ffffff"><td><a href="#DMI_NONSERIALIZABLE_OBJECT_WRITTEN">DMI: Non
serializable object written to ObjectOutput</a></td><td>Dodgy code</td></tr> |
403 <tr bgcolor="#eeeeee"><td><a href="#DMI_THREAD_PASSED_WHERE_RUNNABLE_EXPECTED">D
m: Thread passed where Runnable expected</a></td><td>Dodgy code</td></tr> | 404 <tr bgcolor="#eeeeee"><td><a href="#DMI_USELESS_SUBSTRING">DMI: Invocation of su
bstring(0), which returns the original value</a></td><td>Dodgy code</td></tr> |
404 <tr bgcolor="#ffffff"><td><a href="#EQ_DOESNT_OVERRIDE_EQUALS">Eq: Class doesn't
override equals in superclass</a></td><td>Dodgy code</td></tr> | 405 <tr bgcolor="#ffffff"><td><a href="#DMI_THREAD_PASSED_WHERE_RUNNABLE_EXPECTED">D
m: Thread passed where Runnable expected</a></td><td>Dodgy code</td></tr> |
405 <tr bgcolor="#eeeeee"><td><a href="#EQ_UNUSUAL">Eq: Unusual equals method </a></
td><td>Dodgy code</td></tr> | 406 <tr bgcolor="#eeeeee"><td><a href="#EQ_DOESNT_OVERRIDE_EQUALS">Eq: Class doesn't
override equals in superclass</a></td><td>Dodgy code</td></tr> |
406 <tr bgcolor="#ffffff"><td><a href="#FE_FLOATING_POINT_EQUALITY">FE: Test for flo
ating point equality</a></td><td>Dodgy code</td></tr> | 407 <tr bgcolor="#ffffff"><td><a href="#EQ_UNUSUAL">Eq: Unusual equals method </a></
td><td>Dodgy code</td></tr> |
407 <tr bgcolor="#eeeeee"><td><a href="#VA_FORMAT_STRING_BAD_CONVERSION_TO_BOOLEAN">
FS: Non-Boolean argument formatted using %b format specifier</a></td><td>Dodgy c
ode</td></tr> | 408 <tr bgcolor="#eeeeee"><td><a href="#FE_FLOATING_POINT_EQUALITY">FE: Test for flo
ating point equality</a></td><td>Dodgy code</td></tr> |
408 <tr bgcolor="#ffffff"><td><a href="#IA_AMBIGUOUS_INVOCATION_OF_INHERITED_OR_OUTE
R_METHOD">IA: Ambiguous invocation of either an inherited or outer method</a></t
d><td>Dodgy code</td></tr> | 409 <tr bgcolor="#ffffff"><td><a href="#VA_FORMAT_STRING_BAD_CONVERSION_TO_BOOLEAN">
FS: Non-Boolean argument formatted using %b format specifier</a></td><td>Dodgy c
ode</td></tr> |
409 <tr bgcolor="#eeeeee"><td><a href="#IC_INIT_CIRCULARITY">IC: Initialization circ
ularity</a></td><td>Dodgy code</td></tr> | 410 <tr bgcolor="#eeeeee"><td><a href="#IA_AMBIGUOUS_INVOCATION_OF_INHERITED_OR_OUTE
R_METHOD">IA: Potentially ambiguous invocation of either an inherited or outer m
ethod</a></td><td>Dodgy code</td></tr> |
410 <tr bgcolor="#ffffff"><td><a href="#ICAST_IDIV_CAST_TO_DOUBLE">ICAST: integral d
ivision result cast to double or float</a></td><td>Dodgy code</td></tr> | 411 <tr bgcolor="#ffffff"><td><a href="#IC_INIT_CIRCULARITY">IC: Initialization circ
ularity</a></td><td>Dodgy code</td></tr> |
411 <tr bgcolor="#eeeeee"><td><a href="#ICAST_INTEGER_MULTIPLY_CAST_TO_LONG">ICAST:
Result of integer multiplication cast to long</a></td><td>Dodgy code</td></tr> | 412 <tr bgcolor="#eeeeee"><td><a href="#ICAST_IDIV_CAST_TO_DOUBLE">ICAST: Integral d
ivision result cast to double or float</a></td><td>Dodgy code</td></tr> |
412 <tr bgcolor="#ffffff"><td><a href="#IM_AVERAGE_COMPUTATION_COULD_OVERFLOW">IM: C
omputation of average could overflow</a></td><td>Dodgy code</td></tr> | 413 <tr bgcolor="#ffffff"><td><a href="#ICAST_INTEGER_MULTIPLY_CAST_TO_LONG">ICAST:
Result of integer multiplication cast to long</a></td><td>Dodgy code</td></tr> |
413 <tr bgcolor="#eeeeee"><td><a href="#IM_BAD_CHECK_FOR_ODD">IM: Check for oddness
that won't work for negative numbers </a></td><td>Dodgy code</td></tr> | 414 <tr bgcolor="#eeeeee"><td><a href="#IM_AVERAGE_COMPUTATION_COULD_OVERFLOW">IM: C
omputation of average could overflow</a></td><td>Dodgy code</td></tr> |
414 <tr bgcolor="#ffffff"><td><a href="#INT_BAD_REM_BY_1">INT: Integer remainder mod
ulo 1</a></td><td>Dodgy code</td></tr> | 415 <tr bgcolor="#ffffff"><td><a href="#IM_BAD_CHECK_FOR_ODD">IM: Check for oddness
that won't work for negative numbers </a></td><td>Dodgy code</td></tr> |
415 <tr bgcolor="#eeeeee"><td><a href="#INT_VACUOUS_BIT_OPERATION">INT: Vacuous bit
mask operation on integer value</a></td><td>Dodgy code</td></tr> | 416 <tr bgcolor="#eeeeee"><td><a href="#INT_BAD_REM_BY_1">INT: Integer remainder mod
ulo 1</a></td><td>Dodgy code</td></tr> |
416 <tr bgcolor="#ffffff"><td><a href="#INT_VACUOUS_COMPARISON">INT: Vacuous compari
son of integer value</a></td><td>Dodgy code</td></tr> | 417 <tr bgcolor="#ffffff"><td><a href="#INT_VACUOUS_BIT_OPERATION">INT: Vacuous bit
mask operation on integer value</a></td><td>Dodgy code</td></tr> |
417 <tr bgcolor="#eeeeee"><td><a href="#MTIA_SUSPECT_SERVLET_INSTANCE_FIELD">MTIA: C
lass extends Servlet class and uses instance variables</a></td><td>Dodgy code</t
d></tr> | 418 <tr bgcolor="#eeeeee"><td><a href="#INT_VACUOUS_COMPARISON">INT: Vacuous compari
son of integer value</a></td><td>Dodgy code</td></tr> |
418 <tr bgcolor="#ffffff"><td><a href="#MTIA_SUSPECT_STRUTS_INSTANCE_FIELD">MTIA: Cl
ass extends Struts Action class and uses instance variables</a></td><td>Dodgy co
de</td></tr> | 419 <tr bgcolor="#ffffff"><td><a href="#MTIA_SUSPECT_SERVLET_INSTANCE_FIELD">MTIA: C
lass extends Servlet class and uses instance variables</a></td><td>Dodgy code</t
d></tr> |
419 <tr bgcolor="#eeeeee"><td><a href="#NP_DEREFERENCE_OF_READLINE_VALUE">NP: Derefe
rence of the result of readLine() without nullcheck</a></td><td>Dodgy code</td><
/tr> | 420 <tr bgcolor="#eeeeee"><td><a href="#MTIA_SUSPECT_STRUTS_INSTANCE_FIELD">MTIA: Cl
ass extends Struts Action class and uses instance variables</a></td><td>Dodgy co
de</td></tr> |
420 <tr bgcolor="#ffffff"><td><a href="#NP_IMMEDIATE_DEREFERENCE_OF_READLINE">NP: Im
mediate dereference of the result of readLine()</a></td><td>Dodgy code</td></tr> | 421 <tr bgcolor="#ffffff"><td><a href="#NP_DEREFERENCE_OF_READLINE_VALUE">NP: Derefe
rence of the result of readLine() without nullcheck</a></td><td>Dodgy code</td><
/tr> |
421 <tr bgcolor="#eeeeee"><td><a href="#NP_LOAD_OF_KNOWN_NULL_VALUE">NP: Load of kno
wn null value</a></td><td>Dodgy code</td></tr> | 422 <tr bgcolor="#eeeeee"><td><a href="#NP_IMMEDIATE_DEREFERENCE_OF_READLINE">NP: Im
mediate dereference of the result of readLine()</a></td><td>Dodgy code</td></tr> |
422 <tr bgcolor="#ffffff"><td><a href="#NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE">NP:
Possible null pointer dereference due to return value of called method</a></td><
td>Dodgy code</td></tr> | 423 <tr bgcolor="#ffffff"><td><a href="#NP_LOAD_OF_KNOWN_NULL_VALUE">NP: Load of kno
wn null value</a></td><td>Dodgy code</td></tr> |
423 <tr bgcolor="#eeeeee"><td><a href="#NP_NULL_ON_SOME_PATH_MIGHT_BE_INFEASIBLE">NP
: Possible null pointer dereference on branch that might be infeasible</a></td><
td>Dodgy code</td></tr> | 424 <tr bgcolor="#eeeeee"><td><a href="#NP_METHOD_PARAMETER_TIGHTENS_ANNOTATION">NP:
Method tightens nullness annotation on parameter</a></td><td>Dodgy code</td></t
r> |
424 <tr bgcolor="#ffffff"><td><a href="#NP_PARAMETER_MUST_BE_NONNULL_BUT_MARKED_AS_N
ULLABLE">NP: Parameter must be nonnull but is marked as nullable</a></td><td>Dod
gy code</td></tr> | 425 <tr bgcolor="#ffffff"><td><a href="#NP_METHOD_RETURN_RELAXING_ANNOTATION">NP: Me
thod relaxes nullness annotation on return value</a></td><td>Dodgy code</td></tr
> |
425 <tr bgcolor="#eeeeee"><td><a href="#NP_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD">NP:
Read of unwritten public or protected field</a></td><td>Dodgy code</td></tr> | 426 <tr bgcolor="#eeeeee"><td><a href="#NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE">NP:
Possible null pointer dereference due to return value of called method</a></td><
td>Dodgy code</td></tr> |
426 <tr bgcolor="#ffffff"><td><a href="#NS_DANGEROUS_NON_SHORT_CIRCUIT">NS: Potentia
lly dangerous use of non-short-circuit logic</a></td><td>Dodgy code</td></tr> | 427 <tr bgcolor="#ffffff"><td><a href="#NP_NULL_ON_SOME_PATH_MIGHT_BE_INFEASIBLE">NP
: Possible null pointer dereference on branch that might be infeasible</a></td><
td>Dodgy code</td></tr> |
427 <tr bgcolor="#eeeeee"><td><a href="#NS_NON_SHORT_CIRCUIT">NS: Questionable use o
f non-short-circuit logic</a></td><td>Dodgy code</td></tr> | 428 <tr bgcolor="#eeeeee"><td><a href="#NP_PARAMETER_MUST_BE_NONNULL_BUT_MARKED_AS_N
ULLABLE">NP: Parameter must be nonnull but is marked as nullable</a></td><td>Dod
gy code</td></tr> |
428 <tr bgcolor="#ffffff"><td><a href="#PZLA_PREFER_ZERO_LENGTH_ARRAYS">PZLA: Consid
er returning a zero length array rather than null</a></td><td>Dodgy code</td></t
r> | 429 <tr bgcolor="#ffffff"><td><a href="#NP_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD">NP:
Read of unwritten public or protected field</a></td><td>Dodgy code</td></tr> |
429 <tr bgcolor="#eeeeee"><td><a href="#QF_QUESTIONABLE_FOR_LOOP">QF: Complicated, s
ubtle or wrong increment in for-loop </a></td><td>Dodgy code</td></tr> | 430 <tr bgcolor="#eeeeee"><td><a href="#NS_DANGEROUS_NON_SHORT_CIRCUIT">NS: Potentia
lly dangerous use of non-short-circuit logic</a></td><td>Dodgy code</td></tr> |
430 <tr bgcolor="#ffffff"><td><a href="#RCN_REDUNDANT_COMPARISON_OF_NULL_AND_NONNULL
_VALUE">RCN: Redundant comparison of non-null value to null</a></td><td>Dodgy co
de</td></tr> | 431 <tr bgcolor="#ffffff"><td><a href="#NS_NON_SHORT_CIRCUIT">NS: Questionable use o
f non-short-circuit logic</a></td><td>Dodgy code</td></tr> |
431 <tr bgcolor="#eeeeee"><td><a href="#RCN_REDUNDANT_COMPARISON_TWO_NULL_VALUES">RC
N: Redundant comparison of two null values</a></td><td>Dodgy code</td></tr> | 432 <tr bgcolor="#eeeeee"><td><a href="#PZLA_PREFER_ZERO_LENGTH_ARRAYS">PZLA: Consid
er returning a zero length array rather than null</a></td><td>Dodgy code</td></t
r> |
432 <tr bgcolor="#ffffff"><td><a href="#RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE">RC
N: Redundant nullcheck of value known to be non-null</a></td><td>Dodgy code</td>
</tr> | 433 <tr bgcolor="#ffffff"><td><a href="#QF_QUESTIONABLE_FOR_LOOP">QF: Complicated, s
ubtle or wrong increment in for-loop </a></td><td>Dodgy code</td></tr> |
433 <tr bgcolor="#eeeeee"><td><a href="#RCN_REDUNDANT_NULLCHECK_OF_NULL_VALUE">RCN:
Redundant nullcheck of value known to be null</a></td><td>Dodgy code</td></tr> | 434 <tr bgcolor="#eeeeee"><td><a href="#RCN_REDUNDANT_COMPARISON_OF_NULL_AND_NONNULL
_VALUE">RCN: Redundant comparison of non-null value to null</a></td><td>Dodgy co
de</td></tr> |
434 <tr bgcolor="#ffffff"><td><a href="#REC_CATCH_EXCEPTION">REC: Exception is caugh
t when Exception is not thrown</a></td><td>Dodgy code</td></tr> | 435 <tr bgcolor="#ffffff"><td><a href="#RCN_REDUNDANT_COMPARISON_TWO_NULL_VALUES">RC
N: Redundant comparison of two null values</a></td><td>Dodgy code</td></tr> |
435 <tr bgcolor="#eeeeee"><td><a href="#RI_REDUNDANT_INTERFACES">RI: Class implement
s same interface as superclass</a></td><td>Dodgy code</td></tr> | 436 <tr bgcolor="#eeeeee"><td><a href="#RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE">RC
N: Redundant nullcheck of value known to be non-null</a></td><td>Dodgy code</td>
</tr> |
436 <tr bgcolor="#ffffff"><td><a href="#RV_CHECK_FOR_POSITIVE_INDEXOF">RV: Method ch
ecks to see if result of String.indexOf is positive</a></td><td>Dodgy code</td><
/tr> | 437 <tr bgcolor="#ffffff"><td><a href="#RCN_REDUNDANT_NULLCHECK_OF_NULL_VALUE">RCN:
Redundant nullcheck of value known to be null</a></td><td>Dodgy code</td></tr> |
437 <tr bgcolor="#eeeeee"><td><a href="#RV_DONT_JUST_NULL_CHECK_READLINE">RV: Method
discards result of readLine after checking if it is nonnull</a></td><td>Dodgy c
ode</td></tr> | 438 <tr bgcolor="#eeeeee"><td><a href="#REC_CATCH_EXCEPTION">REC: Exception is caugh
t when Exception is not thrown</a></td><td>Dodgy code</td></tr> |
438 <tr bgcolor="#ffffff"><td><a href="#RV_REM_OF_HASHCODE">RV: Remainder of hashCod
e could be negative</a></td><td>Dodgy code</td></tr> | 439 <tr bgcolor="#ffffff"><td><a href="#RI_REDUNDANT_INTERFACES">RI: Class implement
s same interface as superclass</a></td><td>Dodgy code</td></tr> |
439 <tr bgcolor="#eeeeee"><td><a href="#RV_REM_OF_RANDOM_INT">RV: Remainder of 32-bi
t signed random integer</a></td><td>Dodgy code</td></tr> | 440 <tr bgcolor="#eeeeee"><td><a href="#RV_CHECK_FOR_POSITIVE_INDEXOF">RV: Method ch
ecks to see if result of String.indexOf is positive</a></td><td>Dodgy code</td><
/tr> |
440 <tr bgcolor="#ffffff"><td><a href="#RV_RETURN_VALUE_IGNORED_INFERRED">RV: Method
ignores return value, is this OK?</a></td><td>Dodgy code</td></tr> | 441 <tr bgcolor="#ffffff"><td><a href="#RV_DONT_JUST_NULL_CHECK_READLINE">RV: Method
discards result of readLine after checking if it is nonnull</a></td><td>Dodgy c
ode</td></tr> |
441 <tr bgcolor="#eeeeee"><td><a href="#SA_FIELD_DOUBLE_ASSIGNMENT">SA: Double assig
nment of field</a></td><td>Dodgy code</td></tr> | 442 <tr bgcolor="#eeeeee"><td><a href="#RV_REM_OF_HASHCODE">RV: Remainder of hashCod
e could be negative</a></td><td>Dodgy code</td></tr> |
442 <tr bgcolor="#ffffff"><td><a href="#SA_LOCAL_DOUBLE_ASSIGNMENT">SA: Double assig
nment of local variable </a></td><td>Dodgy code</td></tr> | 443 <tr bgcolor="#ffffff"><td><a href="#RV_REM_OF_RANDOM_INT">RV: Remainder of 32-bi
t signed random integer</a></td><td>Dodgy code</td></tr> |
443 <tr bgcolor="#eeeeee"><td><a href="#SA_LOCAL_SELF_ASSIGNMENT">SA: Self assignmen
t of local variable</a></td><td>Dodgy code</td></tr> | 444 <tr bgcolor="#eeeeee"><td><a href="#RV_RETURN_VALUE_IGNORED_INFERRED">RV: Method
ignores return value, is this OK?</a></td><td>Dodgy code</td></tr> |
444 <tr bgcolor="#ffffff"><td><a href="#SF_SWITCH_FALLTHROUGH">SF: Switch statement
found where one case falls through to the next case</a></td><td>Dodgy code</td><
/tr> | 445 <tr bgcolor="#ffffff"><td><a href="#SA_FIELD_DOUBLE_ASSIGNMENT">SA: Double assig
nment of field</a></td><td>Dodgy code</td></tr> |
445 <tr bgcolor="#eeeeee"><td><a href="#SF_SWITCH_NO_DEFAULT">SF: Switch statement f
ound where default case is missing</a></td><td>Dodgy code</td></tr> | 446 <tr bgcolor="#eeeeee"><td><a href="#SA_LOCAL_DOUBLE_ASSIGNMENT">SA: Double assig
nment of local variable </a></td><td>Dodgy code</td></tr> |
446 <tr bgcolor="#ffffff"><td><a href="#ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD">ST:
Write to static field from instance method</a></td><td>Dodgy code</td></tr> | 447 <tr bgcolor="#ffffff"><td><a href="#SA_LOCAL_SELF_ASSIGNMENT">SA: Self assignmen
t of local variable</a></td><td>Dodgy code</td></tr> |
447 <tr bgcolor="#eeeeee"><td><a href="#SE_PRIVATE_READ_RESOLVE_NOT_INHERITED">Se: p
rivate readResolve method not inherited by subclasses</a></td><td>Dodgy code</td
></tr> | 448 <tr bgcolor="#eeeeee"><td><a href="#SF_SWITCH_FALLTHROUGH">SF: Switch statement
found where one case falls through to the next case</a></td><td>Dodgy code</td><
/tr> |
448 <tr bgcolor="#ffffff"><td><a href="#SE_TRANSIENT_FIELD_OF_NONSERIALIZABLE_CLASS"
>Se: Transient field of class that isn't Serializable. </a></td><td>Dodgy code</
td></tr> | 449 <tr bgcolor="#ffffff"><td><a href="#SF_SWITCH_NO_DEFAULT">SF: Switch statement f
ound where default case is missing</a></td><td>Dodgy code</td></tr> |
449 <tr bgcolor="#eeeeee"><td><a href="#TQ_EXPLICIT_UNKNOWN_SOURCE_VALUE_REACHES_ALW
AYS_SINK">TQ: Value required to have type qualifier, but marked as unknown</a></
td><td>Dodgy code</td></tr> | 450 <tr bgcolor="#eeeeee"><td><a href="#ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD">ST:
Write to static field from instance method</a></td><td>Dodgy code</td></tr> |
450 <tr bgcolor="#ffffff"><td><a href="#TQ_EXPLICIT_UNKNOWN_SOURCE_VALUE_REACHES_NEV
ER_SINK">TQ: Value required to not have type qualifier, but marked as unknown</a
></td><td>Dodgy code</td></tr> | 451 <tr bgcolor="#ffffff"><td><a href="#SE_PRIVATE_READ_RESOLVE_NOT_INHERITED">Se: P
rivate readResolve method not inherited by subclasses</a></td><td>Dodgy code</td
></tr> |
451 <tr bgcolor="#eeeeee"><td><a href="#UCF_USELESS_CONTROL_FLOW">UCF: Useless contr
ol flow</a></td><td>Dodgy code</td></tr> | 452 <tr bgcolor="#eeeeee"><td><a href="#SE_TRANSIENT_FIELD_OF_NONSERIALIZABLE_CLASS"
>Se: Transient field of class that isn't Serializable. </a></td><td>Dodgy code</
td></tr> |
452 <tr bgcolor="#ffffff"><td><a href="#UCF_USELESS_CONTROL_FLOW_NEXT_LINE">UCF: Use
less control flow to next line</a></td><td>Dodgy code</td></tr> | 453 <tr bgcolor="#ffffff"><td><a href="#TQ_EXPLICIT_UNKNOWN_SOURCE_VALUE_REACHES_ALW
AYS_SINK">TQ: Value required to have type qualifier, but marked as unknown</a></
td><td>Dodgy code</td></tr> |
453 <tr bgcolor="#eeeeee"><td><a href="#URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD">UrF: U
nread public/protected field</a></td><td>Dodgy code</td></tr> | 454 <tr bgcolor="#eeeeee"><td><a href="#TQ_EXPLICIT_UNKNOWN_SOURCE_VALUE_REACHES_NEV
ER_SINK">TQ: Value required to not have type qualifier, but marked as unknown</a
></td><td>Dodgy code</td></tr> |
454 <tr bgcolor="#ffffff"><td><a href="#UUF_UNUSED_PUBLIC_OR_PROTECTED_FIELD">UuF: U
nused public or protected field</a></td><td>Dodgy code</td></tr> | 455 <tr bgcolor="#ffffff"><td><a href="#UCF_USELESS_CONTROL_FLOW">UCF: Useless contr
ol flow</a></td><td>Dodgy code</td></tr> |
455 <tr bgcolor="#eeeeee"><td><a href="#UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR">Uw
F: Field not initialized in constructor but dereferenced without null check</a><
/td><td>Dodgy code</td></tr> | 456 <tr bgcolor="#eeeeee"><td><a href="#UCF_USELESS_CONTROL_FLOW_NEXT_LINE">UCF: Use
less control flow to next line</a></td><td>Dodgy code</td></tr> |
456 <tr bgcolor="#ffffff"><td><a href="#UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD">UwF
: Unwritten public or protected field</a></td><td>Dodgy code</td></tr> | 457 <tr bgcolor="#ffffff"><td><a href="#URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD">UrF: U
nread public/protected field</a></td><td>Dodgy code</td></tr> |
457 <tr bgcolor="#eeeeee"><td><a href="#XFB_XML_FACTORY_BYPASS">XFB: Method directly
allocates a specific implementation of xml interfaces</a></td><td>Dodgy code</t
d></tr> | 458 <tr bgcolor="#eeeeee"><td><a href="#UUF_UNUSED_PUBLIC_OR_PROTECTED_FIELD">UuF: U
nused public or protected field</a></td><td>Dodgy code</td></tr> |
| 459 <tr bgcolor="#ffffff"><td><a href="#UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR">Uw
F: Field not initialized in constructor but dereferenced without null check</a><
/td><td>Dodgy code</td></tr> |
| 460 <tr bgcolor="#eeeeee"><td><a href="#UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD">UwF
: Unwritten public or protected field</a></td><td>Dodgy code</td></tr> |
| 461 <tr bgcolor="#ffffff"><td><a href="#XFB_XML_FACTORY_BYPASS">XFB: Method directly
allocates a specific implementation of xml interfaces</a></td><td>Dodgy code</t
d></tr> |
458 </table> | 462 </table> |
459 <h2>Descriptions</h2> | 463 <h2>Descriptions</h2> |
460 <h3><a name="AM_CREATES_EMPTY_JAR_FILE_ENTRY">AM: Creates an empty jar file entr
y (AM_CREATES_EMPTY_JAR_FILE_ENTRY)</a></h3> | |
461 | |
462 | |
463 <p>The code calls <code>putNextEntry()</code>, immediately | |
464 followed by a call to <code>closeEntry()</code>. This results | |
465 in an empty JarFile entry. The contents of the entry | |
466 should be written to the JarFile between the calls to | |
467 <code>putNextEntry()</code> and | |
468 <code>closeEntry()</code>.</p> | |
469 | |
470 | |
471 <h3><a name="AM_CREATES_EMPTY_ZIP_FILE_ENTRY">AM: Creates an empty zip file entr
y (AM_CREATES_EMPTY_ZIP_FILE_ENTRY)</a></h3> | |
472 | |
473 | |
474 <p>The code calls <code>putNextEntry()</code>, immediately | |
475 followed by a call to <code>closeEntry()</code>. This results | |
476 in an empty ZipFile entry. The contents of the entry | |
477 should be written to the ZipFile between the calls to | |
478 <code>putNextEntry()</code> and | |
479 <code>closeEntry()</code>.</p> | |
480 | |
481 | |
482 <h3><a name="BC_EQUALS_METHOD_SHOULD_WORK_FOR_ALL_OBJECTS">BC: Equals method sho
uld not assume anything about the type of its argument (BC_EQUALS_METHOD_SHOULD_
WORK_FOR_ALL_OBJECTS)</a></h3> | 464 <h3><a name="BC_EQUALS_METHOD_SHOULD_WORK_FOR_ALL_OBJECTS">BC: Equals method sho
uld not assume anything about the type of its argument (BC_EQUALS_METHOD_SHOULD_
WORK_FOR_ALL_OBJECTS)</a></h3> |
483 | 465 |
484 | 466 |
485 <p> | 467 <p> |
486 The <code>equals(Object o)</code> method shouldn't make any assumptions | 468 The <code>equals(Object o)</code> method shouldn't make any assumptions |
487 about the type of <code>o</code>. It should simply return | 469 about the type of <code>o</code>. It should simply return |
488 false if <code>o</code> is not the same type as <code>this</code>. | 470 false if <code>o</code> is not the same type as <code>this</code>. |
489 </p> | 471 </p> |
490 | 472 |
491 | 473 |
492 <h3><a name="BIT_SIGNED_CHECK">BIT: Check for sign of bitwise operation (BIT_SIG
NED_CHECK)</a></h3> | 474 <h3><a name="BIT_SIGNED_CHECK">BIT: Check for sign of bitwise operation (BIT_SIG
NED_CHECK)</a></h3> |
493 | 475 |
494 | 476 |
495 <p> This method compares an expression such as | 477 <p> This method compares an expression such as</p> |
496 <pre>((event.detail & SWT.SELECTED) > 0)</pre>. | 478 <pre>((event.detail & SWT.SELECTED) > 0)</pre>. |
497 Using bit arithmetic and then comparing with the greater than operator can | 479 <p>Using bit arithmetic and then comparing with the greater than operator can |
498 lead to unexpected results (of course depending on the value of | 480 lead to unexpected results (of course depending on the value of |
499 SWT.SELECTED). If SWT.SELECTED is a negative number, this is a candidate | 481 SWT.SELECTED). If SWT.SELECTED is a negative number, this is a candidate |
500 for a bug. Even when SWT.SELECTED is not negative, it seems good practice | 482 for a bug. Even when SWT.SELECTED is not negative, it seems good practice |
501 to use '!= 0' instead of '> 0'. | 483 to use '!= 0' instead of '> 0'. |
502 </p> | 484 </p> |
503 <p> | 485 <p> |
504 <em>Boris Bokowski</em> | 486 <em>Boris Bokowski</em> |
505 </p> | 487 </p> |
506 | 488 |
507 | 489 |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
654 must have type <code>java.lang.Object</code>.</p> | 636 must have type <code>java.lang.Object</code>.</p> |
655 | 637 |
656 | 638 |
657 <h3><a name="EQ_CHECK_FOR_OPERAND_NOT_COMPATIBLE_WITH_THIS">Eq: Equals checks fo
r incompatible operand (EQ_CHECK_FOR_OPERAND_NOT_COMPATIBLE_WITH_THIS)</a></h3> | 639 <h3><a name="EQ_CHECK_FOR_OPERAND_NOT_COMPATIBLE_WITH_THIS">Eq: Equals checks fo
r incompatible operand (EQ_CHECK_FOR_OPERAND_NOT_COMPATIBLE_WITH_THIS)</a></h3> |
658 | 640 |
659 | 641 |
660 <p> This equals method is checking to see if the argument is some incompatible
type | 642 <p> This equals method is checking to see if the argument is some incompatible
type |
661 (i.e., a class that is neither a supertype nor subtype of the class that defines | 643 (i.e., a class that is neither a supertype nor subtype of the class that defines |
662 the equals method). For example, the Foo class might have an equals method | 644 the equals method). For example, the Foo class might have an equals method |
663 that looks like: | 645 that looks like: |
664 | 646 </p> |
665 <p><code><pre> | 647 <pre> |
666 public boolean equals(Object o) { | 648 public boolean equals(Object o) { |
667 if (o instanceof Foo) | 649 if (o instanceof Foo) |
668 return name.equals(((Foo)o).name); | 650 return name.equals(((Foo)o).name); |
669 else if (o instanceof String) | 651 else if (o instanceof String) |
670 return name.equals(o); | 652 return name.equals(o); |
671 else return false; | 653 else return false; |
672 </pre></code></p> | 654 </pre> |
673 | 655 |
674 <p>This is considered bad practice, as it makes it very hard to implement an equ
als method that | 656 <p>This is considered bad practice, as it makes it very hard to implement an equ
als method that |
675 is symmetric and transitive. Without those properties, very unexpected behavoirs
are possible. | 657 is symmetric and transitive. Without those properties, very unexpected behavoirs
are possible. |
676 </p> | 658 </p> |
677 | 659 |
678 | 660 |
679 <h3><a name="EQ_COMPARETO_USE_OBJECT_EQUALS">Eq: Class defines compareTo(...) an
d uses Object.equals() (EQ_COMPARETO_USE_OBJECT_EQUALS)</a></h3> | 661 <h3><a name="EQ_COMPARETO_USE_OBJECT_EQUALS">Eq: Class defines compareTo(...) an
d uses Object.equals() (EQ_COMPARETO_USE_OBJECT_EQUALS)</a></h3> |
680 | 662 |
681 | 663 |
682 <p> This class defines a <code>compareTo(...)</code> method but inherits its | 664 <p> This class defines a <code>compareTo(...)</code> method but inherits its |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
836 <p> This class defines a <code>hashCode()</code> method but inherits its | 818 <p> This class defines a <code>hashCode()</code> method but inherits its |
837 <code>equals()</code> method from <code>java.lang.Object</code> | 819 <code>equals()</code> method from <code>java.lang.Object</code> |
838 (which defines equality by comparing object references). Although | 820 (which defines equality by comparing object references). Although |
839 this will probably satisfy the contract that equal objects must have | 821 this will probably satisfy the contract that equal objects must have |
840 equal hashcodes, it is probably not what was intended by overriding | 822 equal hashcodes, it is probably not what was intended by overriding |
841 the <code>hashCode()</code> method. (Overriding <code>hashCode()</code> | 823 the <code>hashCode()</code> method. (Overriding <code>hashCode()</code> |
842 implies that the object's identity is based on criteria more complicated | 824 implies that the object's identity is based on criteria more complicated |
843 than simple reference equality.)</p> | 825 than simple reference equality.)</p> |
844 <p>If you don't think instances of this class will ever be inserted into a HashM
ap/HashTable, | 826 <p>If you don't think instances of this class will ever be inserted into a HashM
ap/HashTable, |
845 the recommended <code>hashCode</code> implementation to use is:</p> | 827 the recommended <code>hashCode</code> implementation to use is:</p> |
846 <p><pre>public int hashCode() { | 828 <pre>public int hashCode() { |
847 assert false : "hashCode not designed"; | 829 assert false : "hashCode not designed"; |
848 return 42; // any arbitrary constant will do | 830 return 42; // any arbitrary constant will do |
849 }</pre></p> | 831 }</pre> |
850 | 832 |
851 | 833 |
852 <h3><a name="HE_INHERITS_EQUALS_USE_HASHCODE">HE: Class inherits equals() and us
es Object.hashCode() (HE_INHERITS_EQUALS_USE_HASHCODE)</a></h3> | 834 <h3><a name="HE_INHERITS_EQUALS_USE_HASHCODE">HE: Class inherits equals() and us
es Object.hashCode() (HE_INHERITS_EQUALS_USE_HASHCODE)</a></h3> |
853 | 835 |
854 | 836 |
855 <p> This class inherits <code>equals(Object)</code> from an abstract | 837 <p> This class inherits <code>equals(Object)</code> from an abstract |
856 superclass, and <code>hashCode()</code> from | 838 superclass, and <code>hashCode()</code> from |
857 <code>java.lang.Object</code> (which returns | 839 <code>java.lang.Object</code> (which returns |
858 the identity hash code, an arbitrary value assigned to the object | 840 the identity hash code, an arbitrary value assigned to the object |
859 by the VM). Therefore, the class is very likely to violate the | 841 by the VM). Therefore, the class is very likely to violate the |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
914 | 896 |
915 <p> | 897 <p> |
916 This code seems to be storing a non-serializable object into an HttpSession. | 898 This code seems to be storing a non-serializable object into an HttpSession. |
917 If this session is passivated or migrated, an error will result. | 899 If this session is passivated or migrated, an error will result. |
918 </p> | 900 </p> |
919 | 901 |
920 | 902 |
921 <h3><a name="JCIP_FIELD_ISNT_FINAL_IN_IMMUTABLE_CLASS">JCIP: Fields of immutable
classes should be final (JCIP_FIELD_ISNT_FINAL_IN_IMMUTABLE_CLASS)</a></h3> | 903 <h3><a name="JCIP_FIELD_ISNT_FINAL_IN_IMMUTABLE_CLASS">JCIP: Fields of immutable
classes should be final (JCIP_FIELD_ISNT_FINAL_IN_IMMUTABLE_CLASS)</a></h3> |
922 | 904 |
923 | 905 |
924 <p> The class is annotated with net.jcip.annotations.Immutable, and the rules
for that annotation require | 906 <p> The class is annotated with net.jcip.annotations.Immutable or javax.annota
tion.concurrent.Immutable, |
925 that all fields are final. | 907 and the rules for those annotations require that all fields are final. |
926 .</p> | 908 .</p> |
927 | 909 |
928 | 910 |
929 <h3><a name="NP_BOOLEAN_RETURN_NULL">NP: Method with Boolean return type returns
explicit null (NP_BOOLEAN_RETURN_NULL)</a></h3> | 911 <h3><a name="NP_BOOLEAN_RETURN_NULL">NP: Method with Boolean return type returns
explicit null (NP_BOOLEAN_RETURN_NULL)</a></h3> |
930 | 912 |
931 | 913 |
932 <p> | 914 <p> |
933 A method that returns either Boolean.TRUE, Boolean.FALSE or null is an accid
ent waiting to happen. | 915 A method that returns either Boolean.TRUE, Boolean.FALSE or null is an accid
ent waiting to happen. |
934 This method can be invoked as though it returned a value of type boolean, an
d | 916 This method can be invoked as though it returned a value of type boolean, an
d |
935 the compiler will insert automatic unboxing of the Boolean value. If a null
value is returned, | 917 the compiler will insert automatic unboxing of the Boolean value. If a null
value is returned, |
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1412 the precise type of the value being cast, and the attempt to | 1394 the precise type of the value being cast, and the attempt to |
1413 downcast it to a subtype will always fail by throwing a ClassCastException. | 1395 downcast it to a subtype will always fail by throwing a ClassCastException. |
1414 </p> | 1396 </p> |
1415 | 1397 |
1416 | 1398 |
1417 <h3><a name="BC_IMPOSSIBLE_DOWNCAST_OF_TOARRAY">BC: Impossible downcast of toArr
ay() result (BC_IMPOSSIBLE_DOWNCAST_OF_TOARRAY)</a></h3> | 1399 <h3><a name="BC_IMPOSSIBLE_DOWNCAST_OF_TOARRAY">BC: Impossible downcast of toArr
ay() result (BC_IMPOSSIBLE_DOWNCAST_OF_TOARRAY)</a></h3> |
1418 | 1400 |
1419 | 1401 |
1420 <p> | 1402 <p> |
1421 This code is casting the result of calling <code>toArray()</code> on a collectio
n | 1403 This code is casting the result of calling <code>toArray()</code> on a collectio
n |
1422 to a type more specific than <code>Object[]</code>, as in: | 1404 to a type more specific than <code>Object[]</code>, as in:</p> |
1423 <pre> | 1405 <pre> |
1424 String[] getAsArray(Collection<String> c) { | 1406 String[] getAsArray(Collection<String> c) { |
1425 return (String[]) c.toArray(); | 1407 return (String[]) c.toArray(); |
1426 } | 1408 } |
1427 </pre> | 1409 </pre> |
1428 <p>This will usually fail by throwing a ClassCastException. The <code>toArray()<
/code> | 1410 <p>This will usually fail by throwing a ClassCastException. The <code>toArray()<
/code> |
1429 of almost all collections return an <code>Object[]</code>. They can't really do
anything else, | 1411 of almost all collections return an <code>Object[]</code>. They can't really do
anything else, |
1430 since the Collection object has no reference to the declared generic type of the
collection. | 1412 since the Collection object has no reference to the declared generic type of the
collection. |
1431 <p>The correct way to do get an array of a specific type from a collection is to
use | 1413 <p>The correct way to do get an array of a specific type from a collection is to
use |
1432 <code>c.toArray(new String[]);</code> | 1414 <code>c.toArray(new String[]);</code> |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1533 int result = 0; | 1515 int result = 0; |
1534 for(int i = 0; i < 4; i++) | 1516 for(int i = 0; i < 4; i++) |
1535 result = ((result << 8) | (b[i] & 0xff)); | 1517 result = ((result << 8) | (b[i] & 0xff)); |
1536 </pre> | 1518 </pre> |
1537 | 1519 |
1538 | 1520 |
1539 | 1521 |
1540 <h3><a name="BIT_SIGNED_CHECK_HIGH_BIT">BIT: Check for sign of bitwise operation
(BIT_SIGNED_CHECK_HIGH_BIT)</a></h3> | 1522 <h3><a name="BIT_SIGNED_CHECK_HIGH_BIT">BIT: Check for sign of bitwise operation
(BIT_SIGNED_CHECK_HIGH_BIT)</a></h3> |
1541 | 1523 |
1542 | 1524 |
1543 <p> This method compares an expression such as | 1525 <p> This method compares an expression such as</p> |
1544 <pre>((event.detail & SWT.SELECTED) > 0)</pre>. | 1526 <pre>((event.detail & SWT.SELECTED) > 0)</pre>. |
1545 Using bit arithmetic and then comparing with the greater than operator can | 1527 <p>Using bit arithmetic and then comparing with the greater than operator can |
1546 lead to unexpected results (of course depending on the value of | 1528 lead to unexpected results (of course depending on the value of |
1547 SWT.SELECTED). If SWT.SELECTED is a negative number, this is a candidate | 1529 SWT.SELECTED). If SWT.SELECTED is a negative number, this is a candidate |
1548 for a bug. Even when SWT.SELECTED is not negative, it seems good practice | 1530 for a bug. Even when SWT.SELECTED is not negative, it seems good practice |
1549 to use '!= 0' instead of '> 0'. | 1531 to use '!= 0' instead of '> 0'. |
1550 </p> | 1532 </p> |
1551 <p> | 1533 <p> |
1552 <em>Boris Bokowski</em> | 1534 <em>Boris Bokowski</em> |
1553 </p> | 1535 </p> |
1554 | 1536 |
1555 | 1537 |
1556 <h3><a name="BOA_BADLY_OVERRIDDEN_ADAPTER">BOA: Class overrides a method impleme
nted in super class Adapter wrongly (BOA_BADLY_OVERRIDDEN_ADAPTER)</a></h3> | 1538 <h3><a name="BOA_BADLY_OVERRIDDEN_ADAPTER">BOA: Class overrides a method impleme
nted in super class Adapter wrongly (BOA_BADLY_OVERRIDDEN_ADAPTER)</a></h3> |
1557 | 1539 |
1558 | 1540 |
1559 <p> This method overrides a method found in a parent class, where that class is
an Adapter that implements | 1541 <p> This method overrides a method found in a parent class, where that class is
an Adapter that implements |
1560 a listener defined in the java.awt.event or javax.swing.event package. As a resu
lt, this method will not | 1542 a listener defined in the java.awt.event or javax.swing.event package. As a resu
lt, this method will not |
1561 get called when the event occurs.</p> | 1543 get called when the event occurs.</p> |
1562 | 1544 |
1563 | 1545 |
1564 <h3><a name="ICAST_BAD_SHIFT_AMOUNT">BSHIFT: 32 bit int shifted by an amount not
in the range 0..31 (ICAST_BAD_SHIFT_AMOUNT)</a></h3> | 1546 <h3><a name="ICAST_BAD_SHIFT_AMOUNT">BSHIFT: 32 bit int shifted by an amount not
in the range -31..31 (ICAST_BAD_SHIFT_AMOUNT)</a></h3> |
1565 | 1547 |
1566 | 1548 |
1567 <p> | 1549 <p> |
1568 The code performs shift of a 32 bit int by a constant amount outside | 1550 The code performs shift of a 32 bit int by a constant amount outside |
1569 the range 0..31. | 1551 the range -31..31. |
1570 The effect of this is to use the lower 5 bits of the integer | 1552 The effect of this is to use the lower 5 bits of the integer |
1571 value to decide how much to shift by (e.g., shifting by 40 bits is the same as s
hifting by 8 bits, | 1553 value to decide how much to shift by (e.g., shifting by 40 bits is the same as s
hifting by 8 bits, |
1572 and shifting by 32 bits is the same as shifting by zero bits). This probably isn
't what was expected, | 1554 and shifting by 32 bits is the same as shifting by zero bits). This probably isn
't what was expected, |
1573 and it is at least confusing. | 1555 and it is at least confusing. |
1574 </p> | 1556 </p> |
1575 | 1557 |
1576 | 1558 |
1577 <h3><a name="BX_UNBOXED_AND_COERCED_FOR_TERNARY_OPERATOR">Bx: Primitive value is
unboxed and coerced for ternary operator (BX_UNBOXED_AND_COERCED_FOR_TERNARY_OP
ERATOR)</a></h3> | 1559 <h3><a name="BX_UNBOXED_AND_COERCED_FOR_TERNARY_OPERATOR">Bx: Primitive value is
unboxed and coerced for ternary operator (BX_UNBOXED_AND_COERCED_FOR_TERNARY_OP
ERATOR)</a></h3> |
1578 | 1560 |
1579 | 1561 |
(...skipping 11 matching lines...) Expand all Loading... |
1591 | 1573 |
1592 | 1574 |
1593 <p> In some situation, this compareTo or compare method returns | 1575 <p> In some situation, this compareTo or compare method returns |
1594 the constant Integer.MIN_VALUE, which is an exceptionally bad practice. | 1576 the constant Integer.MIN_VALUE, which is an exceptionally bad practice. |
1595 The only thing that matters about the return value of compareTo is the sign of
the result. | 1577 The only thing that matters about the return value of compareTo is the sign of
the result. |
1596 But people will sometimes negate the return value of compareTo, expecting th
at this will negate | 1578 But people will sometimes negate the return value of compareTo, expecting th
at this will negate |
1597 the sign of the result. And it will, except in the case where the value retu
rned is Integer.MIN_VALUE. | 1579 the sign of the result. And it will, except in the case where the value retu
rned is Integer.MIN_VALUE. |
1598 So just return -1 rather than Integer.MIN_VALUE. | 1580 So just return -1 rather than Integer.MIN_VALUE. |
1599 | 1581 |
1600 | 1582 |
| 1583 <h3><a name="DLS_DEAD_LOCAL_INCREMENT_IN_RETURN">DLS: Useless increment in retur
n statement (DLS_DEAD_LOCAL_INCREMENT_IN_RETURN)</a></h3> |
| 1584 |
| 1585 |
| 1586 <p>This statement has a return such as <code>return x++;</code>. |
| 1587 A postfix increment/decrement does not impact the value of the expression, |
| 1588 so this increment/decrement has no effect. |
| 1589 Please verify that this statement does the right thing. |
| 1590 </p> |
| 1591 |
| 1592 |
1601 <h3><a name="DLS_DEAD_STORE_OF_CLASS_LITERAL">DLS: Dead store of class literal (
DLS_DEAD_STORE_OF_CLASS_LITERAL)</a></h3> | 1593 <h3><a name="DLS_DEAD_STORE_OF_CLASS_LITERAL">DLS: Dead store of class literal (
DLS_DEAD_STORE_OF_CLASS_LITERAL)</a></h3> |
1602 | 1594 |
1603 | 1595 |
1604 <p> | 1596 <p> |
1605 This instruction assigns a class literal to a variable and then never uses it. | 1597 This instruction assigns a class literal to a variable and then never uses it. |
1606 <a href="//java.sun.com/j2se/1.5.0/compatibility.html#literal">The behavior of t
his differs in Java 1.4 and in Java 5.</a> | 1598 <a href="//java.sun.com/j2se/1.5.0/compatibility.html#literal">The behavior of t
his differs in Java 1.4 and in Java 5.</a> |
1607 In Java 1.4 and earlier, a reference to <code>Foo.class</code> would force the s
tatic initializer | 1599 In Java 1.4 and earlier, a reference to <code>Foo.class</code> would force the s
tatic initializer |
1608 for <code>Foo</code> to be executed, if it has not been executed already. | 1600 for <code>Foo</code> to be executed, if it has not been executed already. |
1609 In Java 5 and later, it does not. | 1601 In Java 5 and later, it does not. |
1610 </p> | 1602 </p> |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1852 different types. The result of this comparison will always be false at runtime. | 1844 different types. The result of this comparison will always be false at runtime. |
1853 </p> | 1845 </p> |
1854 | 1846 |
1855 | 1847 |
1856 <h3><a name="EQ_ALWAYS_FALSE">Eq: equals method always returns false (EQ_ALWAYS_
FALSE)</a></h3> | 1848 <h3><a name="EQ_ALWAYS_FALSE">Eq: equals method always returns false (EQ_ALWAYS_
FALSE)</a></h3> |
1857 | 1849 |
1858 | 1850 |
1859 <p> This class defines an equals method that always returns false. This means
that an object is not equal to itself, and it is impossible to create useful Map
s or Sets of this class. More fundamentally, it means | 1851 <p> This class defines an equals method that always returns false. This means
that an object is not equal to itself, and it is impossible to create useful Map
s or Sets of this class. More fundamentally, it means |
1860 that equals is not reflexive, one of the requirements of the equals method.</p> | 1852 that equals is not reflexive, one of the requirements of the equals method.</p> |
1861 <p>The likely intended semantics are object identity: that an object is equal to
itself. This is the behavior inherited from class <code>Object</code>. If you n
eed to override an equals inherited from a different | 1853 <p>The likely intended semantics are object identity: that an object is equal to
itself. This is the behavior inherited from class <code>Object</code>. If you n
eed to override an equals inherited from a different |
1862 superclass, you can use use: | 1854 superclass, you can use use:</p> |
1863 <pre> | 1855 <pre> |
1864 public boolean equals(Object o) { return this == o; } | 1856 public boolean equals(Object o) { return this == o; } |
1865 </pre> | 1857 </pre> |
1866 </p> | |
1867 | 1858 |
1868 | 1859 |
1869 <h3><a name="EQ_ALWAYS_TRUE">Eq: equals method always returns true (EQ_ALWAYS_TR
UE)</a></h3> | 1860 <h3><a name="EQ_ALWAYS_TRUE">Eq: equals method always returns true (EQ_ALWAYS_TR
UE)</a></h3> |
1870 | 1861 |
1871 | 1862 |
1872 <p> This class defines an equals method that always returns true. This is imag
inative, but not very smart. | 1863 <p> This class defines an equals method that always returns true. This is imag
inative, but not very smart. |
1873 Plus, it means that the equals method is not symmetric. | 1864 Plus, it means that the equals method is not symmetric. |
1874 </p> | 1865 </p> |
1875 | 1866 |
1876 | 1867 |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1986 | 1977 |
1987 | 1978 |
1988 <p> | 1979 <p> |
1989 A method is called that expects a Java printf format string and a list of argume
nts. | 1980 A method is called that expects a Java printf format string and a list of argume
nts. |
1990 However, the format string doesn't contain any format specifiers (e.g., %s) but | 1981 However, the format string doesn't contain any format specifiers (e.g., %s) but |
1991 does contain message format elements (e.g., {0}). It is likely | 1982 does contain message format elements (e.g., {0}). It is likely |
1992 that the code is supplying a MessageFormat string when a printf-style format str
ing | 1983 that the code is supplying a MessageFormat string when a printf-style format str
ing |
1993 is required. At runtime, all of the arguments will be ignored | 1984 is required. At runtime, all of the arguments will be ignored |
1994 and the format string will be returned exactly as provided without any formattin
g. | 1985 and the format string will be returned exactly as provided without any formattin
g. |
1995 </p> | 1986 </p> |
1996 </p> | |
1997 | 1987 |
1998 | 1988 |
1999 <h3><a name="VA_FORMAT_STRING_EXTRA_ARGUMENTS_PASSED">FS: More arguments are pas
sed than are actually used in the format string (VA_FORMAT_STRING_EXTRA_ARGUMENT
S_PASSED)</a></h3> | 1989 <h3><a name="VA_FORMAT_STRING_EXTRA_ARGUMENTS_PASSED">FS: More arguments are pas
sed than are actually used in the format string (VA_FORMAT_STRING_EXTRA_ARGUMENT
S_PASSED)</a></h3> |
2000 | 1990 |
2001 | 1991 |
2002 <p> | 1992 <p> |
2003 A format-string method with a variable number of arguments is called, | 1993 A format-string method with a variable number of arguments is called, |
2004 but more arguments are passed than are actually used by the format string. | 1994 but more arguments are passed than are actually used by the format string. |
2005 This won't cause a runtime exception, but the code may be silently omitting | 1995 This won't cause a runtime exception, but the code may be silently omitting |
2006 information that was intended to be included in the formatted string. | 1996 information that was intended to be included in the formatted string. |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2110 | 2100 |
2111 <pre> | 2101 <pre> |
2112 // Fails for dates after 2037 | 2102 // Fails for dates after 2037 |
2113 Date getDate(int seconds) { return new Date(seconds * 1000L); } | 2103 Date getDate(int seconds) { return new Date(seconds * 1000L); } |
2114 | 2104 |
2115 // better, works for all dates | 2105 // better, works for all dates |
2116 Date getDate(long seconds) { return new Date(seconds * 1000); } | 2106 Date getDate(long seconds) { return new Date(seconds * 1000); } |
2117 </pre> | 2107 </pre> |
2118 | 2108 |
2119 | 2109 |
2120 <h3><a name="ICAST_INT_CAST_TO_DOUBLE_PASSED_TO_CEIL">ICAST: integral value cast
to double and then passed to Math.ceil (ICAST_INT_CAST_TO_DOUBLE_PASSED_TO_CEIL
)</a></h3> | 2110 <h3><a name="ICAST_INT_CAST_TO_DOUBLE_PASSED_TO_CEIL">ICAST: Integral value cast
to double and then passed to Math.ceil (ICAST_INT_CAST_TO_DOUBLE_PASSED_TO_CEIL
)</a></h3> |
2121 | 2111 |
2122 | 2112 |
2123 <p> | 2113 <p> |
2124 This code converts an integral value (e.g., int or long) | 2114 This code converts an integral value (e.g., int or long) |
2125 to a double precision | 2115 to a double precision |
2126 floating point number and then | 2116 floating point number and then |
2127 passing the result to the Math.ceil() function, which rounds a double to | 2117 passing the result to the Math.ceil() function, which rounds a double to |
2128 the next higher integer value. This operation should always be a no-op, | 2118 the next higher integer value. This operation should always be a no-op, |
2129 since the converting an integer to a double should give a number with no fractio
nal part. | 2119 since the converting an integer to a double should give a number with no fractio
nal part. |
2130 It is likely that the operation that generated the value to be passed | 2120 It is likely that the operation that generated the value to be passed |
(...skipping 27 matching lines...) Expand all Loading... |
2158 Thus, if this exception occurs in a thread other than the thread that invokes | 2148 Thus, if this exception occurs in a thread other than the thread that invokes |
2159 the test method, the exception will terminate the thread but not result | 2149 the test method, the exception will terminate the thread but not result |
2160 in the test failing. | 2150 in the test failing. |
2161 </p> | 2151 </p> |
2162 | 2152 |
2163 | 2153 |
2164 <h3><a name="IJU_BAD_SUITE_METHOD">IJU: TestCase declares a bad suite method (I
JU_BAD_SUITE_METHOD)</a></h3> | 2154 <h3><a name="IJU_BAD_SUITE_METHOD">IJU: TestCase declares a bad suite method (I
JU_BAD_SUITE_METHOD)</a></h3> |
2165 | 2155 |
2166 | 2156 |
2167 <p> Class is a JUnit TestCase and defines a suite() method. | 2157 <p> Class is a JUnit TestCase and defines a suite() method. |
2168 However, the suite method needs to be declared as either | 2158 However, the suite method needs to be declared as either</p> |
2169 <pre>public static junit.framework.Test suite()</pre> | 2159 <pre>public static junit.framework.Test suite()</pre> |
2170 or | 2160 or |
2171 <pre>public static junit.framework.TestSuite suite()</pre> | 2161 <pre>public static junit.framework.TestSuite suite()</pre> |
2172 </p> | |
2173 | 2162 |
2174 | 2163 |
2175 <h3><a name="IJU_NO_TESTS">IJU: TestCase has no tests (IJU_NO_TESTS)</a></h3> | 2164 <h3><a name="IJU_NO_TESTS">IJU: TestCase has no tests (IJU_NO_TESTS)</a></h3> |
2176 | 2165 |
2177 | 2166 |
2178 <p> Class is a JUnit TestCase but has not implemented any test methods</p> | 2167 <p> Class is a JUnit TestCase but has not implemented any test methods</p> |
2179 | 2168 |
2180 | 2169 |
2181 <h3><a name="IJU_SETUP_NO_SUPER">IJU: TestCase defines setUp that doesn't call s
uper.setUp() (IJU_SETUP_NO_SUPER)</a></h3> | 2170 <h3><a name="IJU_SETUP_NO_SUPER">IJU: TestCase defines setUp that doesn't call s
uper.setUp() (IJU_SETUP_NO_SUPER)</a></h3> |
2182 | 2171 |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2344 <h3><a name="NP_GUARANTEED_DEREF">NP: Null value is guaranteed to be dereference
d (NP_GUARANTEED_DEREF)</a></h3> | 2333 <h3><a name="NP_GUARANTEED_DEREF">NP: Null value is guaranteed to be dereference
d (NP_GUARANTEED_DEREF)</a></h3> |
2345 | 2334 |
2346 | 2335 |
2347 <p> | 2336 <p> |
2348 There is a statement or branch that if executed guarantees that | 2337 There is a statement or branch that if executed guarantees that |
2349 a value is null at this point, and that | 2338 a value is null at this point, and that |
2350 value that is guaranteed to be dereferenced | 2339 value that is guaranteed to be dereferenced |
2351 (except on forward paths involving runtime exceptions). | 2340 (except on forward paths involving runtime exceptions). |
2352 </p> | 2341 </p> |
2353 <p>Note that a check such as | 2342 <p>Note that a check such as |
2354 <code>if (x == null) throw new NullPointerException();</code | 2343 <code>if (x == null) throw new NullPointerException();</code> |
2355 is treated as a dereference of <code>x</code>. | 2344 is treated as a dereference of <code>x</code>. |
2356 | 2345 |
2357 | 2346 |
2358 <h3><a name="NP_GUARANTEED_DEREF_ON_EXCEPTION_PATH">NP: Value is null and guaran
teed to be dereferenced on exception path (NP_GUARANTEED_DEREF_ON_EXCEPTION_PATH
)</a></h3> | 2347 <h3><a name="NP_GUARANTEED_DEREF_ON_EXCEPTION_PATH">NP: Value is null and guaran
teed to be dereferenced on exception path (NP_GUARANTEED_DEREF_ON_EXCEPTION_PATH
)</a></h3> |
2359 | 2348 |
2360 | 2349 |
2361 <p> | 2350 <p> |
2362 There is a statement or branch on an exception path | 2351 There is a statement or branch on an exception path |
2363 that if executed guarantees that | 2352 that if executed guarantees that |
2364 a value is null at this point, and that | 2353 a value is null at this point, and that |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2599 The code here uses <code>File.separator</code> | 2588 The code here uses <code>File.separator</code> |
2600 where a regular expression is required. This will fail on Windows | 2589 where a regular expression is required. This will fail on Windows |
2601 platforms, where the <code>File.separator</code> is a backslash, which is interp
reted in a | 2590 platforms, where the <code>File.separator</code> is a backslash, which is interp
reted in a |
2602 regular expression as an escape character. Amoung other options, you can just us
e | 2591 regular expression as an escape character. Amoung other options, you can just us
e |
2603 <code>File.separatorChar=='\\' ? "\\\\" : File.separator</code> instead of | 2592 <code>File.separatorChar=='\\' ? "\\\\" : File.separator</code> instead of |
2604 <code>File.separator</code> | 2593 <code>File.separator</code> |
2605 | 2594 |
2606 </p> | 2595 </p> |
2607 | 2596 |
2608 | 2597 |
2609 <h3><a name="RE_POSSIBLE_UNINTENDED_PATTERN">RE: "." used for regular expression
(RE_POSSIBLE_UNINTENDED_PATTERN)</a></h3> | 2598 <h3><a name="RE_POSSIBLE_UNINTENDED_PATTERN">RE: "." or "|" used for regular exp
ression (RE_POSSIBLE_UNINTENDED_PATTERN)</a></h3> |
2610 | 2599 |
2611 | 2600 |
2612 <p> | 2601 <p> |
2613 A String function is being invoked and "." is being passed | 2602 A String function is being invoked and "." or "|" is being passed |
2614 to a parameter that takes a regular expression as an argument. Is this what you
intended? | 2603 to a parameter that takes a regular expression as an argument. Is this what you
intended? |
2615 For example | 2604 For example |
2616 s.replaceAll(".", "/") will return a String in which <em>every</em> | 2605 <li>s.replaceAll(".", "/") will return a String in which <em>every</em> characte
r has been replaced by a '/' character |
2617 character has been replaced by a / character, | 2606 <li>s.split(".") <em>always</em> returns a zero length array of String |
2618 and s.split(".") <em>always</em> returns a zero length array of String. | 2607 <li>"ab|cd".replaceAll("|", "/") will return "/a/b/|/c/d/" |
| 2608 <li>"ab|cd".split("|") will return array with six (!) elements: [, a, b, |, c, d
] |
2619 </p> | 2609 </p> |
2620 | 2610 |
2621 | 2611 |
2622 <h3><a name="RV_01_TO_INT">RV: Random value from 0 to 1 is coerced to the intege
r 0 (RV_01_TO_INT)</a></h3> | 2612 <h3><a name="RV_01_TO_INT">RV: Random value from 0 to 1 is coerced to the intege
r 0 (RV_01_TO_INT)</a></h3> |
2623 | 2613 |
2624 | 2614 |
2625 <p>A random value from 0 to 1 is being coerced to the integer value 0. You pro
bably | 2615 <p>A random value from 0 to 1 is being coerced to the integer value 0. You pro
bably |
2626 want to multiple the random value by something else before coercing it to an int
eger, or use the <code>Random.nextInt(n)</code> method. | 2616 want to multiple the random value by something else before coercing it to an int
eger, or use the <code>Random.nextInt(n)</code> method. |
2627 </p> | 2617 </p> |
2628 | 2618 |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2957 <p> | 2947 <p> |
2958 More precisely, a value annotated with a type qualifier specifying when=
NEVER | 2948 More precisely, a value annotated with a type qualifier specifying when=
NEVER |
2959 is guaranteed to reach a use or uses where the same type qualifier speci
fies when=ALWAYS. | 2949 is guaranteed to reach a use or uses where the same type qualifier speci
fies when=ALWAYS. |
2960 </p> | 2950 </p> |
2961 | 2951 |
2962 <p> | 2952 <p> |
2963 TODO: example | 2953 TODO: example |
2964 </p> | 2954 </p> |
2965 | 2955 |
2966 | 2956 |
| 2957 <h3><a name="TQ_UNKNOWN_VALUE_USED_WHERE_ALWAYS_STRICTLY_REQUIRED">TQ: Value wit
hout a type qualifier used where a value is required to have that qualifier (TQ_
UNKNOWN_VALUE_USED_WHERE_ALWAYS_STRICTLY_REQUIRED)</a></h3> |
| 2958 |
| 2959 |
| 2960 <p> |
| 2961 A value is being used in a way that requires the value be annotation wit
h a type qualifier. |
| 2962 The type qualifier is strict, so the tool rejects any values that do not hav
e |
| 2963 the appropriate annotation. |
| 2964 </p> |
| 2965 |
| 2966 <p> |
| 2967 To coerce a value to have a strict annotation, define an identity functi
on where the return value is annotated |
| 2968 with the strict annotation. |
| 2969 This is the only way to turn a non-annotated value into a value with a stric
t type qualifier annotation. |
| 2970 </p> |
| 2971 |
| 2972 |
| 2973 |
2967 <h3><a name="UMAC_UNCALLABLE_METHOD_OF_ANONYMOUS_CLASS">UMAC: Uncallable method
defined in anonymous class (UMAC_UNCALLABLE_METHOD_OF_ANONYMOUS_CLASS)</a></h3> | 2974 <h3><a name="UMAC_UNCALLABLE_METHOD_OF_ANONYMOUS_CLASS">UMAC: Uncallable method
defined in anonymous class (UMAC_UNCALLABLE_METHOD_OF_ANONYMOUS_CLASS)</a></h3> |
2968 | 2975 |
2969 | 2976 |
2970 <p> This anonymous class defined a method that is not directly invoked and does
not override | 2977 <p> This anonymous class defined a method that is not directly invoked and does
not override |
2971 a method in a superclass. Since methods in other classes cannot directly invoke
methods | 2978 a method in a superclass. Since methods in other classes cannot directly invoke
methods |
2972 declared in an anonymous class, it seems that this method is uncallable. The met
hod | 2979 declared in an anonymous class, it seems that this method is uncallable. The met
hod |
2973 might simply be dead code, but it is also possible that the method is intended t
o | 2980 might simply be dead code, but it is also possible that the method is intended t
o |
2974 override a method declared in a superclass, and due to an typo or other error th
e method does not, | 2981 override a method declared in a superclass, and due to an typo or other error th
e method does not, |
2975 in fact, override the method it is intended to. | 2982 in fact, override the method it is intended to. |
2976 </p> | 2983 </p> |
(...skipping 30 matching lines...) Expand all Loading... |
3007 } | 3014 } |
3008 }</pre> | 3015 }</pre> |
3009 <p>When a <code>B</code> is constructed, | 3016 <p>When a <code>B</code> is constructed, |
3010 the constructor for the <code>A</code> class is invoked | 3017 the constructor for the <code>A</code> class is invoked |
3011 <em>before</em> the constructor for <code>B</code> sets <code>value</code>. | 3018 <em>before</em> the constructor for <code>B</code> sets <code>value</code>. |
3012 Thus, when the constructor for <code>A</code> invokes <code>getValue</code>, | 3019 Thus, when the constructor for <code>A</code> invokes <code>getValue</code>, |
3013 an uninitialized value is read for <code>value</code> | 3020 an uninitialized value is read for <code>value</code> |
3014 </p> | 3021 </p> |
3015 | 3022 |
3016 | 3023 |
3017 <h3><a name="DMI_INVOKING_TOSTRING_ON_ANONYMOUS_ARRAY">USELESS_STRING: Invocatio
n of toString on an array (DMI_INVOKING_TOSTRING_ON_ANONYMOUS_ARRAY)</a></h3> | 3024 <h3><a name="DMI_INVOKING_TOSTRING_ON_ANONYMOUS_ARRAY">USELESS_STRING: Invocatio
n of toString on an unnamed array (DMI_INVOKING_TOSTRING_ON_ANONYMOUS_ARRAY)</a>
</h3> |
3018 | 3025 |
3019 | 3026 |
3020 <p> | 3027 <p> |
3021 The code invokes toString on an (anonymous) array. Calling toString on an array
generates a fairly useless result | 3028 The code invokes toString on an (anonymous) array. Calling toString on an array
generates a fairly useless result |
3022 such as [C@16f0472. Consider using Arrays.toString to convert the array into a r
eadable | 3029 such as [C@16f0472. Consider using Arrays.toString to convert the array into a r
eadable |
3023 String that gives the contents of the array. See Programming Puzzlers, chapter 3
, puzzle 12. | 3030 String that gives the contents of the array. See Programming Puzzlers, chapter 3
, puzzle 12. |
3024 </p> | 3031 </p> |
3025 | 3032 |
3026 | 3033 |
3027 <h3><a name="DMI_INVOKING_TOSTRING_ON_ARRAY">USELESS_STRING: Invocation of toStr
ing on an array (DMI_INVOKING_TOSTRING_ON_ARRAY)</a></h3> | 3034 <h3><a name="DMI_INVOKING_TOSTRING_ON_ARRAY">USELESS_STRING: Invocation of toStr
ing on an array (DMI_INVOKING_TOSTRING_ON_ARRAY)</a></h3> |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3075 <p>OpenJDK introduces a potential incompatibility. | 3082 <p>OpenJDK introduces a potential incompatibility. |
3076 In particular, the java.util.logging.Logger behavior has | 3083 In particular, the java.util.logging.Logger behavior has |
3077 changed. Instead of using strong references, it now uses weak references | 3084 changed. Instead of using strong references, it now uses weak references |
3078 internally. That's a reasonable change, but unfortunately some code relies on | 3085 internally. That's a reasonable change, but unfortunately some code relies on |
3079 the old behavior - when changing logger configuration, it simply drops the | 3086 the old behavior - when changing logger configuration, it simply drops the |
3080 logger reference. That means that the garbage collector is free to reclaim | 3087 logger reference. That means that the garbage collector is free to reclaim |
3081 that memory, which means that the logger configuration is lost. For example, | 3088 that memory, which means that the logger configuration is lost. For example, |
3082 consider: | 3089 consider: |
3083 </p> | 3090 </p> |
3084 | 3091 |
3085 <p><pre>public static void initLogging() throws Exception { | 3092 <pre>public static void initLogging() throws Exception { |
3086 Logger logger = Logger.getLogger("edu.umd.cs"); | 3093 Logger logger = Logger.getLogger("edu.umd.cs"); |
3087 logger.addHandler(new FileHandler()); // call to change logger configuration | 3094 logger.addHandler(new FileHandler()); // call to change logger configuration |
3088 logger.setUseParentHandlers(false); // another call to change logger configurat
ion | 3095 logger.setUseParentHandlers(false); // another call to change logger configurat
ion |
3089 }</pre></p> | 3096 }</pre> |
3090 | 3097 |
3091 <p>The logger reference is lost at the end of the method (it doesn't | 3098 <p>The logger reference is lost at the end of the method (it doesn't |
3092 escape the method), so if you have a garbage collection cycle just | 3099 escape the method), so if you have a garbage collection cycle just |
3093 after the call to initLogging, the logger configuration is lost | 3100 after the call to initLogging, the logger configuration is lost |
3094 (because Logger only keeps weak references).</p> | 3101 (because Logger only keeps weak references).</p> |
3095 | 3102 |
3096 <p><pre>public static void main(String[] args) throws Exception { | 3103 <pre>public static void main(String[] args) throws Exception { |
3097 initLogging(); // adds a file handler to the logger | 3104 initLogging(); // adds a file handler to the logger |
3098 System.gc(); // logger configuration lost | 3105 System.gc(); // logger configuration lost |
3099 Logger.getLogger("edu.umd.cs").info("Some message"); // this isn't logged to th
e file as expected | 3106 Logger.getLogger("edu.umd.cs").info("Some message"); // this isn't logged to th
e file as expected |
3100 }</pre></p> | 3107 }</pre> |
3101 <p><em>Ulf Ochsenfahrt and Eric Fellheimer</em></p> | 3108 <p><em>Ulf Ochsenfahrt and Eric Fellheimer</em></p> |
3102 | 3109 |
3103 | 3110 |
3104 <h3><a name="OBL_UNSATISFIED_OBLIGATION">OBL: Method may fail to clean up stream
or resource (OBL_UNSATISFIED_OBLIGATION)</a></h3> | 3111 <h3><a name="OBL_UNSATISFIED_OBLIGATION">OBL: Method may fail to clean up stream
or resource (OBL_UNSATISFIED_OBLIGATION)</a></h3> |
3105 | 3112 |
3106 | 3113 |
3107 <p> | 3114 <p> |
3108 This method may fail to clean up (close, dispose of) a stream, | 3115 This method may fail to clean up (close, dispose of) a stream, |
3109 database object, or other | 3116 database object, or other |
3110 resource requiring an explicit cleanup operation. | 3117 resource requiring an explicit cleanup operation. |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3375 <p> This method may contain an instance of double-checked locking. | 3382 <p> This method may contain an instance of double-checked locking. |
3376 This idiom is not correct according to the semantics of the Java memory | 3383 This idiom is not correct according to the semantics of the Java memory |
3377 model. For more information, see the web page | 3384 model. For more information, see the web page |
3378 <a href="http://www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.htm
l" | 3385 <a href="http://www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.htm
l" |
3379 >http://www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.html</a>.</
p> | 3386 >http://www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.html</a>.</
p> |
3380 | 3387 |
3381 | 3388 |
3382 <h3><a name="DL_SYNCHRONIZATION_ON_BOOLEAN">DL: Synchronization on Boolean (DL_S
YNCHRONIZATION_ON_BOOLEAN)</a></h3> | 3389 <h3><a name="DL_SYNCHRONIZATION_ON_BOOLEAN">DL: Synchronization on Boolean (DL_S
YNCHRONIZATION_ON_BOOLEAN)</a></h3> |
3383 | 3390 |
3384 | 3391 |
3385 <p> The code synchronizes on a boxed primitive constant, such as an Boolean. | 3392 <p> The code synchronizes on a boxed primitive constant, such as an Boolean.</
p> |
3386 <pre> | 3393 <pre> |
3387 private static Boolean inited = Boolean.FALSE; | 3394 private static Boolean inited = Boolean.FALSE; |
3388 ... | 3395 ... |
3389 synchronized(inited) { | 3396 synchronized(inited) { |
3390 if (!inited) { | 3397 if (!inited) { |
3391 init(); | 3398 init(); |
3392 inited = Boolean.TRUE; | 3399 inited = Boolean.TRUE; |
3393 } | 3400 } |
3394 } | 3401 } |
3395 ... | 3402 ... |
3396 </pre> | 3403 </pre> |
3397 </p> | |
3398 <p>Since there normally exist only two Boolean objects, this code could be synch
ronizing on the same object as other, unrelated code, leading to unresponsivenes
s | 3404 <p>Since there normally exist only two Boolean objects, this code could be synch
ronizing on the same object as other, unrelated code, leading to unresponsivenes
s |
3399 and possible deadlock</p> | 3405 and possible deadlock</p> |
3400 <p>See CERT <a href="https://www.securecoding.cert.org/confluence/display/java/C
ON08-J.+Do+not+synchronize+on+objects+that+may+be+reused">CON08-J. Do not synchr
onize on objects that may be reused</a> for more information.</p> | 3406 <p>See CERT <a href="https://www.securecoding.cert.org/confluence/display/java/C
ON08-J.+Do+not+synchronize+on+objects+that+may+be+reused">CON08-J. Do not synchr
onize on objects that may be reused</a> for more information.</p> |
3401 | 3407 |
3402 | 3408 |
3403 <h3><a name="DL_SYNCHRONIZATION_ON_BOXED_PRIMITIVE">DL: Synchronization on boxed
primitive (DL_SYNCHRONIZATION_ON_BOXED_PRIMITIVE)</a></h3> | 3409 <h3><a name="DL_SYNCHRONIZATION_ON_BOXED_PRIMITIVE">DL: Synchronization on boxed
primitive (DL_SYNCHRONIZATION_ON_BOXED_PRIMITIVE)</a></h3> |
3404 | 3410 |
3405 | 3411 |
3406 <p> The code synchronizes on a boxed primitive constant, such as an Integer. | 3412 <p> The code synchronizes on a boxed primitive constant, such as an Integer.</
p> |
3407 <pre> | 3413 <pre> |
3408 private static Integer count = 0; | 3414 private static Integer count = 0; |
3409 ... | 3415 ... |
3410 synchronized(count) { | 3416 synchronized(count) { |
3411 count++; | 3417 count++; |
3412 } | 3418 } |
3413 ... | 3419 ... |
3414 </pre> | 3420 </pre> |
3415 </p> | |
3416 <p>Since Integer objects can be cached and shared, | 3421 <p>Since Integer objects can be cached and shared, |
3417 this code could be synchronizing on the same object as other, unrelated code, le
ading to unresponsiveness | 3422 this code could be synchronizing on the same object as other, unrelated code, le
ading to unresponsiveness |
3418 and possible deadlock</p> | 3423 and possible deadlock</p> |
3419 <p>See CERT <a href="https://www.securecoding.cert.org/confluence/display/java/C
ON08-J.+Do+not+synchronize+on+objects+that+may+be+reused">CON08-J. Do not synchr
onize on objects that may be reused</a> for more information.</p> | 3424 <p>See CERT <a href="https://www.securecoding.cert.org/confluence/display/java/C
ON08-J.+Do+not+synchronize+on+objects+that+may+be+reused">CON08-J. Do not synchr
onize on objects that may be reused</a> for more information.</p> |
3420 | 3425 |
3421 | 3426 |
3422 <h3><a name="DL_SYNCHRONIZATION_ON_SHARED_CONSTANT">DL: Synchronization on inter
ned String (DL_SYNCHRONIZATION_ON_SHARED_CONSTANT)</a></h3> | 3427 <h3><a name="DL_SYNCHRONIZATION_ON_SHARED_CONSTANT">DL: Synchronization on inter
ned String (DL_SYNCHRONIZATION_ON_SHARED_CONSTANT)</a></h3> |
3423 | 3428 |
3424 | 3429 |
3425 <p> The code synchronizes on interned String. | 3430 <p> The code synchronizes on interned String.</p> |
3426 <pre> | 3431 <pre> |
3427 private static String LOCK = "LOCK"; | 3432 private static String LOCK = "LOCK"; |
3428 ... | 3433 ... |
3429 synchronized(LOCK) { ...} | 3434 synchronized(LOCK) { ...} |
3430 ... | 3435 ... |
3431 </pre> | 3436 </pre> |
3432 </p> | |
3433 <p>Constant Strings are interned and shared across all other classes loaded by t
he JVM. Thus, this could | 3437 <p>Constant Strings are interned and shared across all other classes loaded by t
he JVM. Thus, this could |
3434 is locking on something that other code might also be locking. This could result
in very strange and hard to diagnose | 3438 is locking on something that other code might also be locking. This could result
in very strange and hard to diagnose |
3435 blocking and deadlock behavior. See <a href="http://www.javalobby.org/java/forum
s/t96352.html">http://www.javalobby.org/java/forums/t96352.html</a> and <a href=
"http://jira.codehaus.org/browse/JETTY-352">http://jira.codehaus.org/browse/JETT
Y-352</a>. | 3439 blocking and deadlock behavior. See <a href="http://www.javalobby.org/java/forum
s/t96352.html">http://www.javalobby.org/java/forums/t96352.html</a> and <a href=
"http://jira.codehaus.org/browse/JETTY-352">http://jira.codehaus.org/browse/JETT
Y-352</a>. |
| 3440 </p> |
3436 <p>See CERT <a href="https://www.securecoding.cert.org/confluence/display/java/C
ON08-J.+Do+not+synchronize+on+objects+that+may+be+reused">CON08-J. Do not synchr
onize on objects that may be reused</a> for more information.</p> | 3441 <p>See CERT <a href="https://www.securecoding.cert.org/confluence/display/java/C
ON08-J.+Do+not+synchronize+on+objects+that+may+be+reused">CON08-J. Do not synchr
onize on objects that may be reused</a> for more information.</p> |
3437 </p> | |
3438 | 3442 |
3439 | 3443 |
3440 <h3><a name="DL_SYNCHRONIZATION_ON_UNSHARED_BOXED_PRIMITIVE">DL: Synchronization
on boxed primitive values (DL_SYNCHRONIZATION_ON_UNSHARED_BOXED_PRIMITIVE)</a><
/h3> | 3444 <h3><a name="DL_SYNCHRONIZATION_ON_UNSHARED_BOXED_PRIMITIVE">DL: Synchronization
on boxed primitive values (DL_SYNCHRONIZATION_ON_UNSHARED_BOXED_PRIMITIVE)</a><
/h3> |
3441 | 3445 |
3442 | 3446 |
3443 <p> The code synchronizes on an apparently unshared boxed primitive, | 3447 <p> The code synchronizes on an apparently unshared boxed primitive, |
3444 such as an Integer. | 3448 such as an Integer.</p> |
3445 <pre> | 3449 <pre> |
3446 private static final Integer fileLock = new Integer(1); | 3450 private static final Integer fileLock = new Integer(1); |
3447 ... | 3451 ... |
3448 synchronized(fileLock) { | 3452 synchronized(fileLock) { |
3449 .. do something .. | 3453 .. do something .. |
3450 } | 3454 } |
3451 ... | 3455 ... |
3452 </pre> | 3456 </pre> |
3453 </p> | 3457 <p>It would be much better, in this code, to redeclare fileLock as</p> |
3454 <p>It would be much better, in this code, to redeclare fileLock as | |
3455 <pre> | 3458 <pre> |
3456 private static final Object fileLock = new Object(); | 3459 private static final Object fileLock = new Object(); |
3457 </pre> | 3460 </pre> |
| 3461 <p> |
3458 The existing code might be OK, but it is confusing and a | 3462 The existing code might be OK, but it is confusing and a |
3459 future refactoring, such as the "Remove Boxing" refactoring in IntelliJ, | 3463 future refactoring, such as the "Remove Boxing" refactoring in IntelliJ, |
3460 might replace this with the use of an interned Integer object shared | 3464 might replace this with the use of an interned Integer object shared |
3461 throughout the JVM, leading to very confusing behavior and potential deadlock. | 3465 throughout the JVM, leading to very confusing behavior and potential deadlock. |
3462 </p> | 3466 </p> |
3463 | 3467 |
3464 | 3468 |
3465 <h3><a name="DM_MONITOR_WAIT_ON_CONDITION">Dm: Monitor wait() called on Conditio
n (DM_MONITOR_WAIT_ON_CONDITION)</a></h3> | 3469 <h3><a name="DM_MONITOR_WAIT_ON_CONDITION">Dm: Monitor wait() called on Conditio
n (DM_MONITOR_WAIT_ON_CONDITION)</a></h3> |
3466 | 3470 |
3467 | 3471 |
(...skipping 29 matching lines...) Expand all Loading... |
3497 | 3501 |
3498 <h3><a name="IS2_INCONSISTENT_SYNC">IS: Inconsistent synchronization (IS2_INCONS
ISTENT_SYNC)</a></h3> | 3502 <h3><a name="IS2_INCONSISTENT_SYNC">IS: Inconsistent synchronization (IS2_INCONS
ISTENT_SYNC)</a></h3> |
3499 | 3503 |
3500 | 3504 |
3501 <p> The fields of this class appear to be accessed inconsistently with respect | 3505 <p> The fields of this class appear to be accessed inconsistently with respect |
3502 to synchronization. This bug report indicates that the bug pattern detec
tor | 3506 to synchronization. This bug report indicates that the bug pattern detec
tor |
3503 judged that | 3507 judged that |
3504 </p> | 3508 </p> |
3505 <ul> | 3509 <ul> |
3506 <li> The class contains a mix of locked and unlocked accesses,</li> | 3510 <li> The class contains a mix of locked and unlocked accesses,</li> |
| 3511 <li> The class is <b>not</b> annotated as javax.annotation.concurrent.NotThrea
dSafe,</li> |
3507 <li> At least one locked access was performed by one of the class's own method
s, and</li> | 3512 <li> At least one locked access was performed by one of the class's own method
s, and</li> |
3508 <li> The number of unsynchronized field accesses (reads and writes) was no mor
e than | 3513 <li> The number of unsynchronized field accesses (reads and writes) was no mor
e than |
3509 one third of all accesses, with writes being weighed twice as high as rea
ds</li> | 3514 one third of all accesses, with writes being weighed twice as high as rea
ds</li> |
3510 </ul> | 3515 </ul> |
3511 | 3516 |
3512 <p> A typical bug matching this bug pattern is forgetting to synchronize | 3517 <p> A typical bug matching this bug pattern is forgetting to synchronize |
3513 one of the methods in a class that is intended to be thread-safe.</p> | 3518 one of the methods in a class that is intended to be thread-safe.</p> |
3514 | 3519 |
3515 <p> You can select the nodes labeled "Unsynchronized access" to show the | 3520 <p> You can select the nodes labeled "Unsynchronized access" to show the |
3516 code locations where the detector believed that a field was accessed | 3521 code locations where the detector believed that a field was accessed |
3517 without synchronization.</p> | 3522 without synchronization.</p> |
3518 | 3523 |
3519 <p> Note that there are various sources of inaccuracy in this detector; | 3524 <p> Note that there are various sources of inaccuracy in this detector; |
3520 for example, the detector cannot statically detect all situations in which | 3525 for example, the detector cannot statically detect all situations in which |
3521 a lock is held. Also, even when the detector is accurate in | 3526 a lock is held. Also, even when the detector is accurate in |
3522 distinguishing locked vs. unlocked accesses, the code in question may still | 3527 distinguishing locked vs. unlocked accesses, the code in question may still |
3523 be correct.</p> | 3528 be correct.</p> |
3524 | 3529 |
3525 | 3530 |
3526 | 3531 |
3527 <h3><a name="IS_FIELD_NOT_GUARDED">IS: Field not guarded against concurrent acce
ss (IS_FIELD_NOT_GUARDED)</a></h3> | 3532 <h3><a name="IS_FIELD_NOT_GUARDED">IS: Field not guarded against concurrent acce
ss (IS_FIELD_NOT_GUARDED)</a></h3> |
3528 | 3533 |
3529 | 3534 |
3530 <p> This field is annotated with net.jcip.annotations.GuardedBy, | 3535 <p> This field is annotated with net.jcip.annotations.GuardedBy or javax.annot
ation.concurrent.GuardedBy, |
3531 but can be accessed in a way that seems to violate the annotation.</p> | 3536 but can be accessed in a way that seems to violate those annotations.</p> |
3532 | 3537 |
3533 | 3538 |
3534 <h3><a name="JLM_JSR166_LOCK_MONITORENTER">JLM: Synchronization performed on Loc
k (JLM_JSR166_LOCK_MONITORENTER)</a></h3> | 3539 <h3><a name="JLM_JSR166_LOCK_MONITORENTER">JLM: Synchronization performed on Loc
k (JLM_JSR166_LOCK_MONITORENTER)</a></h3> |
3535 | 3540 |
3536 | 3541 |
3537 <p> This method performs synchronization an object that implements | 3542 <p> This method performs synchronization an object that implements |
3538 java.util.concurrent.locks.Lock. Such an object is locked/unlocked | 3543 java.util.concurrent.locks.Lock. Such an object is locked/unlocked |
3539 using | 3544 using |
3540 <code>acquire()</code>/<code>release()</code> rather | 3545 <code>acquire()</code>/<code>release()</code> rather |
3541 than using the <code>synchronized (...)</code> construct. | 3546 than using the <code>synchronized (...)</code> construct. |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3601 | 3606 |
3602 | 3607 |
3603 <h3><a name="ML_SYNC_ON_FIELD_TO_GUARD_CHANGING_THAT_FIELD">ML: Synchronization
on field in futile attempt to guard that field (ML_SYNC_ON_FIELD_TO_GUARD_CHANGI
NG_THAT_FIELD)</a></h3> | 3608 <h3><a name="ML_SYNC_ON_FIELD_TO_GUARD_CHANGING_THAT_FIELD">ML: Synchronization
on field in futile attempt to guard that field (ML_SYNC_ON_FIELD_TO_GUARD_CHANGI
NG_THAT_FIELD)</a></h3> |
3604 | 3609 |
3605 | 3610 |
3606 <p> This method synchronizes on a field in what appears to be an attempt | 3611 <p> This method synchronizes on a field in what appears to be an attempt |
3607 to guard against simultaneous updates to that field. But guarding a field | 3612 to guard against simultaneous updates to that field. But guarding a field |
3608 gets a lock on the referenced object, not on the field. This may not | 3613 gets a lock on the referenced object, not on the field. This may not |
3609 provide the mutual exclusion you need, and other threads might | 3614 provide the mutual exclusion you need, and other threads might |
3610 be obtaining locks on the referenced objects (for other purposes). An example | 3615 be obtaining locks on the referenced objects (for other purposes). An example |
3611 of this pattern would be: | 3616 of this pattern would be:</p> |
3612 | 3617 <pre> |
3613 <p><pre> | |
3614 private Long myNtfSeqNbrCounter = new Long(0); | 3618 private Long myNtfSeqNbrCounter = new Long(0); |
3615 private Long getNotificationSequenceNumber() { | 3619 private Long getNotificationSequenceNumber() { |
3616 Long result = null; | 3620 Long result = null; |
3617 synchronized(myNtfSeqNbrCounter) { | 3621 synchronized(myNtfSeqNbrCounter) { |
3618 result = new Long(myNtfSeqNbrCounter.longValue() + 1); | 3622 result = new Long(myNtfSeqNbrCounter.longValue() + 1); |
3619 myNtfSeqNbrCounter = new Long(result.longValue()); | 3623 myNtfSeqNbrCounter = new Long(result.longValue()); |
3620 } | 3624 } |
3621 return result; | 3625 return result; |
3622 } | 3626 } |
3623 </pre> | 3627 </pre> |
3624 | 3628 |
3625 | |
3626 </p> | |
3627 | |
3628 | 3629 |
3629 <h3><a name="ML_SYNC_ON_UPDATED_FIELD">ML: Method synchronizes on an updated fie
ld (ML_SYNC_ON_UPDATED_FIELD)</a></h3> | 3630 <h3><a name="ML_SYNC_ON_UPDATED_FIELD">ML: Method synchronizes on an updated fie
ld (ML_SYNC_ON_UPDATED_FIELD)</a></h3> |
3630 | 3631 |
3631 | 3632 |
3632 <p> This method synchronizes on an object | 3633 <p> This method synchronizes on an object |
3633 referenced from a mutable field. | 3634 referenced from a mutable field. |
3634 This is unlikely to have useful semantics, since different | 3635 This is unlikely to have useful semantics, since different |
3635 threads may be synchronizing on different objects.</p> | 3636 threads may be synchronizing on different objects.</p> |
3636 | 3637 |
3637 | 3638 |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3890 one of the atomic array classes in java.util.concurrent (provided | 3891 one of the atomic array classes in java.util.concurrent (provided |
3891 in Java 5.0).</p> | 3892 in Java 5.0).</p> |
3892 | 3893 |
3893 | 3894 |
3894 <h3><a name="WL_USING_GETCLASS_RATHER_THAN_CLASS_LITERAL">WL: Synchronization on
getClass rather than class literal (WL_USING_GETCLASS_RATHER_THAN_CLASS_LITERAL
)</a></h3> | 3895 <h3><a name="WL_USING_GETCLASS_RATHER_THAN_CLASS_LITERAL">WL: Synchronization on
getClass rather than class literal (WL_USING_GETCLASS_RATHER_THAN_CLASS_LITERAL
)</a></h3> |
3895 | 3896 |
3896 | 3897 |
3897 <p> | 3898 <p> |
3898 This instance method synchronizes on <code>this.getClass()</code>. If this
class is subclassed, | 3899 This instance method synchronizes on <code>this.getClass()</code>. If this
class is subclassed, |
3899 subclasses will synchronize on the class object for the subclass, which isn
't likely what was intended. | 3900 subclasses will synchronize on the class object for the subclass, which isn
't likely what was intended. |
3900 For example, consider this code from java.awt.Label: | 3901 For example, consider this code from java.awt.Label:</p> |
3901 <pre> | 3902 <pre> |
3902 private static final String base = "label"; | 3903 private static final String base = "label"; |
3903 private static int nameCounter = 0; | 3904 private static int nameCounter = 0; |
3904 String constructComponentName() { | 3905 String constructComponentName() { |
3905 synchronized (getClass()) { | 3906 synchronized (getClass()) { |
3906 return base + nameCounter++; | 3907 return base + nameCounter++; |
3907 } | 3908 } |
3908 } | 3909 } |
3909 </pre></p> | 3910 </pre> |
3910 <p>Subclasses of <code>Label</code> won't synchronize on the same subclass,
giving rise to a datarace. | 3911 <p>Subclasses of <code>Label</code> won't synchronize on the same subclass,
giving rise to a datarace. |
3911 Instead, this code should be synchronizing on <code>Label.class</code> | 3912 Instead, this code should be synchronizing on <code>Label.class</code></p> |
3912 <pre> | 3913 <pre> |
3913 private static final String base = "label"; | 3914 private static final String base = "label"; |
3914 private static int nameCounter = 0; | 3915 private static int nameCounter = 0; |
3915 String constructComponentName() { | 3916 String constructComponentName() { |
3916 synchronized (Label.class) { | 3917 synchronized (Label.class) { |
3917 return base + nameCounter++; | 3918 return base + nameCounter++; |
3918 } | 3919 } |
3919 } | 3920 } |
3920 </pre></p> | 3921 </pre> |
3921 <p>Bug pattern contributed by Jason Mehrens</p> | 3922 <p>Bug pattern contributed by Jason Mehrens</p> |
3922 | 3923 |
3923 | 3924 |
3924 <h3><a name="WS_WRITEOBJECT_SYNC">WS: Class's writeObject() method is synchroniz
ed but nothing else is (WS_WRITEOBJECT_SYNC)</a></h3> | 3925 <h3><a name="WS_WRITEOBJECT_SYNC">WS: Class's writeObject() method is synchroniz
ed but nothing else is (WS_WRITEOBJECT_SYNC)</a></h3> |
3925 | 3926 |
3926 | 3927 |
3927 <p> This class has a <code>writeObject()</code> method which is synchronized; | 3928 <p> This class has a <code>writeObject()</code> method which is synchronized; |
3928 however, no other method of the class is synchronized.</p> | 3929 however, no other method of the class is synchronized.</p> |
3929 | 3930 |
3930 | 3931 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3963 (e.g., <code>new Double(d).intValue()</code>). Just perform direct primitive coe
rcion (e.g., <code>(int) d</code>).</p> | 3964 (e.g., <code>new Double(d).intValue()</code>). Just perform direct primitive coe
rcion (e.g., <code>(int) d</code>).</p> |
3964 | 3965 |
3965 | 3966 |
3966 <h3><a name="BX_UNBOXING_IMMEDIATELY_REBOXED">Bx: Boxed value is unboxed and the
n immediately reboxed (BX_UNBOXING_IMMEDIATELY_REBOXED)</a></h3> | 3967 <h3><a name="BX_UNBOXING_IMMEDIATELY_REBOXED">Bx: Boxed value is unboxed and the
n immediately reboxed (BX_UNBOXING_IMMEDIATELY_REBOXED)</a></h3> |
3967 | 3968 |
3968 | 3969 |
3969 <p>A boxed value is unboxed and then immediately reboxed. | 3970 <p>A boxed value is unboxed and then immediately reboxed. |
3970 </p> | 3971 </p> |
3971 | 3972 |
3972 | 3973 |
| 3974 <h3><a name="DM_BOXED_PRIMITIVE_FOR_PARSING">Bx: Boxing/unboxing to parse a prim
itive (DM_BOXED_PRIMITIVE_FOR_PARSING)</a></h3> |
| 3975 |
| 3976 |
| 3977 <p>A boxed primitive is created from a String, just to extract the unboxed pri
mitive value. |
| 3978 It is more efficient to just call the static parseXXX method.</p> |
| 3979 |
| 3980 |
3973 <h3><a name="DM_BOXED_PRIMITIVE_TOSTRING">Bx: Method allocates a boxed primitive
just to call toString (DM_BOXED_PRIMITIVE_TOSTRING)</a></h3> | 3981 <h3><a name="DM_BOXED_PRIMITIVE_TOSTRING">Bx: Method allocates a boxed primitive
just to call toString (DM_BOXED_PRIMITIVE_TOSTRING)</a></h3> |
3974 | 3982 |
3975 | 3983 |
3976 <p>A boxed primitive is allocated just to call toString(). It is more effectiv
e to just use the static | 3984 <p>A boxed primitive is allocated just to call toString(). It is more effectiv
e to just use the static |
3977 form of toString which takes the primitive value. So,</p> | 3985 form of toString which takes the primitive value. So,</p> |
3978 <table> | 3986 <table> |
3979 <tr><th>Replace...</th><th>With this...</th></tr> | 3987 <tr><th>Replace...</th><th>With this...</th></tr> |
3980 <tr><td>new Integer(1).toString()</td><td>Integer.toString(1)</td></tr> | 3988 <tr><td>new Integer(1).toString()</td><td>Integer.toString(1)</td></tr> |
3981 <tr><td>new Long(1).toString()</td><td>Long.toString(1)</td></tr> | 3989 <tr><td>new Long(1).toString()</td><td>Long.toString(1)</td></tr> |
3982 <tr><td>new Float(1.0).toString()</td><td>Float.toString(1.0)</td></tr> | 3990 <tr><td>new Float(1.0).toString()</td><td>Float.toString(1.0)</td></tr> |
(...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4677 <h3><a name="VA_FORMAT_STRING_BAD_CONVERSION_TO_BOOLEAN">FS: Non-Boolean argumen
t formatted using %b format specifier (VA_FORMAT_STRING_BAD_CONVERSION_TO_BOOLEA
N)</a></h3> | 4685 <h3><a name="VA_FORMAT_STRING_BAD_CONVERSION_TO_BOOLEAN">FS: Non-Boolean argumen
t formatted using %b format specifier (VA_FORMAT_STRING_BAD_CONVERSION_TO_BOOLEA
N)</a></h3> |
4678 | 4686 |
4679 | 4687 |
4680 <p> | 4688 <p> |
4681 An argument not of type Boolean is being formatted with a %b format specifier. T
his won't throw an | 4689 An argument not of type Boolean is being formatted with a %b format specifier. T
his won't throw an |
4682 exception; instead, it will print true for any nonnull value, and false for null
. | 4690 exception; instead, it will print true for any nonnull value, and false for null
. |
4683 This feature of format strings is strange, and may not be what you intended. | 4691 This feature of format strings is strange, and may not be what you intended. |
4684 </p> | 4692 </p> |
4685 | 4693 |
4686 | 4694 |
4687 <h3><a name="IA_AMBIGUOUS_INVOCATION_OF_INHERITED_OR_OUTER_METHOD">IA: Ambiguous
invocation of either an inherited or outer method (IA_AMBIGUOUS_INVOCATION_OF_I
NHERITED_OR_OUTER_METHOD)</a></h3> | 4695 <h3><a name="IA_AMBIGUOUS_INVOCATION_OF_INHERITED_OR_OUTER_METHOD">IA: Potential
ly ambiguous invocation of either an inherited or outer method (IA_AMBIGUOUS_INV
OCATION_OF_INHERITED_OR_OUTER_METHOD)</a></h3> |
4688 | 4696 |
4689 | 4697 |
4690 <p> An inner class is invoking a method that could be resolved to either a inh
erited method or a method defined in an outer class. By the Java semantics, | 4698 <p> |
| 4699 An inner class is invoking a method that could be resolved to either a inherited
method or a method defined in an outer class. |
| 4700 For example, you invoke <code>foo(17)</code>, which is defined in both a supercl
ass and in an outer method. |
| 4701 By the Java semantics, |
4691 it will be resolved to invoke the inherited method, but this may not be want | 4702 it will be resolved to invoke the inherited method, but this may not be want |
4692 you intend. If you really intend to invoke the inherited method, | 4703 you intend. |
| 4704 </p> |
| 4705 <p>If you really intend to invoke the inherited method, |
4693 invoke it by invoking the method on super (e.g., invoke super.foo(17)), and | 4706 invoke it by invoking the method on super (e.g., invoke super.foo(17)), and |
4694 thus it will be clear to other readers of your code and to FindBugs | 4707 thus it will be clear to other readers of your code and to FindBugs |
4695 that you want to invoke the inherited method, not the method in the outer class. | 4708 that you want to invoke the inherited method, not the method in the outer class. |
4696 </p> | 4709 </p> |
| 4710 <p>If you call <code>this.foo(17)</code>, then the inherited method will be invo
ked. However, since FindBugs only looks at |
| 4711 classfiles, it |
| 4712 can't tell the difference between an invocation of <code>this.foo(17)</code> and
<code>foo(17)</code>, it will still |
| 4713 complain about a potential ambiguous invocation. |
| 4714 </p> |
4697 | 4715 |
4698 | 4716 |
4699 <h3><a name="IC_INIT_CIRCULARITY">IC: Initialization circularity (IC_INIT_CIRCUL
ARITY)</a></h3> | 4717 <h3><a name="IC_INIT_CIRCULARITY">IC: Initialization circularity (IC_INIT_CIRCUL
ARITY)</a></h3> |
4700 | 4718 |
4701 | 4719 |
4702 <p> A circularity was detected in the static initializers of the two | 4720 <p> A circularity was detected in the static initializers of the two |
4703 classes referenced by the bug instance. Many kinds of unexpected | 4721 classes referenced by the bug instance. Many kinds of unexpected |
4704 behavior may arise from such circularity.</p> | 4722 behavior may arise from such circularity.</p> |
4705 | 4723 |
4706 | 4724 |
4707 <h3><a name="ICAST_IDIV_CAST_TO_DOUBLE">ICAST: integral division result cast to
double or float (ICAST_IDIV_CAST_TO_DOUBLE)</a></h3> | 4725 <h3><a name="ICAST_IDIV_CAST_TO_DOUBLE">ICAST: Integral division result cast to
double or float (ICAST_IDIV_CAST_TO_DOUBLE)</a></h3> |
4708 | 4726 |
4709 | 4727 |
4710 <p> | 4728 <p> |
4711 This code casts the result of an integral division (e.g., int or long division) | 4729 This code casts the result of an integral division (e.g., int or long division) |
4712 operation to double or | 4730 operation to double or |
4713 float. | 4731 float. |
4714 Doing division on integers truncates the result | 4732 Doing division on integers truncates the result |
4715 to the integer value closest to zero. The fact that the result | 4733 to the integer value closest to zero. The fact that the result |
4716 was cast to double suggests that this precision should have been retained. | 4734 was cast to double suggests that this precision should have been retained. |
4717 What was probably meant was to cast one or both of the operands to | 4735 What was probably meant was to cast one or both of the operands to |
(...skipping 10 matching lines...) Expand all Loading... |
4728 double value2 = x / (double) y; | 4746 double value2 = x / (double) y; |
4729 </pre> | 4747 </pre> |
4730 </blockquote> | 4748 </blockquote> |
4731 | 4749 |
4732 | 4750 |
4733 <h3><a name="ICAST_INTEGER_MULTIPLY_CAST_TO_LONG">ICAST: Result of integer multi
plication cast to long (ICAST_INTEGER_MULTIPLY_CAST_TO_LONG)</a></h3> | 4751 <h3><a name="ICAST_INTEGER_MULTIPLY_CAST_TO_LONG">ICAST: Result of integer multi
plication cast to long (ICAST_INTEGER_MULTIPLY_CAST_TO_LONG)</a></h3> |
4734 | 4752 |
4735 | 4753 |
4736 <p> | 4754 <p> |
4737 This code performs integer multiply and then converts the result to a long, | 4755 This code performs integer multiply and then converts the result to a long, |
4738 as in: | 4756 as in:</p> |
4739 <code> | |
4740 <pre> | 4757 <pre> |
4741 long convertDaysToMilliseconds(int days) { return 1000*3600*24*days; } | 4758 long convertDaysToMilliseconds(int days) { return 1000*3600*24*days; } |
4742 </pre></code> | 4759 </pre> |
| 4760 <p> |
4743 If the multiplication is done using long arithmetic, you can avoid | 4761 If the multiplication is done using long arithmetic, you can avoid |
4744 the possibility that the result will overflow. For example, you | 4762 the possibility that the result will overflow. For example, you |
4745 could fix the above code to: | 4763 could fix the above code to:</p> |
4746 <code> | |
4747 <pre> | 4764 <pre> |
4748 long convertDaysToMilliseconds(int days) { return 1000L*3600*24*days; } | 4765 long convertDaysToMilliseconds(int days) { return 1000L*3600*24*days; } |
4749 </pre></code> | 4766 </pre> |
4750 or | 4767 or |
4751 <code> | |
4752 <pre> | 4768 <pre> |
4753 static final long MILLISECONDS_PER_DAY = 24L*3600*1000; | 4769 static final long MILLISECONDS_PER_DAY = 24L*3600*1000; |
4754 long convertDaysToMilliseconds(int days) { return days * MILLISECONDS_PER_DA
Y; } | 4770 long convertDaysToMilliseconds(int days) { return days * MILLISECONDS_PER_DA
Y; } |
4755 </pre></code> | 4771 </pre> |
4756 </p> | |
4757 | |
4758 | 4772 |
4759 | 4773 |
4760 <h3><a name="IM_AVERAGE_COMPUTATION_COULD_OVERFLOW">IM: Computation of average c
ould overflow (IM_AVERAGE_COMPUTATION_COULD_OVERFLOW)</a></h3> | 4774 <h3><a name="IM_AVERAGE_COMPUTATION_COULD_OVERFLOW">IM: Computation of average c
ould overflow (IM_AVERAGE_COMPUTATION_COULD_OVERFLOW)</a></h3> |
4761 | 4775 |
4762 | 4776 |
4763 <p>The code computes the average of two integers using either division or signed
right shift, | 4777 <p>The code computes the average of two integers using either division or signed
right shift, |
4764 and then uses the result as the index of an array. | 4778 and then uses the result as the index of an array. |
4765 If the values being averaged are very large, this can overflow (resulting in the
computation | 4779 If the values being averaged are very large, this can overflow (resulting in the
computation |
4766 of a negative average). Assuming that the result is intended to be nonnegative,
you | 4780 of a negative average). Assuming that the result is intended to be nonnegative,
you |
4767 can use an unsigned right shift instead. In other words, rather that using <code
>(low+high)/2</code>, | 4781 can use an unsigned right shift instead. In other words, rather that using <code
>(low+high)/2</code>, |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4852 <h3><a name="NP_LOAD_OF_KNOWN_NULL_VALUE">NP: Load of known null value (NP_LOAD_
OF_KNOWN_NULL_VALUE)</a></h3> | 4866 <h3><a name="NP_LOAD_OF_KNOWN_NULL_VALUE">NP: Load of known null value (NP_LOAD_
OF_KNOWN_NULL_VALUE)</a></h3> |
4853 | 4867 |
4854 | 4868 |
4855 <p> The variable referenced at this point is known to be null due to an earlie
r | 4869 <p> The variable referenced at this point is known to be null due to an earlie
r |
4856 check against null. Although this is valid, it might be a mistake (perhaps yo
u | 4870 check against null. Although this is valid, it might be a mistake (perhaps yo
u |
4857 intended to refer to a different variable, or perhaps the earlier check to see i
f the | 4871 intended to refer to a different variable, or perhaps the earlier check to see i
f the |
4858 variable is null should have been a check to see if it was nonnull). | 4872 variable is null should have been a check to see if it was nonnull). |
4859 </p> | 4873 </p> |
4860 | 4874 |
4861 | 4875 |
| 4876 <h3><a name="NP_METHOD_PARAMETER_TIGHTENS_ANNOTATION">NP: Method tightens nullne
ss annotation on parameter (NP_METHOD_PARAMETER_TIGHTENS_ANNOTATION)</a></h3> |
| 4877 |
| 4878 <p> |
| 4879 A method should always implement the contract of a method it overrides.
Thus, if a method takes a parameter |
| 4880 that is marked as @Nullable, you shouldn't override that method in a sub
class with a method where that parameter is @Nonnull. |
| 4881 Doing so violates the contract that the method should handle a null para
meter. |
| 4882 </p> |
| 4883 |
| 4884 <h3><a name="NP_METHOD_RETURN_RELAXING_ANNOTATION">NP: Method relaxes nullness a
nnotation on return value (NP_METHOD_RETURN_RELAXING_ANNOTATION)</a></h3> |
| 4885 |
| 4886 <p> |
| 4887 A method should always implement the contract of a method it overrides.
Thus, if a method takes is annotated |
| 4888 as returning a @Nonnull value, |
| 4889 you shouldn't override that method in a subclass with a method annotated
as returning a @Nullable or @CheckForNull value. |
| 4890 Doing so violates the contract that the method shouldn't return null. |
| 4891 </p> |
| 4892 |
4862 <h3><a name="NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE">NP: Possible null pointer d
ereference due to return value of called method (NP_NULL_ON_SOME_PATH_FROM_RETUR
N_VALUE)</a></h3> | 4893 <h3><a name="NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE">NP: Possible null pointer d
ereference due to return value of called method (NP_NULL_ON_SOME_PATH_FROM_RETUR
N_VALUE)</a></h3> |
4863 | 4894 |
4864 | 4895 |
4865 <p> The return value from a method is dereferenced without a null check, | 4896 <p> The return value from a method is dereferenced without a null check, |
4866 and the return value of that method is one that should generally be checked | 4897 and the return value of that method is one that should generally be checked |
4867 for null. This may lead to a <code>NullPointerException</code> when the code is
executed. | 4898 for null. This may lead to a <code>NullPointerException</code> when the code is
executed. |
4868 </p> | 4899 </p> |
4869 | 4900 |
4870 | 4901 |
4871 <h3><a name="NP_NULL_ON_SOME_PATH_MIGHT_BE_INFEASIBLE">NP: Possible null pointer
dereference on branch that might be infeasible (NP_NULL_ON_SOME_PATH_MIGHT_BE_I
NFEASIBLE)</a></h3> | 4902 <h3><a name="NP_NULL_ON_SOME_PATH_MIGHT_BE_INFEASIBLE">NP: Possible null pointer
dereference on branch that might be infeasible (NP_NULL_ON_SOME_PATH_MIGHT_BE_I
NFEASIBLE)</a></h3> |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4996 <h3><a name="REC_CATCH_EXCEPTION">REC: Exception is caught when Exception is not
thrown (REC_CATCH_EXCEPTION)</a></h3> | 5027 <h3><a name="REC_CATCH_EXCEPTION">REC: Exception is caught when Exception is not
thrown (REC_CATCH_EXCEPTION)</a></h3> |
4997 | 5028 |
4998 | 5029 |
4999 <p> | 5030 <p> |
5000 This method uses a try-catch block that catches Exception objects, but Excepti
on is not | 5031 This method uses a try-catch block that catches Exception objects, but Excepti
on is not |
5001 thrown within the try block, and RuntimeException is not explicitly caught. I
t is a common bug pattern to | 5032 thrown within the try block, and RuntimeException is not explicitly caught. I
t is a common bug pattern to |
5002 say try { ... } catch (Exception e) { something } as a shorthand for catching
a number of types of exception | 5033 say try { ... } catch (Exception e) { something } as a shorthand for catching
a number of types of exception |
5003 each of whose catch blocks is identical, but this construct also accidentally
catches RuntimeException as well, | 5034 each of whose catch blocks is identical, but this construct also accidentally
catches RuntimeException as well, |
5004 masking potential bugs. | 5035 masking potential bugs. |
5005 </p> | 5036 </p> |
| 5037 <p>A better approach is to either explicitly catch the specific exceptions tha
t are thrown, |
| 5038 or to explicitly catch RuntimeException exception, rethrow it, and then catch
all non-Runtime Exceptions, as shown below:</p> |
| 5039 <pre> |
| 5040 try { |
| 5041 ... |
| 5042 } catch (RuntimeException e) { |
| 5043 throw e; |
| 5044 } catch (Exception e) { |
| 5045 ... deal with all non-runtime exceptions ... |
| 5046 }</pre> |
5006 | 5047 |
5007 | 5048 |
5008 <h3><a name="RI_REDUNDANT_INTERFACES">RI: Class implements same interface as sup
erclass (RI_REDUNDANT_INTERFACES)</a></h3> | 5049 <h3><a name="RI_REDUNDANT_INTERFACES">RI: Class implements same interface as sup
erclass (RI_REDUNDANT_INTERFACES)</a></h3> |
5009 | 5050 |
5010 | 5051 |
5011 <p> | 5052 <p> |
5012 This class declares that it implements an interface that is also implemented
by a superclass. | 5053 This class declares that it implements an interface that is also implemented
by a superclass. |
5013 This is redundant because once a superclass implements an interface, all sub
classes by default also | 5054 This is redundant because once a superclass implements an interface, all sub
classes by default also |
5014 implement this interface. It may point out that the inheritance hierarchy ha
s changed since | 5055 implement this interface. It may point out that the inheritance hierarchy ha
s changed since |
5015 this class was created, and consideration should be given to the ownership o
f | 5056 this class was created, and consideration should be given to the ownership o
f |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5129 | 5170 |
5130 <p> This method contains a switch statement where one case branch will fall th
rough to the next case. | 5171 <p> This method contains a switch statement where one case branch will fall th
rough to the next case. |
5131 Usually you need to end this case with a break or return.</p> | 5172 Usually you need to end this case with a break or return.</p> |
5132 | 5173 |
5133 | 5174 |
5134 <h3><a name="SF_SWITCH_NO_DEFAULT">SF: Switch statement found where default case
is missing (SF_SWITCH_NO_DEFAULT)</a></h3> | 5175 <h3><a name="SF_SWITCH_NO_DEFAULT">SF: Switch statement found where default case
is missing (SF_SWITCH_NO_DEFAULT)</a></h3> |
5135 | 5176 |
5136 | 5177 |
5137 <p> This method contains a switch statement where default case is missing. | 5178 <p> This method contains a switch statement where default case is missing. |
5138 Usually you need to provide a default case.</p> | 5179 Usually you need to provide a default case.</p> |
| 5180 <p>Because the analysis only looks at the generated bytecode, this warning can
be incorrect triggered if |
| 5181 the default case is at the end of the switch statement and doesn't end with a br
eak statement. |
5139 | 5182 |
5140 | 5183 |
5141 <h3><a name="ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD">ST: Write to static field
from instance method (ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD)</a></h3> | 5184 <h3><a name="ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD">ST: Write to static field
from instance method (ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD)</a></h3> |
5142 | 5185 |
5143 | 5186 |
5144 <p> This instance method writes to a static field. This is tricky to get | 5187 <p> This instance method writes to a static field. This is tricky to get |
5145 correct if multiple instances are being manipulated, | 5188 correct if multiple instances are being manipulated, |
5146 and generally bad practice. | 5189 and generally bad practice. |
5147 </p> | 5190 </p> |
5148 | 5191 |
5149 | 5192 |
5150 <h3><a name="SE_PRIVATE_READ_RESOLVE_NOT_INHERITED">Se: private readResolve meth
od not inherited by subclasses (SE_PRIVATE_READ_RESOLVE_NOT_INHERITED)</a></h3> | 5193 <h3><a name="SE_PRIVATE_READ_RESOLVE_NOT_INHERITED">Se: Private readResolve meth
od not inherited by subclasses (SE_PRIVATE_READ_RESOLVE_NOT_INHERITED)</a></h3> |
5151 | 5194 |
5152 | 5195 |
5153 <p> This class defines a private readResolve method. Since it is private, it w
on't be inherited by subclasses. | 5196 <p> This class defines a private readResolve method. Since it is private, it w
on't be inherited by subclasses. |
5154 This might be intentional and OK, but should be reviewed to ensure it is what is
intended. | 5197 This might be intentional and OK, but should be reviewed to ensure it is what is
intended. |
5155 </p> | 5198 </p> |
5156 | 5199 |
5157 | 5200 |
5158 <h3><a name="SE_TRANSIENT_FIELD_OF_NONSERIALIZABLE_CLASS">Se: Transient field of
class that isn't Serializable. (SE_TRANSIENT_FIELD_OF_NONSERIALIZABLE_CLASS)</
a></h3> | 5201 <h3><a name="SE_TRANSIENT_FIELD_OF_NONSERIALIZABLE_CLASS">Se: Transient field of
class that isn't Serializable. (SE_TRANSIENT_FIELD_OF_NONSERIALIZABLE_CLASS)</
a></h3> |
5159 | 5202 |
5160 | 5203 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5210 body of an <code>if</code> statement, e.g.:</p> | 5253 body of an <code>if</code> statement, e.g.:</p> |
5211 <pre> | 5254 <pre> |
5212 if (argv.length == 1); | 5255 if (argv.length == 1); |
5213 System.out.println("Hello, " + argv[0]); | 5256 System.out.println("Hello, " + argv[0]); |
5214 </pre> | 5257 </pre> |
5215 | 5258 |
5216 | 5259 |
5217 <h3><a name="URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD">UrF: Unread public/protected
field (URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD)</a></h3> | 5260 <h3><a name="URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD">UrF: Unread public/protected
field (URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD)</a></h3> |
5218 | 5261 |
5219 | 5262 |
5220 <p> This field is never read.  | 5263 <p> This field is never read. |
5221 The field is public or protected, so perhaps | 5264 The field is public or protected, so perhaps |
5222 it is intended to be used with classes not seen as part of the analysis. If
not, | 5265 it is intended to be used with classes not seen as part of the analysis. If
not, |
5223 consider removing it from the class.</p> | 5266 consider removing it from the class.</p> |
5224 | 5267 |
5225 | 5268 |
5226 <h3><a name="UUF_UNUSED_PUBLIC_OR_PROTECTED_FIELD">UuF: Unused public or protect
ed field (UUF_UNUSED_PUBLIC_OR_PROTECTED_FIELD)</a></h3> | 5269 <h3><a name="UUF_UNUSED_PUBLIC_OR_PROTECTED_FIELD">UuF: Unused public or protect
ed field (UUF_UNUSED_PUBLIC_OR_PROTECTED_FIELD)</a></h3> |
5227 | 5270 |
5228 | 5271 |
5229 <p> This field is never used. | 5272 <p> This field is never used. |
5230 The field is public or protected, so perhaps | 5273 The field is public or protected, so perhaps |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5273 <script language="JavaScript" type="text/javascript"> | 5316 <script language="JavaScript" type="text/javascript"> |
5274 <!---//hide script from old browsers | 5317 <!---//hide script from old browsers |
5275 document.write( "Last updated "+ document.lastModified + "." ); | 5318 document.write( "Last updated "+ document.lastModified + "." ); |
5276 //end hiding contents ---> | 5319 //end hiding contents ---> |
5277 </script> | 5320 </script> |
5278 <p> Send comments to <a class="sidebar" href="mailto:findbugs@cs.umd.edu">findbu
gs@cs.umd.edu</a> | 5321 <p> Send comments to <a class="sidebar" href="mailto:findbugs@cs.umd.edu">findbu
gs@cs.umd.edu</a> |
5279 <p> | 5322 <p> |
5280 <A href="http://sourceforge.net"><IMG src="http://sourceforge.net/sflogo.php?gro
up_id=96405&type=5" width="210" height="62" border="0" alt="SourceForge.net
Logo" /></A> | 5323 <A href="http://sourceforge.net"><IMG src="http://sourceforge.net/sflogo.php?gro
up_id=96405&type=5" width="210" height="62" border="0" alt="SourceForge.net
Logo" /></A> |
5281 </td></tr></table> | 5324 </td></tr></table> |
5282 </body></html> | 5325 </body></html> |
OLD | NEW |