This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug java/12361] New: No error on illegal access to private inner class.


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;
    }
}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]