This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug java/12361] New: No error on illegal access to private inner class.
- From: "suckfish at ihug dot co dot nz" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 22 Sep 2003 05:20:31 -0000
- Subject: [Bug java/12361] New: No error on illegal access to private inner class.
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12361
Summary: No error on illegal access to private inner class.
Product: gcc
Version: 3.4
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: java
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: suckfish at ihug dot co dot nz
CC: gcc-bugs at gcc dot gnu dot org
/*
Access checks appear not to be made when accessing inner classes.
This code should not compile, but does, both with 3.3.1 and trunk as
of 2003-9-21.
It should not be possible to access C outside of B. Therefore
S.C.i below should give an error.
Sun javac does give an error:
$ /usr/java/j2sdk1.4.2/bin/javac temp.java
temp.java:35: B.S.C has private access in B.S
return S.C.i;
^
1 error
*/
package B;
class S
{
private static class C
{
static final int i = 1;
}
}
class D
{
int foo()
{
return S.C.i;
}
}