eclipse-jdt / eclipse-jdt/eclipse.jdt.core

Warning for package visibility top-level classes that don't match file name

Open
#3,941 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
237
Forks
195
Avg merge
1d 12h
Merged PRs (30d)
47

Description

If the top-level class is `public` and doesn't match the file name, an error is given:
```java
//B.java
public class A {} // The public type A must be defined in its own file
```
However, for package access there's no indication of a mismatch (giving an error is wrong), so I suggest a warning along the lines of: "The package-private type A does not have the name of its own file".

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.