gcj/224: gcj incorrectly allows access to private inner interfaces
mdejong@cygnus.com
mdejong@cygnus.com
Sun May 7 17:50:00 GMT 2000
>Number: 224
>Category: gcj
>Synopsis: gcj incorrectly allows access to private inner interfaces
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: apbianco
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sun May 07 17:50:00 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator: Mo
>Release: CVS
>Organization:
>Environment:
>Description:
% cat PrivateInnerInterface.java
// File PrivateInnerInterface.java
public class PrivateInnerInterface {
private interface Inter {}
}
class PrivateInnerInterface_Test extends PrivateInnerInterface {
void foo() {
// Implement the interface with an innerclass
Inter i = new Inter() { } ;
}
}
// This should fail to compile because Inter is private in the superclass
Here are the results I get from jikes:
% jikes -classpath /usr/share/kaffe/Klasses.jar PrivateInnerInterface.java
Found 2 semantic errors compiling "PrivateInnerInterface.java":
11. Inter i = new Inter() { } ;
<--->
*** Error: The type "PrivateInnerInterface$Inter" with private access is not visible here.
11. Inter i = new Inter() { } ;
<--->
*** Error: The type "PrivateInnerInterface$Inter" with private access is not visible here.
And from javac:
% javac PrivateInnerInterface.java
PrivateInnerInterface.java:11: Can't access nested interface PrivateInnerInterface. Inter. Only public classes and interfaces in other packages can be accessed.
Inter i = new Inter() { } ;
^
PrivateInnerInterface.java:11: Can't access nested interface PrivateInnerInterface. Inter. Only public classes and interfaces in other packages can be accessed.
Inter i = new Inter() { } ;
^
2 errors
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="PrivateInnerInterface.java"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="PrivateInnerInterface.java"
Ly8gRmlsZSBQcml2YXRlSW5uZXJJbnRlcmZhY2UuamF2YQoKcHVibGljIGNsYXNzIFByaXZhdGVJ
bm5lckludGVyZmFjZSB7CiAgICBwcml2YXRlIGludGVyZmFjZSBJbnRlciB7fQp9CgoKY2xhc3Mg
UHJpdmF0ZUlubmVySW50ZXJmYWNlX1Rlc3QgZXh0ZW5kcyBQcml2YXRlSW5uZXJJbnRlcmZhY2Ug
ewogICAgdm9pZCBmb28oKSB7CgkvLyBJbXBsZW1lbnQgdGhlIGludGVyZmFjZSB3aXRoIGFuIGlu
bmVyY2xhc3MKCUludGVyIGkgPSBuZXcgSW50ZXIoKSB7IH0gOwogICAgfQp9CgovLyBUaGlzIHNo
b3VsZCBmYWlsIHRvIGNvbXBpbGUgYmVjYXVzZSBJbnRlciBpcyBwcml2YXRlIGluIHRoZSBzdXBl
cmNsYXNzCgovLyBXZSBkbyBub3QgaGF2ZSBhIHRlc3QgZm9yIHRoZSBjYXNlIHdoZXJlIGEgcHJp
dmF0ZSBpbm5lciBpbnRlcmZhY2UgaXMgYWNjZXNzYWJsZQo=
More information about the Java-prs
mailing list