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 211248 - Erroneous hint "The array is only written to, never read from"
Summary: Erroneous hint "The array is only written to, never read from"
Status: RESOLVED FIXED
Alias: None
Product: editor
Classification: Unclassified
Component: Hints & Annotations (show other bugs)
Version: 7.2
Hardware: PC Windows XP
: P3 normal (vote)
Assignee: Jan Lahoda
URL:
Keywords:
: 211589 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-04-16 12:03 UTC by lolo_101
Modified: 2012-04-26 10:34 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Exemple class (do not execute, just compile) (287 bytes, text/plain)
2012-04-16 12:04 UTC, lolo_101
Details

Note You need to log in before you can comment on or make changes to this bug.
Description lolo_101 2012-04-16 12:03:59 UTC
In the attached example, a String array is returned and it's elements are stored in two class members. The hint message is "The array is only written to, never read from" which is obviously wrong.
However, if you store array elements in local variables instead of class members, the hint turns to "The array is only read from, never written to" which is correct.

Product Version: NetBeans IDE Dev (Build 201204100400)
Java: 1.6.0_31; Java HotSpot(TM) Client VM 20.6-b01
System: Windows XP version 5.1 running on x86; Cp1252; fr_FR (nb)
Comment 1 lolo_101 2012-04-16 12:04:47 UTC
Created attachment 118329 [details]
Exemple class (do not execute, just compile)
Comment 2 Jan Lahoda 2012-04-23 13:35:23 UTC
Fixed in NetBeans daily builds:
http://hg.netbeans.org/jet-main/rev/deb6b75f9030

Thanks for the report.
Comment 3 Jan Lahoda 2012-04-23 13:48:01 UTC
*** Bug 211589 has been marked as a duplicate of this bug. ***
Comment 4 Quality Engineering 2012-04-26 10:34:07 UTC
Integrated into 'main-golden', will be available in build *201204260400* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/deb6b75f9030
User: Jan Lahoda <jlahoda@netbeans.org>
Log: #211248: fixing handling of variable initializer in the Unbalaced array access hint: all should be considered to be writes, except plain array creation. Also correcting reads from arrays inside assignment-like trees.