[Bug libgcj/17021] New: gij: class resolution throws errors too eagerly
mckinlay at redhat dot com
gcc-bugzilla@gcc.gnu.org
Fri Aug 13 21:07:00 GMT 2004
NoClassDefFoundError should only be thrown if a code path that attempts to use
the missing class is actually used. GIJ, however, throws the error too early.
This can be seen by compiling the following test case and deleting the class
file for "Bar".
$ gcj -C Foo.java Bar.java
$ rm Bar.class
$ gij Foo
Exception in thread "main" java.lang.NoClassDefFoundError: while resolving
class: Foo
at java.lang.ClassLoader.resolveClass0(java.lang.Class)
(/usr/lib/libgcj.so.4.0.0)
at java.lang.Class.initializeClass() (/usr/lib/libgcj.so.4.0.0)
at java.lang.Class.forName(java.lang.String, boolean, java.lang.ClassLoader)
(/usr/lib/libgcj.so.4.0.0)
...
public class Foo
{
public boolean missing_class_code_path = false;
public static void main(String[] args)
{
new Foo().j();
}
void j()
{
if (missing_class_code_path)
new Bar().x();
}
}
public class Bar
{
public void x() {}
}
--
Summary: gij: class resolution throws errors too eagerly
Product: gcc
Version: 3.5.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: libgcj
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: mckinlay at redhat dot com
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=17021
More information about the Gcc-bugs
mailing list