A few minutes ago I almost made this mistake:
byte[] dest = new byte[50];
System.arraycopy(dest, 0, src, 0, 50);
(That'll teach me not to program in Notepad :)
Would it be possible to create an inspection that detects this use
of an "uninitialized" array?
/Mikael
Actually, this won't necessarily even require a new inspection. All that needs to be done is that the "Mismatched read and write of array contents" needs to have some special case logic for System.arraycopy. Usually passing an array to a method has to count as both a read and write of an array, but for System.arraycopy the first arg is known to be a read and the third arg is known to be a write. We should probably also know the special cases for the java.util.Arrays functions as well.
Please put this in JIRA, so it won't get lost.
--Dave Griffith
Created as http://www.jetbrains.net/jira/browse/IDEA-10942
/Mikael
"Dave Griffith" <dave.griffith@cnn.com> wrote in message
news:26277425.1168354423181.JavaMail.itn@is.intellij.net...
>
>