`
andy54321
  • 浏览: 434581 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

Dead store

    博客分类:
  • J2EE
阅读更多

In Computer programming , if we assign a value to a local variable, but the value is not read by any subsequent instruction, then it's called a Dead Store .

Java example of a Dead Store:

 

// DeadStoreExample.java
import java.util.ArrayList;
import java.util.List;
 
public class DeadStoreExample {
 public static void main(String[] args) {
   List<String> list = new ArrayList<String>(); // Dead Store here.
   list = getList();
   System.out.println(list);
 }
 
 private static List<String> getList() {
   // Some intense operation and finally we return a java.util.List
   return new ArrayList<String>();
 }
}
   

In the above code a List<String> object was created but was never used. Instead, in the next line the reference variable is pointing to some other object in the heap. The object created on line number 6 is never used and hence it's a dead store.

分享到:
评论

相关推荐

    findbugs常见Bug以及处理办法

    1、 Bug级别 ...Dead store to local variable 描述:对一个局部变量赋值,但是这个局部变量可能不会被用到; 处理方式:确认此局部变量是否会被使用,如果确实不会被用到,请去掉; .............

    findbug 常见异常处理

    处理方式:确认此局部变量是否会被使用,如果确实不会被用到,请去掉,和 Dead store to local variable一样处理,只是这里针对的是不是局部变量; Call to static DateFormat 描述:调用静态的DateFormat对象 处理...

    一个用C ++ 17编写的玩具编译器,它将SysY(一种类似C的玩具语言)转换为ARM-v7a程序集。-C/C++开发

    TrivialCompiler是用C ++ 17编写的编译器,它将SysY(一种类似C的玩具语言)转换为ARM-v7a程序集。 TrivialCompiler TrivialCompiler是用C ++ 17编写的编译器,可将SysY(一种类似C的玩具语言)转换为ARM-v7a程序集...

    findbugs检测提示详解

    2、Dead store to newStatusRecord; 3、Invocation of toString on values; 4、ignores exceptional return value of java.io.File.mkdirs(); 5、invokes inefficient new Short(short) constructor; use Short....

    DeadCells-WS-Trainer:死细胞Windows Store Edition培训师

    Windows Store版的Dead Cells基本培训师 要求 .net framework 4.8需要安装, 开始游戏后,请运行培训师 特征 神模式(您的总健康和当前健康将为20000) 添加单元格(一次10个) 加钱(一次加10000 屏幕截图

    playstore-scraper::label: 从 Google Play 商店获取搜索结果和更多内容的简单快捷方式

    Play 商店爬虫 从 Google Play 商店获取搜索结果和应用信息的简单快捷方式。 安装 npm install playstore-scraper 用法 const playstore = require ( ... "title" : "The Walking Dead: Season Two" , "descripti

    Go的无效简单速率限制中间件。-Golang开发

    Go的Limiter Dead简单速率限制中间件。 后端Redis支持的简单API“存储”方法(但也没有捆绑)中间件:使用Go模块的HTTP,FastHTTP和Gin安装$ go get Limiter Dead Go的简单速率限制中间件。 后端Redis支持的简单API...

    UniWeb3.0 unitypackage

    -10/09/2014 Made a cross platform TcpClient class to remove WP8 shenanigans with prebuilt DLL. ... Dead requests when coming back from sleep on iOS Added close messages to discarded websockets.

    Bakery - GPU Lightmapper 1.71.unitypackage

    https://assetstore.unity.com/packages/tools/level-design/bakery-gpu-lightmapper-122218 Bakery is a high-end, production-ready, hassle-free GPU lightmapper, designed as an alternative to Enlighten and...

    UniWeb 3.0.22

    ↓↓↓↓↓↓插件仅用于学习,禁止商用,为了维护您的个人权益,请支持正版↓↓↓↓↓↓ CHANGES: ... Dead requests when coming back from sleep on iOS Added close messages to discarded websockets.

    softwave for avr

    •Dead code removing optimization •4 memory models: TINY (8 bit data pointers for chips with up to 256 bytes of RAM), SMALL (16 bit data pointers for chips with more than 256 bytes of RAM), MEDIUM ...

    asn_intelligence:以开源透明方式收集和分发的ASN智能信息(IP到ASN映射)

    请不要滥用Google Store并从您自己的资源将文件重新分发到您的基础架构。 格式是什么? { "version": "1", "data": [ { "prefix": "dead:beef::0000/48", "asn_number": 112 }, { "prefix": "192.0.2.0/24",...

    AJAX and PHP.pdf

    reload, which represents the dead time when navigating from one page to another. Eliminating page reloads is just one step away from enabling more complex features into websites, such as real-time ...

    《activmq in action 》

    5.2.3. The JDBC Message Store ............................................. 144 5.2.4. The Memory Message Store ......................................... 150 5.3. Caching Messages in the Broker for ...

    EurekaLog_7.5.0.0_Enterprise

    EurekaLog 7.5 (18-August-2016) 1)..Important: Installation layout was changed. All packages now have version suffix (e.g. EurekaLogCore240.bpl). No files are copied to \bin folder of IDE....

    Sakemail

    1997 - 2003 Sergio A....and fixed it. Some minor bugs that I don‘t remember fixed.- Added MIME-compliant base64 support (not for use by now). Added examples.0.9.2.1b- Fixed a bug when send a mail and ...

    数位板压力测试

    • Does the interface prevent a rogue application from "hijacking" the tablet, or causing dead¬locks? • Does the sharing architecture promote efficiency? 2.4 Tablet Feature Support The interface ...

Global site tag (gtag.js) - Google Analytics