This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 236468 - [Missing Hints] saying "Branch is never used"
Summary: [Missing Hints] saying "Branch is never used"
Status: VERIFIED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Hints (show other bugs)
Version: 7.4
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Svata Dedic
URL: https://www.cheapessay247.com
Keywords: 7.4_HR_FIX
Depends on:
Blocks:
 
Reported: 2013-09-27 13:05 UTC by ssazonov
Modified: 2019-05-13 07:46 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
MissingHints (70.68 KB, image/png)
2013-09-27 13:05 UTC, ssazonov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description ssazonov 2013-09-27 13:05:30 UTC
1. Create new java class and compare hints presenting in if branches:

EXAMPLE 1:

    public void method(int val) {
    
        if(val == 1){
            System.out.println("1");
        }
        else if(false || false){
            System.out.println("2");
        }
        else if(false){
            System.out.println("3");
        }
        else if(!true){
            System.out.println("3");
        }
    }

EXAMPLE 2:

    public void method(int val) {
    
        if(true){
            System.out.println("1");
        }
        else if(false || false){
            System.out.println("2");
        }
        else if(false){
            System.out.println("3");
        }
        else if(!true){
            System.out.println("3");
        }
    }

>> Hints in EXAMPLE 1 are calculated correctly, in EXAMPLE 2 some hints miss (see attached image)

Product Version: NetBeans IDE 7.4 RC2 (Build 201309252201)
Java: 1.7.0_40; Java HotSpot(TM) Client VM 24.0-b56
Runtime: Java(TM) SE Runtime Environment 1.7.0_40-b43
System: Windows 7 version 6.1 running on x86; Cp1252; en_US (nb)
Comment 1 ssazonov 2013-09-27 13:05:53 UTC
Created attachment 140552 [details]
MissingHints
Comment 2 Svata Dedic 2013-09-27 13:18:04 UTC
Strictly speaking, the marker is placed correctly. If the code was properly surrounded by block braces, it would look like this:

    public void method(int val) {
    
        if(true){
            System.out.println("1");
        }
        else {
          if(false || false){
              System.out.println("2");
          }
          else {
            if(false){
                System.out.println("3");
            }
            else {
              if(!true){
                System.out.println("3");
              }
            }
          }
       }
    }

With such correction, the marker correctly identifies the 1st statement of the unrechable branch. The rest of branch is, naturally, unreachable as well.
I agree that in the case of degenerated tree the marker may look confusing to the users. 
I need to check whether the error comes from Javac, or it is created by NetBeans.
Comment 3 Svata Dedic 2013-10-14 13:14:12 UTC
I've had all the ifs chained to the unreachable branch marked as dead code. Not exactly correct, but gives a better overview of condition's implications.

Fixed in rev. http://hg.netbeans.org/jet-main/rev/f694c3dd79f9
Comment 4 Quality Engineering 2013-10-16 02:18:48 UTC
Integrated into 'main-silver', will be available in build *201310160001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/f694c3dd79f9
User: Svata Dedic <sdedic@netbeans.org>
Log: #236468: all unrechable branches of chained if are reported
Comment 5 peterpen 2019-03-26 06:15:45 UTC
Here the best update i am shear with you a great feature visit the url and download http://dvdplayerwindows10.com/ fee dvd media player here you found the top five media players and fully information thanks.
Comment 6 jennifergrace 2019-05-11 08:09:54 UTC
With decent words, we never have gotten anything. The entire thought of entrancing, of being a performer, being the focal point of the stage, https://www.usaassignmentservice.com up words - that let me realize that writing is decent.
Comment 7 RoseRogers 2019-05-13 07:46:32 UTC
Does that real mean that I just only talk about what upcoming tests are actually done and proper explain the https://www.cheapessay247.com upcoming tests with detail with the different types of tracking system?