File: ClassName.md

package info (click to toggle)
error-prone-java 2.18.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 23,204 kB
  • sloc: java: 222,992; xml: 1,319; sh: 25; makefile: 7
file content (14 lines) | stat: -rw-r--r-- 676 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
While the Java programming language requires that `public` top-level classes are
declared in a source file matching their name (e.g.: `Foo.java` for `public
class Foo {}`, it is possible to declare a non-public top-level class in a file
with a different name (e.g.: `Bar.java` for `class Foo {}`).

The Google Java Style Guide ยง2.1 states, "The source file name consists of the
case-sensitive name of the top-level class it contains, plus the .java
extension."

## Suppression

Since `@SuppressWarnings` cannot be applied to package declarations, this
warning can be suppressed by annotating any top-level class in the compilation
unit with `@SuppressWarnings("ClassName")`.