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 242161 - unused assignment is incorrect when assigning array values
Summary: unused assignment is incorrect when assigning array values
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Hints (show other bugs)
Version: 8.0
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Svata Dedic
URL:
Keywords:
Depends on:
Blocks: 249320
  Show dependency tree
 
Reported: 2014-02-20 16:35 UTC by Jiri Prox
Modified: 2015-11-11 07:53 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jiri Prox 2014-02-20 16:35:30 UTC
unused assignment is incorrect when assigning array values, which is later changed

Steps to reproduce:
1) have a code
public class JavaApplication8 {
  
    static int[] array = new int[3];
    
    static int[] getArray() {
        return array;
    }

    static void set(int index, int value) {
        int[] a = getArray();  // <- here is incorrectly reported unused assignment
        a[index] = value;        
    }
}



Product Version: NetBeans IDE Dev (Build 20140220-33332dea2d3f)
Java: 1.8.0-ea; Java HotSpot(TM) 64-Bit Server VM 25.0-b65
Runtime: Java(TM) SE Runtime Environment 1.8.0-ea-b123
System: Windows 7 version 6.1 running on amd64; Cp1250; en_US (nb)
User directory: D:\udir
Cache directory: D:\udir\var\cache
Comment 1 Svata Dedic 2015-09-10 14:21:13 UTC
This is rather a simple bug, not a deficiency of the current flow analysis approach. But it would be best to join the fix into the effort of new flow impl.
Comment 2 Svata Dedic 2015-11-11 07:53:45 UTC
Fixed in experimental impl, wait for the umbrella issue to close.