Prechádzať zdrojové kódy

* allow non-virtual class methods to be declared as "final" in Java classes,
since virtual class methods are handled differently from regular ones and
the JDK contains several (non-virtual, since Java does not support virtual
class methods) final class methods

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

Jonas Maebe 14 rokov pred
rodič
commit
e7528bbc05
1 zmenil súbory, kde vykonal 3 pridanie a 1 odobranie
  1. 3 1
      compiler/pdecsub.pas

+ 3 - 1
compiler/pdecsub.pas

@@ -1374,7 +1374,9 @@ begin
   if is_objectpascal_helper(tprocdef(pd).struct) and
       (m_objfpc in current_settings.modeswitches) then
     Message1(parser_e_not_allowed_in_helper, arraytokeninfo[_FINAL].str);
-  if (po_virtualmethod in pd.procoptions) then
+  if (po_virtualmethod in pd.procoptions) or
+     (is_javaclass(tprocdef(pd).struct) and
+      (po_classmethod in pd.procoptions)) then
     include(pd.procoptions,po_finalmethod)
   else
     Message(parser_e_only_virtual_methods_final);