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. BBR加速 Centos

    BBR是什么 BBR 是 Google 提出的一种新型拥塞控制算法,可以使 Linux 服务器显著地提高吞吐量和减少 TCP 连接的延迟. BBR项目地址 https://github.com/goo ...

  2. [Caliburn.Micro专题][1]快速入门

    目录 1. 什么是Caliburn.Micro? 2. 我是否需要学习CM框架? 3. 如何下手? 3.1 需要理解以下几个概念: 3.2 工程概览 3.3 示例代码 开场白:本系列为个人学习记录,才 ...

  3. qos-server can not bind localhost:22222, dubbo version: 2.6.0, current host: 127.0.0.1【问题解决】

    好吧,这个问题比较low,但是记录一下,以免后期遗忘. 说白了,这个问题就是端口被占用了. 问题: qos-server can not bind localhost:22222, dubbo ver ...

  4. Linux进程管理 (篇外)内核线程简要介绍【转】

    转自:https://www.cnblogs.com/arnoldlu/p/8336998.html 关键词:kthread.irq.ksoftirqd.kworker.workqueues 在使用p ...

  5. win10企业版LTSC批量激活

    slmgr -ipk M7XTQ-FN8P6-TTKYV-9D4CC-J462D   slmgr -skms kms.03k.org slmgr -ato slmgr -dlv

  6. bert剪枝系列——Are Sixteen Heads Really Better than One?

    1,概述 剪枝可以分为两种:一种是无序的剪枝,比如将权重中一些值置为0,这种也称为稀疏化,在实际的应用上这种剪枝基本没有意义,因为它只能压缩模型的大小,但很多时候做不到模型推断加速,而在当今的移动设备 ...

  7. Ubuntu下部署Portainer管理docker

    在上一篇文章中,我们部署了Shipyard来管理docker集群,总体比较简单,而且Shipyard界面风格很简约,还是比较喜欢的,但是正如提出的node节点无法显示bug,以及该项目早已停止维护,让 ...

  8. C++ 函数重载、函数模板,类模板

    1.函数重载 相同作用域下,有多个函数名相同,但形参列表不同的函数,常用于处理功能相同但数据类型不同的问题 函数重载的规则: 函数名必须相同 函数形参列表必须不同(可以是参数个数不同,或者数据类型不同 ...

  9. selenium 2定位方式实例

    #########百度输入框的定位方式########## #通过id方式定位 browser.find_element_by_id("kw").send_keys("s ...

  10. svn服务器端程序安装(二)

    1.下载 Setup-Subversion-1.8.9-1.msi 2. 双击,一直next (1) 修改安装地址,要求是非中文无空格 3. 安装完成后,检查是否已添加到系统的环境变量PATH中,若没 ...