Community
Participate
Working Groups
could you add a warning when class fields are initialized with default values, as defined in the JLS: http://books.huihoo.org/the-java-language-specification/first-edition/4.doc.html#10931 for example: public class Test { String s = null; // "= null" is useless code } I think a java developper should know the default values used by the compiler/the JVM and he/she should not write unnecessary code.
>"= null" is useless code I disagree. Sure, every developer know this but if I see this in the code I know that the developer actually really wanted 'null' as initial value. If nothing is set there's a chance that he simply forgot to set it. ==> if this check is added it should be off by default.