Delphi Error – E2207 ‘%s’ clause not allowed in interface type

Delphi Compiler Error

E2207 ‘%s’ clause not allowed in interface type

Reason for the Error & Solution

The clause noted in the message is not allowed in an interface type. Typically this error indicates that an illegal directive has been specified for a property field in the interface.

program Produce;
  type
    Base = interface
      function Reader : Integer;
      procedure Writer(a : Integer);
      property Value : Integer read Reader write Writer stored false;
    end;
begin
end.

The problem in the above program is that the stored directive is not allowed in interface types.

program Solve;
  type
    Base = interface
      function Reader : Integer;
      procedure Writer(a : Integer);
      property Value : Integer read Reader write Writer;
    end;

begin
end.

The solution to problems of this nature are to remove the offending directive. Of course, it is best to understand the desired behavior and to implement it in some other fashion.