public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug java/13098] New: accepts invalid code referencing package only constructor
@ 2003-11-18  5:50 pinskia at gcc dot gnu dot org
  2003-11-18  9:41 ` [Bug java/13098] " s28patel at student dot math dot uwaterloo dot ca
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-11-18  5:50 UTC (permalink / raw)
  To: gcc-bugs

try to compile this, gcj should reject this.
t/t.java:
package t;
public class t
{
t(){}
}
test.java:
import t.t;
class test {
    public static void main(String argv[]) {
        t b = new t();
    }
}

-- 
           Summary: accepts invalid code referencing package only
                    constructor
           Product: gcc
           Version: 3.4
            Status: UNCONFIRMED
          Keywords: accepts-invalid
          Severity: normal
          Priority: P2
         Component: java
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pinskia at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org,s28patel at student dot
                    math dot uwaterloo dot ca


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug java/13098] accepts invalid code referencing package only constructor
  2003-11-18  5:50 [Bug java/13098] New: accepts invalid code referencing package only constructor pinskia at gcc dot gnu dot org
@ 2003-11-18  9:41 ` s28patel at student dot math dot uwaterloo dot ca
  2003-12-27 17:35 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: s28patel at student dot math dot uwaterloo dot ca @ 2003-11-18  9:41 UTC (permalink / raw)
  To: gcc-bugs


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug java/13098] accepts invalid code referencing package only constructor
  2003-11-18  5:50 [Bug java/13098] New: accepts invalid code referencing package only constructor pinskia at gcc dot gnu dot org
  2003-11-18  9:41 ` [Bug java/13098] " s28patel at student dot math dot uwaterloo dot ca
@ 2003-12-27 17:35 ` 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
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-12-27 17:35 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2003-12-27 15:31 -------
Confirmed, there are a couple of access bugs for gcj somewhere.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2003-12-27 15:31:18
               date|                            |


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug java/13098] accepts invalid code referencing package only constructor
  2003-11-18  5:50 [Bug java/13098] New: accepts invalid code referencing package only constructor pinskia at gcc dot gnu dot org
  2003-11-18  9:41 ` [Bug java/13098] " s28patel at student dot math dot uwaterloo dot ca
  2003-12-27 17:35 ` 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
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-12-28  0:20 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2003-12-27 21:15 -------
Related to bug 1262.

-- 


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug java/13098] accepts invalid code referencing package only constructor
  2003-11-18  5:50 [Bug java/13098] New: accepts invalid code referencing package only constructor pinskia at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2003-12-28  0:20 ` pinskia at gcc dot gnu dot org
@ 2004-04-27  9:21 ` rmathew at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: rmathew at gcc dot gnu dot org @ 2004-04-27  9:21 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From rmathew at gcc dot gnu dot org  2004-04-27 09:06 -------
The patch for 9685:

  http://gcc.gnu.org/ml/java-patches/2004-q2/msg00230.html

also fixes this bug.

*** This bug has been marked as a duplicate of 9685 ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |DUPLICATE


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2004-04-27  9:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-11-18  5:50 [Bug java/13098] New: accepts invalid code referencing package only constructor pinskia at gcc dot gnu dot org
2003-11-18  9:41 ` [Bug java/13098] " s28patel at student dot math dot uwaterloo dot ca
2003-12-27 17:35 ` 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

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).