Invoking a Type Method

You can call a type method by qualifying the method call with the name of the class to type, as shown in the following code fragment, which specifies the someMethod method on the Company class.

Company@someMethod();

Call a type method exported from a package in the same way, as shown in the following code fragments.

ImportedCompany@someMethod();

Package::Company@someMethod();

You can provide an application context for the call to a type method, as shown in the following code fragment.

Company@someMethod() in someApplicationContext;

You can also call a type method by using a variable, parameter, or property. In this case, the type of the value of the variable identifies the type method to call. With the exception of the JADE inheritMethod instruction, every call to a type method must be qualified. This includes a method calling a type method on the class of the receiver (or a superclass of the receiver), and a type method calling another type method. Even though the methods are in scope, they must be qualified to make it clear that a type method is being called.

You cannot call a type method indirectly using the Object class sendMsg or sendMsgWithParams method, nor can you explicitly call an exported type method using the Object class invokeMethod method. Illegal calls to a type method result in the error 1185 (Invalid call to a type method).

Calling an instance method with one of the Object class methods sendTypeMsg, sendTypeMsgWithParams, or sendTypeMsgWithIOParams results in the error 1184 (The requested method is not a type method).