ソースを参照

* make the real name of methods implementing interface methods the same as
as the real name of the declaration in the interface, so that the JVM
case-sensitive mapping works out
* process the interface mappings for the compiler-constructed classes for
enums and procvars

git-svn-id: branches/jvmbackend@18693 -

Jonas Maebe 14 年 前
コミット
7e7bdc3c55
2 ファイル変更22 行追加2 行削除
  1. 9 1
      compiler/nobj.pas
  2. 13 1
      compiler/pjvm.pas

+ 9 - 1
compiler/nobj.pas

@@ -573,7 +573,15 @@ implementation
                 if assigned(implprocdef) then
                   begin
                     if (tobjectdef(implprocdef.struct).objecttype<>odt_objcclass) then
-                      ImplIntf.AddImplProc(implprocdef)
+                      begin
+                        { in case of Java, copy the real name from the parent,
+                          since overriding "Destroy" with "destroy" is not
+                          going to work very well }
+                        if is_javaclass(implprocdef.struct) and
+                           (implprocdef.procsym.realname<>tprocdef(def).procsym.realname) then
+                          implprocdef.procsym.realname:=tprocdef(def).procsym.realname;
+                        ImplIntf.AddImplProc(implprocdef);
+                      end
                     else
                       begin
                         { If no message name has been specified for the method

+ 13 - 1
compiler/pjvm.pas

@@ -55,7 +55,7 @@ implementation
     fmodule,
     parabase,aasmdata,
     pdecsub,ngenutil,pparautl,
-    symtable,symcreat,defcmp,jvmdef,
+    symtable,symcreat,defcmp,jvmdef,nobj,
     defutil,paramgr;
 
 
@@ -241,6 +241,7 @@ implementation
 
     procedure jvm_maybe_create_enum_class(const name: TIDString; def: tdef);
       var
+        vmtbuilder: tvmtbuilder;
         arrdef: tarraydef;
         arrsym: ttypesym;
         juhashmap: tdef;
@@ -415,6 +416,11 @@ implementation
         pd.synthetickind:=tsk_jvm_enum_classconstr;
 
         symtablestack.pop(enumclass.symtable);
+
+        vmtbuilder:=TVMTBuilder.Create(enumclass);
+        vmtbuilder.generate_vmt;
+        vmtbuilder.free;
+
         restore_after_new_class(sstate,islocal,oldsymtablestack);
         current_structdef:=old_current_structdef;
       end;
@@ -422,6 +428,7 @@ implementation
 
     procedure jvm_create_procvar_class(const name: TIDString; def: tdef);
       var
+        vmtbuilder: tvmtbuilder;
         oldsymtablestack: tsymtablestack;
         pvclass: tobjectdef;
         temptypesym: ttypesym;
@@ -473,6 +480,11 @@ implementation
         pvclass.symtable.insert(temptypesym);
 
         symtablestack.pop(pvclass.symtable);
+
+        vmtbuilder:=TVMTBuilder.Create(pvclass);
+        vmtbuilder.generate_vmt;
+        vmtbuilder.free;
+
         restore_after_new_class(sstate,islocal,oldsymtablestack);
       end;