Browse Source

* only make clone method accessible once if needed

git-svn-id: branches/jvmbackend@18821 -
Jonas Maebe 14 years ago
parent
commit
336420ef46
1 changed files with 6 additions and 5 deletions
  1. 6 5
      rtl/java/jtvar.inc

+ 6 - 5
rtl/java/jtvar.inc

@@ -30,12 +30,13 @@
                 owningClass:=owningClass.getSuperClass;
             end;
           until assigned(fCloneMethod);
+          { required to enable calling methods of non-public classes (e.g. a
+            record type defined in the implementation of a unit) -- can cause
+            security exceptions if the security manager doesn't allow this
+            though... }
+          if not fCloneMethod.isAccessible then
+            fCloneMethod.setAccessible(true);
         end;
-      { required to enable calling methods of non-public classes (e.g. a record
-        type defined in the implementation of a unit -- can cause security
-        exceptions if the security manager doesn't allow this though... }
-      if not fCloneMethod.isAccessible then
-        fCloneMethod.setAccessible(true);
       { return a copy of the record/shortstring/set/... }
       result:=fCloneMethod.invoke(fInstanceToClone,[]);
     end;