电脑桌面
添加小米粒文库到电脑桌面
安装后可以在桌面快捷访问

sonar检测规则初步整理VIP免费

sonar检测规则初步整理_第1页
1/36
sonar检测规则初步整理_第2页
2/36
sonar检测规则初步整理_第3页
3/36
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"); ...

1、当您付费下载文档后,您只拥有了使用权限,并不意味着购买了版权,文档只能用于自身使用,不得用于其他商业用途(如 [转卖]进行直接盈利或[编辑后售卖]进行间接盈利)。
2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。
3、如文档内容存在违规,或者侵犯商业秘密、侵犯著作权等,请点击“违规举报”。

碎片内容

sonar检测规则初步整理

确认删除?
VIP
微信客服
  • 扫码咨询
会员Q群
  • 会员专属群点击这里加入QQ群
客服邮箱
回到顶部