public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "s28patel at student dot math dot uwaterloo dot ca" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug java/13098] accepts invalid code referencing package only constructor
Date: Tue, 18 Nov 2003 09:41:00 -0000	[thread overview]
Message-ID: <20031118094100.10871.qmail@sources.redhat.com> (raw)
In-Reply-To: <20031118055037.13098.pinskia@gcc.gnu.org>


------- Additional Comments From s28patel at student dot math dot uwaterloo dot ca  2003-11-18 09:40 -------
Some more thoughts on this problem...

If a constructor has no access specifier, "... there is default access, which is
permitted only when the access occurs from within the package in which the type
is declared," so in this case access should not be permitted (section 6.6.1 in
the Java Language Specification 2nd ed. available at
http://java.sun.com/docs/books/jls/second_edition/html/names.doc.html).

Sun's compiler and IBM's jikes compiler do not compile the code, yet gcj does
compile it.

gij throws an an IllegalAccessError when running the improperly compiled code,
but oddly both Microsoft's VM and Sun's VM run it without error (the constructor
is actually executed).  It seems to me that this this is a problem with Sun's VM
and Microsoft's VM, and could possibly cause of incompatibilities.

For example what if someone developed a Java program with gcj that accidently
accesses a constructor with default access from outside the package (which is
technically illegal)?  Then the bytecode would run fine on Sun's VM or
Microsoft's VM, but would fail if run with gij, and users might think gij has a bug.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13098


  reply	other threads:[~2003-11-18  9:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-11-18  5:50 [Bug java/13098] New: " pinskia at gcc dot gnu dot org
2003-11-18  9:41 ` s28patel at student dot math dot uwaterloo dot ca [this message]
2003-12-27 17:35 ` [Bug java/13098] " pinskia at gcc dot gnu dot org
2003-12-28  0:20 ` pinskia at gcc dot gnu dot org
2004-04-27  9:21 ` rmathew at gcc dot gnu dot org

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=20031118094100.10871.qmail@sources.redhat.com \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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).