Inspection info: This inspection analyzes method control and data flow to report possible conditions

练习算法题的时候遇到这个错误:

Condition 'n<5' is always 'true'" less.. (Ctrl+F1)
Inspection info: This inspection analyzes method control and data flow to report possible conditions that are always true or false, expressions whose value is statically proven to be
constant, and situations that can lead to nllability contract violations.
Variables, method parameters and return values marked as @Iullable or QIotIUu11 are treated as nullable (or not-null, respectively) and used during the analysis to check nllability
contracts, e.g. report Iu1lPo intexExcept ion (NPE) errors that might be produced.
More complex contracts can be defined using @Contract annotation, for example:
@Contract(”_ null -> nul1") 一method returns null if its second argument is null
@Contract("_ null -> null; 一!nul1 -> !nu11") 一method returns null if its second argument is null and not-null otherwise
Contract(" true -> fai1') 一a typical asseItF alse method which throws an exception if true is passed to it
The inspection can be configured to use custom @Iul1able
@TotIu1l annotations (by default the ones from annotationsjar will be used)
Condition 'n<5 && result== "continue"' is always 'false' ess.. (Ctrl+F1)
Inspection info: This inspection analyzes method control and data flow to report possible conditions that are always true or false, expressions whose value is statically proven to be
constant, and situations that can lead to nullbility contract violations.
Variables, method parameters and return values marked as @Iullable or @lotIull are treated as nllable (or not-null, respectively) and used during the analysis to check nllbilily
contracts, e.g. report IullPo interExcept ion (NPE) errors that might be produced.
More complex contracts can be defined using @C ontract annotation, for example:
@Contract(”_ null -> nu11") 一method returns null if its second argument is null
Contract("_ null -> mu1l; _ !null -> !nu11') 一method returns null if its second argument is null and not-null otherwise
@Contract(" true -> fail") 一- a typical assertF alse method which throws an exception if true is passed to it
The inspection can be configured to use custom @ITullable
@TotIu1l annotations (by default the ones from annotations.jar will be used)
 

翻译后的意思:


检查信息:此检查分析方法控制和数据流,以报告可能始终为真或为假的表达式,其值被静态证明为
常量以及可能导致违反不可告人性合同的情况。
标记为@Iullable或QIotIUu11的变量,方法参数和返回值被视为可为空(或分别为非空),并在分析期间用于检查可填充性
合约,例如报告可能会产生的IuIlPo intexExcept(NPE)错误。
可以使用@Contract注释定义更复杂的合同,例如:
@Contract(“ _ null-> nul1”)如果第二个参数为null,则该方法返回null
@Contract(“ _ null-> null;一!nul1->!nu11”)如果一个方法的第二个参数为null,则该方法返回null,否则为非null
Contract(“ true-> fai1')一个典型的asseItF alse方法,如果将true传递给它,则会引发异常
可以将检查配置为使用自定义@ Iul1able
@ TotIu1l注释(默认情况下,将使用notificationsjar中的注释)
条件'n <5 && result ==“ continue”'始终为'false'。.(Ctrl + F1)
检查信息:此检查分析方法控制和数据流,以报告可能始终为真或为假的表达式,其值被静态证明为
常量,以及可能导致无效合同违约的情况。
标记为@Iullable或@lotIull的变量,方法参数和返回值被视为nllable(或分别为非null),并在分析过程中用于检查nllbili
合约,例如报告可能会产生的IullPo InterException(NPE)错误。
可以使用@C ontract注释定义更复杂的合同,例如:
@Contract(“ _ null-> nu11”)如果第二个参数为null,则该方法返回null
Contract(“ _ null-> mu1l; _!null->!nu11')如果一个方法的第二个参数为null,则返回null,否则返回非null
@Contract(“ true-> fail”)一-一种典型的assertF alse方法,如果将true传递给它,则会引发异常
可以将检查配置为使用自定义@ITullable
@ TotIu1l批注(默认情况下,将使用notifications.jar中的批注)

主要原因:

循环语句的循环条件出现了问题-始终为真或假,修改一下就好了

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值