public inbox for java-prs@sourceware.org
help / color / mirror / Atom feed
From: "csm at gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: java-prs@gcc.gnu.org
Subject: [Bug java/18119] New: GCJ imports inner classes too eagarly
Date: Sat, 23 Oct 2004 00:50:00 -0000	[thread overview]
Message-ID: <20041023004958.18119.csm@gnu.org> (raw)

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


             reply	other threads:[~2004-10-23  0:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-23  0:50 csm at gnu dot org [this message]
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:48 ` mckinlay at redhat dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20041023004958.18119.csm@gnu.org \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=java-prs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).