Package Case

ID

java.package_case

Severity

info

Remediation Complexity

trivial

Remediation Risk

medium

Remediation Effort

low

Resource

Naming Convention

Language

Java

Tags

naming

Description

Reports package declarations whose fully-qualified name contains any uppercase character.

Rationale

The Java language conventions reserve lowercase for package components. Mixed-case package names blur the boundary between a package reference and a type reference in qualified identifiers (com.Example.Thing makes Example look like a type). File systems are also case-insensitive on some platforms, which causes subtle classpath problems when a repository is cloned on Windows or macOS with default settings.

// Bad
package com.example.BadName;

// Good
package com.example.badname;
// or
package com.example.bad_name;

Remediation

Rename the package so every component is lowercase. When multiple words are unavoidable, use _ (e.g. my_package) rather than camelCase.