Tuesday, November 6, 2012

Missing Quick Fix In Package-Info File

Creating a package-info.java is useless without the package declaration. But strangely, in Eclipse, you get no error if you leave the file empty. And the usual Quick Fix to mend the package declaration is absent. Odd.

But the solution is simple: just add a "class X {}". It's legal syntax, and when that class declaration is present, you'll get that helpful Quick Fix. You can then remove the class if you want -- after you invoke the 'Add Package Declaration' Quick Fix.

No comments:

Post a Comment