You are probably using Android Studio or IntelliJ.

If so, you can add this above your method containing the infinite loop to suppress warnings:

@SuppressWarnings("InfiniteLoopStatement")

  

Or add this "magic" comment above the statement:

//noinspection InfiniteLoopStatement

  

This will tell the IDE that this is ok.

More generally, when you get a false positive warning, do Alt+Enter and do what showed on the screenshot below (select class only if your class is full of false positive, for the same warning)

有时候这个告警是多余的,例如我们手写的监控线程。

如果有消除告警强迫症。在线程的执行方法上加入注解。

@SuppressWarnings("InfiniteLoopStatement")
public void run() {
...
}

  

'while' statement cannot complete without throwing an exception的更多相关文章

  1. Intellij idea 告警:'while' statement cannot complete without throwing an exception

    有时候这个告警是多余的,例如我们手写的监控线程. 如果有消除告警强迫症.在线程的执行方法上加入注解. @SuppressWarnings("InfiniteLoopStatement&quo ...

  2. retrofit框架接口调用时候报Throwing new exception

    最近在开发的时候遇到了一个很坑的问题,在三星6.0手机上请求接口时候报了一个异常:Throwing new exception 'length=1658; index=3248' with unexp ...

  3. 并发安全 sync.Map

    https://mp.weixin.qq.com/s/MqPm7QH3_D9roVkpTs9Xpw 谈谈Go的并发安全相关 原创 歪鼻子 歪鼻子 2020-12-27     package main ...

  4. Debug.Assert vs Exception Throwing(转载)

    来源 Q: I've read plenty of articles (and a couple of other similar questions that were posted on Stac ...

  5. 【JUnit4.10源码分析】5 Statement

    假设要评选JUnit中最最重要的类型.或者说核心,无疑是org.junit.runners.model.Statement.Runner等类型看起来热闹而已. package org.junit.ru ...

  6. How a C++ compiler implements exception handling

    Introduction One of the revolutionary features of C++ over traditional languages is its support for ...

  7. Akka(26): Stream:异常处理-Exception handling

    akka-stream是基于Actor模式的,所以也继承了Actor模式的“坚韧性(resilient)”特点,在任何异常情况下都有某种整体统一的异常处理策略和具体实施方式.在akka-stream的 ...

  8. Java中的异常Exception

    涉及到异常类相关的文章: (1)异常类不能是泛型的 http://www.cnblogs.com/extjs4/p/8888085.html (2)Finally block may not comp ...

  9. Exception (2) Java Exception Handling

    The Java programming language uses exceptions to handle errors and other exceptional events.An excep ...

随机推荐

  1. OC-bug: Undefined symbols for architecture i386: "_OBJC_CLASS_$_JPUSHRegisterEntity", referenced from:

    bug的提示: Undefined symbols for architecture i386: "_OBJC_CLASS_$_JPUSHRegisterEntity", refe ...

  2. Android 项目主要文件

    1.manifests下的AndroidManifest.xml是Andriod程序的清单文件,该文件是整个项目的配置文件,Android四大组件Activity.BroadcastReceiver. ...

  3. composer install 出现“Please provide a valid cache path”

    本文背景:通过deployer部署PHP项目[deployer部署工具:https://deployer.org/] 问题:Php 的laravel框架中执行 composer install 后, ...

  4. INPUT输入子系统【转】

    转自:https://www.cnblogs.com/deng-tao/p/6094049.html 1.Linux系统支持的输入设备繁多,例如键盘.鼠标.触摸屏.手柄或者是一些输入设备像体感输入等等 ...

  5. Django之 数据库ORM

    一.ORM Django的 业务 少不了 跟数据库打交道,不然没有数据库保存一些数据将是一件很糟糕的事情.Django 对 数据库 支持原生的 SQL语句,但更好的对数据库支持,Django自己有一套 ...

  6. testlink 1.9.19安装

    环境平台: 系统:Centos 7.6 数据库:mysql 5.7 PHP版本:PHP 5.6 testlink版本:testlink- 链接:https://pan.baidu.com/s/10Pr ...

  7. django中添加新的filter

    给模板传递了一个字典,却发现无法在模板中直接通过key获得value. 查阅资料后,这个问题可以通过添加自定义的filter来解决. 首先在app目录下创建一个templatetags目录,并在它的下 ...

  8. 2018710101110-李华《面向对象程序设计(java)》第十二周学习总结

    项目 内容 这个作业属于哪个课程 https://www.cnblogs.com/nwnu-daizh/ 这个作业的要求在哪里 https://www.cnblogs.com/nwnu-daizh/p ...

  9. 【软件工程1916|W(福州大学)_助教博客】2019年上学期期末问卷调查结果公示

    1.调查问卷概况 福州大学2019W班,收集到有效答卷44份 2. 调查问卷情况 Q1:请问你平均每周在课程上花费多少小时? 去除自估水平超过40小时的,平均16.6H Q2.软工实践的各次作业分别花 ...

  10. xposed+justtrustme

    1.xposed下载: https://repo.xposed.info/module/de.robv.android.xposed.installer https://forum.xda-devel ...