Browse Source

* translated Pascal 'protected' also in JVM 'protected', because 'protected'
in the JVM means "accessible to subclasses *and* to classes in the same
package" (and all classes in the same unit are by definition also in the
same package) -- before, such fields were declared as "package" which means
that they could not be accessed by subclasses in other packages

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

Jonas Maebe 14 years ago
parent
commit
13d68da2be
1 changed files with 5 additions and 1 deletions
  1. 5 1
      compiler/agjasmin.pas

+ 5 - 1
compiler/agjasmin.pas

@@ -697,9 +697,13 @@ implementation
           vis_hidden,
           vis_hidden,
           vis_strictprivate:
           vis_strictprivate:
             result:='private ';
             result:='private ';
+          { protected in Java means "accessible by subclasses *and* by classes
+            in the same package" -> similar to regular "protected" in Pascal;
+            "strict protected" is actually more strict in Pascal than in Java,
+            but there's not much we can do about that }
+          vis_protected,
           vis_strictprotected:
           vis_strictprotected:
             result:='protected ';
             result:='protected ';
-          vis_protected,
           vis_private:
           vis_private:
             { pick default visibility = "package" visibility; required because
             { pick default visibility = "package" visibility; required because
               other classes in the same unit can also access these symbols }
               other classes in the same unit can also access these symbols }