public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* java/9685: Illegal access to package-private method is allowed
@ 2003-02-13  6:16 rmathew
  0 siblings, 0 replies; only message in thread
From: rmathew @ 2003-02-13  6:16 UTC (permalink / raw)
  To: gcc-gnats


>Number:         9685
>Category:       java
>Synopsis:       Illegal access to package-private method is allowed
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          accepts-illegal
>Submitter-Id:   net
>Arrival-Date:   Thu Feb 13 06:16:01 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     rmathew@hotmail.com
>Release:        3.3
>Organization:
>Environment:

>Description:
GCJ 3.3 seems to allow a class to access the package-private
methods of a different class even though this is not
permitted by the JLS.

Here's a simple testcase:
------------------- File: foo/Bar.java --------------------
package foo;

public class Bar {
    static void snafu( ) { }
}
---------------------------- 8< ----------------------------

------------------- File: ChkAcc.java ----------------------
public class ChkAcc {
    public void checkAccess( ) { foo.Bar.snafu( ); }
}
---------------------------- 8< ----------------------------

GCJ wrongly allows ChkAcc.java to compile successfully.

Note that this works with non-static methods as well.
It also works if a class in a named package accesses
package-private methods in the anonymous "default"
package.

Ranjit.
>How-To-Repeat:
gcj -C foo/Bar.java
gcj -C ChkAcc.java
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-02-13  6:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-02-13  6:16 java/9685: Illegal access to package-private method is allowed rmathew

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).