Error, Warning, Hint & Message

The Error, Warning, Hint and Message aspects can be attached to types and members in order to generate the corresponding message whenever the annotated type or member is accessed from code.

The aspects takes an optional string parameter that can provide a custom message to replace the more generic default message generated for the compiler – for example to direct the developer trying to use the API to a better-suited alternative or give an explanation for the message.

The aspects can be applied to individual members or to a whole type. If applied to a whole type, any access of the type or any of its members will trigger the warning (or error).

The aspects are very similar to the more commonly used Obsolete aspect, but without the implied obsolescence. Obsolete should be used if an API is truly obsolete and should not be used; these aspects may be used to indicate other problems – for example an API that is already present, but not fully implemented yet.

[Warning('Foo is not implemented yet, sorry')]
method Foo;
begin
end;
[Warning("Foo is not implemented yet, sorry")]
public void Foo()
{
}
@Warning("Foo is not implemented yet, sorry")
public func Foo() {
}
@Warning("Foo is not implemented yet, sorry")
public void Foo()
{
}

Defined by the the core compiler

See Also