[multiple changes]

2006-05-04  Andrew Haley  <aph@redhat.com>

        * class.c (make_field_value): Always build_address_of fdecl if
        there is an initializer.

2006-05-03  Andrew Haley  <aph@redhat.com>

        PR libgcj/27352
        * expr.c (maybe_rewrite_invocation): New function.
        (rewrite_arglist_getclass): Likewise.
        (rules): New.
        (expand_invoke): Call maybe_rewrite_invocation.
        * parse.y (patch_invoke): Likewise.
        * java-tree.h: (maybe_rewrite_invocation): New function.

2006-05-03  Andrew Haley  <aph@redhat.com>

        PR libgcj/27352
        * java/lang/Class.java (getClassLoader(Class)): New.
        forName(String, Class): New.
        * java/lang/natClass.cc (getClassLoader(Class)): New.

2006-05-02  Andrew Haley  <aph@redhat.com>

        * prims.cc (_Jv_NewMultiArray): Check for phantom class.

From-SVN: r113532
This commit is contained in:
Andrew Haley 2006-05-04 18:44:53 +00:00 committed by Andrew Haley
parent a7285117b4
commit b2ed63b4aa
10 changed files with 143 additions and 4 deletions

View file

@ -297,6 +297,8 @@ public:
JArray<jclass> *getClasses (void);
java::lang::ClassLoader *getClassLoader (void);
private:
java::lang::ClassLoader *getClassLoader (jclass caller);
public:
// This is an internal method that circumvents the usual security
// checks when getting the class loader.

View file

@ -111,6 +111,14 @@ public final class Class implements Serializable
public static native Class forName (String className)
throws ClassNotFoundException;
// A private internal method that is called by compiler-generated code.
private static Class forName (String className, Class caller)
throws ClassNotFoundException
{
return forName(className, true, caller.getClassLoader());
}
/**
* Use the specified classloader to load and link a class. If the loader
* is null, this uses the bootstrap class loader (provide the security
@ -185,6 +193,9 @@ public final class Class implements Serializable
*/
public native ClassLoader getClassLoader ();
// A private internal method that is called by compiler-generated code.
private final native ClassLoader getClassLoader (Class caller);
/**
* If this is an array, get the Class representing the type of array.
* Examples: "[[Ljava.lang.String;" would return "[Ljava.lang.String;", and

View file

@ -115,9 +115,19 @@ java::lang::Class::getClassLoader (void)
if (s != NULL)
{
jclass caller = _Jv_StackTrace::GetCallingClass (&Class::class$);
ClassLoader *caller_loader = NULL;
if (caller)
caller_loader = caller->getClassLoaderInternal();
return getClassLoader (caller);
}
return loader;
}
java::lang::ClassLoader *
java::lang::Class::getClassLoader (jclass caller)
{
java::lang::SecurityManager *s = java::lang::System::getSecurityManager();
if (s != NULL)
{
ClassLoader *caller_loader = caller->getClassLoaderInternal();
// If the caller has a non-null class loader, and that loader
// is not this class' loader or an ancestor thereof, then do a