public inbox for java-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug java/19629] New: simple anonymous constructor bug
@ 2005-01-25 20:41 tromey at gcc dot gnu dot org
  2005-01-25 20:45 ` [Bug java/19629] " pinskia at gcc dot gnu dot org
  2005-08-11  0:02 ` pinskia at gcc dot gnu dot org
  0 siblings, 2 replies; 4+ messages in thread
From: tromey at gcc dot gnu dot org @ 2005-01-25 20:41 UTC (permalink / raw)
  To: java-prs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1328 bytes --]

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

    System.out.println(k);
    System.out.println(k.getProtectionDomain().getCodeSource());
    System.out.println(k.getClassLoader());
  }
}


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.

-- 
           Summary: simple anonymous constructor bug
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: java
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tromey at gcc dot gnu dot org
                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=19629


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

end of thread, other threads:[~2007-01-09 20:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-19629-360@http.gcc.gnu.org/bugzilla/>
2005-12-30 16:45 ` [Bug java/19629] simple anonymous constructor bug dwashington at gmx dot net
2007-01-09 20:50 ` tromey at gcc dot gnu dot org
2005-01-25 20:41 [Bug java/19629] New: " tromey at gcc dot gnu dot org
2005-01-25 20:45 ` [Bug java/19629] " pinskia at gcc dot gnu dot org
2005-08-11  0:02 ` 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).