#197 Missing package declaration

release_3.2
closed
Check (274)
5
2012-10-10
2003-06-08
Simon Harris
No

Description
Ensure a class is has a package declaration.

Rationale
Classes that live in the null package cannot be
imported. Many novice developers are not aware of this.

Discussion

  • Tim Tyler
    Tim Tyler
    2003-06-09

    Logged In: YES
    user_id=796025

    "import Foo;" succeeds for me.

     
  • Dale King
    Dale King
    2003-06-09

    Logged In: YES
    user_id=130378

    It depends on the compiler whether it succeeds. For a long
    time Visual Age for Java was controversial because it did not
    allow you to do it. But now Sun's compiler does not either.
    I'll bet Tim was using a different compiler that does not
    forbid it.

     
  • Simon Harris
    Simon Harris
    2003-06-09

    Logged In: YES
    user_id=146770

    More specifically you couldn't import the null package as in
    import *; Maybe these days you can. Whatever the case I feel
    it is poor design to have classes live in the null package.

     
  • Logged In: YES
    user_id=746148

    Committed in CVS for 3.2 (PackageDeclaration module)