fpc/tests/test/jvm/ujsetter.pp
Jonas Maebe 1ce93f7430 * when automatically generating an overriding getter/setter method (because
a property in a child class has a higher visibility than the getter/
    setter), ensure that we call the inherited method and not the method
    itself (causing a stack overflow due to infinite recursion)

git-svn-id: trunk@25223 -
2013-08-06 21:50:56 +00:00

49 lines
726 B
ObjectPascal

unit ujsetter;
{$namespace org.freepascal.test.jsetter}
{$mode delphi}
interface
type
tjsetterbase = class
protected
fval: longint;
procedure SetVal(v: longint); virtual;
public
function get: longint;
end;
tjsetterchild = class(tjsetterbase)
public
property Val: longint read fval write SetVal;
end;
tjsetterchild2 = class(tjsetterchild)
protected
procedure SetVal(v: longint); override;
public
property Val: longint read fval write SetVal;
end;
implementation
function tjsetterbase.get: longint;
begin
result:=fval;
end;
procedure tjsetterbase.SetVal(v: longint);
begin
fval:=v;
end;
procedure tjsetterchild2.SetVal(v: longint);
begin
fval:=v-1;
end;
end.