Methods



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

Methods

Methods can have where clauses of their own:

<MethodDeclaration> -> [<MethodModifiers>] <ResultType>
	<MethodDeclarator> [<Throws>]
	[<where>] <MethodBody>
The where clause can constrain one of the type parameters of the containing interface or type. Calls to methods or constructors of formal parameter types are legal within the method body if they match constraints for the parameter that are given either in the where clauses of the containing class or interface, or in the where clauses of the method.



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