public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug java/18215] New: GCJ disallows some references to 'this' from an enclosing class
@ 2004-10-29 3:51 csm at gnu dot org
2004-10-29 3:54 ` [Bug java/18215] " pinskia at gcc dot gnu dot org
0 siblings, 1 reply; 2+ messages in thread
From: csm at gnu dot org @ 2004-10-29 3:51 UTC (permalink / raw)
To: gcc-bugs
In the constructor of a member class, GCJ does not allow you to do a 'super'
call with an argument that calls an instance method of the enclosing class.
For example, GCJ rejects this perfectly valid class:
--- outer.java ---
public class outer
{
private String name;
public outer (String name)
{
this.name = name;
}
public String getID()
{
return name;
}
public class inner extends Thread
{
public inner()
{
super ("thread-" + getID());
}
}
}
--- outer.java ---
This is valid because the call to 'getID()' is referencing the 'this' from the
enclosing class. GCJ also rejects 'outer.this.getID()' in this example, so there
does not appear to be a workaround.
GCJ fails with:
outer.java: In class `outer$inner':
outer.java: In constructor `(outer)':
outer.java:19: error: Can't reference `this' before the superclass constructor
has been called.
super ("thread-" + outer.this.getID());
^
1 error
Tested on:
gcj (GCC) 3.4.2
gcj (GCC) 4.0.0 20041025 (experimental)
--
Summary: GCJ disallows some references to 'this' from an
enclosing class
Product: gcc
Version: 4.0.0
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=18215
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug java/18215] GCJ disallows some references to 'this' from an enclosing class
2004-10-29 3:51 [Bug java/18215] New: GCJ disallows some references to 'this' from an enclosing class csm at gnu dot org
@ 2004-10-29 3:54 ` pinskia at gcc dot gnu dot org
0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-10-29 3:54 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-10-29 03:54 -------
*** This bug has been marked as a duplicate of 4695 ***
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |DUPLICATE
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18215
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-10-29 3:54 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-29 3:51 [Bug java/18215] New: GCJ disallows some references to 'this' from an enclosing class csm at gnu dot org
2004-10-29 3:54 ` [Bug java/18215] " pinskia 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).