Method Naming Convention
ID |
java.naming_method |
Severity |
low |
Remediation Complexity |
trivial |
Remediation Risk |
medium |
Remediation Effort |
low |
Resource |
Naming Convention |
Language |
Java |
Tags |
naming |
Description
Reports method names that do not start with a lowercase letter or that contain an underscore.
Rationale
The Java naming convention for methods is lowerCamelCase. Method names starting with an uppercase letter look like constructors or type names, and underscores belong to constant names (UPPER_SNAKE_CASE). Deviations confuse readers and break tool expectations such as IDE getter/setter generation, serialisation frameworks, and JavaBeans conventions.
// Bad
public void GetValue() {}
public void set_name(String s) {}
// Good
public void getValue() {}
public void setName(String s) {}