Reputation: 4819
Just before you say this is a duplicate, I saw the other questions already and I still wanted to post this.
So I was reading Thinking in Java -Bruce Eckel and this passage is about the lowercase naming convention:
In Java 1.0 and Java 1.1 the domain extensions com, edu, org, net, etc., were capitalized by convention, so the library would appear: NET.mindview.utility.foibles. Partway through the development of Java 2, however, it was discovered that this caused problems, so now the entire package name is lowercase.
I'm having the issue at "it was discovered that this caused problems". What problem? It couldn't have been name conflict because the domain name was in all caps, right?
I've searched on Google for this, but all I got was: Why should java package name be lowercase?:
Package names are written in all lower case to avoid conflict with the names of classes or interfaces.
I've also searched for java package lowercase convention changed all-caps domain name
but to no avail.
So does anyone have any idea why they changed the naming convention midway?
Upvotes: 3
Views: 930
Reputation: 2120
I think the quote in the book refers to errors like the following: RS01799: IMPLEMENTATION CLASS IS NOT FOUND WHEN A JAVA PACKAGE NAME START S WITH AN UPPER CASE CHARACTER.
I don't think the author wrote about programmers confusion but internal JVM implementation. I've made tests using JDK 1.8 and could not reproduce the problem. Do notice the use of "may not be found" in the bug report description.
Upvotes: 1
Reputation: 40335
Just a wild guess, not based on any credible source: Package names are tied to filesystem directory structure. A package name with NET
in it could conceivably cause problems if e.g. a source tree from a case-sensitive filesystem was copied to / used on a case-insensitive filesystem and for whatever reason the directory name was changed from "NET" to the equivalent "net".
Same deal in the opposite direction, too: Resolving filesystem paths from package names, I can conceive of situations where this could cause some ambiguity or at least catch a user by surprise.
I could see this causing confusion in some scenarios.
Another potential issue is the fact that it conflicts with what's allowable in the class naming conventions. Classes are generally first-letter-uppercase but it's not uncommon for e.g. acronyms to be all capital, e.g. a class named API
, or COM
or something. This allows some overlap between the package and class naming convention. But my feeling is that the filesystem issues are a more likely problem.
Upvotes: 3