I have a few classes (of TObject
) in Delphi XE7 (Firemonkey) which have a property AsJson
:
uses
System.Classes, System.SysUtils, XSuperObject;
type
TMyObject = class(TObject)
public
property AsJson: ISuperObject read GetAsJson;
end;
However, the compiler is giving me warnings for these:
[dcc32 Warning] MyUnit.pas(383): W1009 Redeclaration of 'AsJson' hides a member in the base class
I'm looking in the base class of TObject
and see no such thing, nor is it a valid field if I were to try to use it. I see nothing in the documentation about such a property. This only appears to happen if the property type is ISuperObject
which is the latest version of XSuperObject
(from SVN a few weeks ago at least). I also tried using type Integer
and I get it too.
What does this warning mean in my scenario and how do I get rid of it?
EDIT
It appears to only happen when I have XSuperObject
in the uses clause...
program Project1;
{$APPTYPE CONSOLE}
{$R *.res}
uses
System.SysUtils,
XSuperObject in 'C:\...\XSuperObject.pas',
XSuperJSON in 'C:\...\XSuperJSON.pas';
type
TMyObject = class(TObject)
private
FTest: Integer;
public
property AsJson: Integer read FTest;
end;
begin
end.
Above example produces:
[dcc32 Warning] Project1.dpr(17): W1009 Redeclaration of 'AsJson' hides a member in the base class
If I simply remove XSuperObject
, I don't get this warning. My copy of XSuperObject is a few weeks old.
In ten years, no proper answer has been provided. Here is how to get rid of that message:
TMyObject = class(TObject)
public
{$WARNINGS OFF}
property AsJson: ISuperObject read GetAsJson;
{$WARNINGS ON}
end;