Instantiation



next up previous
Next: Classes Up: Java Grammar Extensions Previous: Interfaces

Instantiation

The form of an instantiation is

<instantiationType> -> <idn> "[" <actualParams> "]"
where

<actualParams> -> <Type> [, <Type> ]*
The idn in the instantiation must name a parameterized class or interface. The number of actualParams must match the number given in that parameterized definition, and each Type must satisfy the constraints for the corresponding formal parameter of that definition.

Satisfying a constraint means: (1) if the constraint indicates a constructor is required, the actual type must have a constructor with a signature that is compatible with that given in the constraint; (2) if the constraint indicates that a method is required, the actual type must have a method of that name with a signature that is compatible with that given in the constraint; if the constraint indicates the method is static, the matching method in the actual type must also be static, and otherwise it must not be static.



Andrew C. Myers, Joseph A. Bank, Barbara Liskov
Copyright © 1996 Association for Computing Machinery