variableName and type with the same name would refer to the static field instead of the class


The problem

When a field/variable name is the same as the field/variable type, it is difficult to determine which to use at which time.

For example,

private static String String;

This would cause future use of String.something within this class to refer to the static field String, instead of the class String.

This is worth calling out to avoid confusion and is a violation of Google Java style naming conventions

Instead of this naming style, the correct way would be:

private static String string;


Suppress false positives by adding the suppression annotation @SuppressWarnings("VariableNameSameAsType") to the enclosing element.