Imagine the following situation: class T { void test(){ M.staticMethod(); // a new M().method(); // b M.staticField = "FOO"; // c new M().field = "FOO"; // d } } class M{ static void staticMethod(){} void method(){} static String staticField; String field; } Compile this and then replace the class file of M with the compiled code of this class: class M{} The JDK has no problems loading the T class and when running each the statement *on its own* it would throw a NoSuchMethodError (case a & b) or a NoSuchFieldError (case c & d). GIJ should do the same.
Created attachment 10408 [details] test setup A test setup for the above mentioned 4 cases. There are three scripts which runs different interpreters: nf-run.sh: Runs java - usually an proprietary runtime. gij-run.sh: Runs gij in interpreted mode bc-run.sh: Run gij with BC compiled classes. The output describes what was done and what was expected.
Created attachment 10409 [details] test setup Same as above but fixed the messages about expected and unexpected Throwables.
The version of gcj in SVN cannot handle loading classes of case d ( = accessing a nonstatic field which is removed) when BC-compiled classes are used (interpreted mode is fine in all cases).
Subject: Bug 25265 Author: aph Date: Thu Dec 8 14:40:48 2005 New Revision: 108232 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=108232 Log: 2005-12-08 Andrew Haley <aph@redhat.com> PR libgcj/25265 * java-tree.h (enum java_tree_index): Add JTI_SOFT_NOSUCHFIELD_NODE. (soft_abstractmethod_node): New. * expr.c (build_field_ref): Add in-line check for missing field. * decl.c (java_init_decl_processing): Add soft_nosuchfield_node. Modified: branches/gcc-4_1-branch/gcc/java/ChangeLog branches/gcc-4_1-branch/gcc/java/decl.c branches/gcc-4_1-branch/gcc/java/expr.c branches/gcc-4_1-branch/gcc/java/java-tree.h
Subject: Bug 25265 Author: aph Date: Thu Dec 8 14:44:29 2005 New Revision: 108233 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=108233 Log: 2005-12-08 Andrew Haley <aph@redhat.com> PR libgcj/25265 * java/lang/Object.h (throwNoSuchMethodError): New method. * java/lang/Object.java (throwNoSuchMethodError): New method. * include/jvm.h (_Jv_ThrowNoSuchFieldError): Declare. * link.cc (_Jv_ThrowNoSuchFieldError): New. (link_symbol_table): Don't throw a NoSuchFieldError if a field is missing. Instead, set the otable entry to zero. (link_symbol_table): If we don't find a nonstatic method, insert the vtable offset of Object.throwNoSuchMethodError() into the otable. Modified: branches/gcc-4_1-branch/libjava/ChangeLog
Subject: Bug 25265 Author: aph Date: Thu Dec 8 15:32:44 2005 New Revision: 108235 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=108235 Log: 2005-12-08 Andrew Haley <aph@redhat.com> PR libgcj/25265 * java-tree.h (enum java_tree_index): Add JTI_SOFT_NOSUCHFIELD_NODE. (soft_abstractmethod_node): New. * expr.c (build_field_ref): Add in-line check for missing field. * decl.c (java_init_decl_processing): Add soft_nosuchfield_node. 2005-12-08 Andrew Haley <aph@redhat.com> PR libgcj/25265 * java/lang/Object.h (throwNoSuchMethodError): New method. * java/lang/Object.java (throwNoSuchMethodError): New method. * include/jvm.h (_Jv_ThrowNoSuchFieldError): Declare. * link.cc (_Jv_ThrowNoSuchFieldError): New. (link_symbol_table): Don't throw a NoSuchFieldError if a field is missing. Instead, set the otable entry to zero. (link_symbol_table): If we don't find a nonstatic method, insert the vtable offset of Object.throwNoSuchMethodError() into the otable. Modified: trunk/gcc/java/ChangeLog trunk/libjava/ChangeLog
.