This is the mail archive of the
java-prs@gcc.gnu.org
mailing list for the Java project.
[Bug libgcj/17021] New: gij: class resolution throws errors too eagerly
- From: "mckinlay at redhat dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: java-prs at gcc dot gnu dot org
- Date: 13 Aug 2004 21:07:27 -0000
- Subject: [Bug libgcj/17021] New: gij: class resolution throws errors too eagerly
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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