Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
java_language_specification_7.pdf
Скачиваний:
13
Добавлен:
21.03.2016
Размер:
3.11 Mб
Скачать

NAMES

Meaning of Method Names

6.5.7

This does not restrict the Java programming language in any meaningful way. Type parameters may not be used in the types of static variables, and so the type arguments of a parameterized type can never influence the type of a static variable. Therefore, no expressive power is lost. Technically, the type name Foo above is a raw type, but this use of raw types is harmless, and does not give rise to warnings

6.5.7 Meaning of Method Names

The meaning of a name classified as a MethodName is determined as follows.

6.5.7.1 Simple Method Names

A simple method name may appear as the element name in an element-value pair.

In that case, the Identifier in an ElementValuePair must be the simple name of one of the elements of the annotation type identified by TypeName in the containing annotation, or a compile-time error occurs.

In other words, the identifier in an element-value pair must also be a method name in the interface identified by TypeName.

Otherwise, a simple method name necessarily appears in the context of a method invocation expression. In that case, if a method name consists of a single Identifier, then Identifier is the method name to be used for method invocation.

The Identifier must name at least one method that is visible at the point where the Identifier appears (§6.4.1), or a method imported by a single-static-import declaration (§7.5.3) or static-import-on-demand declaration (§7.5.4) within the compilation unit within which the Identifier appears, or else a compile-time error occurs by the rules of §15.12.

6.5.7.2 Qualified Method Names

A qualified method name can only appear in the context of a method invocation expression.

If a method name is of the form Q.Id, then Q has already been classified as a package name, a type name, or an expression name:

If Q is a package name, then a compile-time error occurs.

Otherwise, Q is a type name or an expression name.

Id is the method name to be used for method invocation.

If Q is a type name, then Id must name at least one static method of the type Q, or a compile-time error occurs by the rules of §15.12.

151

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]