§A.3 Method bindings

The rule of items declarable in a class body is augmented by method bindings:

§ A.3.1 ClassBodyDeclaration
...
CalloutBinding
CallinBinding
§ A.3.2 CalloutBinding
[Modifier] [TypeArguments] MethodSpec CalloutKind MethodSpec CalloutParameterMappings
[Modifier] [TypeArguments] MethodSpec CalloutKind CalloutModifier FieldSpec
§ A.3.3 Callin binding
[ Identifier : ] [TypeArguments] MethodSpec <- CallinModifier MethodSpecs
[Guard] CallinParameterMappings
§ A.3.4 MethodSpec
Identifier
ResultType MethodDeclarator
ConstructorDeclarator
Note, that ResultType, MethodDeclarator and ConstructorDeclarator are not explicit in the overall syntax of the Java language specification. For convenience we refer to the definition in sections 8.4. Method Declarations and 8.8. Constructor Declarations of the Java language specification.
§ A.3.5 MethodSpecs
MethodSpec [, MethodSpecs]
§ A.3.6 CalloutKind
->
=>
§ A.3.7 CallinModifier
before
after
replace
§ A.3.8 CalloutModifier
get
set
§ A.3.9 FieldSpec
[Type] Identifier
Contextual constraints:
  1. CalloutBindings and CallinBindings may occur only in bound role classes.
  2. A CalloutBinding or CallinBinding may not mix identifiers and full signatures (MethodDeclarationHead) for its method specifiers (MethodSpec).
    Binding a full method signature to a field requires the FieldSpec to include the Type.
  3. The method specifier at the left hand side of a CallinBinding which has the replace modifier must refer to a method that has the callin modifier.
  4. The Modifier of a callout binding can only be one of the visility modifiers public, protected or private. A short callout binding (i.e., without signatures) must not specify a visibility modifier.
  5. A MethodSpec of the shape ConstructorDeclarator is legal only on the right hand side of a callin after binding (see §4.1.(i)).