## §4.1 Callin method binding

→ Syntax §A.3.3

#### (a) Method call interception

A role method may intercept calls to a base method by a callin binding.

#### (b) Prerequisite: Class binding

A callin binding requires the enclosing class to be a role class bound to a base class according to §2.1. An unliftable role (see §2.3.4.(a)) should not define callin bindings. In this case callin bindings can only safely be introduced in sub-roles which (by an appropriately refined `playedBy` clause) disambiguate the lifting translation.

For corner cases the above rule can be overridden by suppressing the corresponding error using the `"hidden-lifting-problem"` token (see §2.3.5). This will allow callin bindings to be defined even for unliftable roles expecting that lifting may still succeed by one of the patterns desribed in §2.3.4.(b).

#### (c) Callin declaration

A callin binding composes an existing role method with a given base method. It may appear within the role class at any place where feature declarations are allowed. It is denoted by

    role_method_designator <- callin_modifier base_method_designator;

Just like with callout bindings, method designators may or may not contain parameters lists and return type but no modifiers; also, each method designator must exactly and uniquely select one method (cf. §3.1.(c)).
For callin modifiers see below (§4.2).

#### (d) Multiple base methods

Base method designators may furthermore enumerate a list of methods. If multiple base methods are bound in one callin declaration generally all signatures in this binding must be conform.
However, extraneous parameters from base methods may be ignored at the role.
For result types different rules exist, depending on the applied callin modifier (see next).

#### (e) Named callin binding

Any callin binding may be labeled with a name. The name of a callin binding is used for declaring precedence (§4.8). A named callin binding overrides any inherited callin binding (explicit and implicit (§1.3.1)) with the same name.
It is an error to use the same callin name more than once within the same role class.

#### (f) Callin to final

When binding to a final base method, the enclosing role must be played by the exact base class declaring the final method. I.e., callin binding to a final method inherited from the base class's super-class is not allowed. This is motivated by the fact that no sub-class may have a version of a final method with different semantics.

#### (g) Declared exceptions

It is an error if a role method to be bound by callin declares in its `throws` clause any exceptions that are not declared by the corresponding base method(s).

#### (h) Method of enclosing class

In a `before` or `after` callin binding the left hand side may alternatively resolve to a method of an enclosing class rather than the current role.

#### (i) Callin to constructor

A callin binding may refer to a constructor of the bound base class by using the constructor's source name (identical to the name of the base class). In this case only an after binding (§4.2.(a)) is allowed.