Package Naming Standard

ID

java.naming_package

Severity

info

Remediation Complexity

trivial

Remediation Risk

medium

Remediation Effort

low

Resource

Naming Convention

Language

Java

Tags

naming

Description

Reports package declarations that do not follow the standard naming convention. Package names should have at least 3 levels (e.g., com.example.app) and all components should be lowercase.

Rationale

The reverse-domain naming convention (com.company.project.module) prevents name collisions across organizations. Shallow packages with fewer than 3 levels (e.g., com.example) risk collisions and do not provide enough namespace granularity. Uppercase characters in package names break the visual distinction between packages and types.

// Bad — too few levels
package com.example;

// Good — at least 3 levels, all lowercase
package com.example.myapp;
package org.apache.commons.lang3;

Remediation

Add enough levels to follow the reverse-domain convention (minimum 3) and ensure all components are lowercase.