Daniel Trebbien created NETBEANS-278:
----------------------------------------

             Summary: Erroneous "The array is only written to, never read from" 
warning
                 Key: NETBEANS-278
                 URL: https://issues.apache.org/jira/browse/NETBEANS-278
             Project: NetBeans
          Issue Type: Bug
          Components: java - Hints
            Reporter: Daniel Trebbien


Test case:

{code:java}
package hintstest;

import java.util.Map;

public class MismatchedReadAndWriteOfArrayTest {
    public void test(Map<Object, int[]> map, Object k) {
        int[] iarr = map.get(k);
        iarr[0] = -1;
    }
}
{code}

A warning is shown on the declaration of {{iarr}}. However, I think that the 
warning is incorrect because, although {{iarr}} might not be read from within 
test(), we don't know whether the {{int}} array will be retrieved from the map 
and read from elsewhere.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to