Bug 19629 - simple anonymous constructor bug
Summary: simple anonymous constructor bug
Alias: None
Product: gcc
Classification: Unclassified
Component: java (show other bugs)
Version: 4.0.0
: P2 normal
Target Milestone: 4.3.0
Assignee: Not yet assigned to anyone
Keywords: ice-on-valid-code, rejects-valid
Depends on: 28067
Blocks: 18131
  Show dependency treegraph
Reported: 2005-01-25 20:41 UTC by Tom Tromey
Modified: 2007-01-09 20:46 UTC (History)
2 users (show)

See Also:
Known to work:
Known to fail:
Last reconfirmed: 2005-07-23 05:58:08


Note You need to log in before you can comment on or make changes to this bug.
Description Tom Tromey 2005-01-25 20:41:08 UTC
test case:

public class z
  public static void main(String[] args) throws Throwable
    final String name = "java_cup.terminal";
    Class k;

    ClassLoader cl = new ClassLoader(null) { };
    k = cl.loadClass(name);


gcj gives:

opsy. gcj -C z.java
z.java: In class 'z$1':
z.java: In constructor '(z,java.lang.String,java.lang.Object)':
z.java:9: error: No constructor matching ‘(z,java.lang.String,java.lang.Object)’
found in class ‘java.lang.ClassLoader’.
       ClassLoader cl = new ClassLoader(null) { };
1 error

This is wrong.
It looks like variable capture is confusing creation of the
super() call in the anonymous class constructor.
Comment 1 Andrew Pinski 2005-01-25 20:45:48 UTC
Confirmed (there might be another bug like this somewhere).
Comment 2 Andrew Pinski 2005-08-11 00:02:33 UTC
Hmm, it ICEs now on the mainline after the error, I want to say the ICE is regression.
Comment 3 Denis Washington 2005-12-30 16:45:02 UTC
I think the problem is the null. "null" is asscoiated with type java.lang.Object, though it here is a ClassLoader "null". A method resolution problem.
Comment 4 Tom Tromey 2007-01-09 20:46:56 UTC
All gcj front end bugs have been fixed by the gcj-eclipse branch merge.
I'm mass-closing the affected PRs.
If you believe one of these was closed in error, please reopen it
with a note explaining why.