gcj/225: gcj incorrectly checks access on protected inner interfaces
mdejong@cygnus.com
mdejong@cygnus.com
Sun May 7 20:40:00 GMT 2000
>Number: 225
>Category: gcj
>Synopsis: gcj incorrectly checks access on protected inner interfaces
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: apbianco
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sun May 07 20:40:00 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator: Mo
>Release: CVS
>Organization:
>Environment:
>Description:
I don't think the following code is legal. The
ProtectedInnerInterface class is in the global
package and it has a protected member Inter
that should not be accessible.
% cat ProtectedInnerInterface.java
// File ProtectedInnerInterface.java
public class ProtectedInnerInterface {
protected interface Inter {}
}
% cat ProtectedInnerInterface_OtherPkgTest3.java
// File ProtectedInnerInterface_OtherPkgTest3.java
package foo;
import ProtectedInnerInterface;
public class ProtectedInnerInterface_OtherPkgTest3 implements ProtectedInnerInterface.Inter {}
// This should fail to compile because the Inter member of ProtectedInnerInterface
// is protected and therefore should not be accessible.
% javac ProtectedInnerInterface.java ProtectedInnerInterface_OtherPkgTest3.java
ProtectedInnerInterface_OtherPkgTest3.java:11: Can't access nested interface ProtectedInnerInterface. Inter. Only public classes and interfaces in other packages can be accessed.
public class ProtectedInnerInterface_OtherPkgTest3 implements ProtectedInnerInterface.Inter {}
^
1 error
% jikes -classpath /usr/share/kaffe/Klasses.jar ProtectedInnerInterface.java ProtectedInnerInterface_OtherPkgTest3.java
(No error generated)
% gcj -C ProtectedInnerInterface.java ProtectedInnerInterface_OtherPkgTest3.java
(No error generated)
So it seems like both jikes and gcj are wrong to compile this code. Only javac
seems to get it right.
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the Java-prs
mailing list