Skip to content

invalid-java-namespace

Id
@azure-tools/typespec-java/invalid-java-namespace

Severity: warning

This diagnostic is issued when a generated Java package segment is a reserved Java keyword.

The emitter appends namespace to the reserved package segment, so the generated package differs from the requested namespace.

@service
namespace Contoso.Public;

The derived Java namespace contains the reserved keyword public.

Namespace 'contoso.public' contains reserved Java keywords, replaced it with 'contoso.publicnamespace'.

Rename the TypeSpec namespace or configure a Java namespace that does not contain Java keywords.

@service
namespace Contoso.PublicApi;

Suppress the warning only when the adjusted package name is intentionally accepted.