public inbox for java-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug java/16284] New: GCJ incorrectly reports forbidden 'this' reference error
@ 2004-06-29 22:39 stepan at srnet dot cz
  2004-06-30  3:26 ` [Bug java/16284] " pinskia at gcc dot gnu dot org
  0 siblings, 1 reply; 2+ messages in thread
From: stepan at srnet dot cz @ 2004-06-29 22:39 UTC (permalink / raw)
  To: java-prs

Used GCJ is from Slackware 10.0, version 3.4.0 (fails also with 3.3.4 from the
same distribution).

Test case:

public class Test {

  public Test() {
    super();
    new TestThread();
  }

  private class TestThread extends Thread {

    public TestThread() {
      super(a());
    }

  }

  public String a() {
    return "XXX";
  }

}

GCJ reports:

Test.java: In class `Test$TestThread':
Test.java: In constructor `(Test)':
Test.java:12: error: Can't reference `this' before the superclass constructor
has been called.
         super(a());
               ^
1 error

That is not correct because there is no use of 'this' when calling Test.a, only
silent argument of type Test is (should) used. Sun's Java 1.4.2 compiler
produces (disassembled with javap):

public Test$TestThread(Test);
  Code:
   0:   aload_0
   1:   aload_1
   2:   invokevirtual   #1; //Method Test.a:()Ljava/lang/String;
   5:   invokespecial   #2; //Method java/lang/Thread."<init>":(Ljava/lang/String;)V
   8:   aload_0
   9:   aload_1
   10:  putfield        #3; //Field this$0:LTest;
   13:  return

}

-- 
           Summary: GCJ incorrectly reports forbidden 'this' reference error
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: java
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: stepan at srnet dot cz
                CC: gcc-bugs at gcc dot gnu dot org,java-prs at gcc dot gnu
                    dot org


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


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

* [Bug java/16284] GCJ incorrectly reports forbidden 'this' reference error
  2004-06-29 22:39 [Bug java/16284] New: GCJ incorrectly reports forbidden 'this' reference error stepan at srnet dot cz
@ 2004-06-30  3:26 ` pinskia at gcc dot gnu dot org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-06-30  3:26 UTC (permalink / raw)
  To: java-prs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-06-29 22:38 -------
This is a dup of bug 4695.

*** 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=16284


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

end of thread, other threads:[~2004-06-29 22:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-06-29 22:39 [Bug java/16284] New: GCJ incorrectly reports forbidden 'this' reference error stepan at srnet dot cz
2004-06-30  3:26 ` [Bug java/16284] " 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).