Reserved Package Prefix

ID

java.naming_reserved_package

Severity

low

Remediation Complexity

trivial

Remediation Risk

medium

Remediation Effort

low

Resource

Naming Convention

Language

Java

Tags

naming

Description

Reports package declarations whose name starts with the reserved prefixes java. or javax..

Rationale

The java and javax package prefixes are reserved by the JDK specification. User code that uses these prefixes may trigger security-manager restrictions, fail at class loading when the JVM enforces sealed packages, and confuse readers about whether the code is part of the standard library or a third-party addition.

// Bad
package java.custom.util;
package javax.myapp.service;

// Good
package com.example.util;
package org.myapp.service;

Remediation

Choose a package prefix that follows the reverse-domain-name convention (e.g. com.example, org.myorg) and does not collide with the reserved JDK namespaces.