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() {
...
}

  

最新文章

  1. Fiddler-1 安装
  2. gulpfile.js 合并压缩 requirejs 的配置文件
  3. 1.1 让CPU占用率曲线听你指挥[cpu manager]
  4. PHP 解压zip文件的函数封装
  5. Contest2037 - CSU Monthly 2013 Oct (problem D :CX and girls)
  6. Navicat for MySQL之MySQL客户端的下载、安装和使用
  7. 再造轮子之网易彩票-第一季(IOS 篇 by sixleaves)
  8. OpenCV中的KNN
  9. MySQL server has gone away错误的解决办法
  10. mysql学习笔记--数据库内置函数
  11. 为创世纪图书馆(Library Genesis)作镜像
  12. 如何在DataTemplate中绑定RadioButton的Checked事件
  13. 从匿名函数(闭包特性)到 PHP 设计模式之容器模式
  14. 一次Flannel和Docker网络不通定位问题
  15. PAT1018 (dijkstra+dfs)
  16. springmvc学习总结(二) -- maven+springmvc+spring+mybatis+mysql详细搭建整合过程讲解
  17. 微信小程序与java后台交互
  18. HDU 4300 Clairewd’s message(扩展KMP)题解
  19. hdu 5206 Four Inages Strategy 判断是否是正方形
  20. keras channels_last、preprocess_input、全连接层Dense、SGD优化器、模型及编译

热门文章

  1. 读《TCP/IP详解》:TCP
  2. 一条SELECT查询语句在数据库里执行时都经历了什么
  3. Shel脚本-初步入门之《04》
  4. JAVAWEB复习笔记-day02
  5. 201871010133-赵永军《面向对象程序设计(java)》第八周学习总结
  6. 使用构造函数 Boolean 创造的对象不是布尔值,而是对象,typeof new Boolean(1) == 'object'
  7. luoguP4294 [WC2008]游览计划
  8. appium--多进程启动多设备
  9. [LeetCode] 885. Spiral Matrix III 螺旋矩阵之三
  10. [LeetCode] 22. Generate Parentheses 生成括号