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 with fewer than 3 levels (e.g., com.example rather than com.example.app).

Case is not checked here. An uppercase component is reported by java.package_case. The two rules are complementary: this one owns the depth, java.package_case owns the case, and one package declaration yields at most one finding from each.

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.

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

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

Remediation

Add enough levels to follow the reverse-domain convention (minimum 3).

© 2026 Xygeni. All rights reserved