Method Naming Convention

ID

java.naming_method

Severity

info

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, in production sources only.

Test sources are exempt in full — the test methods, the data-provider feeds they consume and the private helpers they call. when_old_column_is_same_as_new_column_ISA_is_thrown is printed verbatim in the test report, so readability there wins over lowerCamelCase, and none of it is API. A test fixture that lives in a main source root is still exempt method by method, through its JUnit or TestNG annotation.

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) {}

Remediation

Rename the method to lowerCamelCase. Remove underscores and ensure the first character is lowercase.

© 2026 Xygeni. All rights reserved