File: JavaLangClash.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 (9 lines) | stat: -rw-r--r-- 579 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
Class names from `java.lang` should never be reused. From
[Java Puzzlers](http://www.javapuzzlers.com/java-puzzlers-sampler.pdf):

> Avoid reusing the names of platform classes, and never reuse class names from
> `java.lang`, because these names are automatically imported everywhere.
> Programmers are used to seeing these names in their unqualified form and
> naturally assume that these names refer to the familiar classes from
> `java.lang`. If you reuse one of these names, the unqualified name will refer
> to the new definition any time it is used inside its own package.