You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by "Daniel Trebbien (JIRA)" <ji...@apache.org> on 2018/01/13 02:40:00 UTC

[jira] [Created] (NETBEANS-278) Erroneous "The array is only written to, never read from" warning

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: commits-unsubscribe@netbeans.apache.org
For additional commands, e-mail: commits-help@netbeans.apache.org

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