title英文详解错误示例中文解释Anon InnerLengthChecks for long anonymous innerclasses匿名内部类长度限制Avoid ArrayLoopsInstead of copying data betweentwo arrays, useSystem.arrayCopy method两个数组之间复制数据,使用System.arrayCopy方法Avoid Assert AsIdentifierFinds all places 'assert' isused as an identifier is used.避免'assert'做为标识Avoid CallingFinalizeObject.finalize() is called bythe garbage collector on anobject when garbage collectiondetermines that there are nomore references to the object.禁止使用Object.finalize()Avoid CatchingNPECode should never throw NPEunder normal circumstances. Acatch block may hide theoriginal error, causing othermore subtle errors in its wake.代码可能会抛出无法被TRY捕获的异常.Avoid CatchingThrowableThis is dangerous because itcasts too wide a net; it cancatch things likeOutOfMemoryError.Avoid DecimalLiterals In BigDecimalConstructorOne might assume that newBigDecimal(.1) is exactly equalto .1, but it is actually equalto.1000000000000000055511151231257827021181583404541015625. Thisis so because .1 cannot berepresented exactly as a double(or, for that matter, as abinary fraction of any finitelength). Thus, the long valuethat is being passed in to theconstructor is not exactlyequal to .1, appearancesnotwithstanding. The (String)constructor, on the other hand,is perfectly predictable: 'newBigDecimal(.1)' is exactlyequal to .1, as one wouldexpect. Therefore, it isgenerally recommended that the(String) constructor be used inpreference to this one.Key:AvoidDecimalLiteralsInBigDecimalConstructor尽量避免BigDecimal(.1) 因为它实际上等于它实际上等于.1000000000000000055511151231257827021181583404541015625.而不是0.1Avoid DuplicateLiteralsCode containing duplicateString literals can usually beimproved by declaring theString as a constant field.Example :map.put("tyName","0"); ...