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 271860 - Unreachable statement error
Summary: Unreachable statement error
Status: NEW
Alias: None
Product: ide
Classification: Unclassified
Component: Code (show other bugs)
Version: 8.2
Hardware: PC Windows 10
: P3 normal (vote)
Assignee: issues@ide
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-11-29 06:32 UTC by mrkite.2
Modified: 2017-11-29 10:55 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
IDE log (78.16 KB, text/plain)
2017-11-29 06:33 UTC, mrkite.2
Details

Note You need to log in before you can comment on or make changes to this bug.
Description mrkite.2 2017-11-29 06:32:57 UTC
Product Version = NetBeans IDE 8.2 (Build 201609300101)
Operating System = Windows 10 version 10.0 running on amd64
Java; VM; Vendor = 1.8.0_92
Runtime = Java HotSpot(TM) 64-Bit Server VM 25.92-b14

Reproducibility: Happens every time

STEPS:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package javaapplication1;

import java.util.Random;

/**
 *
 * @author kurt
 */
public class JavaApplication1 {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        Noodle[] noodle = new Noodle[313];
//        String word = "abcdefghijklmnop";
//        String nib;
        int toss;
        Random rand = new Random();
        int i;

        for (i = 0; i < 313; i++) {
            noodle[i] = new Noodle(0);
        }

        for (i = 0; 1 < 9; i++) {
            for (int k = 0; k < 20; k++) {
                int value = rand.nextInt(313);
                noodle[value].dressed(1);
            }
        }
        for (i = 0; i < 313; i++) {    Error on this line  Code Unreachable Statement
//            System.out.println(String.format("%s %s", i, noodle[i].coated()));
        }
    }

}


ACTUAL:
 unreachable Statement

EXPECTED:
  If I move the statement block up into the the preceding for loop the error goes away but that is not the program flow I wanted.  I have tried delleting all spaces and the the two closing brackets and recreating them but that doesn't help either.  I beleive this to be a bug.
Comment 1 mrkite.2 2017-11-29 06:33:23 UTC
Created attachment 165511 [details]
IDE log
Comment 2 Alexander Simon 2017-11-29 10:55:19 UTC
(In reply to mrkite.2 from comment #0)
>         for (i = 0; 1 < 9; i++) {
IDE is right because loop is infinite.