java.lang.reflect.Proxy support with native code?
Martin Egholm Nielsen
martin@egholm-nielsen.dk
Tue Jun 15 11:17:00 GMT 2004
Hi Andrew,
> > In my progress of porting my existing code to gcj, I've run into some
> > problems with java.lang.reflect.Proxy.
> > When running the compiled code I get a java.lang.NoClassDefFoundError
> > exception thrown for "$Proxy0"...
> > Is there an issue with java.lang.reflect.Proxy when running natively
> > compiled code?
> I've used it quite a lot with native code. Let's have simple test
> case, and we'll see what happens.
I've attached a simple example, and below is the outcome of executing:
---------------------
In cygwin with "GCJ (GCC) 3.3.1 (cygming special)" I get:
$ ./ProxyTest2.exe
1: starting...
2: classloader: gnu.gcj.runtime.VMClassLoader@1012f810
Exception in thread "main" 5 [main] ProxyTest2 2252
fhandler_base::fork_fixup: - Win32 error 6, handle io_handle<0x4B8>
=== SNIP ===
java.lang.InternalError: Unexpected: java.lang.NoClassDefFoundError:
while resolving class: $Proxy0
<<No stacktrace available>>
Caused by: java.lang.NoClassDefFoundError: while resolving class: $Proxy0
<<No stacktrace available>>
Caused by: java.lang.ClassNotFoundException:
java.lang.reflect.UndeclaredThrowableException not found in [file:./,
core:/]
<<No stacktrace available>>
---------------------
With MinGW and "gcj.exe (GCC) 3.4.0 (mingw special)" I get:
$ ./ProxyTest2.exe
1: starting...
2: classloader: gnu.gcj.runtime.VMClassLoader@bbdfc0
Exception in thread "main" java.lang.InternalError: Unexpected:
java.lang.NoClassDefFoundError: while resolving class: $Proxy0
=== SNIP ===
---------------------
With my gcj-crosscompiler "powerpc-405-linux-gnu-gcj (GCC) 3.4.0" I get
all the way past 4), but then it dies:
# ./ProxyTest2
1: starting...
2: classloader: gnu.gcj.runtime.VMClassLoader@10073fc0
3: proxyClass: class $Proxy0
4: constructor: public $Proxy0(java.lang.reflect.InvocationHandler)
Illegal instruction
I wonder if the two initial tests die because these are static build,
whereas the final one isn't.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ProxyTest2.java
Type: text/java
Size: 1141 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/java/attachments/20040615/801e7e99/attachment.bin>
More information about the Java
mailing list