summaryrefslogtreecommitdiffstats
path: root/libjava/java/lang
diff options
context:
space:
mode:
authoraph <aph@138bc75d-0d04-0410-961f-82ee72b054a4>2006-05-04 18:44:53 +0000
committeraph <aph@138bc75d-0d04-0410-961f-82ee72b054a4>2006-05-04 18:44:53 +0000
commitecc74eeaa9039b5cca365292229f95e4ff0df24b (patch)
tree53c5cc5b6cfb9186e5f76d34fc5fec1124c7e943 /libjava/java/lang
parentbbfdda8b30845a74660e87202c4bcc24e4c25e2f (diff)
downloadppe42-gcc-ecc74eeaa9039b5cca365292229f95e4ff0df24b.tar.gz
ppe42-gcc-ecc74eeaa9039b5cca365292229f95e4ff0df24b.zip
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@113532 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/java/lang')
-rw-r--r--libjava/java/lang/Class.h2
-rw-r--r--libjava/java/lang/Class.java11
-rw-r--r--libjava/java/lang/natClass.cc16
3 files changed, 26 insertions, 3 deletions
diff --git a/libjava/java/lang/Class.h b/libjava/java/lang/Class.h
index 722129498aa..f6ca3deb949 100644
--- a/libjava/java/lang/Class.h
+++ b/libjava/java/lang/Class.h
@@ -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.
diff --git a/libjava/java/lang/Class.java b/libjava/java/lang/Class.java
index 60ca4577e99..66b85c7ce99 100644
--- a/libjava/java/lang/Class.java
+++ b/libjava/java/lang/Class.java
@@ -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
diff --git a/libjava/java/lang/natClass.cc b/libjava/java/lang/natClass.cc
index d88835019f4..887088933f7 100644
--- a/libjava/java/lang/natClass.cc
+++ b/libjava/java/lang/natClass.cc
@@ -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
OpenPOWER on IntegriCloud