[Bug java/19629] New: simple anonymous constructor bug
tromey at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Tue Jan 25 20:41:00 GMT 2005
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
More information about the Gcc-bugs
mailing list