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 253553 - [81cat] Guarded code is not checked for the "array is never read from" hint
Summary: [81cat] Guarded code is not checked for the "array is never read from" hint
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Hints (show other bugs)
Version: 8.1
Hardware: PC Other
: P3 normal (vote)
Assignee: Svata Dedic
URL:
Keywords:
Depends on: 253861
Blocks:
  Show dependency tree
 
Reported: 2015-07-17 21:35 UTC by cezariusz
Modified: 2015-08-05 01:20 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Sample project (17.15 KB, application/octet-stream)
2015-07-17 21:55 UTC, cezariusz
Details

Note You need to log in before you can comment on or make changes to this bug.
Description cezariusz 2015-07-17 21:35:18 UTC
Product Version: NetBeans IDE Dev (Build 201507170001)
Java: 1.8.0_45; Java HotSpot(TM) 64-Bit Server VM 25.45-b02
Runtime: Java(TM) SE Runtime Environment 1.8.0_45-b15
System: Windows 8 version 6.2 running on amd64; UTF-8; pl_PL (nb)

Steps to reproduce:
1. Create a dialog.
2. Add the following constant:
    private static String[] ITEMS = {"AA", "BB", "CC"};
3. Add a combo with a custom code:
        jComboBox1.setModel(new DefaultComboBoxModel(ITEMS));

Expected: no warnings on ITEMS.
Actual: the warning "The array is only written to, never read from".
Comment 1 cezariusz 2015-07-17 21:55:00 UTC
Created attachment 154704 [details]
Sample project
Comment 2 Svata Dedic 2015-07-24 21:44:39 UTC
I see ... the hint needs to be reimplemented; it uses the tree kind matcher to identify reads - but the matcher purposely skips guarded code... so write is found (field initializer is not in the guarded section), but the read is not passed from the infrastructure to the hint :)
Comment 3 Svata Dedic 2015-08-04 07:31:41 UTC
Fixed in jet-main#ee478d3d4ad8
Comment 4 Quality Engineering 2015-08-05 01:20:55 UTC
Integrated into 'main-silver', will be available in build *201508050002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/ee478d3d4ad8
User: Svata Dedic <sdedic@netbeans.org>
Log: #253553: hint scans reads in guarded blocks