public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug java/18119] New: GCJ imports inner classes too eagarly
@ 2004-10-23 0:50 csm at gnu dot org
2004-10-23 16:13 ` [Bug java/18119] " pinskia at gcc dot gnu dot org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: csm at gnu dot org @ 2004-10-23 0:50 UTC (permalink / raw)
To: gcc-bugs
GCJ erroneously looks up inner classes (usually private) before classes in other
packages.
For example, I have three files a/A.java, b/B.java, and b/C.java:
-- a/A.java:
package a;
public abstract class A
{
public abstract void a();
public void b()
{
new B().innerB();
}
private class B
{
public void innerB()
{
System.out.println ("inner b!");
}
}
}
-- b/B.java:
package b;
class B
{
public void b()
{
System.out.println ("b!");
}
}
-- b/C.java:
package b;
import a.A;
class C extends A
{
public void a()
{
System.out.println ("aaa!");
}
public static final void main (String[] argv)
{
C c = new C();
c.a();
c.b();
B b = new B();
b.b();
}
}
$ gcj -C a/A.java b/B.java b/C.java
b/C.java:15: error: Nested class a.A$B is private; cannot be accessed from here.
B b = new B();
^
1 error
$ gcj --version
gcj (GCC) 3.4.2
This is easy to work around (just say "b.B b = new b.B()"), but is still
incorrect. Javac and jikes do not fail.
--
Summary: GCJ imports inner classes too eagarly
Product: gcc
Version: 3.4.2
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: java
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: csm at gnu dot org
CC: gcc-bugs at gcc dot gnu dot org,java-prs at gcc dot gnu
dot org
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18119
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug java/18119] GCJ imports inner classes too eagarly
2004-10-23 0:50 [Bug java/18119] New: GCJ imports inner classes too eagarly csm at gnu dot org
@ 2004-10-23 16:13 ` pinskia at gcc dot gnu dot org
2005-06-18 1:49 ` [Bug java/18119] Private inner class is visible when it shouldn't be mckinlay at redhat dot com
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-10-23 16:13 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-10-23 16:13 -------
Confirmed.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Keywords| |rejects-valid
Last reconfirmed|0000-00-00 00:00:00 |2004-10-23 16:13:21
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18119
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug java/18119] Private inner class is visible when it shouldn't be
2004-10-23 0:50 [Bug java/18119] New: GCJ imports inner classes too eagarly csm at gnu dot org
2004-10-23 16:13 ` [Bug java/18119] " pinskia at gcc dot gnu dot org
@ 2005-06-18 1:49 ` mckinlay at redhat dot com
2005-07-07 14:44 ` cvs-commit at gcc dot gnu dot org
2005-07-07 14:49 ` mckinlay at redhat dot com
3 siblings, 0 replies; 5+ messages in thread
From: mckinlay at redhat dot com @ 2005-06-18 1:49 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From mckinlay at redhat dot com 2005-06-18 01:49 -------
GCJ actually has the resolution order correct here. The problem is that a.A.B is
not visible from b.C, because its a private class. Instead of an error, however,
GCJ needs to resolve to the visible class b.B instead.
I'm testing a patch.
--
What |Removed |Added
----------------------------------------------------------------------------
Summary|GCJ imports inner classes |Private inner class is
|too eagarly |visible when it shouldn't be
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18119
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug java/18119] Private inner class is visible when it shouldn't be
2004-10-23 0:50 [Bug java/18119] New: GCJ imports inner classes too eagarly csm at gnu dot org
2004-10-23 16:13 ` [Bug java/18119] " pinskia at gcc dot gnu dot org
2005-06-18 1:49 ` [Bug java/18119] Private inner class is visible when it shouldn't be mckinlay at redhat dot com
@ 2005-07-07 14:44 ` cvs-commit at gcc dot gnu dot org
2005-07-07 14:49 ` mckinlay at redhat dot com
3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-07-07 14:44 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2005-07-07 14:44 -------
Subject: Bug 18119
CVSROOT: /cvs/gcc
Module name: gcc
Changes by: bryce@gcc.gnu.org 2005-07-07 14:44:03
Modified files:
libjava : ChangeLog
libjava/testsuite/libjava.jacks: jacks.xfail
gcc/java : ChangeLog parse.y
Log message:
2005-07-07 Bryce McKinlay <mckinlay@redhat.com>
PR java/18119
* parse.y (inner_class_accessible): New function. Logic moved from
check_inner_class_access.
(check_inner_class_access): Use inner_class_accessible.
(resolve_inner_class): Simplify arguments. Create circularity hash
here. Keep looking for classes if we found one that was
inaccessible. Return the inaccessible class only if there is no other
match.
(do_resolve_class): Update for new resolve_inner_class arguments.
Don't create circularity_hash here.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/ChangeLog.diff?cvsroot=gcc&r1=1.3694&r2=1.3695
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/testsuite/libjava.jacks/jacks.xfail.diff?cvsroot=gcc&r1=1.27&r2=1.28
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/java/ChangeLog.diff?cvsroot=gcc&r1=1.1642&r2=1.1643
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/java/parse.y.diff?cvsroot=gcc&r1=1.547&r2=1.548
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18119
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug java/18119] Private inner class is visible when it shouldn't be
2004-10-23 0:50 [Bug java/18119] New: GCJ imports inner classes too eagarly csm at gnu dot org
` (2 preceding siblings ...)
2005-07-07 14:44 ` cvs-commit at gcc dot gnu dot org
@ 2005-07-07 14:49 ` mckinlay at redhat dot com
3 siblings, 0 replies; 5+ messages in thread
From: mckinlay at redhat dot com @ 2005-07-07 14:49 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From mckinlay at redhat dot com 2005-07-07 14:47 -------
Fixed on HEAD.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
Target Milestone|--- |4.1.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18119
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2005-07-07 14:48 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-23 0:50 [Bug java/18119] New: GCJ imports inner classes too eagarly csm at gnu dot org
2004-10-23 16:13 ` [Bug java/18119] " pinskia at gcc dot gnu dot org
2005-06-18 1:49 ` [Bug java/18119] Private inner class is visible when it shouldn't be mckinlay at redhat dot com
2005-07-07 14:44 ` cvs-commit at gcc dot gnu dot org
2005-07-07 14:49 ` mckinlay at redhat dot com
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).