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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

NAMES Meaning of Method Names 6.5.7<br />

lost. Technically, the type name Foo above is a raw type, but this use of raw types is harmless,<br />

and does not give rise to warnings<br />

6.5.7 Meaning of Method Names<br />

A MethodName can appear only in a method invocation expression (§15.12) or as<br />

an element name in an element-value pair (§9.7). <strong>The</strong> meaning of a name classified<br />

as a MethodName is determined as follows.<br />

6.5.7.1 Simple Method Names<br />

A simple method name may appear as the element name in an element-value<br />

pair. <strong>The</strong> Identifier in an ElementValuePair must be the simple name of one of the<br />

elements of the annotation type identified by TypeName in the containing annotation.<br />

Otherwise, a compile-time error occurs. (In other words, the identifier in an<br />

element-value pair must also be a method name in the interface identified by Type-<br />

Name.)<br />

Otherwise, a simple method name necessarily appears in the context of a method<br />

invocation expression. In that case, if a method name consists of a single Identifier,<br />

then Identifier is the method name to be used for method invocation. <strong>The</strong><br />

Identifier must name at least one visible (§6.3.1) method that is in scope at the<br />

point where the Identifier appear or a method imported by a single-static-import<br />

declaration (§7.5.3) or static-import-on-demand declaration (§7.5.4) within the<br />

compilation unit within which the Identifier appears.<br />

See §15.12 for further discussion of the interpretation of simple method names in<br />

method invocation expressions.<br />

6.5.7.2 Qualified Method Names<br />

DRAFT<br />

A qualified method name can only appear in the context of a method invocation<br />

expression. If a method name is of the form Q.Id, then Q has already been classified<br />

as a package name, a type name, or an expression name. If Q is a package<br />

name, then a compile-time error occurs. Otherwise, Id is the method name to be<br />

used for method invocation. If Q is a type name, then Id must name at least one<br />

static method of the type Q.IfQ is an expression name, then let T be the type of<br />

the expression Q; Id must name at least one method of the type T. See §15.12 for<br />

further discussion of the interpretation of qualified method names in method invocation<br />

expressions.<br />

137

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

Saved successfully!

Ooh no, something went wrong!