What's the point of package modifiers?

I don't understand package modifiers (not annotations) like this:

public package foo;

public class Bar {
}

Do they have any meaning?

Jon Skeet
people
quotationmark

The only type of package modifier in the JLS is an annotation. From JLS 7.4.1:

PackageDeclaration:
{PackageModifier} package Identifier {. Identifier} ;

PackageModifier:
Annotation

So public package foo; is invalid syntax.

This compiles under some versions of Eclipse, due to a bug which has been fixed in some conditions, and will be fixed in all conditions from Eclipse 4.4 onwards.

people

See more on this question at Stackoverflow