Compiler Error AL0923

Note


The AL diagnostics topics are in preview. If you have input for this topic, we'd love to hear from you. Use our GitHub repo to create a PR and add content to this topic by going to here. To read about contributing, see Contribute to the Help. Thanks!

The attribute '[RequiredPending]' can only be applied to interface methods with a default implementation.

Description

The [RequiredPending] attribute is only valid on interface methods that have a body (default implementation). Methods without a body are already required.

Remarks

The [RequiredPending] attribute signals that an optional interface method (one with a default implementation) will become required in a future version. Applying it to a method without a body is meaningless because methods without a default implementation are already required -- all implementors must provide them.

How to fix it

Either add a default implementation (body) to the interface method, or remove the [RequiredPending] attribute.

Example of code that triggers AL0923

interface INotification
{
    // Error: RequiredPending on a method without a body.
    // This method is already required because it has no default implementation.
    [RequiredPending('This will become required', '27.0')]
    procedure Notify(message: Text);
}

Example of how to fix it

If the method should be required, simply remove the [RequiredPending] attribute. It is already required because it has no body.

interface INotification
{
    procedure Notify(message: Text);
}

If you intend to make the method optional now and required later, add a default implementation body.

interface INotification
{
    [RequiredPending('Implementors must provide Notify by v27.0', '27.0')]
    procedure Notify(message: Text);
    begin
        // Default no-op implementation.
        // Implementors should override this.
    end;
}

Getting started with AL
Developing extensions
Interfaces in AL
Compiler Warning AL0924