* mark classes representing records as final

* mark sealed classes as final
  * mark "final" fields as final

git-svn-id: branches/jvmbackend@18609 -
This commit is contained in:
Jonas Maebe 2011-08-20 08:14:50 +00:00
parent 0f15664ffa
commit 52b62732e2

View File

@ -555,7 +555,8 @@ implementation
case obj.typ of
recorddef:
begin
AsmWrite('.class ');
{ can't inherit from records }
AsmWrite('.class final ');
if toplevelowner.symtabletype=globalsymtable then
AsmWrite('public ');
AsmWriteln(obj.jvm_full_typename(true));
@ -567,6 +568,8 @@ implementation
odt_javaclass:
begin
AsmWrite('.class ');
if oo_is_sealed in tobjectdef(obj).objectoptions then
AsmWrite('final ');
if toplevelowner.symtabletype=globalsymtable then
AsmWrite('public ');
AsmWriteln(obj.jvm_full_typename(true));
@ -821,7 +824,7 @@ implementation
if (sym.typ=staticvarsym) or
(sp_static in sym.symoptions) then
result:=result+'static ';
if sym.varspez=vs_const then
if sym.varspez in [vs_const,vs_final] then
result:=result+'final ';
result:=result+jvmmangledbasename(sym,true);
end;