FindBugs
 
Docs and Info
 FindBugs 2.0
 Demo and data
 Users and supporters
 FindBugs blog
 Fact sheet
 Manual
 Manual(ja/日本語)
 FAQ
 Bug descriptions
 Bug descriptions(ja/日本語)
 Bug descriptions(fr)
 Mailing lists
 Documents and Publications
 Links
 
Downloads
 
FindBugs Swag
 
Development
 Open bugs
 Reporting bugs
 Contributing
 Dev team
 API [no frames]
 Change log
 SF project page
 Browse source
 Latest code changes

FindBugs Bug Descriptions

This document lists the standard bug patterns reported by FindBugs version 3.0.1-dev-20221227.

Summary

DescriptionCategory
BC: equals ????????????????????????????????????????????????????????????Bad practice
BIT: ?????????????????????????????????????????????Bad practice
CN: Cloneable ??????????????????????????? clone ???????????????????????????????????????????????????????????????Bad practice
CN: clone ??????????????? super.clone() ???????????????????????????Bad practice
CN: Cloneable ???????????????????????????????????? clone ?????????????????????????????????Bad practice
CNT: ??????????????????????????????????????????Bad practice
Co: ??????????????????????????? compareTo ?????????????????????????????????Bad practice
Co: compareTo()/compare() ??????????????? float ????????? double ??????????????????Bad practice
Co: compareTo()/compare() ??? Integer.MIN_VALUE ?????????Bad practice
Co: ????????? compareTo ?????????????????????Bad practice
DE: ??????????????????????????????????????????????????????Bad practice
DE: ?????????????????????????????????????????????????????????Bad practice
DMI: ??????????????????????????????????????????????????????Entry ????????????????????????????????????????????????????????????????????????Bad practice
DMI: Random ?????????????????????????????????1????????????????????????Bad practice
DMI: ?????????????????????????????????????????? removeAll ??????????????????????????????Bad practice
Dm: System.exit(...) ????????????????????????????????????Bad practice
Dm: ????????????????????? runFinalizersOnExit ????????????????????????????????????Bad practice
ES: String ?????????????????? == ??? != ?????????????????????????????????Bad practice
ES: String ????????????????????? == ??? != ?????????????????????????????????Bad practice
Eq: ??????????????????????????? equals ?????????????????????????????????Bad practice
Eq: equals ???????????????????????????????????????????????????????????????????????????Bad practice
Eq: compareTo(...) ??????????????????????????? Object.equals() ??????????????????????????????Bad practice
Eq: equals ??????????????????????????????????????????????????????Bad practice
Eq: ????????? equals ?????????????????????Bad practice
FI: ????????????????????????????????????????????????Bad practice
FI: ????????????????????????????????????????????????Bad practice
FI: ?????????????????????????????????????????? null ?????????Bad practice
FI: ?????????????????????????????????????????? null ???????????????Bad practice
FI: ????????????????????????????????????????????????????????????????????????????????????????????????Bad practice
FI: ?????????????????????????????????????????????????????????????????????????????????????????????Bad practice
FI: ???????????????????????????????????????????????????????????????????????????????????????????????????Bad practice
FS: ?????????????????? \n ????????? %n ?????????????????????Bad practice
GC: ?????????????????????????????????????????????Bad practice
HE: equals ??????????????????????????????????????? hashCode ?????????????????????????????????????????????Bad practice
HE: equals ??????????????????????????? Object.hashCode() ??????????????????????????????Bad practice
HE: hashCode ??????????????????????????????????????? equals ?????????????????????????????????????????????Bad practice
HE: hashCode ??????????????????????????? Object.equals() ??????????????????????????????Bad practice
HE: equals ??????????????????????????? Object.hashCode() ??????????????????????????????Bad practice
IC: ???????????????????????????????????????????????????????????????????????????Bad practice
IMSE: ???????????? IllegalMonitorStateException ???????????????Bad practice
ISC: static ??????????????????????????????????????????????????????????????????????????????Bad practice
It: Iterator.next() ??? NoSuchElementException ????????????????????????Bad practice
J2EE: HttpSession ???????????????????????????????????????????????????Bad practice
JCIP: ???????????????????????????????????? final ????????????Bad practice
ME: public ??????????????????????????????????????????????????????????????????Public enum method unconditionally sets its fieldBad practice
ME: ??????????????????????????? public ??????????????????Bad practice
NP: ???????????? Boolean ?????????????????????????????? null ??????????????????Bad practice
NP: null ??????????????????????????? clone ????????????Bad practice
NP: equals ??????????????? null ???????????????????????????????????????Bad practice
NP: null ??????????????????????????? toString ????????????Bad practice
Nm: ?????????????????????????????????????????????Bad practice
Nm: ?????????????????????????????????????????????????????????????????? Exception ??????????????????????????????Bad practice
Nm: ????????????????????????????????????Bad practice
Nm: ???????????????????????????????????????????????????Bad practice
Nm: Java ?????????????????????????????????????????????????????????????????????????????????Bad practice
Nm: Java ?????????????????????????????????????????????????????????????????????????????????Bad practice
Nm: ??????????????????????????????????????????????????????Bad practice
Nm: ??????????????????????????????????????????????????????????????????????????????????????????Bad practice
Nm: ???????????????????????????????????????????????????????????????????????????Bad practice
Nm: ????????????????????????????????????????????? (???????????????)Bad practice
Nm: ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????Bad practice
ODR: ??????????????????????????????????????????????????????????????????????????????????????????Bad practice
ODR: ?????????????????????????????????????????????????????????????????????????????????????????????????????????Bad practice
OS: ???????????????????????????????????????????????????????????????????????????Bad practice
OS: ??????????????????????????????????????????????????????????????????????????????????????????Bad practice
PZ: ??????????????????????????????????????????????????????????????????Bad practice
RC: ????????????????????????????????????Bad practice
RC: Boolean ??????????????????????????????Bad practice
RR: InputStream.read() ?????????????????????????????????????????????Bad practice
RR: InputStream.skip() ?????????????????????????????????????????????Bad practice
RV: compareTo()/compare() ???????????????????????????Bad practice
RV: ???????????????????????????????????????????????????Bad practice
SI: ????????????????????????????????????????????????????????? static final ????????????????????????????????????????????????????????????????????????Bad practice
SW: Swing ??????????????? AWT ???????????????????????????????????????????????????????????????????????????Bad practice
Se: ?????????????????????????????? transient ?????????????????????????????????????????????????????????Bad practice
Se: ????????????????????????????????????????????????????????????????????????Bad practice
Se: ????????????????????????????????????????????????????????????????????????????????????????????????????????????Bad practice
Se: Comparator ??? Serializable ????????????????????????Bad practice
Se: ?????????????????????????????????Bad practice
Se: serialVersionUID ??? final ????????????Bad practice
Se: serialVersionUID ??? long ????????????Bad practice
Se: serialVersionUID ??? static ????????????Bad practice
Se: Serializable ???????????????????????????????????????????????????????????????????????????????????????????????????Bad practice
Se: Externalizable ????????????????????????????????????????????????????????????????????????Bad practice
Se: readResolve ????????????????????????????????? Object ???????????????????????????Bad practice
Se: ????????????????????????????????????????????? transient ??????????????? Bad practice
SnVI: Serializable ??????????????? serialVersionUID ????????????????????????Bad practice
UI: ????????????????????????????????? getResource ???????????????????????????????????????????????????Bad practice
BC: ????????????????????????Correctness
BC: ?????????????????????????????????Correctness
BC: toArray ?????????????????????????????????????????????????????????Correctness
BC: ?????? false ????????? instanceofCorrectness
BIT: ??????????????????????????????????????????Correctness
BIT: ????????????????????????????????????Correctness
BIT: ((...) & 0) == 0 ???????????????????????????Correctness
BIT: ????????????????????????????????????Correctness
BIT: ?????????????????????????????????????????????Correctness
BIT: ?????????????????????????????????????????????Correctness
BOA: ???????????????????????? Adapter ????????????????????????????????????????????????????????????????????????????????????Correctness
BSHIFT: ??????????????????????????????????????????????????????????????????Correctness
BSHIFT: 32????????? int ???-31??????31??????????????????????????????????????????Correctness
DLS: return ?????????????????????????????????????????????Correctness
DLS: ???????????????????????????????????????Correctness
DLS: ???????????????????????????????????????Correctness
DMI: ?????????????????????Correctness
DMI: ????????????????????????????????????Correctness
DMI: ???????????????????????? double ????????????????????? BigDecimalCorrectness
DMI: hasNext ??????????????? next ????????????????????????????????????Correctness
DMI: ???????????????????????????????????????????????????????????????Correctness
DMI: D'oh! ????????????????????????????????????Correctness
DMI: ????????? hashCode ????????????????????????????????????Correctness
DMI: int ???????????? Double.longBitsToDouble() ????????????????????????Correctness
DMI: ????????????????????????????????????????????????Correctness
Dm: ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????Correctness
Dm: ScheduledThreadPoolExecutor ??????????????????????????????????????????????????????????????????Correctness
Dm: ???????????????????????????0??? ScheduledThreadPoolExecutor ?????????Correctness
Dm: EasyMock ????????????????????????????????????/????????????????????????Correctness
Dm: Math.max ??? Math.min ??????????????????????????????Correctness
EC: equals ??????????????????????????????????????????????????????????????????Correctness
EC: ????????? equals ??????????????????????????? == ??????????????????Correctness
EC: equals(...) ????????????????????????????????????????????????????????????????????????Correctness
EC: equals(null) ???????????????Correctness
EC: equals ????????????????????????????????????????????????????????????????????????????????????????????????Correctness
EC: equals ???????????????????????????????????????????????????????????????????????????????????????Correctness
EC: equals ???????????????????????????????????????????????????????????????Correctness
EC: ???????????????????????????????????????????????????????????????Correctness
Eq: equals ????????????????????? false ?????????Correctness
Eq: equals ????????????????????? true ?????????Correctness
Eq: equals ???????????????????????????????????????????????????????????????????????????????????????Correctness
Eq: ????????????????????? equals ?????????????????????????????????Correctness
Eq: equals(Object) ??????????????????????????????????????????????????? equals ?????????????????????Correctness
Eq: Object.equals(Object) ??????????????????????????????????????? equals ?????????????????????Correctness
Eq: equals ??????????????????????????????????????? equals ?????????????????????????????????????????????????????????????????????????????????????????????Correctness
Eq: ????????? equals ??????????????????????????????Object.equals(Object) ?????????????????????Correctness
FE: NaN ????????????????????????????????????????????????Correctness
FS: ????????????????????????????????????????????????????????????Correctness
FS: ??????????????????????????????????????????????????????????????????Correctness
FS: printf ????????????????????????????????????????????????????????? MessageFormat ????????????????????????Correctness
FS: ????????????????????????????????????????????????????????????????????????????????????Correctness
FS: ????????????????????????Correctness
FS: ?????????????????????????????????????????????????????????Correctness
FS: ?????????????????????????????????????????????Correctness
GC: ?????????????????????????????????????????????????????????Correctness
HE: ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????Correctness
HE: ?????????????????????????????? hashCode ???????????????????????????????????????????????????Correctness
ICAST: int ?????? long ??????????????????????????????????????????????????????Correctness
ICAST: ???????????? double ????????????????????? Math.ceil() ??????????????????Correctness
ICAST: ???????????? float ????????????????????? Math.round() ??????????????????Correctness
IJU: run ?????????????????? JUnit ????????????????????? JUnit ??????????????????????????????Correctness
IJU: TestCase ??? suite ????????????????????????????????????????????????Correctness
IJU: TestCase ????????????????????? Correctness
IJU: TestCase ??? super.setup() ????????????????????? setUp ?????????????????????????????????Correctness
IJU: TestCase ??? ??? static ??? suite ?????????????????????????????????Correctness
IJU: TestCase ??? super.tearDown() ????????????????????? tearDown ????????????????????????????????? Correctness
IL: ??????????????????????????????????????????????????????Correctness
IL: ???????????????????????????Correctness
IL: ?????????????????????????????????Correctness
IM: ????????????????????????????????????Correctness
INT: int ?????? long ??????????????????????????????Correctness
INT: ?????????????????????????????????????????????????????????????????????Correctness
INT: ??????????????????????????????????????????Correctness
IO: ????????????????????????????????????????????????????????????????????????Correctness
IP: ???????????????????????????????????????????????????????????????????????????Correctness
MF: ?????????????????????????????????????????????????????????????????????????????????????????????Correctness
MF: ???????????????????????????????????????????????????????????????Correctness
NP: null ????????????????????????Correctness
NP: null ???????????????????????????????????????Correctness
NP: null ???????????????????????????????????????????????????Correctness
NP: ?????? null ??????????????????????????? close ????????????????????????????????????Correctness
NP: null ????????????????????????????????????????????????Correctness
NP: null ???????????????????????????????????????????????????????????????Correctness
NP: ??? null ?????????????????????????????????????????????Correctness
NP: ?????????????????????????????? null ??????????????????????????? null ??????????????????Correctness
NP: null ?????????????????????????????????????????? @Nonnull ?????????????????????Correctness
NP: null ????????????????????????????????????????????????????????????????????????????????????Correctness
NP: null ??????????????????????????????????????????Correctness
NP: null ?????????????????????????????????????????????????????????Correctness
NP: ?????????????????????????????? null ??????????????????????????? null ??????????????????Correctness
NP: ?????????????????????????????? null ??????????????????????????? null ??????????????????Correctness
NP: ??? null ?????????????????? null ??????????????????????????????????????????????????????Correctness
NP: Optional ???????????????????????????????????????????????? null ?????????Correctness
NP: @Nonnull ????????????????????????????????????????????? null ?????????????????????Correctness
NP: ?????????????????????????????????????????????????????????Correctness
Nm: ???????????? equal(Object) ???????????????????????????equals(Object) ??????????????????????Correctness
Nm: ???????????? hashcode() ???????????????????????????hashCode() ??????????????????????Correctness
Nm: ???????????? tostring() ???????????????????????????toString() ??????????????????????Correctness
Nm: ?????????????????????????????????????????????????????????Correctness
Nm: ?????????????????????????????????????????????Correctness
Nm: ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????Correctness
QBA: ???????????? boolean ????????????????????????????????????????????????Correctness
RANGE: ????????????????????????????????????Correctness
RANGE: ???????????????????????????Correctness
RANGE: ?????????????????????????????????Correctness
RANGE: ???????????????????????????????????????Correctness
RC: ????????????????????????Correctness
RCN: ?????????????????????????????? null ????????????Correctness
RE: ???????????????????????????????????????Correctness
RE: ?????????????????????????????????????????? File.separatorCorrectness
RE: ?????????????????????????????????????????? "." ????????? "|"Correctness
RV: 0??????1????????????????????????0??????????????????Correctness
RV: ????????????32???????????????????????????????????????????????????????????????????????????Correctness
RV: ????????????????????????????????????????????????????????????????????????Correctness
RV: compareTo ????????????????????????????????????????????????????????????Correctness
RV: ??????????????????????????????????????????????????????????????????Correctness
RV: ??????????????????????????????????????????Correctness
RpC: ??????????????????????????????Correctness
SA: ??????????????????????????????Correctness
SA: ????????????????????????????????????????????????Correctness
SA: ?????????????????????????????????????????? (??????????????? x & x)Correctness
SA: ???????????????????????????????????????????????????????????????????????????Correctness
SA: ???????????????????????????????????????????????????Correctness
SA: ????????????????????????????????? (???????????????x & x)Correctness
SF: switch ????????????????????????????????????????????????????????????????????????Correctness
SF: ??????????????? switch ????????????????????????????????????????????????????????????????????????Correctness
SIC: ??? static ???????????????????????????????????????????????????????????????Correctness
SIO: instanceof ???????????????????????????????????????????????????Correctness
SQL: ?????????????????????0??? PreparedStatement ???????????????????????????????????????????????????Correctness
SQL: ?????????????????????0??? ResultSet ???????????????????????????????????????????????????Correctness
STI: interrupted ????????????????????????????????????????????? currentThread ????????????????????????????????????Correctness
STI: ????????????????????????????????? static Thread.interrupted() ????????????????????????Correctness
Se: ??????????????????????????? private ??????????????????????????????????????????Correctness
Se: readResolve ??????????????? static ??????????????????????????????????????????Correctness
TQ: ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????Correctness
TQ: ????????????????????????????????????????????????Correctness
TQ: ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????Correctness
TQ: ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????Correctness
TQ: ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????Correctness
TQ: ?????????????????????????????????????????????????????????????????????????????????Correctness
UMAC: ??????????????????????????????????????????????????????????????????????????????Correctness
UR: ??????????????????????????????????????????????????????????????????????????????????????????Correctness
UR: ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????Correctness
USELESS_STRING: ???????????????????????? toString ????????????????????????????????????Correctness
USELESS_STRING: ????????? toString ????????????????????????????????????Correctness
USELESS_STRING: ????????????????????????????????????????????????????????????????????????????????????????????????Correctness
UwF: null ??????????????????????????????????????????Correctness
UwF: ??????????????????????????????????????????Correctness
VA: ???????????????????????????????????????????????????????????????????????????????????????????????????Correctness
LG: ????????????????????? OpenJDK ????????????????????????????????????????????????Experimental
OBL: ???????????????????????????????????????????????????????????????????????????????????????????????????Experimental
OBL: ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????Experimental
Dm: ?????????????????????????????? Locale ???????????????????????????????????????Internationalization
Dm: ???????????????????????????????????????????????????Internationalization
DP: doPrivileged ?????????????????????????????????????????????????????????Malicious code vulnerability
DP: doPrivileged ????????????????????????????????????????????????Malicious code vulnerability
EI: ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????Malicious code vulnerability
EI2: ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????Malicious code vulnerability
FI: ???????????????????????? public ???????????? protected ????????????Malicious code vulnerability
MS: static ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????Malicious code vulnerability
MS: final ???????????????????????????????????????????????????????????????????????????Malicious code vulnerability
MS: ?????????????????????????????????????????????????????????????????????????????? public static ????????????Malicious code vulnerability
MS: final ?????????????????????????????????????????????????????????????????????Malicious code vulnerability
MS: ??????????????????????????????Malicious code vulnerability
MS: ??????????????????????????????????????????Malicious code vulnerability
MS: ??????????????????????????????????????????????????????????????????????????????????????????Malicious code vulnerability
MS: ?????? Hashtable ??????????????????Malicious code vulnerability
MS: ??????????????????????????????????????????????????????????????????????????????????????????????????????Malicious code vulnerability
MS: ???????????????????????????????????????????????????????????????Malicious code vulnerability
MS: final ???????????????????????????Malicious code vulnerability
MS: final ???????????????????????????????????????????????????????????????Malicious code vulnerability
AT: ??????????????????????????????????????????????????????????????????????????????????????????Multithreaded correctness
DC: ???????????????????????????????????????????????????Multithreaded correctness
DC: ?????????????????????????????????????????????????????????????????????????????????Multithreaded correctness
DL: Boolean ????????????Multithreaded correctness
DL: ???????????????????????????????????????????????????????????????????????????????????????????????????????????????Multithreaded correctness
DL: ????????????????????????????????????Multithreaded correctness
DL: ?????????????????????????????????????????????????????????Multithreaded correctness
Dm: Condition ??? wait ????????????????????????????????????Multithreaded correctness
Dm: ???????????????????????? run ??????????????????????????????????????????????????????Multithreaded correctness
ESync: ?????? synchronized ????????????Multithreaded correctness
IS: ???????????????????????????Multithreaded correctness
IS: ????????????????????????????????????????????????????????????????????????Multithreaded correctness
JLM: Lock ????????????????????????Multithreaded correctness
JLM: java.util.concurrent ?????????????????????????????????????????????Multithreaded correctness
JLM: util.concurrent ????????????????????????????????? wait ?????????????????????????????????Multithreaded correctness
LI: static ?????????????????????????????????????????????Multithreaded correctness
LI: ??????????????? static ?????????????????????????????????????????????Multithreaded correctness
ML: ????????????????????????????????????????????????????????????????????????Multithreaded correctness
ML: ??????????????????????????????????????????????????????????????????Multithreaded correctness
MSF: ???????????????????????????????????????Multithreaded correctness
MWN: ???????????? notify ????????????Multithreaded correctness
MWN: ???????????? wait ????????????Multithreaded correctness
NN: ?????? notify ????????????Multithreaded correctness
NP: ??????????????????????????????????????? null ????????????Multithreaded correctness
No: notifyAll ???????????????????????? notify ?????????????????????????????????Multithreaded correctness
RS: readObject ?????????????????????????????????????????????Multithreaded correctness
RV: putIfAbsent ?????????????????????????????? putIfAbsent ????????????????????????????????????Multithreaded correctness
Ru: ??????????????? run ????????????????????????????????????Multithreaded correctness
SC: Thread.start() ?????????????????????????????????????????????Multithreaded correctness
SP: ?????????????????????????????????????????????Multithreaded correctness
STCAL: static Calendar ???????????????Multithreaded correctness
STCAL: static DateFormat ???????????????Multithreaded correctness
STCAL: static Calendar ???????????????Multithreaded correctness
STCAL: static DateFormatMultithreaded correctness
SWL: ???????????????????????? Thread.sleep() ????????????????????????????????????Multithreaded correctness
TLW: 2???????????????????????????????????? wait ????????????????????????????????????Multithreaded correctness
UG: ???????????????????????? get ???????????????????????????????????? set ????????????Multithreaded correctness
UL: ???????????????????????????????????????????????????????????????Multithreaded correctness
UL: ?????????????????????????????????????????????????????????????????????Multithreaded correctness
UW: wait ????????????????????????????????????Multithreaded correctness
VO: volatile ????????????????????????????????????????????????????????????????????????Multithreaded correctness
VO: ???????????? volatile ??????????????????????????? volatile ?????????????????????Multithreaded correctness
WL: ????????????????????????????????? getClass ????????????????????????Multithreaded correctness
WS: writeObject ???????????????????????????????????????????????????????????????????????????????????????????????????Multithreaded correctness
Wa: Condition.await() ???????????????????????????Multithreaded correctness
Wa: wait ???????????????????????????????????????Multithreaded correctness
Bx: ??????????????????????????????????????????????????????????????????????????????????????????Performance
Bx: ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????Performance
Bx: ????????????????????????3???????????????????????????????????????????????????????????????????????????Performance
Bx: ???????????????????????????????????????????????????????????????????????????????????????????????????Performance
Bx: ????????????????????????????????????????????????????????????Performance
Bx: ???????????????/?????????????????????????????????????????????????????????Performance
Bx: toString ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????Performance
Bx: ?????????????????????????????? Number ?????????????????????????????????????????????????????????Performance
Bx: ??????????????? Number ?????????????????????????????????????????????????????????Performance
Dm: URL ??? equals ??????????????? hashCode ?????????????????????????????????Performance
Dm: URL ??? Map ??? Set ???????????????????????????Performance
Dm: ??????????????? Boolean ?????????????????????????????????????????????????????????Performance
Dm: ??????????????????????????????????????????Performance
Dm: ??????????????????????????????????????????????????????????????????????????????????????????????????????Performance
Dm: ?????????????????????????????????????????? nextDouble ???????????? ???????????? nextInt ???????????????????????????Performance
Dm: ??????????????? new String(String) ?????????????????????????????????????????????????????????Performance
Dm: String ??? toString ????????????????????????????????????????????????Performance
Dm: ??????????????? new String() ?????????????????????????????????????????????????????????Performance
HSC: ??????????????????????????????????????????????????????????????????????????????????????????Performance
SBSC: ?????????????????? + ?????????????????????????????????????????????????????????Performance
SIC: static ???????????????????????????Performance
SIC: ???????????? static ?????????????????????????????????????????????????????????????????????Performance
SIC: static ?????????????????????????????????????????????????????????????????????Performance
SS: ????????????????????????????????????Performance
UM: ???????????? Math ???????????? static ????????????????????????????????????????????????Performance
UPM: private ?????????????????????????????????????????????Performance
UrF: ????????????????????????????????????Performance
UuF: ???????????????????????????Performance
WMI: entrySet ?????????????????????????????????????????? keySet ????????????????????????????????????Performance
Dm: ??????????????????????????????????????????????????????????????????Security
Dm: ???????????????????????????????????????Security
HRS: ????????????????????????????????????????????? HTTP cookieSecurity
HRS: HTTP ????????????????????????????????????????????????Security
PT: ???????????????????????????????????????????????????Security
PT: ???????????????????????????????????????????????????Security
SQL: SQL ??? Statement ??? execute ????????? addBatch ?????????????????????????????????????????????????????????Security
SQL: PreparedStatement ??????????????????????????????????????????????????????Security
XSS: ????????????????????????????????????????????????????????????????????? JSPSecurity
XSS: ????????????????????????????????????????????????????????????????????????????????????????????????????????????Security
XSS: ???????????????????????????????????????????????????????????????????????????????????????Security
BC: ??????????????????????????????????????????????????????Dodgy code
BC: ??????????????????????????????????????????????????????Dodgy code
BC: ???????????????/????????????????????????Dodgy code
BC: ????????????????????????????????????????????????/????????????????????????Dodgy code
BC: ?????? true ????????? instanceofDodgy code
BSHIFT: ??????????????????????????? short/byte ???????????????????????????Dodgy code
CI: final ??????????????? protected ????????????????????????????????????Dodgy code
DB: 2????????????????????????????????????????????????????????????????????????Dodgy code
DB: switch ??????2?????? case ????????????????????????????????????????????????????????????Dodgy code
DLS: ???????????????????????????????????????Dodgy code
DLS: return ???????????????????????????????????????Dodgy code
DLS: ????????????????????????????????? null ??????Dodgy code
DLS: ???????????????????????????????????????????????????????????????Dodgy code
DMI: ???????????????????????????????????????????????????????????????Dodgy code
DMI: ObjectOutput ?????????????????????????????????????????????????????????Dodgy code
DMI: substring(0) ????????????????????????????????????Dodgy code
Dm: Thread ????????????????????? Runnable ??????????????????????????????????????????????????????Dodgy code
Eq: ???????????????????????? equals ????????????????????????????????????????????????????????????Dodgy code
Eq: ????????? equals ???????????? Dodgy code
FE: ????????????????????????????????????????????????Dodgy code
FS: Boolean ????????????????????? ???b ????????????????????????????????????????????????????????????Dodgy code
IA: ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????Dodgy code
IC: ??????????????????????????????Dodgy code
ICAST: ??????????????????????????? double ????????? float ???????????????????????????Dodgy code
ICAST: ???????????????????????? long ???????????????????????????Dodgy code
IM: ???????????????????????????????????????????????????????????????Dodgy code
IM: ??????????????????????????????????????????Dodgy code
INT: 1??????????????????????????????Dodgy code
INT: ????????????????????????????????????????????????Dodgy code
INT: ??????????????????????????????Dodgy code
MTIA: Servlet ????????????????????????????????????????????????????????????????????????Dodgy code
MTIA: Struts Action ???????????????????????????????????????????????????????????????Dodgy code
NP: readLine ???????????????????????? null ???????????????????????????????????????????????????Dodgy code
NP: readLine ???????????????????????????????????????????????????Dodgy code
NP: null ????????????????????????????????????Dodgy code
NP: ????????????????????????????????? nullness ??????????????????????????????????????????Dodgy code
NP: ??????????????????????????? nullness ??????????????????????????????????????????Dodgy code
NP: null ?????????????????????????????????????????????????????????????????????????????????Dodgy code
NP: null ????????????????????????????????????????????????????????????????????????????????????Dodgy code
NP: ?????????????????? ??? null ?????????????????????????????? null ?????????????????????????????????????????????Dodgy code
NP: ??????????????????????????? public ????????? protected ??????????????????????????????Dodgy code
NS: ?????????????????????????????????????????????Dodgy code
NS: ????????????????????????????????????Dodgy code
PZLA: null ?????????????????????0???????????????????????????????????????Dodgy code
QF: ?????????????????????????????????????????????????????? for ?????????Dodgy code
RCN: ??? null ?????? null ????????????????????????Dodgy code
RCN: 2?????? null ?????????????????????Dodgy code
RCN: null ??????????????????????????????????????????????????? null ????????????Dodgy code
RCN: null ???????????????????????????????????? null ????????????Dodgy code
REC: ?????????????????????????????????????????????????????????????????????Dodgy code
RI: ?????????????????????????????????????????????????????????????????????????????????Dodgy code
RV: String.indexOf ?????????????????????????????????????????????Dodgy code
RV: readLine ???????????????????????? null ????????????????????????????????????????????????Dodgy code
RV: ??????????????????????????????????????????????????????Dodgy code
RV: ????????????32?????????????????????????????????Dodgy code
RV: ???????????????????????????????????????????????????????????????????????????????????????????Dodgy code
RV: ????????????????????????????????????????????????????????????Dodgy code
SA: ??????????????????????????????Dodgy code
SA: ?????????????????????????????????Dodgy code
SA: ?????????????????????????????????Dodgy code
SF: 1?????? case ????????? case ????????????????????? switch ??????????????????Dodgy code
SF: default ????????? switch ??????????????????Dodgy code
ST: ???????????????????????????????????? static ?????????????????????????????????Dodgy code
Se: ???????????????????????????????????? private ??? readResolve ????????????Dodgy code
Se: Serializable ????????????????????? transient ???????????????Dodgy code
TQ: ???????????????????????????????????????????????????????????????????????????????????????Dodgy code
TQ: ????????????????????????????????????????????????????????????????????????????????????Dodgy code
UC: ????????????????????????Dodgy code
UC: ?????????????????????????????????????????????Dodgy code
UC: ???????????????????????????????????????????????????Dodgy code
UC: ??????????????????????????????????????????????????????????????????Dodgy code
UC: ????????????????????????????????? void ????????????Dodgy code
UCF: ?????????????????????????????????Dodgy code
UCF: ????????????????????????????????????????????????????????????Dodgy code
UrF: ????????????????????? public ????????? protected ???????????????Dodgy code
UuF: ???????????? public ????????? protected ???????????????Dodgy code
UwF: ????????????????????????????????????????????????????????????????????? null ????????????????????? null ????????????????????????Dodgy code
UwF: ??????????????????????????? public ????????? protected ???????????????Dodgy code
XFB: XML?????????????????????????????????????????????????????????????????????????????????????????????Dodgy code

Descriptions

BC: equals ???????????????????????????????????????????????????????????? (BC_EQUALS_METHOD_SHOULD_WORK_FOR_ALL_OBJECTS)

equals(Object o) ??????????????????o ???????????????????????????????????????????????????????????????????????? o ??? this ????????????????????????????????? false ????????????????????????

BIT: ????????????????????????????????????????????? (BIT_SIGNED_CHECK)

????????????????????????((event.detail & SWT.SELECTED) > 0) ?????????????????????????????????????????? ??????????????????????????????????????????????????????????????????????????????????????? (???????????????SWT.SELECTED ???????????????) ????????????????????????????????????????????? SWT.SELECTED ???????????????????????????????????????????????????????????? SWT.SELECTED ?????????????????????????????????'> 0' ??????????????? '!= 0' ?????????????????????????????????????????????????????????????????????

Boris Bokowski

CN: Cloneable ??????????????????????????? clone ??????????????????????????????????????????????????????????????? (CN_IDIOM)

?????????????????????Cloneable ??????????????????????????????clone ??????????????????????????????????????????????????????????????????

CN: clone ??????????????? super.clone() ??????????????????????????? (CN_IDIOM_NO_SUPER_CALL)

????????? final ???????????????super.clone() ????????????????????? clone ??????????????????????????????????????? ????????? A ?????????????????? B ?????????????????????????????????????????? B ??? super.clone() ????????????????????????????????? B ??? clone ????????????????????? A ????????????????????????????????????????????????????????? ????????? clone ?????????????????????????????????????????????

???????????? clone ??????????????? super.clone() ????????????????????? Object.clone() ?????????????????????????????????????????????????????????????????????????????????????????????????????????

CN: Cloneable ???????????????????????????????????? clone ????????????????????????????????? (CN_IMPLEMENTS_CLONE_BUT_NOT_CLONEABLE)

?????????????????????Cloneable ?????????????????????????????? clone ??????????????????????????????????????? ????????? OK (???????????????????????????????????????????????????????????????????????????????????????????????????) ???????????????????????????????????????????????????????????????????????????????????????

CNT: ?????????????????????????????????????????? (CNT_ROUGH_CONSTANT_VALUE)

???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

Co: ??????????????????????????? compareTo ????????????????????????????????? (CO_ABSTRACT_SELF)

?????????????????????????????? compareTo ??????????????????????????????????????? Comparable ???????????????????????? compareTo ???????????????????????????????????????????????? compareTo ??????????????????????????????????????????java.lang.Object ?????????????????????????????????

Co: compareTo()/compare() ??????????????? float ????????? double ?????????????????? (CO_COMPARETO_INCORRECT_FLOATING)

??????????????????????????????????????????????????????????????? double ????????? float ??????????????????????????? ??? val1 > val2 ? 1 : val1 < val2 ? -1 : 0??? ????????????????????? ???????????????????????????????????????????????????????????????????????????????????????????????? -0.0 ??? NaN ??????????????????????????????????????? ????????????????????????????????????????????????????????????????????? ??????????????????????????????????????????????????????????????? Double.compare ????????? Float.compare ???????????????????????????????????????????????????

Co: compareTo()/compare() ??? Integer.MIN_VALUE ????????? (CO_COMPARETO_RESULTS_MIN_VALUE)

??????????????????????????????????????? compareTo ????????? compare ??????????????? Integer.MIN_VALUE ??????????????????????????????????????????????????????????????? compareTo ??????????????????????????????????????????????????????????????????????????? ?????????????????????????????????????????????????????????????????????compareTo ?????????????????????????????????????????????????????????????????? ?????????????????? Integer.MIN_VALUE ?????????????????????????????? Integer.MIN_VALUE ?????????-1???????????????????????????

Co: ????????? compareTo ????????????????????? (CO_SELF_NO_OBJECT)

?????????????????????????????? compareTo ??????????????????????????????????????? Comparable ???????????????????????? compareTo ???????????????????????????????????????????????? compareTo ??????????????????????????????????????????java.lang.Object ?????????????????????????????????

DE: ?????????????????????????????????????????????????????? (DE_MIGHT_DROP)

???????????????????????????????????????????????????????????????????????? ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

DE: ????????????????????????????????????????????????????????? (DE_MIGHT_IGNORE)

???????????????????????????????????????????????????????????????????????? ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

DMI: ??????????????????????????????????????????????????????Entry ???????????????????????????????????????????????????????????????????????? (DMI_ENTRY_SETS_MAY_REUSE_ENTRY_OBJECTS)

entrySet ??????????????????????????? Entry ?????????????????????????????????????????????????????????????????? Map ????????????????????????????????????????????????????????? Java 1.6 ???????????????IdentityHashMap ??? EnumMap ????????????????????????????????? ??????????????? Map ?????????????????????????????????????????????????????????????????????????????????????????????????????? ???????????????addAll ?????????????????????????????? entrySet ???????????????????????????????????????????????????????????????????????????

DMI: Random ?????????????????????????????????1???????????????????????? (DMI_RANDOM_USED_ONLY_ONCE)

?????????????????????java.util.Random ?????????????????????????????????1????????????????????????????????????????????????????????????????????? ??????????????????????????????????????????????????????????????????????????????????????? ???????????????Random ?????????????????????1??????????????????????????????????????????????????????????????????????????????????????? ????????????????????????????????????????????? Random ????????????????????????????????????????????????????????????????????????

????????????????????????????????????????????????????????????????????????????????????????????? Random ??????????????????????????????????????????????????? (?????????????????????????????????????????????)??? ?????????????????? java.security.SecureRandom ?????????????????????????????????????????? (??????????????????????????????????????????????????? SecureRandom ????????????????????????????????????????????????????????????)???

DMI: ?????????????????????????????????????????? removeAll ?????????????????????????????? (DMI_USING_REMOVEALL_TO_CLEAR_COLLECTION)

?????????????????? c ???????????????????????????????????????????????????c.removeAll(c) ???????????? c.clear ?????????????????????????????? ?????????????????????????????????????????? c.removeAll(c) ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????ConcurrentModificationException ??????????????????????????????????????????

Dm: System.exit(...) ???????????????????????????????????? (DM_EXIT)

System.exit(...) ???????????????????????????Java ???????????????????????????????????????????????????????????????????????? ???????????????????????????????????????????????????????????? System.exit(...) ????????????????????????????????????????????????????????????????????????????????????????????? ?????????????????? RuntimeException ??????????????????????????????????????????????????????

Dm: ????????????????????? runFinalizersOnExit ???????????????????????????????????? (DM_RUN_FINALIZERS_ON_EXIT)

?????????????????????????????????????????? System.runFinalizersOnExit ??? Runtime.runFinalizersOnExit ??????????????????????????????????????? Java ????????????????????????????????????????????????1???????????? -- Joshua Bloch

ES: String ?????????????????? == ??? != ????????????????????????????????? (ES_COMPARING_PARAMETER_STRING_WITH_EQ)

???????????????????????????????????????????????? == ??? != ??????????????? java.lang.String ?????????????????????????????????????????? ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ?????????????????? equals(Object) ???????????????????????????????????????????????????????????????

ES: String ????????????????????? == ??? != ????????????????????????????????? (ES_COMPARING_STRINGS_WITH_EQ)

???????????????????????????????????????????????? == ??? != ??????????????? java.lang.String ????????????????????????????????????????????? ?????????????????????????????????????????????????????????String.intern() ????????????????????????????????????????????????????????????????????????2??????????????? String ?????????????????????????????????????????????????????????????????? ?????????????????? equals(Object) ???????????????????????????????????????????????????????????????

Eq: ??????????????????????????? equals ????????????????????????????????? (EQ_ABSTRACT_SELF)

?????????????????????????????? equals ??????????????????????????????????????? java.lang.Object ??? equals ??????????????????????????????????????????????????????????????? equals ??????????????????????????????????????????java.lang.Object ?????????????????????????????????

Eq: equals ??????????????????????????????????????????????????????????????????????????? (EQ_CHECK_FOR_OPERAND_NOT_COMPATIBLE_WITH_THIS)

?????? equals ???????????????????????????????????????????????? (?????????????????????????????????????????????equals ????????????????????????????????????????????????????????????????????????????????????????????????????????????) ????????????????????????????????? ???????????????Foo ???????????? equals ???????????????????????????????????????????????????????????????

public boolean equals(Object o) {
    if (o instanceof Foo)
        return name.equals(((Foo)o).name);
    else if (o instanceof String)
        return name.equals(o);
    else return false;
}

??????????????????????????????????????? equals ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ???????????????????????????????????????????????????????????????????????????????????????????????????

Eq: compareTo(...) ??????????????????????????? Object.equals() ?????????????????????????????? (EQ_COMPARETO_USE_OBJECT_EQUALS)

?????????????????????compareTo(...) ??????????????????????????????????????????equals ??????????????? java.lang.Object ?????????????????????????????? ????????????equals ??????????????? true ???????????????????????????compareTo ???????????????0???????????????????????? ?????????????????????????????????????????????????????????????????? PriorityQueue ??????????????????????????????????????? J2SE 5.0?????????PriorityQueue.remove() ??? compareTo ????????????????????????????????????Java SE 6?????????equals ?????????????????????????????????

Comparable ???????????????????????? compareTo ??????????????? JavaDoc ??????????????????????????????

????????????????????????????????????????????????(x.compareTo(y)==0) == (x.equals(y)) ????????????????????????????????????????????? ????????????Comparable ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ??????:?????????????????? equals ????????????????????????????????????????????????????????????????????????????????????????????????????????????

Eq: equals ?????????????????????????????????????????????????????? (EQ_GETCLASS_AND_CLASS_CONSTANT)

???????????????????????????????????????????????????????????????????????? equlas ?????????????????????????????? equals ???????????????????????????????????????????????????????????????????????????????????? (???????????????Foo ???????????? Foo.class == o.getClass() ???????????????????????????????????????)??? this.getClass() == o.getClass() ??????????????????????????????

Eq: ????????? equals ????????????????????? (EQ_SELF_NO_OBJECT)

?????????????????????????????? equals ??????????????????????????????????????? java.lang.Object ??? equals ??????????????????????????????????????????????????????????????? equals ??????????????????????????????????????????java.lang.Object ?????????????????????????????????

FI: ???????????????????????????????????????????????? (FI_EMPTY)

?????? finalize ??????????????????????????????????????????????????????????????????

FI: ???????????????????????????????????????????????? (FI_EXPLICIT_INVOCATION)

????????????????????????????????????????????????????????? finalize ????????????????????????????????????????????? ???????????????????????? Java ???????????????????????????1?????????????????????????????????????????????????????????????????????????????????????????????

?????????????????????????????????????????????????????????????????????????????????????????????????????????Java ??????????????????????????????????????????????????? finalize ???????????????????????????????????? ?????????????????????????????????????????????????????? ??????????????????????????? X ??? finalize ???????????????????????? X ?????????????????????????????????????????????????????? finalize ??????????????????????????????????????????????????????????????????????????? ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

FI: ?????????????????????????????????????????? null ????????? (FI_FINALIZER_NULLS_FIELDS)

??????????????????????????????????????????????????? null ????????????????????? ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

FI: ?????????????????????????????????????????? null ??????????????? (FI_FINALIZER_ONLY_NULLS_FIELDS)

??????????????????????????????????????????????????? null ????????????????????????????????????????????? ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? finalize ??????????????????????????????????????????

FI: ???????????????????????????????????????????????????????????????????????????????????????????????? (FI_MISSING_SUPER_CALL)

?????? finalize ?????????????????????????????????????????? finalize ????????????????????????????????????????????? ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? super.finalize() ?????????????????????????????????????????????

FI: ????????????????????????????????????????????????????????????????????????????????????????????? (FI_NULLIFY_SUPER)

???????????? finalize ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ??????????????????????????????????????????????????????????????????????????????????????????

FI: ??????????????????????????????????????????????????????????????????????????????????????????????????? (FI_USELESS)

?????? finalize ?????????????????????????????????????????? finalize ??????????????????????????????????????????????????? ??????????????????????????????????????????

FS: ?????????????????? \n ????????? %n ????????????????????? (VA_FORMAT_STRING_USES_NEWLINE)

??????????????????????????????????????? (\n) ??????????????????????????? ????????????????????????????????? %n ???????????????????????????????????????????????????%n ??????????????????????????????????????????????????????????????????????????????

GC: ????????????????????????????????????????????? (GC_UNCHECKED_TYPE_IN_GENERIC_CALL)

??????????????????????????????????????????????????????????????? Object ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ??????????????????????????? Java ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

HE: equals ??????????????????????????????????????? hashCode ????????????????????????????????????????????? (HE_EQUALS_NO_HASHCODE)

?????????????????????equals(Object) ?????????????????????????????????????????????????????????hashCode ????????????????????????????????????????????????????????? ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? hashCode ??????????????????????????????????????????????????????????????????

HE: equals ??????????????????????????? Object.hashCode() ?????????????????????????????? (HE_EQUALS_USE_HASHCODE)

?????????????????????equals(Object) ?????????????????????????????????????????????hashCode ??????????????? java.lang.Object ??????????????????????????? (?????????????????????????????? (Java ???????????????????????????????????????????????????????????????????????????) ???????????????)??? ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? hashCode ??????????????????????????????????????????????????????????????????

??????????????????????????????????????? HashMap/HashTable ???????????????????????????????????????????????????????????????????????? hashCode ?????????????????????????????????????????????????????????

public int hashCode() {
    assert false : "hashCode????????????????????????????????????????????????????????????";
    return 42; // ???????????? 
}

HE: hashCode ??????????????????????????????????????? equals ????????????????????????????????????????????? (HE_HASHCODE_NO_EQUALS)

?????????????????????hashCode ??????????????????????????????????????????equals ?????????????????????????????????????????? ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????? hashCode ??????????????????????????????????????????????????????????????????

HE: hashCode ??????????????????????????? Object.equals() ?????????????????????????????? (HE_HASHCODE_USE_OBJECT_EQUALS)

?????????????????????hashCode ?????????????????????????????????????????? equals ??????????????? java.lang.Object ??????????????????????????? (???????????????????????????????????????????????????????????????)??? ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????? hashCode ???????????????????????????????????????????????????????????????????????? ???????????????hashCode ????????????????????????????????????????????????????????????????????????????????????????????????????????? (hashCode ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????)???

??????????????????????????????????????? HashMap/HashTable ???????????????????????????????????????????????????????????????????????? hashCode ?????????????????????????????????????????????????????????

public int hashCode() {
    assert false : "hashCode????????????????????????????????????????????????????????????";
    return 42; // ???????????? 
}

HE: equals ??????????????????????????? Object.hashCode() ?????????????????????????????? (HE_INHERITS_EQUALS_USE_HASHCODE)

?????????????????????????????????????????????????????? equals(Object) ??????????????????????????????java.lang.Object ?????? hashCode ???????????????????????????????????? (?????????????????????????????? (Java ???????????????????????????????????????????????????????????????????????????) ???????????????)??? ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? hashCode ??????????????????????????????????????????????????????????????????

hashCode ?????????????????????????????????????????????????????????????????? HashMap/Hashtable ??????????????????????????????????????????????????????????????? UnsupportedOperationException ?????????????????? hashCode() ??????????????????????????????????????????

IC: ??????????????????????????????????????????????????????????????????????????? (IC_SUPERCLASS_USES_SUBCLASS_DURING_INITIALIZATION)

???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
????????????????????????????????????????????????foo ??? null ?????????

public class CircularClassInitialization {
    static class InnerClassSingleton extends CircularClassInitialization {
        static InnerClassSingleton singleton = new InnerClassSingleton();
    }
    
    static CircularClassInitialization foo = InnerClassSingleton.singleton;
}

IMSE: ???????????? IllegalMonitorStateException ??????????????? (IMSE_DONT_CATCH_IMSE)

IllegalMonitorStateException ???????????????????????????????????? (?????????????????????????????????????????????????????? wait ????????????????????? notify ???????????????????????????) ??????????????????????????????????????????

ISC: static ?????????????????????????????????????????????????????????????????????????????? (ISC_INSTANTIATE_STATIC_CLASS)

?????????????????????static ?????????????????????????????????????????????????????????????????????????????????????????? ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? static ????????????????????????????????????????????????

It: Iterator.next() ??? NoSuchElementException ???????????????????????? (IT_NO_SUCH_ELEMENT)

?????????????????????java.util.Iterator ??????????????????????????? ?????????????????????next ??????????????? java.util.NoSuchElementException ?????????????????????????????? next ??????????????????????????????????????????????????????????????????????????? NoSuchElementException ??????????????????????????????????????????????????????

J2EE: HttpSession ??????????????????????????????????????????????????? (J2EE_STORE_OF_NON_SERIALIZABLE_OBJECT_INTO_SESSION)

?????????????????????HttpSession ????????????????????????????????????????????????????????????????????????????????? ????????????????????????????????????????????????????????????????????????????????????????????????

JCIP: ???????????????????????????????????? final ???????????? (JCIP_FIELD_ISNT_FINAL_IN_IMMUTABLE_CLASS)

???????????????net.jcip.annotations.Immutable ????????? javax.annotation.concurrent.Immutable ??????????????????????????????????????? ????????????????????????????????????????????????????????????????????? final ???????????????????????????????????????

ME: public ??????????????????????????????????????????????????????????????????Public enum method unconditionally sets its field (ME_ENUM_FIELD_SETTER)

????????????????????????????????????????????????????????? public ???????????? public ??????????????????????????????????????? ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

ME: ??????????????????????????? public ?????????????????? (ME_MUTABLE_ENUM_FIELD)

?????? public ?????????????????? public ????????????????????????????????????????????? ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ????????????????????? final ????????????????????????????????????????????????????????????????????????????????????????????????

NP: ???????????? Boolean ?????????????????????????????? null ?????????????????? (NP_BOOLEAN_RETURN_NULL)

Boolean.TRUE???Boolean.FALSE???null ?????????????????????????????????????????????????????????????????????????????? ???????????????????????????????????????????????????????????????????????????????????????????????? ?????????????????? Boolean ????????????????????????????????????????????????????????? null ???????????????????????? NullPointerException ???????????????????????????????????????

NP: null ??????????????????????????? clone ???????????? (NP_CLONE_COULD_RETURN_NULL)

?????? clone ?????????????????????????????????????????? null ?????????????????????????????? ????????????clone ???????????????????????? null ???????????????????????????????????? ????????????????????????????????????????????????????????????????????????????????? AssertionError ?????????????????????????????????

NP: equals ??????????????? null ??????????????????????????????????????? (NP_EQUALS_SHOULD_HANDLE_NULL_ARGUMENT)

?????? equals(Object) ????????????????????????????????????????????????????????? null ???????????????????????????????????????java.lang.Object.equals() ??????????????????????????????????????????????????? ???????????? equals ???????????????????????? null ????????????????????? false ????????????????????????

NP: null ??????????????????????????? toString ???????????? (NP_TOSTRING_COULD_RETURN_NULL)

?????? toString ?????????????????????????????????????????? null ?????????????????????????????? ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? null ?????????????????????????????????????????????????????????????????????????????????????????????????????????

Nm: ????????????????????????????????????????????? (NM_CLASS_NAMING_CONVENTION)

?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ???????????????????????????????????????????????????????????????????????? ?????????????????? (URL???HTML??????????????????????????????????????????????????????????????????????????????????????????????????????) ????????????????????????????????????

Nm: ?????????????????????????????????????????????????????????????????? Exception ?????????????????????????????? (NM_CLASS_NOT_EXCEPTION)

??????????????????????????????????????????????????????????????????????????????????????????Exception?????????????????????????????? ???????????????????????????????????????????????????????????????

Nm: ???????????????????????????????????? (NM_CONFUSING)

?????????????????????????????????????????????????????????????????????????????????????????????????????????

Nm: ??????????????????????????????????????????????????? (NM_FIELD_NAMING_CONVENTION)

final ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

Nm: Java ????????????????????????????????????????????????????????????????????????????????? (NM_FUTURE_KEYWORD_USED_AS_IDENTIFIER)

???????????????Java ??????????????????????????????????????????????????????????????????????????????????????? ???????????? Java ????????????????????????????????????????????????????????????????????????????????????????????????

Nm: Java ????????????????????????????????????????????????????????????????????????????????? (NM_FUTURE_KEYWORD_USED_AS_MEMBER_IDENTIFIER)

?????????????????????Java ????????????????????????????????????????????????????????????????????? ?????????????????? API ???????????????????????????????????????Java ????????????????????????????????????????????????????????????????????????????????????????????????

Nm: ?????????????????????????????????????????????????????? (NM_METHOD_NAMING_CONVENTION)

???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

Nm: ?????????????????????????????????????????????????????????????????????????????????????????? (NM_SAME_SIMPLE_NAME_AS_INTERFACE)

??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????/??????????????????????????????????????????????????????????????? (???????????????alpha.Foo ??? beta.Foo ??????????????????????????????????????????)??? ???????????????????????????????????????????????????????????????????????? import ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

Nm: ??????????????????????????????????????????????????????????????????????????? (NM_SAME_SIMPLE_NAME_AS_SUPERCLASS)

??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? (???????????????alpha.Foo ??? beta.Foo ??????????????????)??? ???????????????????????????????????????????????????????????????????????? import ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

Nm: ????????????????????????????????????????????? (???????????????) (NM_VERY_CONFUSING_INTENTIONAL)

????????????????????????????????????????????????????????????????????????????????????????????????????????? ???????????????????????????????????????????????????1???????????????????????????????????????????????????????????????????????????????????????????????? ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? API????????????????????????????????????????????????????????????????????????????????????????????????1???????????????????????????????????????????????????

Nm: ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? (NM_WRONG_PACKAGE_INTENTIONAL)

?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
????????????????????????????????????????????????

import alpha.Foo;

public class A {
    public int f(Foo x) { return 17; }
}
----
import beta.Foo;

public class B extends A {
    public int f(Foo x) { return 42; }
    public int f(alpha.Foo x) { return 27; }
}

????????? B ?????????????????? f(Foo) ??????????????????????????? A ??? f(Foo) ??????????????????????????????????????????????????? ????????????????????? Foo ??????????????????????????????????????????

?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ???????????????????????????????????????????????????????????????????????????????????? ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

ODR: ?????????????????????????????????????????????????????????????????????????????????????????? (ODR_OPEN_DATABASE_RESOURCE)

?????????????????????????????????????????????????????? (??????????????????????????????????????????????????????????????????) ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

ODR: ????????????????????????????????????????????????????????????????????????????????????????????????????????? (ODR_OPEN_DATABASE_RESOURCE_EXCEPTION_PATH)

?????????????????????????????????????????????????????? (??????????????????????????????????????????????????????????????????) ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

OS: ??????????????????????????????????????????????????????????????????????????? (OS_OPEN_STREAM)

????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ????????????????????????????????????????????????????????????????????????????????????????????? ???????????????????????????????????????????????????????????????????????? finally ?????????????????????????????????????????????????????????????????????

OS: ?????????????????????????????????????????????????????????????????????????????????????????? (OS_OPEN_STREAM_EXCEPTION_PATH)

???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ???????????????????????????????????????????????????????????????????????????????????????????????? ???????????????????????????????????????????????????????????????????????? finally ?????????????????????????????????????????????????????????????????????

PZ: ?????????????????????????????????????????????????????????????????? (PZ_DONT_REUSE_ENTRY_OBJECTS_IN_ITERATORS)

?????????????????????Iterator ??? Map.Entry ????????? Map ?????????????????????????????????????????????????????? entrySet ?????????????????????????????? ?????????????????????????????????Map ??????????????????????????????????????????????????????????????????????????????????????????????????????????????? Map m ??? entrySet ?????????????????????????????????????????????????????????c.addAll(m.entrySet()) ????????????????????????????????????????????? OpenJDK 1.7 ??? ???????????? Map ??????????????????????????????????????????????????????????????????

RC: ???????????????????????????????????? (RC_REF_COMPARISON_BAD_PRACTICE)

???????????????????????? ???????????? == ????????? != ????????????????????????????????????????????????????????? ??????????????????????????????????????????????????????????????????????????? equals ????????????????????? ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? == ???????????????????????????????????? ????????????????????????????????????????????????????????????????????????????????????java.lang.Integer ???java.lang.Float ???????????????

RC: Boolean ?????????????????????????????? (RC_REF_COMPARISON_BAD_PRACTICE_BOOLEAN)

????????????????????????== ????????? != ????????????????????????2?????? Boolean ?????????????????????????????? ???????????????2?????? Boolean ??? (Boolean.TRUE ??? Boolean.FALSE) ?????????????????? new Boolean(b) ?????????????????????????????????????????? Boolean ???????????????????????????????????????????????????????????? ???????????????????????????????????????????????????????????????????????? ?????????????????????????????????????????????Boolean ???????????????????????????????????????????????????????????? .equals(...) ???????????? == ????????? != ??????????????????????????????????????????????????????????????????

RR: InputStream.read() ????????????????????????????????????????????? (RR_NOT_CHECKED)

?????????????????????????????????????????????????????????????????? java.io.InputStream.read() (????????????????????????????????????) ??????????????????????????????????????? ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

RR: InputStream.skip() ????????????????????????????????????????????? (SR_NOT_CHECKED)

?????????????????????????????????????????????????????????????????????????????? java.io.InputStream.skip() ??????????????????????????????????????? ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ?????????????????????????????????????????????????????? ?????? skip ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

RV: compareTo()/compare() ??????????????????????????? (RV_NEGATING_RESULT_OF_COMPARETO)

?????????????????????compareTo ????????? compare ?????????????????????????????????????????????????????? ????????????????????????????????????????????????????????????????????????????????????????????? Integer.MIN_VALUE ?????????????????????????????????????????????????????????????????????????????????????????? ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

RV: ??????????????????????????????????????????????????? (RV_RETURN_VALUE_IGNORED_BAD_PRACTICE)

?????????????????????????????????????????????????????????????????????????????? ??????????????????????????????????????????????????????????????????????????????????????????????????????????????? ???????????????File.delete() ??????????????????????????????????????????????????????????????????????????????????????????????????? false ?????????????????? ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

SI: ????????????????????????????????????????????????????????? static final ???????????????????????????????????????????????????????????????????????? (SI_INSTANCE_BEFORE_FINALS_ASSIGNED)

???????????? static final ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

SW: Swing ??????????????? AWT ??????????????????????????????????????????????????????????????????????????? (SW_SWING_METHODS_INVOKED_IN_SWING_THREAD)

(From JDC Tech Tip)
????????????????????????????????????Swing ??????????????????show ???????????????setVisible ???????????????pack ????????????????????????????????????????????????????????????????????????????????? ??????????????????????????????????????????????????????????????????????????????????????????????????? ???????????????????????????????????????????????????????????? pack ??????????????? validate ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ??????????????????2????????????????????? Swing ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? pack ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

Se: ?????????????????????????????? transient ????????????????????????????????????????????????????????? (SE_BAD_FIELD)

????????????????????????????????????transient???Serializable???java.lang.Object ?????????????????????????????????????????????????????????????????????????????????????????? Externalizable ?????????????????????????????? readObject ??????????????? writeObject ?????????????????????????????????????????????????????? ?????????Externalizable ???????????????????????????????????????????????????readObject ??????????????? writeObject ?????????????????????????????????????????? ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

Se: ???????????????????????????????????????????????????????????????????????? (SE_BAD_FIELD_INNER_CLASS)

?????????????????????????????????????????????????????????????????????????????????????????? ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

????????????????????????????????? static ????????????????????????????????????????????? ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ?????????????????????????????????

Se: ???????????????????????????????????????????????????????????????????????????????????????????????????????????? (SE_BAD_FIELD_STORE)

?????????????????????????????????????????????????????? ??? transient ??????????????????????????????????????????

Se: Comparator ??? Serializable ???????????????????????? (SE_COMPARATOR_SHOULD_BE_SERIALIZABLE)

?????????????????? Comparator ???????????????????????????????????????????????? Serializable ????????????????????????????????????????????????????????????????????????????????? ????????????????????? TreeMap ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????TreeMap ??????????????????????????? ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

Se: ????????????????????????????????? (SE_INNER_CLASS)

???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ????????????????????????????????? static ?????????????????????????????????????????????

Se: serialVersionUID ??? final ???????????? (SE_NONFINAL_SERIALVERSIONID)

?????????????????????final ????????? serialVersionUID ?????????????????????????????????????????? ?????????????????????????????????????????? UID ?????????????????????????????????????????????????????????????????? final ?????????????????????

Se: serialVersionUID ??? long ???????????? (SE_NONLONG_SERIALVERSIONID)

?????????????????????long ????????? serialVersionUID ?????????????????????????????????????????? ?????????????????????????????????????????? UID ?????????????????????????????????????????????????????????????????? long ?????????????????????

Se: serialVersionUID ??? static ???????????? (SE_NONSTATIC_SERIALVERSIONID)

?????????????????????static ????????? serialVersionUID ?????????????????????????????????????????? ?????????????????????????????????????????? UID ?????????????????????????????????????????????????????????????????? static ?????????????????????

Se: Serializable ??????????????????????????????????????????????????????????????????????????????????????????????????? (SE_NO_SUITABLE_CONSTRUCTOR)

?????????????????? Serializable ???????????????????????????????????????????????????????????????????????????????????????????????????????????? ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

Se: Externalizable ???????????????????????????????????????????????????????????????????????? (SE_NO_SUITABLE_CONSTRUCTOR_FOR_EXTERNALIZATION)

?????????????????????Externalizable ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????? Externalizable ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

Se: readResolve ????????????????????????????????? Object ??????????????????????????? (SE_READ_RESOLVE_MUST_RETURN_OBJECT)

readResolve ?????????????????????????????????????????????????????????????????????????????? Object ?????????????????????????????????????????????

Se: ????????????????????????????????????????????? transient ??????????????? (SE_TRANSIENT_FIELD_NOT_RESTORED)

?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ??????????????????????????????????????? transient ?????????????????????????????? readObject/readResolve ????????????????????????????????? ??????????????????????????????????????????????????????????????????????????????????????????????????????

SnVI: Serializable ??????????????? serialVersionUID ???????????????????????? (SE_NO_SERIALVERSIONID)

?????????????????? Serializable ???????????????????????????????????????????????????serialVersionUID ????????????????????????????????????????????? .class ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ???????????????????????????????????? serialVersionUID ??????????????? (???????????????String.class ?????????????????????????????????class$java$lang$String ????????? static ?????????????????????????????????)??? ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ?????????????????????????????? Serializable ?????????????????????????????????????????????????????? serialVersionUID ???????????????????????????????????????????????????

UI: ????????????????????????????????? getResource ??????????????????????????????????????????????????? (UI_INHERITANCE_UNSAFE_GETRESOURCE)

???????????????????????????????????????????????????????????????????????????this.getClass().getResource(...) ??????????????????????????????????????????????????????????????????????????????

BC: ???????????????????????? (BC_IMPOSSIBLE_CAST)

?????????????????????????????? ClassCastException ???????????????????????? FindBugs ??????instanceof ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

BC: ????????????????????????????????? (BC_IMPOSSIBLE_DOWNCAST)

?????????????????????????????? ClassCastException ???????????????????????? ???????????????????????????????????????????????????????????????????????????????????????????????? ?????????????????????????????????????????????????????????????????????????????????ClassCastException ????????????????????????????????????????????????

BC: toArray ????????????????????????????????????????????????????????? (BC_IMPOSSIBLE_DOWNCAST_OF_TOARRAY)

??????????????????????????????????????????Object[] ?????????????????????????????????????????? toArray ??????????????????????????????????????????????????????????????????

String[] getAsArray(Collection<String> c) {
  return (String[]) c.toArray();
}

??????????????? ClassCastException ???????????????????????????????????? ????????????????????????????????????????????? toArray ??????????????????Object[] ?????????????????? Collection ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ???????????????????????????????????????????????????????????????????????????c.toArray(new String[]); ????????? c.toArray(new String[c.size()]); (??????????????????????????????????????????) ?????????????????????????????? ??????????????????1????????????????????????????????????????????????????????? Arrays.asList(...)???????????????????????????????????? toArray() ???????????????????????????????????????????????? ???????????????Arrays.asArray(new String[] { "a" }).toArray() ??? String [] ?????????????????? FindBugs ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

BC: ?????? false ????????? instanceof (BC_IMPOSSIBLE_INSTANCEOF)

?????? instanceof ????????? false ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

BIT: ?????????????????????????????????????????? (BIT_ADD_OF_SIGNED_BYTE)

?????????????????????????????????8????????????????????????????????????????????????????????????????????? ?????????????????????????????????????????????????????????????????????????????????32?????????????????????????????????????????? ??????????????????b[0] ????????? 0xff ??????x ??????????????? 0 ?????????????????? ((x << 8) + b[0]) ??????0xff ?????????????????? 0xffffffff ????????????????????????????????? 0xffffffff ?????????????????????

???????????????????????? int ?????????????????????????????????????????????????????????????????????????????????

int result = 0;
for(int i = 0; i < 4; i++) 
  result = ((result << 8) + b[i]);

????????????????????????????????????????????????????????????????????????

int result = 0;
for(int i = 0; i < 4; i++) 
  result = ((result << 8) + (b[i] & 0xff));

BIT: ???????????????????????????????????? (BIT_AND)

????????????????????????(e & C) ??????????????? D ??????????????????????????? ?????? C ?????????????????? D ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????

BIT: ((...) & 0) == 0 ??????????????????????????? (BIT_AND_ZZ)

????????????????????????(e & 0) ???????????????0????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

BIT: ???????????????????????????????????? (BIT_IOR)

????????????????????????(e | C) ??????????????? D ??????????????????????????? ?????? C ?????????????????? D ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ??????????????????????????????????????? ("&") ?????????????????????????????????????????? ("|") ???????????????????????????

BIT: ????????????????????????????????????????????? (BIT_IOR_OF_SIGNED_BYTE)

??????????????????????????? (????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????) ???????????????????????????????????????????????? ???????????????????????????????????????????????????32?????????????????????????????????????????? ??????????????????b[0] ????????? 0xff ??????x ??????????????? 0 ?????????????????? ((x << 8) | b[0]) ??????0xff ?????????????????? 0xffffffff ????????????????????????????????? 0xffffffff ?????????????????????

???????????????????????? int ?????????????????????????????????????????????????????????????????????????????????

int result = 0;
for(int i = 0; i < 4; i++) {
    result = ((result << 8) | b[i]);
}

????????????????????????????????????????????????????????????????????????

int result = 0;
for(int i = 0; i < 4; i++) {
    result = ((result << 8) | (b[i] & 0xff));
}

BIT: ????????????????????????????????????????????? (BIT_SIGNED_CHECK_HIGH_BIT)

????????????????????????((event.detail & SWT.SELECTED) > 0) ?????????????????????????????????????????? ??????????????????????????????????????????????????????????????????????????????????????? (???????????????SWT.SELECTED ???????????????) ????????????????????????????????????????????? SWT.SELECTED ???????????????????????????????????????????????????????????? SWT.SELECTED ?????????????????????????????????'> 0' ??????????????? '!= 0' ?????????????????????????????????????????????????????????????????????

Boris Bokowski

BOA: ???????????????????????? Adapter ???????????????????????????????????????????????????????????????????????????????????? (BOA_BADLY_OVERRIDDEN_ADAPTER)

??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ???????????????????????????java.awt.event ??? javax.swing.event ??????????????????????????????????????????????????????????????? Adapter ????????? ????????????????????????????????????????????????????????????????????????????????????????????????

BSHIFT: ?????????????????????????????????????????????????????????????????? (BSHIFT_WRONG_ADD_PRIORITY)

???????????? (x << 8 + y) ???????????????????????????????????? ????????????????????????????????????????????????????????? (x << 8) + y ????????????????????????????????????????????? ???????????????????????????????????????????????????????????????????????? x << (8 + y) ????????????????????????????????????

BSHIFT: 32????????? int ???-31??????31?????????????????????????????????????????? (ICAST_BAD_SHIFT_AMOUNT)

?????????????????????32????????? int ???-31??????31??????????????????????????????????????????????????????????????? ????????????????????????????????????????????????????????????????????????????????????????????????5????????? (32??????????????????) ??????????????????????????? (???????????????40????????????????????????????????????8????????????????????????????????????????????????32????????????????????????????????????0????????????????????????????????????????????????)??? ????????????????????????????????????????????????????????????????????????????????????????????????

DLS: return ????????????????????????????????????????????? (DLS_DEAD_LOCAL_INCREMENT_IN_RETURN)

return x++; ???????????? return ????????????????????? ??????????????????????????????/????????????????????? ???????????????????????????????????????????????????????????????/???????????????????????????????????????????????? ??????????????????????????????????????????????????????

DLS: ??????????????????????????????????????? (DLS_DEAD_STORE_OF_CLASS_LITERAL)

?????????????????????????????????????????????????????????????????????????????????????????????????????????
The behavior of this differs in Java 1.4 and in Java 5
J2SE 1.4 ????????????????????????????????????????????????Foo.class ??????????????? Foo ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? J2SE 5.0 ???????????????????????????

?????????????????????????????? J2SE 5.0 ????????????????????????????????????????????????????????? Sun ??? article on Java SE compatibility ??????????????????????????????

DLS: ??????????????????????????????????????? (DLS_OVERWRITTEN_INCREMENT)

???????????????????????????????????????????????? (???????????????i++) ??????????????????????????????????????????????????? ???????????????i = i++ ?????????????????????????????????????????????????????????????????????

DMI: ????????????????????? (DMI_ARGUMENTS_WRONG_ORDER)

??????????????????????????????????????????????????????????????????????????????????????????????????? ??????????????????????????? Preconditions.checkNotNull("message", message) ????????????????????????????????????????????????????????????????????????????????????

DMI: ???????????????????????????????????? (DMI_BAD_MONTH)

????????????????????????????????????0??????11???????????????????????????????????????????????????

DMI: ???????????????????????? double ????????????????????? BigDecimal (DMI_BIGDECIMAL_CONSTRUCTED_FROM_DOUBLE)

?????????????????????10?????????????????????????????????????????? double ????????? BigDecimal ??????????????????????????? ???????????????Java ??? new BigDecimal(0.1) ???????????????0.1????????????????????? BigDecimal (???????????????1??????????????????????????????1) ?????????????????????????????????????????????????????? ????????????0.1000000000000000055511151231257827021181583404541015625???????????????????????????

???????????? BigDecimal.valueOf(double d) ?????????????????????????????????????????????BigDecimal(???????????????BigDecimal.valueOf(0.1) ???0.1???????????????) ??????????????????????????? double ???????????????????????????????????????

DMI: hasNext ??????????????? next ???????????????????????????????????? (DMI_CALLING_NEXT_FROM_HASNEXT)

hasNext ??????????????????next ?????????????????????????????????????????? hasNext ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? next ????????????????????????????????????????????????????????????????????????????????????

DMI: ??????????????????????????????????????????????????????????????? (DMI_COLLECTIONS_SHOULD_NOT_CONTAIN_THEMSELVES)

?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? (???????????????s.contains(s) ??? true) ????????????????????????????????? ?????????????????????????????????????????????????????????????????????????????????????????? (???????????????????????????????????????????????????????????????????????????)??? ???????????????????????????????????????????????????????????????????????????

DMI: D'oh! ???????????????????????????????????? (DMI_DOH)

????????????????????????????????????????????????????????????????????????????????????????????????????????????

DMI: ????????? hashCode ???????????????????????????????????? (DMI_INVOKING_HASHCODE_ON_ARRAY)

?????????????????????????????? hashCode ?????????????????????????????????????????? ????????? hashCode ???????????????????????????????????????System.identityHashCode ???????????????????????????????????????????????????????????????????????????????????? ?????? a ???????????????????????????????????????????????????????????????????????????java.util.Arrays.hashCode(a) ??????????????????????????????

DMI: int ???????????? Double.longBitsToDouble() ???????????????????????? (DMI_LONG_BITS_TO_DOUBLE_INVOKED_ON_INT)

Double.longBitsToDouble() ?????????????????????32????????? int ????????????????????????????????????????????? ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

DMI: ???????????????????????????????????????????????? (DMI_VACUOUS_SELF_COLLECTION_CALL)

???????????????????????????????????????????????? ??????????????????????????? c ??? c.containsAll(c) ?????????????????????????????? true ???????????????????????? ????????????c.retainAll(c) ?????????????????????????????????????????????

Dm: ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? (DMI_ANNOTATION_IS_NOT_VISIBLE_TO_REFLECTION)

???????????????????????????@Retention(RetentionPolicy.RUNTIME) ???????????????????????????????????????????????????????????? (???????????????isAnnotationPresent(...) ????????????) ??????????????????????????????????????????????????????

Dm: ScheduledThreadPoolExecutor ?????????????????????????????????????????????????????????????????? (DMI_FUTILE_ATTEMPT_TO_CHANGE_MAXPOOL_SIZE_OF_SCHEDULED_THREAD_POOL_EXECUTOR)

ScheduledThreadPoolExecutor ??? ThreadPoolExecutor ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ?????????corePoolSize ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????maximumPoolSize ????????????????????????????????????????????????
(Javadoc)

Dm: ???????????????????????????0??? ScheduledThreadPoolExecutor ????????? (DMI_SCHEDULED_THREAD_POOL_EXECUTOR_WITH_ZERO_CORE_THREADS)

???????????????????????????0??? ScheduledThreadPoolExecutor ??????????????????????????????????????? ????????????????????????????????????????????????????????????
(Javadoc)

Dm: EasyMock ????????????????????????????????????/???????????????????????? (DMI_VACUOUS_CALL_TO_EASYMOCK_METHOD)

????????????????????? EasyMock ????????????????????????????????????????????????????????????????????????????????????

Dm: Math.max ??? Math.min ?????????????????????????????? (DM_INVALID_MIN_MAX)

?????????????????????Math.min(0, Math.max(100, value)) ????????????????????????????????????????????????????????????????????????????????? ??????????????????????????????????????????????????????????????? Math.min(100, Math.max(0, value)) ????????????????????? ??????????????????????????????????????????????????? ??????????????? NaN ?????? NaN??? ????????????????????????

EC: equals ?????????????????????????????????????????????????????????????????? (EC_ARRAY_AND_NONARRAY)

?????????????????????????????????????????????????????????????????????????????????????????? .equals(Object o) ?????????????????????????????? ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ???????????????????????????????????????????????????????????????????????? equals ???????????????2???????????????????????????????????????????????????????????????????????? ??????????????????????????????????????????????????? java.util.Arrays.equals(Object[], Object[]) ??????????????????????????????

EC: ????????? equals ??????????????????????????? == ?????????????????? (EC_BAD_ARRAY_COMPARE)

????????????????????????????????? .equals(Object o) ?????????????????????????????? ????????????Object ??? equals ??????????????????????????????????????????????????????????????? equals ??????????????????????????????????????????????????????????????????????????????????????? ??????????????????????????????????????????????????? java.util.Arrays.equals(Object[], Object[]) ?????????????????????????????? ????????????????????????????????????????????????????????? == ???????????????????????????????????????????????????????????????????????????????????????????????????????????????

EC: equals(...) ???????????????????????????????????????????????????????????????????????? (EC_INCOMPATIBLE_ARRAY_COMPARE)

?????????????????????????????????????????????????????????????????????????????? .equals(Object o) ??????????????????????????? (???????????????String[] ??? StringBuffer[]???String[] ??? int[]) ??? ?????????????????????????????????????????????????????? ????????????equals(...) ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

EC: equals(null) ??????????????? (EC_NULL_ARG)

???????????????????????? null ???????????????????????? equals(Object) ?????????????????????????????? equals ??????????????????????????????????????????????????????????????? false ????????????????????????

EC: equals ???????????????????????????????????????????????????????????????????????????????????????????????? (EC_UNRELATED_CLASS_AND_INTERFACE)

????????????????????????????????????????????????????????????????????????????????????2??????????????? equals(Object) ?????????????????????????????????????????? ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ????????????????????????????????????2??????????????????????????????????????????????????????????????????????????????????????????????????? (???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????)??? equals ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ??????????????????java.lang.Object.equals(Object) ?????????????????????????????????????????????????????????????????????????????????????????? false ??????????????????

EC: equals ??????????????????????????????????????????????????????????????????????????????????????? (EC_UNRELATED_INTERFACES)

????????????????????????????????????????????????????????????????????????????????????????????????????????????2??????????????? equals(Object) ?????????????????????????????????????????? ????????????????????????????????????????????????????????????????????????????????????????????????????????? ????????????????????????????????????2??????????????????????????????????????????????????????????????????????????????????????????????????? (???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????)??? equals ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ??????????????????java.lang.Object.equals(Object) ?????????????????????????????????????????????????????????????????????????????????????????? false ??????????????????

EC: equals ??????????????????????????????????????????????????????????????? (EC_UNRELATED_TYPES)

????????????????????????????????????????????????2??????????????? equals(Object) ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ?????????????????????????????????????????????equals ????????????????????????????????????????????????????????? false ??????????????? ???????????? equals ????????????????????? (Object ???????????? equals ????????????????????????????????????) ????????????????????????????????????????????????????????????

EC: ??????????????????????????????????????????????????????????????? (EC_UNRELATED_TYPES_USING_POINTER_EQUALITY)

????????????????????????????????????????????????2?????????????????????????????????????????????????????????????????????????????? ????????????????????????????????? false ?????????

Eq: equals ????????????????????? false ????????? (EQ_ALWAYS_FALSE)

?????????????????????????????? false ????????? equlas ??????????????????????????????????????? ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? Map ??? Set ??????????????????????????? ?????????????????????equals ????????????????????????????????????????????????????????????????????????????????????????????????

??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ????????? Object ??????????????????????????????????????????????????? ??????????????????????????????????????????????????? equals ????????????????????????????????????????????????????????????????????????????????????????????????????????????

public boolean equals(Object o) {
    return this == o;
}

Eq: equals ????????????????????? true ????????? (EQ_ALWAYS_TRUE)

??????????????????????????? true ????????? equals ??????????????????????????????????????? ??????????????????????????????????????????????????????????????????????????????????????????equals ???????????????????????????????????????????????????????????????

Eq: equals ??????????????????????????????????????????????????????????????????????????????????????? (EQ_COMPARING_CLASS_NAMES)

????????????????????????????????????????????????????????????????????????2??????????????????????????????????????????????????????????????????????????? ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ????????????????????????????????????????????????????????????????????????

Eq: ????????????????????? equals ????????????????????????????????? (EQ_DONT_DEFINE_EQUALS_FOR_ENUM)

?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ?????????????????????????????? equals ???????????????????????????????????????????????????????????????????????????????????? 2??????????????????????????? equals ????????????????????????????????????????????????????????????????????? equals ??????????????????????????????????????????????????????????????? ????????? equals ????????????????????????????????????????????????

Eq: equals(Object) ??????????????????????????????????????????????????? equals ????????????????????? (EQ_OTHER_NO_OBJECT)

?????????????????????equals ??????????????????????????????????????????java.lang.Object ???????????? equals(Object) ????????????????????????????????????????????????????????? ???????????????????????????????????????????????? equals(Object) ??????????????????????????????boolean equals(Object) ??????????????????????????????????????????

Eq: Object.equals(Object) ??????????????????????????????????????? equals ????????????????????? (EQ_OTHER_USE_OBJECT)

?????????????????????equals ??????????????????????????????????????????java.lang.Object ???????????? equals(Object) ????????????????????????????????????????????????????????? ???????????????boolean equals(Object) ??????????????????????????????????????????

Eq: equals ??????????????????????????????????????? equals ????????????????????????????????????????????????????????????????????????????????????????????? (EQ_OVERRIDING_EQUALS_NOT_SYMMETRIC)

?????????????????????????????????????????? equals ?????????????????????????????????????????? equals ??????????????????????????????????????? ????????? equals ??????????????????2???????????????????????????????????????????????????????????????instanceof ??????????????????????????? equals ???????????????????????? (a.equals(b) == b.equals(a)) ???????????????????????????????????????????????????????????????????????? B ??? A ???????????????????????? A ??? equals ???????????????????????? instanceof A ????????????????????????????????? ????????????B ??? equals ???????????????????????? instanceof B ????????????????????????????????? ????????????????????????????????????????????????????????????????????????????????????????????????????????????

Eq: ????????? equals ??????????????????????????????Object.equals(Object) ????????????????????? (EQ_SELF_USE_OBJECT)

?????????????????????????????? equals ?????????????????????????????????????????? equals(Object) ??????????????? java.lang.Object ??????????????????????????????????????? ???????????????boolean equals(Object) ??????????????????????????????????????????

FE: NaN ???????????????????????????????????????????????? (FE_TEST_IF_EQUAL_TO_NOT_A_NUMBER)

??????????????????????????????????????????????????????????????????????????????????????????????????? (???????????? if (x == Double.NaN))??? ?????????????????????NaN ???????????????????????????????????? NaN ????????????????????????????????? ??????????????????x == Double.NaN ????????? false ????????????????????? x ?????????????????????????????????????????????????????????????????????????????? Double.isNaN(x) ?????????????????? (????????? x ??????????????????????????????????????? Float.isNaN(x))???

FS: ???????????????????????????????????????????????????????????? (VA_FORMAT_STRING_BAD_ARGUMENT)

???????????????????????????????????????????????????????????????????????? ???????????????System.out.println("%d\n", "hello"); ??? %d ??????????????????????????????????????????????????????????????????????????????????????????????????????????????? ??????????????????????????????????????????????????????????????????

FS: ?????????????????????????????????????????????????????????????????? (VA_FORMAT_STRING_BAD_CONVERSION)

?????????1???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ???????????????String.format("%d", "1") ??????????????? "1" ?????????????????? "%d" ??????????????????????????????????????????????????????

FS: printf ????????????????????????????????????????????????????????? MessageFormat ???????????????????????? (VA_FORMAT_STRING_EXPECTED_MESSAGE_FORMAT_SUPPLIED)

Java ??? printf ???????????????????????????????????????????????????????????????????????????????????????????????? ?????????????????????????????????????????????????????????????????? (???????????????%s) ??????????????????????????????????????????????????????????????? (???????????????{0}) ???????????????????????? printf ??????????????????????????????????????????????????????MessageFormat ????????????????????????????????????????????????????????? ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

FS: ???????????????????????????????????????????????????????????????????????????????????? (VA_FORMAT_STRING_EXTRA_ARGUMENTS_PASSED)

??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

FS: ???????????????????????? (VA_FORMAT_STRING_ILLEGAL)

???????????????????????????????????????????????????????????????????????????????????????????????????????????????

FS: ????????????????????????????????????????????????????????? (VA_FORMAT_STRING_MISSING_ARGUMENT)

?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

FS: ????????????????????????????????????????????? (VA_FORMAT_STRING_NO_PREVIOUS_ARGUMENT)

????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ("<")?????????????????????????????? ?????????????????????????????????????????????????????? ???????????????formatter.format("%<s %s", "a", "b") ????????????????????? MissingFormatArgumentException ????????????????????????

GC: ????????????????????????????????????????????????????????? (GC_UNRELATED_TYPES)

????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? (????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????)??? ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ??????????????????????????????????????????????????????????????? ????????????2????????????????????????????????????????????????????????????????????????????????? ???????????????Foo ??? Bar ???????????????????????????????????????????????????????????????Foo ???????????????????????? Bar ???????????????????????????????????????????????????????????? ?????????????????????????????????????????? equals ???????????????????????????????????????????????? ???????????????Foo ??? String ??????????????????????????? Foo ?????????????????????????????????String ??? String ?????????????????????????????????equals ????????????????????????????????????????????????

????????????????????? equals ??????????????????????????????????????????????????????????????????????????????????????????????????? API????????????????????????????????????????????????????????????????????????Collection<String> ??? Foo ?????????????????????????????????????????? ????????? equals ???????????? (???????????????Foo???????????? equals ????????????) ???????????????????????????????????????????????????

HE: ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? (HE_SIGNATURE_DECLARES_HASHING_OF_UNHASHABLE_CLASS)

?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ???????????????equals ??????????????????????????????????????????hashCode ??????????????? java.lang.Object ?????????????????????????????? ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????? hashCode ???????????????????????????????????????????????????????????????????????????????????????

HE: ?????????????????????????????? hashCode ??????????????????????????????????????????????????? (HE_USE_OF_UNHASHABLE_CLASS)

?????????????????????equals(Object) ??????????????????????????????????????????hashCode ?????????????????????????????????????????? ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????? hashCode ?????????????????????????????????????????????????????? ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

ICAST: int ?????? long ?????????????????????????????????????????????????????? (ICAST_INT_2_LONG_AS_INSTANT)

?????????????????????32????????? int ??????64????????? long ????????????????????????????????????????????????????????????????????????????????????????????????????????? ?????????????????????????????????????????????????????????1970???1???1??????00:00:00 GMT????????????????????????????????????????????????????????????????????????????????????
????????????????????????????????? ?????????????????????????????? Date ??????????????????????????????????????? ?????????????????????????????????

Date getDate(int seconds) { return new Date(seconds * 1000); }

?????????32?????????????????????????????????64???????????????????????????????????? 32??????????????????64???????????????????????????????????????????????????????????????????????????????????????1969???12??????1970???1????????????????????????????????????

?????????????????????????????????????????????????????????????????????

// ?????????2037???????????????
Date getDate(int seconds) { return new Date(seconds * 1000L); }

// ????????????????????????????????????????????????
Date getDate(long seconds) { return new Date(seconds * 1000); }

ICAST: ???????????? double ????????????????????? Math.ceil() ?????????????????? (ICAST_INT_CAST_TO_DOUBLE_PASSED_TO_CEIL)

?????????????????????????????? (???????????????int ??? long) ?????????????????????????????????????????????????????????????????? Math.ceil() ???????????????????????? ????????? double ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? Math.ceil()???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

ICAST: ???????????? float ????????????????????? Math.round() ?????????????????? (ICAST_INT_CAST_TO_FLOAT_PASSED_TO_ROUND)

????????????????????????????????? float ???????????????????????????????????????????????????????????? Math.round() ????????????????????????????????? int/long ?????????????????? ????????? float ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? Math.round()??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

IJU: run ?????????????????? JUnit ????????????????????? JUnit ?????????????????????????????? (IJU_ASSERT_METHOD_INVOKED_FROM_RUN_METHOD)

run ??????????????? JUnit ???????????????????????????????????????????????????????????? JUnit ??????????????????????????????????????????????????? ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

IJU: TestCase ??? suite ???????????????????????????????????????????????? (IJU_BAD_SUITE_METHOD)

JUnit ??? TestCase ???????????????suite ??????????????????????????????????????? ?????????????????????suite ??????????????????

public static junit.framework.Test suite()

???

public static junit.framework.TestSuite suite()

??????????????????????????????????????????????????????

IJU: TestCase ????????????????????? (IJU_NO_TESTS)

JUnit ??? TestCase ???????????????????????????????????????????????????????????????????????????

IJU: TestCase ??? super.setup() ????????????????????? setUp ????????????????????????????????? (IJU_SETUP_NO_SUPER)

JUnit ??? TestCase ???????????????setUp ??????????????????????????????????????? setUp ??????????????????super.setUp() ?????????????????????????????????????????????????????????

IJU: TestCase ??? ??? static ??? suite ????????????????????????????????? (IJU_SUITE_NOT_STATIC)

JUnit ??? TestCase ???????????????suite ??????????????????????????????????????? suite ??????????????? static ???????????????????????????????????????????????????????????????

IJU: TestCase ??? super.tearDown() ????????????????????? tearDown ????????????????????????????????? (IJU_TEARDOWN_NO_SUPER)

JUnit ??? TestCase ???????????????tearDown ??????????????????????????????????????? tearDown ??????????????????super.tearDown() ?????????????????????????????????????????????????????????

IL: ?????????????????????????????????????????????????????? (IL_CONTAINER_ADDED_TO_ITSELF)

??????????????????????????????????????????????????????????????????????????????hashCode ?????????????????? StackOverflowException ????????????????????????

IL: ??????????????????????????? (IL_INFINITE_LOOP)

??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

IL: ????????????????????????????????? (IL_INFINITE_RECURSIVE_LOOP)

????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

IM: ???????????????????????????????????? (IM_MULTIPLYING_RESULT_OF_IREM)

???????????????????????????????????????????????????????????????????????????????????? ??????????????????????????????????????????????????????????????????????????????????????? ???????????????i % 60 * 1000 ??????i % (60 * 1000) ???????????? (i % 60) * 1000 ??????????????????

INT: int ?????? long ?????????????????????????????? (INT_BAD_COMPARISON_WITH_INT_VALUE)

?????????????????????int ?????? int ?????????????????????????????????????????? long ????????????????????????????????? ??????????????????????????????????????????????????????????????????

INT: ????????????????????????????????????????????????????????????????????? (INT_BAD_COMPARISON_WITH_NONNEGATIVE_VALUE)

??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

INT: ?????????????????????????????????????????? (INT_BAD_COMPARISON_WITH_SIGNED_BYTE)

????????????????????????????????????????????????-128???127????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ????????????????????? b ????????????0???255????????????????????????????????????????????? 0xff & b ??????????????????????????????

IO: ???????????????????????????????????????????????????????????????????????? (IO_APPENDING_TO_OBJECT_OUTPUT_STREAM)

?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

IP: ??????????????????????????????????????????????????????????????????????????? (IP_PARAMETER_IS_DEAD_BUT_OVERWRITTEN)

?????????????????????????????????????????????????????????????????????????????????????????? ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

MF: ????????????????????????????????????????????????????????????????????????????????????????????? (MF_CLASS_MASKS_FIELD)

???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

MF: ??????????????????????????????????????????????????????????????? (MF_METHOD_MASKS_FIELD)

?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

NP: null ???????????????????????? (NP_ALWAYS_NULL)

????????? null ?????????????????????????????????????????? ?????????????????????????????? NullPointerException ?????????????????????

NP: null ??????????????????????????????????????? (NP_ALWAYS_NULL_EXCEPTION)

??????????????????????????? null ???????????????????????????????????????????????????????????? NullPointerException ????????????????????? ????????? FindBugs ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

switch ?????? default ?????????????????????????????????????????? FindBugs ???????????????????????? default ????????????????????????????????????????????????

NP: null ??????????????????????????????????????????????????? (NP_ARGUMENT_MIGHT_BE_NULL)

?????????????????????????????????????????? null ?????????????????????????????????????????????????????????????????????????????????????????????????????? ????????????null ??????????????????????????????null ?????????????????????????????????

NP: ?????? null ??????????????????????????? close ???????????????????????????????????? (NP_CLOSING_NULL)

close ???????????????????????? null ????????????????????????????????????????????????????????? ????????????????????????????????? NullPointerException ????????????????????? ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

NP: null ???????????????????????????????????????????????? (NP_GUARANTEED_DEREF)

?????????????????????????????????????????????????????????????????? null ????????????null ?????????????????? (???????????????????????????????????????????????????????????????) ????????????????????????????????????

?????????if (x == null) throw new NullPointerException(); ??? x ?????????????????????????????????????????????????????????????????????

NP: null ??????????????????????????????????????????????????????????????? (NP_GUARANTEED_DEREF_ON_EXCEPTION_PATH)

???????????????????????????????????????????????????????????????????????????????????? null ????????????null ?????????????????? (???????????????????????????????????????????????????????????????) ????????????????????????????????????

NP: ??? null ????????????????????????????????????????????? (NP_NONNULL_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR)

???????????????????????? null ??????????????????????????????????????????????????????????????????????????????????????????????????? ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

NP: ?????????????????????????????? null ??????????????????????????? null ?????????????????? (NP_NONNULL_PARAM_VIOLATION)

??????????????????????????? null ?????????????????????????????????????????????????????????????????????null ??????????????????????????? ???????????????????????????@Nonnull ????????????????????????????????????????????????????????????????????????????????? null ?????????????????????????????????????????????

NP: null ?????????????????????????????????????????? @Nonnull ????????????????????? (NP_NONNULL_RETURN_VIOLATION)

????????????????????????null ???????????????????????????????????????????????? (?????????????????????????????????????????????) ??????????????? @Nonnull ??????????????????????????????

NP: null ???????????????????????????????????????????????????????????????????????????????????? (NP_NULL_INSTANCEOF)

????????????????????????????????? null ????????????????????????????????????????????????instanceof ????????? faluse ?????????????????? ?????????????????????????????????????????????????????????????????????????????????????????????????????????

NP: null ?????????????????????????????????????????? (NP_NULL_ON_SOME_PATH)

??????????????????????????????????????????????????? null ????????????????????? NullPointerException ????????????????????? ??????????????????????????????????????????????????????????????????NullPointerException ????????????????????????????????????????????????????????????????????????????????? ???????????????????????? FindBugs ?????????????????????????????????

NP: null ????????????????????????????????????????????????????????? (NP_NULL_ON_SOME_PATH_EXCEPTION)

??????????????????????????? null ??????????????????????????????????????????????????????????????? NullPointerException ?????????????????????????????????????????? ????????? FindBugs ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

switch ?????? default ?????????????????????????????????????????? FindBugs ???????????????????????? default ????????????????????????????????????????????????

NP: ?????????????????????????????? null ??????????????????????????? null ?????????????????? (NP_NULL_PARAM_DEREF)

???????????????????????????????????? null ??????????????????????????????????????? null ??????????????????????????? ?????????????????????????????? null ???????????????????????????????????????????????????????????????????????????????????????????????? null ?????????????????????????????????????????????

NP: ?????????????????????????????? null ??????????????????????????? null ?????????????????? (NP_NULL_PARAM_DEREF_ALL_TARGETS_DANGEROUS)

?????????????????????????????????????????????????????? null ???????????????????????????????????????????????????????????????????????????????????? null ??????????????????????????? ?????????????????????????????? null ???????????????????????????????????????????????????????????????????????????????????????????????? null ?????????????????????????????????????????????

NP: ??? null ?????????????????? null ?????????????????????????????????????????????????????? (NP_NULL_PARAM_DEREF_NONVIRTUAL)

null ??????????????????????????? ??? null ?????????????????????????????????????????????????????? ?????????????????????????????? null ???????????????????????????????????????????????????????????????????????????????????????????????? null ?????????????????????????????????????????????

NP: Optional ???????????????????????????????????????????????? null ????????? (NP_OPTIONAL_RETURN_NULL)

Optional ???????????????????????????????????????????????? null ????????????????????????????????????????????????????????????????????? null ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

NP: @Nonnull ????????????????????????????????????????????? null ????????????????????? (NP_STORE_INTO_NONNULL_FIELD)

@Nonnull ??????????????????????????????????????????????????? null ????????????????????????????????????????????????

NP: ????????????????????????????????????????????????????????? (NP_UNWRITTEN_FIELD)

?????????????????????????????? null ???????????????????????????????????????????????????????????????????????????????????????????????? ??????????????????????????? NullPointerException ?????????????????????

Nm: ???????????? equal(Object) ???????????????????????????equals(Object) ?????????????????????? (NM_BAD_EQUAL)

?????????????????????equal(Object) ????????????????????????????????????????????????????????? ????????????????????????java.lang.Object ??? equals(Object) ??? (????????????????????????) ??????????????????????????????????????????

Nm: ???????????? hashcode() ???????????????????????????hashCode() ?????????????????????? (NM_LCASE_HASHCODE)

?????????????????????hashcode() ????????????????????????????????????????????????????????? ????????????????????????java.lang.Object ??? hashCode ??????????????? (????????????????????????) ??????????????????????????????????????????

Nm: ???????????? tostring() ???????????????????????????toString() ?????????????????????? (NM_LCASE_TOSTRING)

?????????????????????tostring() ????????????????????????????????????????????????????????? ????????????????????????java.lang.Object ??? toString ??????????????? (????????????????????????) ??????????????????????????????????????????

Nm: ????????????????????????????????????????????????????????? (NM_METHOD_CONSTRUCTOR_CONFUSION)

????????????????????????????????????????????????????????????????????????????????? ???????????????????????????????????????????????????????????????????????????????????????????????? void ???????????????????????????????????????????????? ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

Nm: ????????????????????????????????????????????? (NM_VERY_CONFUSING)

????????????????????????????????????????????????????????????????????????????????????????????????????????? ???????????????????????????????????????????????????1????????????????????????????????????????????????????????????????????????????????????????????????

Nm: ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? (NM_WRONG_PACKAGE)

?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
????????????????????????????????????????????????

import alpha.Foo;

public class A {
    public int f(Foo x) { return 17; }
}
----
import beta.Foo;

public class B extends A {
    public int f(Foo x) { return 42; }
}

????????? B ?????????????????? f(Foo) ??????????????????????????? A ??? f(Foo) ????????????????????????????????????????????????????????? ????????????????????? Foo ??????????????????????????????????????????

QBA: ???????????? boolean ???????????????????????????????????????????????? (QBA_QUESTIONABLE_BOOLEAN_ASSIGNMENT)

????????????????????????if ????????? while ??????????????? boolean ????????? boolean ??????????????? (true ????????? false) ??????????????????????????? ???????????????????????? = ??????????????????????????????== ?????????????????????????????????????????????????????????????????????

RANGE: ???????????????????????????????????? (RANGE_ARRAY_INDEX)

???????????????????????????????????????????????????????????????????????????????????????????????? ArrayIndexOutOfBoundsException ??????????????????????????????

RANGE: ??????????????????????????? (RANGE_ARRAY_LENGTH)

???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ???????????? IndexOutOfBoundsException ??????????????????????????????

RANGE: ????????????????????????????????? (RANGE_ARRAY_OFFSET)

?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ???????????? IndexOutOfBoundsException ??????????????????????????????

RANGE: ??????????????????????????????????????? (RANGE_STRING_INDEX)

??????????????????????????????????????????????????????????????????????????????????????????????????????????????? ???????????? StringIndexOutOfBoundsException ??????????????????????????????

RC: ???????????????????????? (RC_REF_COMPARISON)

???????????????????????? == ????????? != ????????????????????????2?????????????????????????????????????????? ??????????????????????????????????????????????????????????????????????????? equals ????????????????????? ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? == ???????????????????????????????????? ??????????????????????????????????????????????????????????????????????????????java.lang.Integer ???java.lang.Float ???????????????

RCN: ?????????????????????????????? null ???????????? (RCN_REDUNDANT_NULLCHECK_WOULD_HAVE_BEEN_A_NPE)

??????????????? null ?????????????????????????????????????????????????????????????????????????????? null ??????????????????????????????????????? ?????? null ???????????????????????? NullPointerException ???????????????????????????????????? ????????????????????? null ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ???????????????????????????????????????????????????????????????????????????

RE: ??????????????????????????????????????? (RE_BAD_SYNTAX_FOR_REGULAR_EXPRESSION)

???????????????????????????????????????????????????????????????????????????????????????????????????????????? ????????????????????????????????? PatternSyntaxException ????????????????????????

RE: ?????????????????????????????????????????? File.separator (RE_CANT_USE_FILE_SEPARATOR_AS_REGULAR_EXPRESSION)

?????????????????????????????????????????????????????????File.separator ??????????????????????????? ????????? File.separator ???????????????????????????????????? Windows ????????????????????????????????????????????? ???????????????????????????????????????????????????????????????????????????????????????????????? ????????????????????????????????????File.separator ??????????????? File.separatorChar=='\\' ? "\\\\" : File.separator ????????????????????????

RE: ?????????????????????????????????????????? "." ????????? "|" (RE_POSSIBLE_UNINTENDED_PATTERN)

String ????????????????????????????????????"." ????????? "|" ????????????????????????????????????????????????????????????????????????????????? ????????????????????????????????????? ????????????

  • s.replaceAll(".", "/") ??????????????????????????? '/' ???????????????????????? String ?????????
  • s.split(".") ?????????????????????0??? String ???????????????
  • "ab|cd".replaceAll("|", "/") ??????"/a/b/|/c/d/" ?????????
  • "ab|cd".split("|") ??????6????????????????????????????????????: [, a, b, |, c, d]

RV: 0??????1????????????????????????0?????????????????? (RV_01_TO_INT)

0??????1????????????????????????0???????????????????????? ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? Random.nextInt(n) ???????????????????????????????????????????????????

RV: ????????????32??????????????????????????????????????????????????????????????????????????? (RV_ABSOLUTE_VALUE_OF_HASHCODE)

????????????????????????????????????????????????????????????????????????????????????????????? ???????????????????????? Integer.MIN_VALUE ????????????????????????????????? (Math.abs(Integer.MIN_VALUE) == Integer.MIN_VALUE ?????????)???

????????????2^32??????1?????? Integer.MIN_VALUE ????????????????????????????????????????????????polygenelubricants?????????GydZG_?????????DESIGNING WORKHOUSES????????????????????????

RV: ???????????????????????????????????????????????????????????????????????? (RV_ABSOLUTE_VALUE_OF_RANDOM_INT)

??????????????????????????????????????????????????????????????????????????????????????????????????? ????????????????????????????????????????????? Integer.MIN_VALUE ????????????????????????????????? (Math.abs(Integer.MIN_VALUE) == Integer.MIN_VALUE ?????????)??? (??????????????? long ??????????????????????????????)???

RV: compareTo ???????????????????????????????????????????????????????????? (RV_CHECK_COMPARETO_FOR_SPECIFIC_RETURN_VALUE)

?????????????????????compareTo ????????? compare ????????????????????????????????????????????????????????????????????????1?????????-1??? ????????????????????????????????? ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ??????????????????????????? compareTo ????????????????????????-1???0?????????1???????????????????????????????????????????????????????????????

RV: ?????????????????????????????????????????????????????????????????? (RV_EXCEPTION_NOT_THROWN)

??????????????????????????? (??????????????????) ???????????????????????????????????????????????????????????????????????????
????????????????????????????????????????????????

if (x < 0) {
    new IllegalArgumentException("x must be nonnegative");
}

????????????????????????????????????????????????????????????????????????????????????????????????

if (x < 0) {
    throw new IllegalArgumentException("x must be nonnegative");
}

RV: ?????????????????????????????????????????? (RV_RETURN_VALUE_IGNORED)

?????????????????????????????????????????????????????????????????? ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
????????????????????????????????????????????????

String dateString = getHeaderField(name);
dateString.trim();

?????????????????????trim ??????????????? dateString ??????????????????????????? String ???????????????????????????????????????????????????????????? ????????????String ?????????????????????????????????trim ???????????????????????? String ????????????????????????????????????????????????????????? ??????????????????????????????????????????????????????????????????

String dateString = getHeaderField(name);
dateString = dateString.trim();

RpC: ?????????????????????????????? (RpC_REPEATED_CONDITIONAL_TEST)

???????????????????????????????????????2??????????????????1?????????????????????????????????????????????2????????????????????????????????????????????? (???????????????x == 0 || x == 0)??? ?????????2????????????????????????????????????????????????????????????????????? (???????????????x == 0 || y == 0)???

SA: ?????????????????????????????? (SA_FIELD_SELF_ASSIGNMENT)

????????????????????????????????????????????????????????????????????????
????????????????????????????????????????????????

int x;
public void foo() {
    x = x;
}

????????????????????????????????????????????????????????????????????????????????????????????????????????????

SA: ???????????????????????????????????????????????? (SA_FIELD_SELF_COMPARISON)

????????????????????????????????????????????????????????????????????????????????? ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

SA: ?????????????????????????????????????????? (??????????????? x & x) (SA_FIELD_SELF_COMPUTATION)

????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? (???????????????x & x ????????? x - x)??? ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ??????????????????????????????????????????

SA: ??????????????????????????????????????????????????????????????????????????? (SA_LOCAL_SELF_ASSIGNMENT_INSTEAD_OF_FIELD)

?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
????????????????????????????????????????????????

    int foo;
    public void setFoo(int foo) {
        foo = foo;
    }

???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

SA: ??????????????????????????????????????????????????? (SA_LOCAL_SELF_COMPARISON)

????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ????????????????????????????????????????????????????????????????????????

SA: ????????????????????????????????? (???????????????x & x) (SA_LOCAL_SELF_COMPUTATION)

??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? (???????????????x & x ????????? x - x)??? ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ???????????????????????????????????????????????????

SF: switch ???????????????????????????????????????????????????????????????????????? (SF_DEAD_STORE_DUE_TO_SWITCH_FALLTHROUGH)

?????? case ???????????????????????? switch ?????????????????????????????????????????????????????????????????????????????? ?????? case ??????????????? break ????????? return ??????????????????????????????????????????????????????

SF: ??????????????? switch ???????????????????????????????????????????????????????????????????????? (SF_DEAD_STORE_DUE_TO_SWITCH_FALLTHROUGH_TO_THROW)

?????? case ???????????????????????????????????????????????????????????????switch ???????????????????????????????????????????????????????????????????????? ?????? case ??????????????? break ????????? return ??????????????????????????????????????????????????????

SIC: ??? static ??????????????????????????????????????????????????????????????? (SIC_THREADLOCAL_DEADLY_EMBRACE)

????????????????????????????????????????????????????????? static ???????????????????????????????????? ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ?????????????????? static ?????????????????????????????????????????????????????????????????? ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

SIO: instanceof ??????????????????????????????????????????????????? (SIO_SUPERFLUOUS_INSTANCEOF)

?????????????????????????????????????????????????????????????????????????????????????????????????????? instanceof ????????????????????????????????????????????????????????????

SQL: ?????????????????????0??? PreparedStatement ??????????????????????????????????????????????????? (SQL_BAD_PREPARED_STATEMENT_ACCESS)

?????????????????????0??????PreparedStatement ??? setXXX ?????????????????????????????????????????? ?????????????????????1????????????????????????????????????????????????????????????

SQL: ?????????????????????0??? ResultSet ??????????????????????????????????????????????????? (SQL_BAD_RESULTSET_ACCESS)

?????????????????????0??????ResultSet ??? getXXX???updateXXX ?????????????????????????????????????????? ResultSet ????????????????????????1????????????????????????????????????????????????????????????

STI: interrupted ????????????????????????????????????????????? currentThread ???????????????????????????????????? (STI_INTERRUPTED_ON_CURRENTTHREAD)

????????????????????????interrupted ???????????????????????????????????? Thread.currentThread() ?????????????????????????????? interrupted ??????????????? static ????????????????????????Thread.interrupted() ?????????????????????????????????????????????

STI: ????????????????????????????????? static Thread.interrupted() ???????????????????????? (STI_INTERRUPTED_ON_UNKNOWNTHREAD)

????????????????????????????????????????????????????????? Thread ????????????????????????????????????????????? Thread ????????????????????? Thread.interrupted() ?????????????????????????????? interrupted ??????????????? static ??????????????????????????????????????????????????????????????????????????????????????????????????????

Se: ??????????????????????????? private ?????????????????????????????????????????? (SE_METHOD_MUST_BE_PRIVATE)

?????????????????????Serializable ????????????????????????????????????????????????????????????/?????????????????????????????????????????????????????????????????? ????????????????????????????????? private ???????????????????????????????????????????????????/??????????????? API ?????????????????????????????????

Se: readResolve ??????????????? static ?????????????????????????????????????????? (SE_READ_RESOLVE_IS_STATIC)

readResolve ???????????????????????????????????????????????????????????? static ??????????????????????????????????????????????????????

TQ: ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? (TQ_ALWAYS_VALUE_USED_WHERE_NEVER_REQUIRED)

?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

??????????????????when=ALWAYS ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? when=NEVER ????????????????????????????????????????????????

???????????????@NonNegative ???????????????????????????????????? @Negative(when=When.NEVER) ???????????????????????? ????????????????????????return ?????? ???NonNegative ????????????????????? ???Negative ??????????????????????????????????????????????????????????????????????????????????????????

public @NonNegative Integer example(@Negative Integer value) {
    return value;
}

TQ: ???????????????????????????????????????????????? (TQ_COMPARING_VALUES_WITH_INCOMPATIBLE_TYPE_QUALIFIERS)

????????????????????????????????????????????????????????????????????????????????????????????????????????????

??????????????????when=ALWAYS ????????????????????????????????????????????????????????????????????????????????? when=NEVER ?????????????????????????????????????????????

???????????????@NonNegative ???????????????????????????????????? @Negative(when=When.NEVER) ???????????????????????? ????????????????????????return ?????? @NonNegative ????????????????????????@Negative ??????????????????????????????????????????????????????????????????????????????????????????

public boolean example(@Negative Integer value1, @NonNegative Integer value2) {
    return value1.equals(value2);
}

TQ: ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? (TQ_MAYBE_SOURCE_VALUE_REACHES_ALWAYS_SINK)

?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

TQ: ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? (TQ_MAYBE_SOURCE_VALUE_REACHES_NEVER_SINK)

??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

TQ: ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? (TQ_NEVER_VALUE_USED_WHERE_ALWAYS_REQUIRED)

?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

??????????????????when=NEVER ????????????????????????????????????????????????????????????????????????????????? when=ALWAYS ????????????????????????????????????????????????

TQ: ????????????????????????????????????????????????????????????????????????????????? (TQ_UNKNOWN_VALUE_USED_WHERE_ALWAYS_STRICTLY_REQUIRED)

?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

UMAC: ?????????????????????????????????????????????????????????????????????????????? (UMAC_UNCALLABLE_METHOD_OF_ANONYMOUS_CLASS)

???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

UR: ?????????????????????????????????????????????????????????????????????????????????????????? (UR_UNINIT_READ)

?????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

UR: ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? (UR_UNINIT_READ_CALLED_FROM_SUPER_CONSTRUCTOR)

?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

???????????????????????????????????????????????????????????????????????????????????????????????????????????????

abstract class A {
    int hashCode;
    abstract Object getValue();
    
    A() {
        hashCode = getValue().hashCode();
    }
}

class B extends A {
    Object value;

    B(Object v) {
        this.value = v;
    }

    Object getValue() {
        return value;
    }
}

B ???????????????????????????B ??????????????????????????? value ??????????????????????????????A ???????????????????????????????????????????????????????????? ??????????????????A ??????????????????????????? getValue ????????????????????????value ????????????????????????????????????????????????????????????

USELESS_STRING: ???????????????????????? toString ???????????????????????????????????? (DMI_INVOKING_TOSTRING_ON_ANONYMOUS_ARRAY)

??????????????????????????????????????? toString ?????????????????????????????????????????????[C@16f0472????????????????????????????????????????????????????????????????????? ?????????????????????????????????????????????????????????????????????????????? Arrays.toString() ???????????????????????????????????????????????????
???Programming Puzzlers?????????3???????????????12??????????????????????????????

USELESS_STRING: ????????? toString ???????????????????????????????????? (DMI_INVOKING_TOSTRING_ON_ARRAY)

?????????????????????????????? toString ?????????????????????????????????????????????[C@16f0472????????????????????????????????????????????????????????????????????? ?????????????????????????????????????????????????????????????????????????????? Arrays.toString() ???????????????????????????????????????????????????
???Programming Puzzlers?????????3???????????????12??????????????????????????????

USELESS_STRING: ???????????????????????????????????????????????????????????????????????????????????????????????? (VA_FORMAT_STRING_BAD_CONVERSION_FROM_ARRAY)

????????????????????????????????????????????????????????????1????????????????????? [I@304282 ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ????????????????????????????????? Arrays.asList(...) ???????????????????????????????????????????????????????????????????????????

UwF: null ?????????????????????????????????????????? (UWF_NULL_FIELD)

????????????????????????????????? null ??????????????????????????????????????????????????????????????????????????? null ?????????????????? ?????????????????????????????????????????????????????????????????????????????????????????????

UwF: ?????????????????????????????????????????? (UWF_UNWRITTEN_FIELD)

????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ??????????????????????????????????????? (??????????????????????????????????????????????????????)??????????????????????????????????????????????????????

VA: ??????????????????????????????????????????????????????????????????????????????????????????????????? (VA_PRIMITIVE_ARRAY_PASSED_TO_OBJECT_VARARG)

??????????????????????????????????????????????????????????????????????????????????????????????????????????????? ????????????????????????????????????????????????????????????????????????1??????????????????????????????????????????????????????

LG: ????????????????????? OpenJDK ???????????????????????????????????????????????? (LG_LOST_LOGGER_DUE_TO_WEAK_REFERENCE)

OpenJDK ???????????????????????????????????????????????????????????????java.util.logging.Logger ????????????????????????????????????????????? ???????????????????????????????????????????????????????????????????????????????????? ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ????????????????????????????????????????????????????????????????????????????????? ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
???????????????????????????????????????????????????

public static void initLogging() throws Exception {
    Logger logger = Logger.getLogger("edu.umd.cs");
    logger.addHandler(new FileHandler()); // ???????????????????????????
    logger.setUseParentHandlers(false); // ?????????????????????????????????
}

???????????????????????????????????????????????? (?????????????????????????????????) ???????????????????????? initLogging ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????? (???????????? Logger ??????????????????????????????????????????)???

public static void main(String[] args) throws Exception {
    initLogging(); // ??????????????????????????????????????????????????????
    System.gc(); // ?????????????????????????????????
    Logger.getLogger("edu.umd.cs").info("Some message"); // ?????????????????????????????????????????????????????????
}

Ulf Ochsenfahrt ??? Eric Fellheimer

OBL: ??????????????????????????????????????????????????????????????????????????????????????????????????? (OBL_UNSATISFIED_OBLIGATION)

??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? (?????????????????????????????????) ???????????????????????????????????????

??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? try/finally ??????????????????????????????????????????

??????????????????????????????OS_OPEN_STREAM ??? ODR_OPEN_DATABASE_RESOURCE ??????????????????????????????????????? (??????????????????????????????????????????) ????????????????????????????????????????????? ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ????????????????????????????????????????????????????????????????????????

?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

???????????????????????????Weimer ??? Necula ????????? Finding and Preventing Run-Time Error Handling Mistakes ??????????????????????????????

OBL: ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? (OBL_UNSATISFIED_OBLIGATION_EXCEPTION_EDGE)

???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? (?????????????????????????????????) ???????????????????????????????????????

??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? try/finally ??????????????????????????????????????????

??????????????????????????????OS_OPEN_STREAM ??? ODR_OPEN_DATABASE_RESOURCE ??????????????????????????????????????? (??????????????????????????????????????????) ????????????????????????????????????????????? ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ????????????????????????????????????????????????????????????????????????

?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

???????????????????????????Weimer ??? Necula ????????? Finding and Preventing Run-Time Error Handling Mistakes ??????????????????????????????

Dm: ?????????????????????????????? Locale ??????????????????????????????????????? (DM_CONVERT_CASE)

????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ?????????????????????????????????????????????????????????????????????????????????

  • String.toUpperCase(Locale l)
  • String.toLowerCase(Locale l)

Dm: ??????????????????????????????????????????????????? (DM_DEFAULT_ENCODING)

byte ?????? String (????????? String ?????? byte) ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? API ????????????????????????????????????????????? Charset ?????????????????????????????????????????????????????????

DP: doPrivileged ????????????????????????????????????????????????????????? (DP_CREATE_CLASSLOADER_INSIDE_DO_PRIVILEGED)

?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? doPrivileged ???????????????????????????????????????????????????

DP: doPrivileged ???????????????????????????????????????????????? (DP_DO_INSIDE_DO_PRIVILEGED)

??????????????????????????????????????????????????????????????????????????????????????????????????????????????? ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? doPrivileged ?????????????????????????????????????????????????????????

EI: ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? (EI_EXPOSE_REP)

???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

EI2: ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? (EI_EXPOSE_REP2)

?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

FI: ???????????????????????? public ???????????? protected ???????????? (FI_PUBLIC_SHOULD_BE_PROTECTED)

?????????????????? finalize ??????????????? public ???????????????protected ?????????????????????

MS: static ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? (EI_EXPOSE_STATIC_REP2)

?????????????????????static ?????????????????????????????????????????????????????????????????????????????? ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

MS: final ??????????????????????????????????????????????????????????????????????????? (MS_CANNOT_BE_FINAL)

???????????? static ????????????????????????????????????????????????????????????????????????????????????????????????????????? ???????????????????????????????????????????????????????????????????????????

MS: ?????????????????????????????????????????????????????????????????????????????? public static ???????????? (MS_EXPOSE_REP)

public static ?????????????????????????????? ?????????????????????????????????????????????????????????????????? ?????????????????????????????????????????????????????????????????????????????????????????????????????? ?????????????????????????????????????????????????????????

MS: final ????????????????????????????????????????????????????????????????????? (MS_FINAL_PKGPROTECT)

???????????? static ????????????????????????????????????????????????????????????????????????????????????????????????????????? ?????????????????????????????????????????????????????? final ?????????/????????????????????????????????????????????????????????????

MS: ?????????????????????????????? (MS_MUTABLE_ARRAY)

?????? final static ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ??????????????????????????????????????????????????????????????????????????????

MS: ?????????????????????????????????????????? (MS_MUTABLE_COLLECTION)

???????????????????????????????????????????????? final static ??????????????????????????????????????????????????? ?????????????????? ??????????????????????????????????????????????????????????????????????????????????????? ?????????????????????????????? Collections.unmodifiableSet/List/Map ????????????????????????????????????????????????????????????????????????????????????

MS: ?????????????????????????????????????????????????????????????????????????????????????????? (MS_MUTABLE_COLLECTION_PKGPROTECT)

???????????????????????????????????????????????? final static ??????????????????????????????????????????????????? ????????????????????????????????????????????????????????????????????????????????????????????????????????? ?????????????????????????????????????????????????????????????????????????????????????????????????????? ???????????? Collections.unmodifiableSet/List/Map ????????????????????????????????????????????????????????????????????????????????????????????????

MS: ?????? Hashtable ?????????????????? (MS_MUTABLE_HASHTABLE)

?????? final static ?????????????????? Hashtable ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ?????????????????????Hashtable ???????????????????????????????????????????????????

MS: ?????????????????????????????????????????????????????????????????????????????????????????????????????? (MS_OOI_PKGPROTECT)

??????????????????????????????????????? final static ??????????????????????????? Hashtable ???????????????????????????????????????????????????????????? ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

MS: ??????????????????????????????????????????????????????????????? (MS_PKGPROTECT)

???????????? static ????????????????????????????????????????????????????????????????????????????????????????????????????????? ?????????????????????????????????????????????????????????????????????????????????????????????????????????

MS: final ??????????????????????????? (MS_SHOULD_BE_FINAL)

final ????????? public static ????????????????????????????????????????????????????????????????????????????????????????????????????????? ?????????????????????????????????????????????????????? final ???????????????

MS: final ??????????????????????????????????????????????????????????????? (MS_SHOULD_BE_REFACTORED_TO_BE_FINAL)

final ????????? public static ????????????????????????????????????????????????????????????????????????????????????????????????????????? ?????????????????????????????????????????????????????? final ??????????????? ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

AT: ?????????????????????????????????????????????????????????????????????????????????????????? (AT_OPERATION_SEQUENCE_ON_CONCURRENT_ABSTRACTION)

???????????????????????????????????? ???????????????????????????????????????????????? ???????????????????????????????????????????????? ???????????????????????????????????????????????????????????????

DC: ??????????????????????????????????????????????????? (DC_DOUBLECHECK)

?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????Java ??????????????????????????????????????????????????????
????????????http://www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.html ??????????????????????????????

DC: ????????????????????????????????????????????????????????????????????????????????? (DC_PARTIALLY_CONSTRUCTED)

???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ??????????????????????????? volatile ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? volatile ???????????????????????????????????????????????????????????????

DL: Boolean ???????????? (DL_SYNCHRONIZATION_ON_BOOLEAN)

Boolean ????????????????????????????????????????????????????????????????????????????????????????????????

private static Boolean inited = Boolean.FALSE;

synchronized(inited) { 
    if (!inited) {
        init();
        inited = Boolean.TRUE;
    }
}

????????????2?????? Boolean ??????????????????????????????????????????????????? ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

DL: ??????????????????????????????????????????????????????????????????????????????????????????????????????????????? (DL_SYNCHRONIZATION_ON_BOXED_PRIMITIVE)

?????????????????????Integer ????????????????????????????????????????????????????????????????????????????????????????????????

private static Integer count = 0;

synchronized(count) { 
    count++;
}

Integer ??????????????????????????????????????????????????????????????? ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

CERT ??? CON08-J. Do not synchronize on objects that may be reused ??????????????????????????????

DL: ???????????????????????????????????? (DL_SYNCHRONIZATION_ON_SHARED_CONSTANT)

???????????????????????????????????????????????????????????????????????????

private static String LOCK = "LOCK";

synchronized(LOCK) {
    ...
}

????????????????????????????????????Java ???????????????????????????????????????????????????????????????????????????????????????????????? ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
????????????http://www.javalobby.org/java/forums/t96352.html ??? http://jira.codehaus.org/browse/JETTY-352 ??????????????????????????????

DL: ????????????????????????????????????????????????????????? (DL_SYNCHRONIZATION_ON_UNSHARED_BOXED_PRIMITIVE)

????????????????????????????????????????????????????????? Integer ???????????????????????????????????????????????????????????????????????????????????????

private static final Integer fileLock = new Integer(1);

synchronized(fileLock) { 
    .. do something ..
}

????????????????????? fileLock ???????????????????????????????????????????????????????????????

private static final Object fileLock = new Object();

?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ???????????????IntelliJ ??? "Remove Boxing" ??????????????????????????????????????? Java ???????????????????????????????????????????????????????????? Integer ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

Dm: Condition ??? wait ???????????????????????????????????? (DM_MONITOR_WAIT_ON_CONDITION)

????????????????????????java.util.concurrent.locks.Condition ????????????????????? wait ?????????????????????????????????????????? Condition ???????????????????????????????????????????????? Condition ??????????????????????????????????????? await ??????????????????????????????????????????

Dm: ???????????????????????? run ?????????????????????????????????????????????????????? (DM_USELESS_THREAD)

????????????????????????Thread ??????????????????????????? run ??????????????????????????????????????????Runnable ????????????????????????????????????????????????????????????????????????????????? ????????????????????????????????????????????????

ESync: ?????? synchronized ???????????? (ESync_EMPTY_SYNC)

??????????????????????????? synchronized ??????????????????????????????

synchronized() {
}

?????? synchronized ?????????????????????????????????????????????????????????????????? ?????? synchronized ????????????????????????????????????????????????????????????????????????????????????

IS: ??????????????????????????? (IS2_INCONSISTENT_SYNC)

???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

  • ?????????????????????????????????????????????????????????????????????????????????????????????????????????
  • ???????????????javax.annotation.concurrent.NotThreadSafe ???????????????????????????????????????
  • ???????????????1????????????????????????????????????????????????????????????????????????1??????????????????????????????
  • ???????????????2???????????????????????????????????????????????????????????????????????????????????? (???????????????????????????) ??????????????????????????????????????????1/3

???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

?????????????????????????????????????????????????????????????????????????????????????????????????????? ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

IS: ???????????????????????????????????????????????????????????????????????? (IS_FIELD_NOT_GUARDED)

???????????????????????????net.jcip.annotations.GuardedBy ????????? javax.annotation.concurrent.GuardedBy ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

JLM: Lock ???????????????????????? (JLM_JSR166_LOCK_MONITORENTER)

????????????????????????java.util.concurrent.locks.Lock ??????????????????????????????????????????????????????????????? ???????????????????????????????????? synchronized (...) ??????????????? acquire()/release() ????????????????????????????????????????????????????????????

JLM: java.util.concurrent ????????????????????????????????????????????? (JLM_JSR166_UTILCONCURRENT_MONITORENTER)

????????????????????????java.util.concurrent ??????????????????????????? (????????????????????????) ??????????????????????????????????????????????????? ????????????????????????????????????????????????synchronized ???????????????????????????????????????????????????????????????????????????????????????????????????????????? ???????????????AtomicBoolean ?????????????????????????????????????????? AtomicBoolean ???????????????????????????????????????

?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

JLM: util.concurrent ????????????????????????????????? wait ????????????????????????????????? (JML_JSR166_CALLING_WAIT_RATHER_THAN_AWAIT)

????????????????????????await() ???????????????signal ???????????????signalAll ????????????????????????????????????????????? (???????????????util.concurrent ??? Condition ??????????????????) ??????wait ???????????????notify ???????????????notifyAll ?????????????????????????????????????????? ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

LI: static ????????????????????????????????????????????? (LI_LAZY_INIT_STATIC)

????????????????????????volatile ????????? static ??????????????????????????????????????????????????????????????? ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ????????????????????????????????????????????????????????????????????????????????????????????????????????? ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ?????????????????????????????????????????????????????? volatile ??????????????????
????????????Java Memory Model web site ??????????????????????????????

LI: ??????????????? static ????????????????????????????????????????????? (LI_LAZY_INIT_UPDATE_STATIC)

????????????????????????static ??????????????????????????????????????????????????????????????? ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

?????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? static ????????????????????????????????????????????????????????????????????????

ML: ???????????????????????????????????????????????????????????????????????? (ML_SYNC_ON_FIELD_TO_GUARD_CHANGING_THAT_FIELD)

???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ??????????????????????????????????????????????????????????????????????????????????????? ????????????????????? (????????????????????????) ????????????????????????????????????????????????????????????????????????????????????
????????????????????????????????????????????????????????????

private Long myNtfSeqNbrCounter = new Long(0);
private Long getNotificationSequenceNumber() {
     Long result = null;
     synchronized(myNtfSeqNbrCounter) {
         result = new Long(myNtfSeqNbrCounter.longValue() + 1);
         myNtfSeqNbrCounter = new Long(result.longValue());
     }
     return result;
}

ML: ?????????????????????????????????????????????????????????????????? (ML_SYNC_ON_UPDATED_FIELD)

?????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

MSF: ??????????????????????????????????????? (MSF_MUTABLE_SERVLET_FIELD)

Web ???????????????????????????????????????????????? JSP ?????????????????????????????????1???????????????????????? (??????????????????????????????????????????????????????)??? ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ???????????????????????????????????????????????????????????????????????????????????????????????????

MWN: ???????????? notify ???????????? (MWN_MISMATCHED_NOTIFY)

????????????????????????????????????????????????????????????????????????????????????????????? Object.notify() ??? Object.notifyAll() ?????????????????????????????? ?????????????????????????????????????????????notify ??????????????? notifyAll ???????????????????????????????????????IllegalMonitorStateException ??????????????????????????????????????????

MWN: ???????????? wait ???????????? (MWN_MISMATCHED_WAIT)

????????????????????????????????????????????????????????????????????????????????????????????????Object.wait() ?????????????????????????????? ?????????????????????????????????????????????wait ???????????????????????????????????????IllegalMonitorStateException ??????????????????????????????????????????

NN: ?????? notify ???????????? (NN_NAKED_NOTIFY)

notify ????????????????????? notifyAll ??????????????????????????????????????????????????????????????????????????? (????????????) ????????????????????????????????????????????????????????? ??????????????????????????????????????????????????????????????????????????????????????????????????????????????? notify ??????????????????????????????????????? ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

NP: ??????????????????????????????????????? null ???????????? (NP_SYNC_AND_NULL_CHECK_FIELD)

???????????????????????????????????????????????????????????? null ????????????????????????????????? null ??????????????????????????????????????? NullPointerException ??????????????????????????????null ?????????????????????????????????????????? ???????????????????????????????????????????????????????????????

No: notifyAll ???????????????????????? notify ????????????????????????????????? (NO_NOTIFY_NOT_NOTIFYALL)

????????????????????????notifyAll ???????????????????????? notify ?????????????????????????????????????????? ???????????????????????????????????????????????????????????????????????? notify ??????????????????????????????1??????????????????????????????????????????????????????????????????????????????????????????????????????????????????1??????????????????????????????????????????????????????????????????

RS: readObject ????????????????????????????????????????????? (RS_READOBJECT_SYNC)

???????????????????????????????????????????????? readObject ???????????? ?????????????????????????????? ???????????????????????????????????????????????????????????????1????????????????????????????????????????????????????????? ??????????????????readObject ????????????????????????????????????????????????????????? readObject ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

RV: putIfAbsent ?????????????????????????????? putIfAbsent ???????????????????????????????????? (RV_RETURN_VALUE_OF_PUTIFABSENT_IGNORED)

putIfAbsent ??????????????????1????????????????????????????????? (???????????????????????????????????????????????????) ??????????????????????????????????????????????????????????????? ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????1???????????????????????????????????????????????????????????? ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

Ru: ??????????????? run ???????????????????????????????????? (RU_INVOKE_RUN)

??????????????????????????????????????? ???????????? run ?????????????????????????????????????????? ????????????????????????????????????????????????????????? run ???????????????????????????????????????????????? Runnable ?????????????????????????????????????????? ??????????????????Thread.start() ???????????????????????????????????????

SC: Thread.start() ????????????????????????????????????????????? (SC_START_IN_CTOR)

???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

SP: ????????????????????????????????????????????? (SP_SPIN_ON_FIELD)

??????????????????????????????????????????????????????????????????????????????????????? ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ?????????????????? (wait/notify ??????????????????????????????) ?????????????????????????????????????????????????????????

STCAL: static Calendar ??????????????? (STCAL_INVOKE_ON_STATIC_CALENDAR_INSTANCE)

????????? JavaDoc ?????????????????????????????????????????????????????????Calendar ????????????????????????????????????????????????????????????????????????????????? ?????????????????????static ????????????????????????????????? Calendar ???????????????????????????????????????????????????????????? ???????????????????????????????????? ????????????????????????Sun Bug #6231579 ??? Sun Bug #6178997 ??????????????????????????????

STCAL: static DateFormat ??????????????? (STCAL_INVOKE_ON_STATIC_DATE_FORMAT_INSTANCE)

JavaDoc ?????????????????????????????? DateFormat ????????????????????????????????????????????????????????????????????????????????? ?????????????????????static ????????????????????????????????? DateFormat ???????????????????????????????????????????????????????????? ???????????????????????????????????? ????????????????????????Sun Bug #6231579 ??? Sun Bug #6178997 ??????????????????????????????

STCAL: static Calendar ??????????????? (STCAL_STATIC_CALENDAR_INSTANCE)

????????? JavaDoc ?????????????????????????????????????????????????????????Calendar ?????????????????????????????????????????????????????????????????????????????? ??????????????????????????????????????????????????????????????????1????????????????????????????????????????????????????????????????????????????????????????????????????????? JDK 5.0???????????? JDK 1.4 ????????????????????????????????????????????????????????????????????? sun.util.calendar.BaseCalendar.getCalendarDateFromFixedDate() ??? ArrayIndexOutOfBoundsExceptions ??? IndexOutOfBoundsExceptions ???????????????????????????????????? ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
????????????????????????Sun Bug #6231579 ??? Sun Bug #6178997 ??????????????????????????????

STCAL: static DateFormat (STCAL_STATIC_SIMPLE_DATE_FORMAT_INSTANCE)

JavaDoc ?????????????????????????????? DateFormat ????????????????????????????????????????????????????????????????????????????????? ??????????????????????????????????????????????????????????????????1????????????????????????????????????????????????????????????????????????????????????????????????????????? JDK 5.0???????????? JDK 1.4 ????????????????????????????????????????????????????????????????????? sun.util.calendar.BaseCalendar.getCalendarDateFromFixedDate() ??? ArrayIndexOutOfBoundsExceptions ??? IndexOutOfBoundsExceptions ???????????????????????????????????? ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
????????????????????????Sun Bug #6231579 ??? Sun Bug #6178997 ??????????????????????????????

SWL: ???????????????????????? Thread.sleep() ???????????????????????????????????? (SWL_SLEEP_WITH_LOCK_HELD)

???????????????????????????????????????????????????Thread.sleep() ?????????????????????????????? ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ???????????? wait ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

TLW: 2???????????????????????????????????? wait ???????????????????????????????????? (TLW_TWO_LOCK_WAIT)

2????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? wait ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ?????????????????????????????????????????????????????????????????????????????????????????????

UG: ???????????????????????? get ???????????????????????????????????? set ???????????? (UG_SYNC_SET_UNSYNC_GET)

?????????????????????????????????????????? get ??????????????? set ????????????????????????set ???????????????????????????????????????get ????????????????????????????????????????????? get ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? get ?????????????????????????????????????????????

UL: ??????????????????????????????????????????????????????????????? (UL_UNRELEASED_LOCK)

????????????????????????JSR-166(java.util.concurrent) ??????????????????????????????????????????????????????????????????????????????????????????????????????????????? ???????????? JSR-166????????????????????????????????????????????????????????????????????????????????????????????????

Lock l = ...;
l.lock();
try {
    // do something
} finally {
    l.unlock();
}

UL: ????????????????????????????????????????????????????????????????????? (UL_UNRELEASED_LOCK_EXCEPTION_PATH)

????????????????????????JSR-166(java.util.concurrent) ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ???????????? JSR-166????????????????????????????????????????????????????????????????????????????????????????????????

Lock l = ...;
l.lock();
try {
    // do something
} finally {
    l.unlock();
}

UW: wait ???????????????????????????????????? (UW_UNCOND_WAIT)

?????????????????????????????????????????????????????????????????????????????? java.lang.Object.wait() ????????????????????????????????? ?????????????????????wait ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ?????????????????????????????????????????????

VO: volatile ???????????????????????????????????????????????????????????????????????? (VO_VOLATILE_INCREMENT)

?????????????????????volatile ????????????????????????????????????????????????????????? volatile ????????????????????????????????????????????????????????????????????????????????? ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

VO: ???????????? volatile ??????????????????????????? volatile ????????????????????? (VO_VOLATILE_REFERENCE_TO_ARRAY)

????????? volatile ???????????????????????????????????????????????????????????????????????????????????????????????? ???????????? volatile ??????????????????????????????????????????????????????????????? volatile ????????????????????????????????????????????? volatile ?????????????????????????????? ??????????????? volatile ???????????????????????????????????????J2SE 5.0?????????????????? java.util.concurrent ???????????????????????????????????????????????????????????????????????????????????????

WL: ????????????????????????????????? getClass ???????????????????????? (WL_USING_GETCLASS_RATHER_THAN_CLASS_LITERAL)

??????????????????????????????????????????this.getClass() ?????????????????????????????? ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ???????????????java.awt.Label ???????????????????????????????????????????????????

private static final String base = "label";
private static int nameCounter = 0;

String constructComponentName() {
    synchronized (getClass()) {
        return base + nameCounter++;
    }
}

Label ??????????????????????????????????????????????????????????????????????????????????????????????????????????????? ????????????????????????????????????Label.class ?????????????????????????????????

private static final String base = "label";
private static int nameCounter = 0;

String constructComponentName() {
    synchronized (Label.class) {
        return base + nameCounter++;
    }
}

Jason Mehrens ?????????????????????????????????????????????

WS: writeObject ??????????????????????????????????????????????????????????????????????????????????????????????????? (WS_WRITEOBJECT_SYNC)

?????????????????????????????????????????? writeObject ?????????????????????????????? ??????????????????????????????????????????????????????????????????????????????????????????

Wa: Condition.await() ??????????????????????????? (WA_AWAIT_NOT_IN_LOOP)

???????????????????????????????????????????????? java.util.concurrent.await() (????????????????????????????????????) ?????????????????????????????? ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

Wa: wait ??????????????????????????????????????? (WA_NOT_IN_LOOP)

???????????????????????????????????????????????? java.lang.Object.wait() ?????????????????????????????? ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

Bx: ?????????????????????????????????????????????????????????????????????????????????????????? (BX_BOXING_IMMEDIATELY_UNBOXED)

???????????????????????????????????????????????????????????????????????????????????????????????? ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ?????????????????????????????????????????????????????????????????????????????????????????????????????????

Bx: ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? (BX_BOXING_IMMEDIATELY_UNBOXED_TO_PERFORM_COERCION)

??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? (???????????? new Double(d).intValue())??? ?????????????????????????????????????????????????????????????????? (???????????? (int) d)???

Bx: ????????????????????????3??????????????????????????????????????????????????????????????????????????? (BX_UNBOXED_AND_COERCED_FOR_TERNARY_OPERATOR)

?????????????????????????????????????????????3???????????? ( b ? e1 : e2) ??????????????????????????????????????????????????????????????????????????????????????????????????????????????? Java ?????????????????????e1 ??? e2 ?????????????????????????????????????????????????????????????????????????????????????????????/????????????????????? (???????????????e1 ??? Integer ??????e2 ??? Float ?????? e1 ???????????????????????? (int ?????????) ?????????float ????????????????????????????????? (Float ?????????) ????????????)??? JLS ???????????????15.25??????????????????????????????

Bx: ??????????????????????????????????????????????????????????????????????????????????????????????????? (BX_UNBOXING_IMMEDIATELY_REBOXED)

?????????????????????????????????????????????????????????????????????????????????????????????????????????

Bx: ???????????????????????????????????????????????????????????? (DM_BOXED_PRIMITIVE_FOR_COMPARE)

??????????????????????????????????????????????????? compareTo ???????????????????????????????????????????????????????????? ????????????????????????????????? static compare ???????????? (double ??????float ??? Java 1.4??????????????????????????????????????? Java 1.7??????) ??????????????????????????????????????????

Bx: ???????????????/????????????????????????????????????????????????????????? (DM_BOXED_PRIMITIVE_FOR_PARSING)

????????????????????????????????????????????????String ?????????????????????????????????????????????????????????????????????????????????????????????????????? static parseXXX ???????????????????????????????????????????????????

Bx: toString ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? (DM_BOXED_PRIMITIVE_TOSTRING)

toString ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ?????????????????????????????????????????????????????? static ??? toString ??????????????????????????????????????????????????????

??????????????????
new Integer(1).toString()Integer.toString(1)
new Long(1).toString()Long.toString(1)
new Float(1.0).toString()Float.toString(1.0)
new Double(1.0).toString()Double.toString(1.0)
new Byte(1).toString()Byte.toString(1)
new Short(1).toString()Short.toString(1)
new Boolean(true).toString()Boolean.toString(true)

Bx: ?????????????????????????????? Number ????????????????????????????????????????????????????????? (DM_FP_NUMBER_CTOR)

new Double(double) ?????????????????????????????????????????????????????????????????????????????????????????? ?????????????????????Double.valueOf(double) ???????????????????????????????????????????????????Java ?????????????????????????????????????????????????????? ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

???????????? J2SE 5.0???????????? Java ??????????????????????????????????????????????????????????????????????????? Double???Float ??? valueOf ??????????????????????????????????????????

Bx: ??????????????? Number ????????????????????????????????????????????????????????? (DM_NUMBER_CTOR)

new Integer(int) ?????????????????????????????????????????????????????????????????????????????????????????? ?????????????????????Integer.valueOf(int) ???????????????????????????????????????????????????Java ?????????????????????????????????????????????????????? ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

-128??????127?????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ????????????valueOf ????????????????????????????????????????????????????????????????????????3.5?????????????????? ???????????????????????????????????????????????????????????????????????????

???????????? J2SE 5.0???????????? Java ????????????????????????????????????????????????Long???Integer???Short???Character???Byte ??????????????????????????????????????????????????????????????????????????? valueOf ??????????????????????????????????????????

Dm: URL ??? equals ??????????????? hashCode ????????????????????????????????? (DMI_BLOCKING_METHODS_ON_URL)

URL ??? equals ??????????????? hashCode ???????????????????????????????????????????????????????????????????????????????????????????????????????????????
????????????http://michaelscharf.blogspot.com/2006/11/javaneturlequals-and-hashcode-make.html ??????????????????????????????
?????????????????? java.net.URI ???????????????????????????????????????????????????

Dm: URL ??? Map ??? Set ??????????????????????????? (DMI_COLLECTION_OF_URLS)

????????????????????????????????????????????????URL ??? Map ??? Set ??????????????????????????? URL ??? equals ??? hashCode ?????????????????????????????????????????????????????????????????????????????????
????????????http://michaelscharf.blogspot.com/2006/11/javaneturlequals-and-hashcode-make.html ??????????????????????????????
?????????????????? java.net.URI ???????????????????????????????????????????????????

Dm: ??????????????? Boolean ????????????????????????????????????????????????????????? (DM_BOOLEAN_CTOR)

java.lang.Boolean ?????????????????????????????????????????????????????????????????????????????? Boolean ?????????????????????????????????2?????????????????? (Boolean.TRUE ??? Boolean.FALSE) ?????????????????? ?????????????????? Boolean.valueOf ???????????? (????????? J2SE 5.0 ???????????????????????????) ??????????????? Boolean ????????????????????????????????????????????????

Dm: ?????????????????????????????????????????? (DM_GC)

??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

????????????close ??????????????? finalize ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

Dm: ?????????????????????????????????????????????????????????????????????????????????????????????????????? (DM_NEW_FOR_GETCLASS)

???????????????????????????????????????????????????????????????????????????????????????????????? getClass ?????????????????????????????????????????? ????????????????????? (Foo.class) ?????????????????????????????????

Dm: ?????????????????????????????????????????? nextDouble ???????????? ???????????? nextInt ??????????????????????????? (DM_NEXTINT_VIA_NEXTDOUBLE)

java.util.Random ????????????????????? r ??????0 ?????? n-1 ?????????????????????????????????????????????(int)(r.nextDouble() * n) ???????????? r.nextInt(n) ?????????????????????

nextInt ?????????????????????????????????????????????????????????????????? ???????????????-99??????0??????????????????????????????????????????-r.nextInt(100) ??????????????????????????????

Dm: ??????????????? new String(String) ????????????????????????????????????????????????????????? (DM_STRING_CTOR)

new String(String) ??????????????????????????????????????????????????????????????? ????????????????????????????????????????????????????????? ???????????????????????????????????? String ??????????????????????????????????????????????????? ????????? String ??????????????????????????????????????????

Dm: String ??? toString ???????????????????????????????????????????????? (DM_STRING_TOSTRING)

String.toString() ????????????????????????????????????String ??????????????????????????????

Dm: ??????????????? new String() ????????????????????????????????????????????????????????? (DM_STRING_VOID_CTOR)

??????????????????????????????????????????????????????????????? java.lang.String() ?????????????????????????????????????????????????????????????????? ?????????????????????????????????????????????????????????????????????????????? "" ??????????????????????????????????????????????????? Java??????????????????????????????????????? String ????????????????????????????????????????????????????????????????????? ???????????????????????????????????????????????????????????????????????????

HSC: ?????????????????????????????????????????????????????????????????????????????????????????? (HSC_HUGE_SHARED_STRING_CONSTANT)

??????????????????????????????????????????????????????????????????????????????????????????????????? final ??????????????????????????????????????????????????????Java ?????????????????????????????????????????? final ????????????????????????????????????????????????????????????????????????????????????????????????????????????

JDK ??????????????????????????????????????????1MB????????????????????????????????????
????????????JDK bug 6447475 ??????????????????????????????

SBSC: ?????????????????? + ????????????????????????????????????????????????????????? (SBSC_USE_STRINGBUFFER_CONCATENATION)

?????????????????????????????????????????? + ??????????????? String ?????????????????????????????????????????? ????????????????????????????????????String ??? StringBuffer/StringBuilder ???????????????????????????String ???????????????????????? ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

StringBuffer (????????? J2SE 5.0??? StringBuilder) ???????????????????????????????????????????????????????????????

???????????????

// This is bad
String s = "";
for (int i = 0; i < field.length; ++i) {
    s = s + field[i];
}

// This is better
StringBuffer buf = new StringBuffer();
for (int i = 0; i < field.length; ++i) {
    buf.append(field[i]);
}
String s = buf.toString();

SIC: static ??????????????????????????? (SIC_INNER_SHOULD_BE_STATIC)

????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ??????????????????????????? static ?????????????????????

SIC: ???????????? static ????????????????????????????????????????????????????????????????????? (SIC_INNER_SHOULD_BE_STATIC_ANON)

????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ??????????????????????????? static ???????????????????????????????????? ???????????????????????? static ????????????????????????????????????????????????????????????????????????????????????????????????????????????

SIC: static ????????????????????????????????????????????????????????????????????? (SIC_INNER_SHOULD_BE_STATIC_NEEDS_THIS)

????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ??????????????????????????? static ???????????????????????????????????? ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

SS: ???????????????????????????????????? (SS_SHOULD_BE_STATIC)

????????????????????????????????????????????????????????????????????????????????????????????? final ????????????????????????????????? static ????????????????????????????????????????????????????????????

UM: ???????????? Math ???????????? static ???????????????????????????????????????????????? (UM_UNNECESSARY_MATH)

???????????????????????????????????? java.lang.Math ??? static ?????????????????????????????????????????? ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
????????????????????????????????????????????????????????????

???????????? ???????????????
abs -any-
acos 0.0 or 1.0
asin 0.0 or 1.0
atan 0.0 or 1.0
atan2 0.0
cbrt 0.0 or 1.0
ceil -any-
cos 0.0
cosh 0.0
exp 0.0 or 1.0
expm1 0.0
floor -any-
log 0.0 or 1.0
log10 0.0 or 1.0
rint -any-
round -any-
sin 0.0
sinh 0.0
sqrt 0.0 or 1.0
tan 0.0
tanh 0.0
toDegrees 0.0 or 1.0
toRadians 0.0

UPM: private ????????????????????????????????????????????? (UPM_UNCALLED_PRIVATE_METHOD)

?????? private ?????????????????????????????????????????????????????? ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

UrF: ???????????????????????????????????? (URF_UNREAD_FIELD)

???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

UuF: ??????????????????????????? (UUF_UNUSED_FIELD)

?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

WMI: entrySet ?????????????????????????????????????????? keySet ???????????????????????????????????? (WMI_WRONG_MAP_ITERATOR)

????????????????????????keySet ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? Map ??? entrySet ??????????????????????????????????????? Map.get(key) ???????????????????????????????????????????????????????????????

Dm: ?????????????????????????????????????????????????????????????????? (DMI_CONSTANT_DB_PASSWORD)

??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

Dm: ??????????????????????????????????????? (DMI_EMPTY_DB_PASSWORD)

??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ???????????????????????????????????????????????????????????????????????????????????????????????????????????????

HRS: ????????????????????????????????????????????? HTTP cookie (HRS_REQUEST_PARAMETER_TO_COOKIE)

???????????????????????????????????? HTTP ?????????????????????????????? HTTP ??????????????????????????????????????? ????????????????????? HTTP ??????????????????????????????????????????HRS(HTTP ???????????????????????????????????????) ?????????????????????????????????
????????????http://en.wikipedia.org/wiki/HTTP_response_splitting ??????????????????????????????

FindBugs ??????HRS ???????????????????????????????????????????????????????????? FindBugs ??????????????????????????????????????????????????? FindBugs ?????????????????????????????????????????????????????????????????? HRS ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

HRS: HTTP ???????????????????????????????????????????????? (HRS_REQUEST_PARAMETER_TO_HTTP_HEADER)

?????????????????????HTTP ???????????? HTTP ???????????????????????????????????????????????????????????? HRS(HTTP ???????????????????????????????????????) ?????????????????????????????????
????????????http://en.wikipedia.org/wiki/HTTP_response_splitting ??????????????????????????????

FindBugs ??????HRS ???????????????????????????????????????????????????????????? FindBugs ??????????????????????????????????????????????????? FindBugs ?????????????????????????????????????????????????????????????????? HRS ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

PT: ??????????????????????????????????????????????????? (PT_ABSOLUTE_PATH_TRAVERSAL)

????????????????????????????????????????????????????????????????????????????????????????????????????????????HTTP??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????/abs/path???????????????????????????????????????????????????????????????????????????????????? ????????????http://cwe.mitre.org/data/definitions/36.html ??????????????????????????????

FindBugs ???????????????????????????????????????????????????????????????????????????????????????????????? FindBugs ??????????????????????????????????????????????????? FindBugs ?????????????????????????????????????????????????????????????????? ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

PT: ??????????????????????????????????????????????????? (PT_RELATIVE_PATH_TRAVERSAL)

????????????????????????????????????????????????????????????????????????????????????????????????????????????HTTP??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????..???????????????????????????????????????????????????????????????????????? ????????????http://cwe.mitre.org/data/definitions/23.html ??????????????????????????????

FindBugs ???????????????????????????????????????????????????????????????????????????????????????????????? FindBugs ??????????????????????????????????????????????????? FindBugs ?????????????????????????????????????????????????????????????????? ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

SQL: SQL ??? Statement ??? execute ????????? addBatch ????????????????????????????????????????????????????????? (SQL_NONCONSTANT_STRING_PASSED_TO_EXECUTE)

???????????????????????????????????????????????????????????????????????????????????? SQL ??? ??? execute ????????? addBatch ?????????????????????????????????????????? ?????????????????? PreparedStatement ??????????????????????????????????????????????????? ???????????????SQL ????????????????????????????????????????????????

SQL: PreparedStatement ?????????????????????????????????????????????????????? (SQL_PREPARED_STATEMENT_GENERATED_FROM_NONCONSTANT_STRING)

??????????????????????????????????????????????????? SQL ??? PreparedStatement ??????????????????????????? ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????PreparedStatement ????????????????????????????????????????????????????????? SQL ??????????????????????????????????????????????????????????????????

XSS: ????????????????????????????????????????????????????????????????????? JSP (XSS_REQUEST_PARAMETER_TO_JSP_WRITER)

?????????????????????JSP ???????????? HTTP ???????????????????????????????????????????????????????????? XSS(??????????????????????????????????????????) ?????????????????????????????????
????????????http://en.wikipedia.org/wiki/Cross-site_scripting ??????????????????????????????

FindBugs ??????XSS ???????????????????????????????????????????????????????????? FindBugs ??????????????????????????????????????????????????? FindBugs ?????????????????????????????????????????????????????????????????? XSS ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

XSS: ???????????????????????????????????????????????????????????????????????????????????????????????????????????? (XSS_REQUEST_PARAMETER_TO_SEND_ERROR)

??????????????????????????????????????????????????????????????? HttpServletResponse.sendError ??????????????? HTTP ??????????????????????????????????????????????????? ??????????????????????????????????????????????????? XSS(??????????????????????????????????????????) ?????????????????????????????????
????????????http://en.wikipedia.org/wiki/Cross-site_scripting ??????????????????????????????

FindBugs ??????XSS ???????????????????????????????????????????????????????????? FindBugs ??????????????????????????????????????????????????? FindBugs ?????????????????????????????????????????????????????????????????? XSS ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

XSS: ??????????????????????????????????????????????????????????????????????????????????????? (XSS_REQUEST_PARAMETER_TO_SERVLET_WRITER)

??????????????????????????????????????????????????? HTTP ????????????????????????????????????????????????????????????????????? XSS(??????????????????????????????????????????) ?????????????????????????????????
????????????http://en.wikipedia.org/wiki/Cross-site_scripting ??????????????????????????????

FindBugs ??????XSS ???????????????????????????????????????????????????????????? FindBugs ??????????????????????????????????????????????????? FindBugs ?????????????????????????????????????????????????????????????????? XSS ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

BC: ?????????????????????????????????????????????????????? (BC_BAD_CAST_TO_ABSTRACT_COLLECTION)

?????????????????????Collection ????????????????????????????????????????????????????????? (???????????? List???Set???Map)??? ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ?????????????????????????????????????????????????????????????????? Set ????????? List ????????????????????????????????????????????????

BC: ?????????????????????????????????????????????????????? (BC_BAD_CAST_TO_CONCRETE_COLLECTION)

?????????????????????????????????????????? (???????????????Collection???List???Set) ???????????????????????? (???????????????ArrayList???HashSet) ????????????????????????????????? ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

BC: ???????????????/???????????????????????? (BC_UNCONFIRMED_CAST)

??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????

BC: ????????????????????????????????????????????????/???????????????????????? (BC_UNCONFIRMED_CAST_OF_RETURN_VALUE)

??????????????????????????????????????????????????????????????????????????????????????????????????? ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????FindBugs ?????????????????????????????????????????????????????????????????? ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????

BC: ?????? true ????????? instanceof (BC_VACUOUS_INSTANCEOF)

?????? instanceof ????????? true ??????????????? (??????????????????????????? null ??????????????????)??? ????????????????????????????????????????????????????????????????????????????????????????????????????????? ????????? null ???????????????????????????????????????????????????instanceof ???????????? null ??????????????????????????????????????????????????????????????????

BSHIFT: ??????????????????????????? short/byte ??????????????????????????? (ICAST_QUESTIONABLE_UNSIGNED_RIGHT_SHIFT)

??????????????????????????????????????????????????????????????? short ????????? byte ????????????????????????????????????????????????????????????????????????????????? ????????????????????????????????????????????????????????????????????????????????? (?????????????????????????????????) ?????????????????????????????????????????????

CI: final ??????????????? protected ???????????????????????????????????? (CI_CONFUSED_INHERITANCE)

?????????????????????final ??????????????????????????????????????????????????? protected ?????????????????????????????? ???????????? fainal ????????????????????????????????????protected ???????????????????????????????????? ?????????????????????????????????????????????????????????????????????????????????????????????????????? private ??? public ??????????????????????????????

DB: 2???????????????????????????????????????????????????????????????????????? (DB_DUPLICATE_BRANCHES)

???????????????????????????????????????2???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

DB: switch ??????2?????? case ???????????????????????????????????????????????????????????? (DB_DUPLICATE_SWITCH_CLAUSES)

????????????????????????switch ??????2?????? case ?????????????????????????????????????????????????????????????????? ?????????????????? case ????????????????????????????????????????????????????????????????????????

DLS: ??????????????????????????????????????? (DLS_DEAD_LOCAL_STORE)

????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ?????????????????????????????????????????????????????????????????????????????????????????????????????????

Sun ??? javac ?????????????????? final ??????????????????????????????????????????????????????????????????????????????????????????????????????????????? FindBugs ???????????????????????????????????????????????????????????????????????????????????????????????????????????????

DLS: return ??????????????????????????????????????? (DLS_DEAD_LOCAL_STORE_IN_RETURN)

???????????????return ???????????????????????????????????????????????????????????????????????????????????????????????? ?????????????????????????????????????????????????????????

DLS: ????????????????????????????????? null ?????? (DLS_DEAD_LOCAL_STORE_OF_NULL)

??????????????????????????????????????? null ????????????????????????????????????????????????????????????????????????????????? ?????????????????????????????????????????????????????????????????????????????????????????????????????????Java SE 6 ?????????????????????????????????????????????????????????????????????

DLS: ??????????????????????????????????????????????????????????????? (DLS_DEAD_LOCAL_STORE_SHADOWS_FIELD)

???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ????????????????????????????????????????????????????????????????????????????????????????????????????????? ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

DMI: ??????????????????????????????????????????????????????????????? (DMI_HARDCODED_ABSOLUTE_FILENAME)

?????????????????????????????????????????????????????????????????????????????? File ?????????????????????????????????????????? (???????????? new File("/home/dannyc/workspace/j2ee/src/share/com/sun/enterprise/deployment");)???

DMI: ObjectOutput ????????????????????????????????????????????????????????? (DMI_NONSERIALIZABLE_OBJECT_WRITTEN)

?????????????????????ObjectOutput.writeObject ?????????????????????????????????????????????????????????????????????????????? ??????????????????????????????????????????????????????????????????????????????????????????

DMI: substring(0) ???????????????????????????????????? (DMI_USELESS_SUBSTRING)

????????????????????????????????? substring(0) ????????????????????????????????????????????????????????????

Dm: Thread ????????????????????? Runnable ?????????????????????????????????????????????????????? (DMI_THREAD_PASSED_WHERE_RUNNABLE_EXPECTED)

Thread????????????????????? Runnable ?????????????????????????????????????????????????????????????????????????????????????????? ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

Eq: ???????????????????????? equals ???????????????????????????????????????????????????????????? (EQ_DOESNT_OVERRIDE_EQUALS)

?????????????????????equals ??????????????????????????????????????????????????????????????????????????????????????????????????????equals ?????????????????????????????????????????? ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ?????????????????????????????????????????????equals ???????????????????????????????????????????????????????????????????????????????????????????????? ????????? equals ??????????????????????????????????????????????????????????????????????????????????????????????????? equals ??????????????? super.equals(o) ?????????????????????????????????????????????????????????????????????????????????????????????equals ??????????????????????????????????????????????????????????????????????????????

Eq: ????????? equals ???????????? (EQ_UNUSUAL)

?????????????????? equals ????????????????????????????????? this ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????

FE: ???????????????????????????????????????????????? (FE_FLOATING_POINT_EQUALITY)

???????????????????????????????????????2??????????????????????????????????????????????????? ????????????????????????????????????????????????????????????????????????????????? float ??? double ??????????????????????????????????????????????????? ?????????????????????????????????????????????????????????????????? BigDecimal ?????????????????????????????????????????????????????????????????????????????? ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ???????????????if (Math.abs(x - y) < .0000001)???
????????? Java ????????????4.2.4??????????????????????????????

FS: Boolean ????????????????????? ???b ???????????????????????????????????????????????????????????? (VA_FORMAT_STRING_BAD_CONVERSION_TO_BOOLEAN)

Boolean ????????????????????? %b ???????????????????????????????????????????????????????????????????????????????????????????????? ???????????????????????? null ????????? true ???null ?????? false ????????????????????? ????????????????????????????????????????????????????????????????????????????????????????????????

IA: ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? (IA_AMBIGUOUS_INVOCATION_OF_INHERITED_OR_OUTER_METHOD)

????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ???????????????foo(17) ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? Java ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

?????????????????????????????????????????????????????????????????? super ???????????? (??????super.foo(17)) ?????????????????????????????? ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? FindBugs ???????????????????????????

this.foo(17) ????????????????????????????????????????????????????????????????????????????????? ?????????????????????FindBugs ???????????????????????????????????????????????????this.foo(17) ??? foo(17) ?????????????????????????????????????????????????????????????????? ?????????????????????????????????????????????????????????????????????????????????

IC: ?????????????????????????????? (IC_INIT_CIRCULARITY)

???????????????????????????????????????????????????2????????????????????????????????????????????????????????????????????????????????????????????? ??????????????????????????????????????????????????????????????????????????????????????????????????????

ICAST: ??????????????????????????? double ????????? float ??????????????????????????? (ICAST_IDIV_CAST_TO_DOUBLE)

?????????????????? ??????????????????????????? double ????????? float ????????????????????????????????? ?????????????????????????????????????????????????????????????????????????????????????????????????????? ????????? double ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ????????????????????????????????????????????????????????????????????????????????????1????????????????????? double ???????????????????????????????????????
??????????????????????????????

int x = 2;
int y = 5;
// Wrong: yields result 0.0
double value1 =  x / y;

// Right: yields result 0.4
double value2 =  x / (double) y;

ICAST: ???????????????????????? long ??????????????????????????? (ICAST_INTEGER_MULTIPLY_CAST_TO_LONG)

???????????????????????????????????????????????????????????????????????????????????? long ???????????????????????????

long convertDaysToMilliseconds(int days) { return 1000*3600*24*days; } 

long ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????
???????????????????????????????????????????????????

long convertDaysToMilliseconds(int days) { return 1000L*3600*24*days; } 

?????????

static final long MILLISECONDS_PER_DAY = 24L*3600*1000;
long convertDaysToMilliseconds(int days) { return days * MILLISECONDS_PER_DAY; } 

IM: ??????????????????????????????????????????????????????????????? (IM_AVERAGE_COMPUTATION_COULD_OVERFLOW)

?????????????????????????????????????????????????????????????????????2???????????????????????????????????????????????????????????????????????????????????????????????? ??????????????????????????????????????????????????????????????????????????????????????? (?????????????????????????????????????????????)??? ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ????????????(low+high)/2 ???????????? (low+high) >>> 1 ??????????????????????????????

??????????????????????????????????????????????????????????????????????????????????????????????????? Martin Buchholz ??? JDK ??????????????????????????????????????????????????????????????? Joshua Bloch ??? ????????????????????????????????????????????????

IM: ?????????????????????????????????????????? (IM_BAD_CHECK_FOR_ODD)

?????????????????????x % 2 == 1 ????????????????????????????????????????????????????????????????????? (???????????????(-5) % 2 == -1) ?????????????????????????????? ????????????????????????????????????????????????x & 1 == 1 ????????? x % 2 != 0 ???????????????????????????????????????????????????

INT: 1?????????????????????????????? (INT_BAD_REM_BY_1)

???????????? (exp % 1) ?????????0????????????????????????????????????????????? ?????????????????????(exp & 1) ????????? (exp & 2) ?????????????????????????????????

INT: ???????????????????????????????????????????????? (INT_VACUOUS_BIT_OPERATION)

????????????????????????????????????????????????????????? (AND???OR???XOR) ?????? (???????????? v & 0xffffffff)???

INT: ?????????????????????????????? (INT_VACUOUS_COMPARISON)

?????????????????????????????????????????????????????? (???????????? x <= Integer.MAX_VALUE)???

MTIA: Servlet ???????????????????????????????????????????????????????????????????????? (MTIA_SUSPECT_SERVLET_INSTANCE_FIELD)

Servlet?????????????????????????????????????????????????????????????????????????????????????????? Servlet ????????????1????????????????????????????????? Java EE ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ???????????????????????????????????????????????????????????????????????????

MTIA: Struts Action ??????????????????????????????????????????????????????????????? (MTIA_SUSPECT_STRUTS_INSTANCE_FIELD)

Struts Action ?????????????????????????????????????????????????????????????????????????????????????????? Struts Action ????????????1????????????????????????????????? Struts ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ??????????????????????????????????????????????????????????????????????????? ??????????????????????????????????????????????????????????????????????????????????????????????????????

NP: readLine ???????????????????????? null ??????????????????????????????????????????????????? (NP_DEREFERENCE_OF_READLINE_VALUE)

readLine ???????????????????????? null ????????????????????????????????????????????????????????? readLine ???????????????????????????????????????????????????????????????????????? null ??????????????????NullPointerException ?????????????????????

NP: readLine ??????????????????????????????????????????????????? (NP_IMMEDIATE_DEREFERENCE_OF_READLINE)

readLine ????????????????????????????????????????????????????????? readLine ???????????????????????????????????????????????????????????????????????? null ??????????????????NullPointerException ?????????????????????

NP: null ???????????????????????????????????? (NP_LOAD_OF_KNOWN_NULL_VALUE)

??????????????????????????????????????????????????? null ??????????????????????????????????????? null ?????????????????????????????????????????? ????????????????????????????????????????????????????????? (??????????????????????????????????????????????????????????????????????????????????????? null ??????????????? null ??????????????????????????????????????????)???

NP: ????????????????????????????????? nullness ?????????????????????????????????????????? (NP_METHOD_PARAMETER_TIGHTENS_ANNOTATION)

?????????????????????????????????????????????????????????????????????????????????????????????????????? ????????????????????????????????? @Nullable ????????????????????????????????????????????????????????????????????????????????????????????????????????? @Nonnull ?????????????????????????????????????????????????????????????????????????????? ?????????????????????????????? null ?????????????????????????????????????????????????????????

NP: ??????????????????????????? nullness ?????????????????????????????????????????? (NP_METHOD_RETURN_RELAXING_ANNOTATION)

?????????????????????????????????????????????????????????????????????????????????????????????????????? ????????????????????????????????? @Nonnull ????????????????????????????????????????????????????????????????????????????????????????????? @Nullable ????????? @CheckForNull ??????????????????????????????????????????????????????????????????????????????????????????????????????????????? ?????????????????????????????? null ??????????????????????????????????????????????????????

NP: null ????????????????????????????????????????????????????????????????????????????????? (NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE)

????????????????????????????????? null ??????????????????????????????????????????????????????????????????????????? null ?????????????????????????????????????????? ?????????????????????????????? NullPointerException ??????????????????????????????????????????

NP: null ???????????????????????????????????????????????????????????????????????????????????? (NP_NULL_ON_SOME_PATH_MIGHT_BE_INFEASIBLE)

?????????????????????????????????????????????null ????????????????????? NullPointerException ????????????????????? ??????????????????????????????????????????????????????????????????NullPointerException ????????????????????????????????????????????????????????????????????????????????? ???????????????????????? FindBugs ????????????????????????????????? ?????????????????? null ???????????????????????????????????????????????????????????????????????????????????????

NP: ?????????????????? ??? null ?????????????????????????????? null ????????????????????????????????????????????? (NP_PARAMETER_MUST_BE_NONNULL_BUT_MARKED_AS_NULLABLE)

????????????????????????????????? ??? null ??????????????????????????????????????????????????????????????????????????????????????????????????? null ??????????????????????????????????????????????????? ?????????????????????????????????????????????????????????????????????????????????????????????

NP: ??????????????????????????? public ????????? protected ?????????????????????????????? (NP_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD)

?????????????????????????????? null ???????????????????????????????????????????????? public ????????? protected ?????????????????? null ?????????????????????????????? ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? NullPointerException ?????????????????????

NS: ????????????????????????????????????????????? (NS_DANGEROUS_NON_SHORT_CIRCUIT)

????????????????????????????????? (&& ??? ||) ??????????????????????????? (& ??? |) ?????????????????????????????????????????? ??????????????????????????????????????????????????????????????? (??????????????????????????????????????????????????????????????????) ????????????????????????????????????????????? ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

????????????????????????the Java Language Specification ??????????????????????????????

NS: ???????????????????????????????????? (NS_NON_SHORT_CIRCUIT)

????????????????????????????????? (&& ??? ||) ??????????????????????????? (& ??? |) ?????????????????????????????????????????? ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

????????????????????????the Java Language Specification ??????????????????????????????

PZLA: null ?????????????????????0??????????????????????????????????????? (PZLA_PREFER_ZERO_LENGTH_ARRAYS)

????????????????????? (???????????????????????????????????????) ?????????????????? null ???????????????????????????0????????? ???????????????????????????????????????????????????????????????

???????????????????????????????????????????????????????????????????????????????????? null ??????????????????????????????????????????????????? ???????????????File.listFiles() ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? null ??????????????????

QF: ?????????????????????????????????????????????????????? for ????????? (QF_QUESTIONABLE_FOR_LOOP)

??????????????? for ???????????????????????????????????????????????????????????????????????? ??????????????? for ????????????????????????????????????????????????????????????????????????????????????

RCN: ??? null ?????? null ???????????????????????? (RCN_REDUNDANT_COMPARISON_OF_NULL_AND_NONNULL_VALUE)

????????????????????????null ????????????????????????????????????????????? null ???????????????????????????????????????????????????????????????

RCN: 2?????? null ????????????????????? (RCN_REDUNDANT_COMPARISON_TWO_NULL_VALUES)

???????????????????????????????????????????????? null ?????????????????????2????????????????????????????????????????????????

RCN: null ??????????????????????????????????????????????????? null ???????????? (RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE)

???????????????????????? null ??????????????????????????????????????????????????? null ??????????????????????????????

RCN: null ???????????????????????????????????? null ???????????? (RCN_REDUNDANT_NULLCHECK_OF_NULL_VALUE)

????????????????????????null ???????????????????????????????????? null ??????????????????????????????

REC: ????????????????????????????????????????????????????????????????????? (REC_CATCH_EXCEPTION)

????????????????????????????????????????????????????????????????????? try-catch ??????????????????????????????????????????????????? try ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ??????????????? catch ???????????????????????????????????????????????????????????????????????????????????????????????? try { ... } catch (Exception e) { something } ???????????????????????????????????????????????????????????? ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ??????????????????????????????????????????????????? RuntimeException ????????????????????????????????????????????????????????????????????????????????????

try {
    ...
} catch (RuntimeException e) {
    throw e;
} catch (Exception e) {
    ... deal with all non-runtime exceptions ...
}

RI: ????????????????????????????????????????????????????????????????????????????????? (RI_REDUNDANT_INTERFACES)

????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

RV: String.indexOf ????????????????????????????????????????????? (RV_CHECK_FOR_POSITIVE_INDEXOF)

????????????????????? String.indexOf ?????????????????????????????????????????????????????????????????? ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

RV: readLine ???????????????????????? null ???????????????????????????????????????????????? (RV_DONT_JUST_NULL_CHECK_READLINE)

readLine ??????????????????????????? null ?????????????????????????????????????????????????????? ????????????????????????????????????????????? null ????????????????????????????????????????????????????????? ?????? readLine ???????????????????????????????????????????????????????????????

RV: ?????????????????????????????????????????????????????? (RV_REM_OF_HASHCODE)

?????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ?????????????????????????????????????????????????????????????????????????????????

?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ?????????2?????????????????????????????????????????????????????????????????????????????????????????????????????? (???????????????x.hashCode()%n ??????????????? x.hashCode()&(n-1) ???????????????????????????)??? ?????????????????????????????????????????????????????????????????? ?????????2?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? (???????????? Math.abs(x.hashCode()%n))???

RV: ????????????32????????????????????????????????? (RV_REM_OF_RANDOM_INT)

????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ?????????????????? Random.nextInt(int) ?????????????????????????????????????????????

RV: ??????????????????????????????????????????????????????????????????????????????????????????? (RV_RETURN_VALUE_IGNORED_INFERRED)

?????????????????????????????????????????????????????????????????????????????????????????? ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ??????????????????String.toLowerCase() ??????????????????????????????????????????

???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????FindBugs ??????????????? @CheckReturnValue ???????????????????????????????????????

???????????????????????????????????????????????????????????????????????????????????????????????????????????????

RV: ???????????????????????????????????????????????????????????? (RV_RETURN_VALUE_IGNORED_NO_SIDE_EFFECT)

??????????????????????????????????????????????????????????????????????????????????????? ?????????????????????????????????????????? (????????????????????????????????????????????????) ?????????????????????????????????????????????????????????????????????????????? ??????????????????????????????????????????

?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ??????????????????????????????

- ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

- ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

- ????????????????????????????????????????????????????????????????????????

??????????????????????????????????????????????????????FindBugs ????????????????????????????????????????????????????????????????????????????????????????????? @CheckReturnValue ????????????????????????????????????????????????????????????

SA: ?????????????????????????????? (SA_FIELD_DOUBLE_ASSIGNMENT)

????????????????????????????????????????????????????????????????????????
????????????????????????????????????????????????

int x,y;
public void foo() {
    x = x = 17;
}

??????????????????2????????????????????????????????????????????????????????????????????????????????????????????????????????????

SA: ????????????????????????????????? (SA_LOCAL_DOUBLE_ASSIGNMENT)

???????????????????????????????????????????????????????????????????????????
????????????????????????????????????????????????

public void foo() {
    int x,y;
    x = x = 17;
}

?????????????????????2????????????????????????????????????????????????????????????????????????????????????????????????????????????

SA: ????????????????????????????????? (SA_LOCAL_SELF_ASSIGNMENT)

???????????????????????????????????????????????????????????????????????????
????????????????????????????????????????????????

public void foo() {
    int x = 3;
    x = x;
}

????????????????????????????????????????????????????????????????????????????????????????????????????????????

SF: 1?????? case ????????? case ????????????????????? switch ?????????????????? (SF_SWITCH_FALLTHROUGH)

????????????????????????1?????? case ????????? case ????????????????????? switch ????????????????????? ????????????break ??? return ????????? case ??????????????????????????????????????????

SF: default ????????? switch ?????????????????? (SF_SWITCH_NO_DEFAULT)

????????????????????????default ????????? switch ????????????????????? ????????????default ???????????????????????????????????????

?????????????????????????????????????????????????????????????????????default ??? switch ???????????????????????????????????????????????? break ???????????????????????????????????????????????????????????????????????????

ST: ???????????????????????????????????? static ????????????????????????????????? (ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD)

??????????????????????????????????????????static ??????????????????????????????????????????????????? ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

Se: ???????????????????????????????????? private ??? readResolve ???????????? (SE_PRIVATE_READ_RESOLVE_NOT_INHERITED)

?????????????????????private ??? readResolve ??????????????????????????????????????? ?????????????????????????????????????????????????????????????????????????????? ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

Se: Serializable ????????????????????? transient ??????????????? (SE_TRANSIENT_FIELD_OF_NONSERIALIZABLE_CLASS)

?????????????????????transient ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ???????????? transient ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

TQ: ??????????????????????????????????????????????????????????????????????????????????????? (TQ_EXPLICIT_UNKNOWN_SOURCE_VALUE_REACHES_ALWAYS_SINK)

???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ???????????????????????????????????????????????????????????????????????????

TQ: ???????????????????????????????????????????????????????????????????????????????????? (TQ_EXPLICIT_UNKNOWN_SOURCE_VALUE_REACHES_NEVER_SINK)

?????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ???????????????????????????????????????????????????????????????????????????

UC: ???????????????????????? (UC_USELESS_CONDITION)

?????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ?????????????????????????????????????????????????????????????????????????????????????????????????????????

UC: ????????????????????????????????????????????? (UC_USELESS_CONDITION_TYPE)

????????????????????????????????????????????????????????????????????????????????????????????????????????? ?????????????????????????????????????????????????????????????????????????????????????????????????????????

UC: ??????????????????????????????????????????????????? (UC_USELESS_OBJECT)

??????????????????????????????????????????????????????????????????????????????????????? ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

???????????????????????????????????????????????????????????????????????????????????????????????????????????????

- ???????????????????????????????????????????????????

- ????????????????????????????????????????????????????????????

- ???/?????????????????????????????????????????????????????????????????????

UC: ?????????????????????????????????????????????????????????????????? (UC_USELESS_OBJECT_STACK)

?????????????????????????????????????????????????????????????????????????????????????????????????????? ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

UC: ????????????????????????????????? void ???????????? (UC_USELESS_VOID_METHOD)

?????????????????????????????????????????? void ???????????????????????????????????????????????????????????????????????????????????? ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ?????????????????????????????????

- ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

- ???????????????????????????????????????????????????????????????????????????????????????????????????

UCF: ????????????????????????????????? (UCF_USELESS_CONTROL_FLOW)

????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
???????????????????????? ?????? if ??????????????????????????????

if (argv.length == 0) {
    // TODO: handle this case
}

UCF: ???????????????????????????????????????????????????????????? (UCF_USELESS_CONTROL_FLOW_NEXT_LINE)

??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
?????????????????????????????? if ?????????????????????????????????????????????????????????????????????

if (argv.length == 1);
    System.out.println("Hello, " + argv[0]);

UrF: ????????????????????? public ????????? protected ??????????????? (URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD)

???????????????????????????????????????????????????????????? ?????????????????????public ??? protected ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ???????????????????????????????????????????????????????????????????????????????????????

UuF: ???????????? public ????????? protected ??????????????? (UUF_UNUSED_PUBLIC_OR_PROTECTED_FIELD)

????????????????????????????????????????????????????????? ?????????????????????public ??? protected ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ???????????????????????????????????????????????????????????????????????????????????????

UwF: ????????????????????????????????????????????????????????????????????? null ????????????????????? null ???????????????????????? (UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR)

?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????null ???????????????????????????????????? ????????????????????????????????????????????????null ????????????????????? null ??????????????????????????? ???????????????????????????????????????????????????????????? NullPointerException ???????????????????????????????????????????????????????????????????????????

UwF: ??????????????????????????? public ????????? protected ??????????????? (UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD)

?????? public ????????? protected ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ??????????????????????????????????????? (??????????????????????????????????????????????????????)??????????????????????????????????????????????????????

XFB: XML????????????????????????????????????????????????????????????????????????????????????????????? (XFB_XML_FACTORY_BYPASS)

????????????????????????XML??????????????????????????????????????????????????????????????????????????????????????? ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
????????????????????????????????????????????????

  • javax.xml.parsers.DocumentBuilderFactory
  • javax.xml.parsers.SAXParserFactory
  • javax.xml.transform.TransformerFactory
  • org.w3c.dom.Document.createXXXX

Send comments to findbugs@cs.umd.edu

FindBugs on SourceForge.net