mirror of git://gcc.gnu.org/git/gcc.git
SystemClassLoader.java (addClass): Get the value of package-private field "loadedClasses" using reflection.
* gnu/gcj/runtime/SystemClassLoader.java (addClass): Get the value of package-private field "loadedClasses" using reflection. * java/lang/VMCompiler.java (compileClass): Remove unreachable catch block. From-SVN: r112858
This commit is contained in:
parent
b4426e0a70
commit
20cbfac4e9
|
@ -1,3 +1,10 @@
|
||||||
|
2006-04-11 Bryce McKinlay <mckinlay@redhat.com>
|
||||||
|
|
||||||
|
* gnu/gcj/runtime/SystemClassLoader.java (addClass): Get the value
|
||||||
|
of package-private field "loadedClasses" using reflection.
|
||||||
|
* java/lang/VMCompiler.java (compileClass): Remove unreachable catch
|
||||||
|
block.
|
||||||
|
|
||||||
2006-04-10 Matthias Klose <doko@debian.org>
|
2006-04-10 Matthias Klose <doko@debian.org>
|
||||||
|
|
||||||
* testsuite/lib/libjava.exp (libjava_init): Recognize multilib
|
* testsuite/lib/libjava.exp (libjava_init): Recognize multilib
|
||||||
|
|
|
@ -9,8 +9,9 @@ details. */
|
||||||
package gnu.gcj.runtime;
|
package gnu.gcj.runtime;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
|
import java.lang.reflect.Field;
|
||||||
import java.util.StringTokenizer;
|
import java.util.StringTokenizer;
|
||||||
import java.util.HashSet;
|
import java.util.HashMap;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.net.URLClassLoader;
|
import java.net.URLClassLoader;
|
||||||
|
|
||||||
|
@ -21,6 +22,8 @@ public final class SystemClassLoader extends URLClassLoader
|
||||||
super(new URL[0], parent);
|
super(new URL[0], parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private HashMap loadedClasses;
|
||||||
|
|
||||||
// This is called to register a native class which was linked into
|
// This is called to register a native class which was linked into
|
||||||
// the application but which is registered with the system class
|
// the application but which is registered with the system class
|
||||||
// loader after the VM is initialized.
|
// loader after the VM is initialized.
|
||||||
|
@ -37,7 +40,23 @@ public final class SystemClassLoader extends URLClassLoader
|
||||||
// precompiled manifest.
|
// precompiled manifest.
|
||||||
definePackage(packageName, null, null, null, null, null, null, null);
|
definePackage(packageName, null, null, null, null, null, null, null);
|
||||||
}
|
}
|
||||||
loadedClasses.put(className, klass);
|
|
||||||
|
// Use reflection to access the package-private "loadedClasses" field.
|
||||||
|
if (this.loadedClasses == null)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Class cl = java.lang.ClassLoader.class;
|
||||||
|
Field lcField = cl.getDeclaredField("loadedClasses");
|
||||||
|
lcField.setAccessible(true);
|
||||||
|
this.loadedClasses = (HashMap) lcField.get(this);
|
||||||
|
}
|
||||||
|
catch (Exception x)
|
||||||
|
{
|
||||||
|
throw new RuntimeException(x);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.loadedClasses.put(className, klass);
|
||||||
}
|
}
|
||||||
|
|
||||||
// We add the URLs to the system class loader late. The reason for
|
// We add the URLs to the system class loader late. The reason for
|
||||||
|
|
|
@ -198,11 +198,6 @@ final class VMCompiler
|
||||||
md.update(data);
|
md.update(data);
|
||||||
digest = md.digest();
|
digest = md.digest();
|
||||||
}
|
}
|
||||||
catch (CloneNotSupportedException _)
|
|
||||||
{
|
|
||||||
// Can't happen.
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
catch (NullPointerException _)
|
catch (NullPointerException _)
|
||||||
{
|
{
|
||||||
// If md5Digest==null -- but really this should never happen
|
// If md5Digest==null -- but really this should never happen
|
||||||
|
|
Loading…
Reference in New Issue