User account creation filtered due to spam.

Bug 24442 - wrong inner class instantiated
Summary: wrong inner class instantiated
Status: RESOLVED WONTFIX
Alias: None
Product: gcc
Classification: Unclassified
Component: java (show other bugs)
Version: 4.1.0
: P2 normal
Target Milestone: ---
Assignee: Andrew Haley
URL:
Keywords:
Depends on: 28067
Blocks: 12257 18131
  Show dependency treegraph
 
Reported: 2005-10-19 13:01 UTC by Andrew Haley
Modified: 2006-08-28 16:57 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2006-01-18 00:37:19


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Haley 2005-10-19 13:01:45 UTC
public class SameName
{
    public Object foo ()
    {
        class SingleName
        {
            public String toString ()
            {
                return "foo.SingleName";
            }
        }
        return new SingleName ();
    }
    public Object bar ()
    {
        class SingleName
        {
            public String toString ()
            {
                throw new RuntimeException ("bar.SingleName");
            }
        }
        return new SingleName ();
    }
    public static void main (String[] args)
    {
        System.out.println (new SameName ().foo().toString());
    }
}

cagney@localhost$ ./a.out
Exception in thread "main" java.lang.RuntimeException: bar.SingleName
   at SameName$2$SingleName.toString() (Unknown Source)
   at SameName.main(java.lang.String[]) (Unknown Source)
   at gnu.java.lang.MainThread.call_main() (/usr/lib/libgcj.so.6.0.0)
   at gnu.java.lang.MainThread.run() (/usr/lib/libgcj.so.6.0.0)
Comment 1 Andrew Pinski 2005-10-19 13:15:26 UTC
This is very related to PR 12257 which is a crash for inner classes with the same name.
Comment 2 Andrew Haley 2006-08-28 16:57:55 UTC
This will be fixed with ecj.