Name: sg39081 Date: 10/28/97
Look at the method java.lang.String.toCharArray():
public char[] toCharArray() {
int i, max = length();
char result[] = new char[max];
getChars(0, max, result, 0);
return result;
}
See the variable 'i'? Its extraneous (and ought to have a
bug entered concerning that fact...), but the bigger issue
is that there is no warning level flag on the compiler, javac, that
would tell the engineer that the code is
extraneous - this is a bug. For example,
Gcc issues warnings like "variable i set but never used".
Now, any compiler worth its salt will not generate any
code for the variable 'i', but still, a warning flag
would be good.
(Review ID: 19408)
======================================================================
- duplicates
-
JDK-4128179 # Add a lint-like facility to javac
-
- Closed
-