10.12.2012 Views

The Java Language Specification, Third Edition

The Java Language Specification, Third Edition

The Java Language Specification, Third Edition

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

NAMES Syntactic Classification of a Name According to Context 6.5.1<br />

MethodName:<br />

Identifier<br />

AmbiguousName . Identifier<br />

PackageOrTypeName:<br />

Identifier<br />

PackageOrTypeName . Identifier<br />

AmbiguousName:<br />

Identifier<br />

AmbiguousName . Identifier<br />

<strong>The</strong> use of context helps to minimize name conflicts between entities of different<br />

kinds. Such conflicts will be rare if the naming conventions described in<br />

§6.8 are followed. Nevertheless, conflicts may arise unintentionally as types<br />

developed by different programmers or different organizations evolve. For example,<br />

types, methods, and fields may have the same name. It is always possible to<br />

distinguish between a method and a field with the same name, since the context of<br />

a use always tells whether a method is intended.<br />

6.5.1 Syntactic Classification of a Name According to Context<br />

A name is syntactically classified as a PackageName in these contexts:<br />

• In a package declaration (§7.4)<br />

• To the left of the “.” in a qualified PackageName<br />

A name is syntactically classified as a TypeName in these contexts:<br />

• In a single-type-import declaration (§7.5.1)<br />

• To the left of the "." in a single static import (§7.5.3) declaration<br />

• To the left of the "." in a static import-on-demand (§7.5.4) declaration<br />

• To the left of the "

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!