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 244226 - "The assigned value is never used" hint appears when not reading on the same method
Summary: "The assigned value is never used" hint appears when not reading on the same ...
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Hints (show other bugs)
Version: 8.0
Hardware: PC Linux
: P3 normal (vote)
Assignee: Svata Dedic
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-05-01 13:14 UTC by dktcoding
Modified: 2014-05-25 01:30 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
IDE log (42.87 KB, text/plain)
2014-05-01 13:14 UTC, dktcoding
Details

Note You need to log in before you can comment on or make changes to this bug.
Description dktcoding 2014-05-01 13:14:10 UTC
I prepared the following code to help understand the problem:

0    public class Matrix {
1       public double[][] matrix = new double[10][10];
2       public int size = 10;
3       public void foo(int i, double s) {
4          double[] row = matrix[i];
5          for (int j = 0; j < size; j++) {
6             row[j] += s;
7          }
8       }
9    }

In that code in line 4 I get two hints:
1) The array is only written to and never read from (Which is annoying but technically correct)
2) The assigned value is never used (which is wrong)

The example may seem odd (but it's the best SSCCE I was able to write), this hint is appearing in different (wrong) places, but always with a similar pattern.

Regards

Product Version = NetBeans IDE 8.0 (Build 201403101706)
Operating System = Linux version 3.13.0-24-generic running on amd64
Java; VM; Vendor = 1.7.0_55
Runtime = OpenJDK 64-Bit Server VM 24.51-b03
Comment 1 dktcoding 2014-05-01 13:14:16 UTC
Created attachment 147044 [details]
IDE log
Comment 2 Svata Dedic 2014-05-02 10:34:26 UTC
Fixed in jet-main#2c773e336f61
Comment 3 Quality Engineering 2014-05-25 01:30:32 UTC
Integrated into 'main-silver', will be available in build *201405250001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/2c773e336f61
User: Svata Dedic <sdedic@netbeans.org>
Log: #244226: flow treats array dereference as rvalue