Groovy Language Specification  
First Draft  
Chapter 6

Names

The organization of this chapter parallels the chapter on Names in the Java Language Specification (second edition), which begins as follows:
Names are used to refer to entities declared in a program. A declared entity (§6.1, JLS) is a package, class type, interface type, member (class, interface, field, or method) of a reference type, parameter (to a method, constructor, or exception handler), or local variable.
Names in programs are either simple, consisting of a single identifier, or qualified, consisting of a sequence of identifiers separated by "." tokens (§6.2, JLS).
Every declaration that introduces a name has a scope (§6.3, JLS), which is the part of the program text within which the declared entity can be referred to by a simple name.
Packages and reference types (that is, class types, interface types, and array types) have members (§6.4, JLS). A member can be referred to using a qualified name N.x, where N is a simple or qualified name and x is an identifier. If N names a package, then x is a member of that package, which is either a class or interface type or a subpackage. If N names a reference type or a variable of a reference type, then x names a member of that type, which is either a class, an interface, a field, or a method.
In determining the meaning of a name (§6.5, JLS), the context of the occurrence is used to disambiguate among packages, types, variables, and methods with the same name.
Access control (§6.6, JLS) can be specified in a class, interface, method, or field declaration to control when access to a member is allowed. Access is a different concept from scope; access specifies the part of the program text within which the declared entity can be referred to by a qualified name, a field access expression (§15.11, JLS), or a method invocation expression (§15.12, JLS) in which the method is not specified by a simple name. The default access is that a member can be accessed anywhere within the package that contains its declaration; other possibilities are public, protected, and private.
Fully qualified and canonical names (§6.7, JLS) and naming conventions (§6.8, JLS) are also discussed in this chapter.

6.1 Declarations

(Cf. JLS. §6.1.)

TO DO

6.2 Names and Identifiers

(Cf. JLS. §6.2.)

TO DO

6.3 Scope of a Declaration

(Cf. JLS. §6.3.)

TO DO

6.3.1 Shadowing Declarations

(Cf. JLS. §6.3.1.)

TO DO

6.3.2 Obscured Declarations

(Cf. JLS. §6.3.2.)

TO DO

6.4 Members and Inheritance

(Cf. JLS. §6.4.)

TO DO

6.4.1 The Members of a Package

(Cf. JLS. §6.4.1.)

TO DO

6.4.2 The Members of a Class Type

(Cf. JLS. §6.4.2.)

TO DO

6.4.3 The Members of an Interface Type

(Cf. JLS. §6.4.3.)

TO DO

6.4.4 The Members of an Array Type

(Cf. JLS. §6.4.4.)

TO DO

6.5 Determining the Meaning of a Name

(Cf. JLS. §6.5.)

TO DO

6.5.1 Syntactic Classification of a Name According to Context

(Cf. JLS. §6.5.1.)

TO DO

6.5.2 Reclassification of Contextually Ambiguous Names

(Cf. JLS. §6.5.2.)

TO DO

6.5.3 Meaning of Package Names

(Cf. JLS. §6.5.3.)

TO DO

6.5.3.1 Simple Package Names

(Cf. JLS. §6.5.3.1.)

TO DO

6.5.3.2 Qualified Package Names

(Cf. JLS. §6.5.3.2.)

TO DO

6.5.4 Meaning of <i>PackageOrTypeNames</h3>

(Cf. JLS. §6.5.4.)

TO DO

6.5.4.1 Simple <i>PackageOrTypeNames</h4>

(Cf. JLS. §6.5.4.1.)

TO DO

6.5.4.2 Qualified <i>PackageOrTypeNames</h4>

(Cf. JLS. §6.5.4.2.)

TO DO

6.5.5 Meaning of Type Names

(Cf. JLS. §6.5.5.)

TO DO

6.5.5.1 Simple Type Names

(Cf. JLS. §6.5.5.1.)

TO DO

6.5.5.2 Qualified Type Names

(Cf. JLS. §6.5.5.2.)

TO DO

6.5.6 Meaning of Expression Names

(Cf. JLS. §6.5.6.)

TO DO

6.5.6.1 Simple Expression Names

(Cf. JLS. §6.5.6.1.)

TO DO

6.5.6.2 Qualified Expression Names

(Cf. JLS. §6.5.6.2.)

TO DO

6.5.7 Meaning of Method Names

(Cf. JLS. §6.5.7.)

TO DO

6.5.7.1 Simple Method Names

(Cf. JLS. §6.5.7.1.)

TO DO

6.5.7.2 Qualified Method Names

(Cf. JLS. §6.5.7.2.)

TO DO

6.6 Access Control

(Cf. JLS. §6.6.)

TO DO

6.6.1 Determining Accessibility

(Cf. JLS. §6.6.1.)

TO DO

6.6.2 Details on <code>protected Access</h3>

(Cf. JLS. §6.6.2.)

TO DO

6.6.2.1 Access to a <code>protected Member</h4>

(Cf. JLS. §6.6.2.1.)

TO DO

6.6.2.2 Qualified Access to a <code>protected Constructor</h4>

(Cf. JLS. §6.6.2.2.)

TO DO

6.6.3 An Example of Access Control

(Cf. JLS. §6.6.3.)

TO DO

6.6.4 Example: Access to <code>public and <code>Non-public</code> Classes</h3>

(Cf. JLS. §6.6.4.)

TO DO

6.6.5 Example: Default-Access Fields, Methods, and Constructors

(Cf. JLS. §6.6.5.)

TO DO

6.6.6 Example: <code>public Fields, Methods, and Constructors</h3>

(Cf. JLS. §6.6.6.)

TO DO

6.6.7 Example: <code>protected Fields, Methods, and Constructors</h3>

(Cf. JLS. §6.6.7.)

TO DO

6.6.8 Example: <code>private Fields, Methods, and Constructors</h3>

(Cf. JLS. §6.6.8.)

TO DO

6.7 Fully Qualified Names and Canonical Names

(Cf. JLS. §6.7.)

TO DO

6.8 Naming Conventions

(Cf. JLS. §6.8.)

TO DO

6.8.1 Package Names

(Cf. JLS. §6.8.1.)

TO DO

6.8.2 Class and Interface Type Names

(Cf. JLS. §6.8.2.)

TO DO

6.8.3 Method Names

(Cf. JLS. §6.8.3.)

TO DO

6.8.4 Field Names

(Cf. JLS. §6.8.4.)

TO DO

6.8.5 Constant Names

(Cf. JLS. §6.8.5.)

TO DO

6.8.6 Local Variable and Parameter Names

(Cf. JLS. §6.8.6.)

TO DO


Specification Table of Contents.

The organization of this chapter parallels the chapter on Names in the Java Language Specification (second edition).

The original of this specification is at http://docs.codehaus.org/display/GroovyJSR.