Java Reference
In-Depth Information
When TypeArguments are provided after the class name, it is a compile-time error
if the type arguments, when applied to the class, do not denote a well-formed para-
meterized type (§ 4.5 ) .
When “ <> ” is used to elide type arguments after the class name, it is a compile-
time error if the class is not generic.
The class being instantiated is the class denoted by the TypeDeclSpecifier .
• Otherwise, the class instance creation expression is a qualified class instance cre-
ation expression.
It is a compile-time error if the Identifier after the new token is not the simple name
6.2 ) of an accessible (§ 6.6 ) non- abstract inner class (§ 8.1.3 ) C that is a member of
the compile-time type of the Primary .
It is a compile-time error if the name is ambiguous (§ 8.5 ) or denotes an enum type
8.9 ) .
When TypeArguments are provided after the name, it is a compile-time error if the
type arguments, when applied to C , do not denote a well-formed parameterized
type (§ 4.5 ).
When “ <> ” is used to elide type arguments after the name, it is a compile-time er-
ror if C is not generic.
The class being instantiated is C .
The type of the class instance creation expression is the class type being instantiated, as
defined above.
15.9.2. Determining Enclosing Instances
Let C be the class being instantiated, and let i be the instance being created. If C is an inner
class then i may have an immediately enclosing instance. The immediately enclosing in-
stance of i 8.1.3 ) is determined as follows.
If C is an anonymous class, then:
• If the class instance creation expression occurs in a static context (§ 8.1.3 ), then i
has no immediately enclosing instance.
• Otherwise, the immediately enclosing instance of i is this .
If C is a local class (§ 14.3 ), then let O be the innermost lexically enclosing class of C . Let n
be an integer such that O is the n 'th lexically enclosing class of the class in which the class
instance creation expression appears. Then:
Search WWH ::




Custom Search