## Why is this an issue?

Two classes can have the same simple name if they are in two different packages.

    package org.foo.domain;

    public class User {
      // ..
    }

    package org.foo.presentation;

    public class User {
      // ..
    }

However, this becomes an issue when a class has the same name as the superclass it extends or the interfaces it implements, also known as class name shadowing. It is problematic because it can be unclear which class is being referred to in the code, leading to ambiguity and potential bugs.

Therefore, it is recommended to use unique and descriptive class names that do not conflict with the names of the superclass or interfaces.

This rule raises an issue when a class name shadows its superclass or interface names.

## How to fix it

Rename the class using a more descriptive name.

### Code examples

#### Noncompliant code example

    package org.foo.presentation;

    public class User implements org.foo.domain.User { // Noncompliant
      // ...
    }

#### Compliant solution

    package org.foo.presentation;

    import org.foo.domain.User;

    public class UserView implements User { // Compliant
      // ...
    }

## Resources

### Documentation

- Java SE Specifications > Java Language Specification > 6.4.1. Shadowing