Community
Participate
Working Groups
Could we add a Java compiler warning for the incorrect case used for variable names. E.g., a variable in all caps that is not a constant or a constant that is not in all caps. I expect this would be settable in the Java --> Compiler --> Errors/Warnings preference panel. The rules would follow standard conventions. Here (without looking it up) is what I think we'll have: final fields -- must be all caps non-final fields and local vars -- initial lowercase letter class name -- Initial capital letter. Perhaps additional checks like only constants can have an underscore, and class names should have a lowercase letter somewhere in the name. Also an optional rule against more than one capital in a row in variable names and class names (some people have this as a convention). The story is that I was debugging code that had a variable in all caps that I assumed it was a constant. In fact, it was not, and if there were a warning available, I would have found that out sooner.