`
nuistcc
  • 浏览: 83872 次
社区版块
存档分类
最新评论

The label NO_TRADE is never explicitly referenced

阅读更多

1. 问题描述

      今天在写Java switch case语句的时候,有一句代码引起Eclipse黄色警告:The label NO_TRADE is never explicitly referenced。

      原代码如下:

 

switch (tradeStatus) {
            case CREATE:
            NO_TRADE:
                result.setCommonStatus(CommonStatus.UNPAY);
                result.setActionButtons(Lists.newArrayList(getTradeButton("付款")));
                break;
            case SHIP:
                result.setCommonStatus(CommonStatus.ACCEPTED);
                result.setActionButtons(Lists.newArrayList(getTradeButton("确认服务")));
                break;
            case SUCCESS:
                result.setCommonStatus(CommonStatus.FINISH);
                result.setActionButtons(Lists.newArrayList(getTradeButton("评价")));
                break;
            default:
                break;
            }

 

 

    告警的是“NO_TRADE:”这行,告警的意思是次标签将永远不会被明确引用。

 

2. 原因分析

       后来自己又看了下代码及Java switch case的语法,原因是自己错误使用了语法,这种写法在Java语法中只会匹配CREATE这一种情况,后面的NO_TRADE是永远不会考虑的。

 

3. 解决方法

      只需要对NO_TRADE这个Label新增一个case标记即可,修改后的代码如下所示:

TradeStatus tradeStatus = TradeStatus.getByValue(searchDO.getTbMainOrderPayStatus().get(0).intValue());
            switch (tradeStatus) {
            case CREATE:
            case NO_TRADE:
                result.setCommonStatus(CommonStatus.UNPAY);
                result.setActionButtons(Lists.newArrayList(getTradeButton("付款")));
                break;
            case SHIP:
                result.setCommonStatus(CommonStatus.ACCEPTED);
                result.setActionButtons(Lists.newArrayList(getTradeButton("确认服务")));
                break;
            case SUCCESS:
                result.setCommonStatus(CommonStatus.FINISH);
                result.setActionButtons(Lists.newArrayList(getTradeButton("评价")));
                break;
            default:
                break;
            }

 

 

分享到:
评论

相关推荐

    reactivity.esm-bundler.js

    vue新建项目出现问题 替换这个文件

    LEAD.rar_#classifier_#matlab_#multi-label_The Network_bayesian n

    This toolbox contains programs for the multi-label classifier which explicitly exploits label dependency with Bayesian network structure.

    stbc.rar_The Signal_stbc_ui_start

    In these simulations the SISO option is not explicitly given. This is because the SISO result for a particular type of modulation is shown in every plot for purposes of comparison. This software ...

    微软内部资料-SQL性能优化5

     If the table is a heap (in other words, it has no clustered index), the bookmark is a RID, which is an actual row locator in the form File#:Page#:Slot#. Finding Rows with a NC Index on a Heap ...

    Google C++ Style Guide(Google C++编程规范)高清PDF

    Another useful rule of thumb: it's typically not cost effective to inline functions with loops or switch statements (unless, in the common case, the loop or switch statement is never executed)....

    Fast Object Detection in 3D Point Clouds Using Convolutional Neural Networks

    In particular, this is achieved by leveraging a feature-centric voting scheme to implement novel convolutional layers which explicitly exploit the sparsity encountered in the input. To this end, we ...

    php解决Deprecated Automatically populating is deprecated and will be removed_will后面跟什么

    To avoid this warning and prepare your code for PHP 8, you should explicitly pass the `$_FILES` array to `move_uploaded_file()`, `is_uploaded_file()` and other functions dealing with uploaded files. ...

    k-nearest-neighbors-from-global-to-local

    In its basic form, given a new instance, the algorithm finds the \( k \) closest instances (neighbors) in the training set and assigns a label based on the majority vote or a weighted average of the ...

    中关村在线

    The Gen 0 size is tuned by the Garbage Collector and can change during the execution of the application. At the end of a Gen 0 collection the size of the Gen 0 heap is infact 0 bytes; this counter ...

    ImagesBy360.zip

    The Zen of Python, by Tim Peters Beautiful is better than ugly. ...If the implementation is easy to explain, it may be a good idea. Namespaces are one honking great idea -- let's do more of those!

    Sublime.Text.Build.3078._Win_32bit破解主文件

    Note that this change will have no effect if the hot_exit setting is left at its default value of true Build 3073 Release Date: 28 February 2015 See also the Forum Thread Fixed a Goto Definition ...

    单元测试框架.txt

    The Zen of Python Python之禅 by Tim Peters Beautiful is better than ...If the implementation is easy to explain, it may be a good idea. Namespaces are one honking great idea -- let's do more of those!

    LCTF软件备份VariSpec™ Liquid Crystal Tunable Filters

    a) there is a conflict when one uses the implicit palette to set wavelengths, and also defines palette states explicitly using the VsDefinePalette() function. When the explicitly set palette state ...

    3D Simulation of the IFRF Industrial Pulverized-coal Furnace

    The purpose of this tutorial is to simulate a realistic industrial pulverized-coal furnace and compare the results with the measured data. Prerequisites This tutorial assumes that you are familiar ...

    一个win32下的ARM开源编译器

    give no width suffix fasmarm will select the narrow form if it is available and encodable, and the wide form otherwise. To see how this impacts code using IT blocks examine the following example: ...

    php.ini-development

    Instead, explicitly set the output handler using ob_start(). ; Using this ini directive may cause problems unless you know what script ; is doing. ; Note: You cannot use both "mb_output_handler" with...

    Fiori_Development_Guideline_Portal_V1.1 - Final Version.pdf

    for example - for this guideline is that you have to change the margin of some UI elements in you app to get a pixel perfect design but you heard that there is the golden rule "No custom CSS is ...

    Build Report Tool 3.0.19.rar

    your .unity3d file is a compressed archive of all your used assets, your Unity scene files, your scripts' resulting managed DLLs, any managed DLLs from the Mono standard library your build needs, plus...

    Obstacle Detection and Tracking for the Urban Challenge 障碍物检测跟踪

    This paper describes the obstacle detection and ...explicitly abstracts each of the levels of processing. The subsystem can easily be extended by adding new sensors and validation algorithms.

    dhcp server

    You may freely distribute and copy TFTPD32 as long as no fee is charged and the TFTPD32 archive contains unmodified copies of the original files as produced by its author. No part of TFTPD32 may be ...

Global site tag (gtag.js) - Google Analytics