OSDN Git Service

2007-03-02 Andrew Haley <aph@redhat.com>
[pf3gnuchains/gcc-fork.git] / libjava / java / lang / natClass.cc
index cf07e86..ea55546 100644 (file)
@@ -1,6 +1,6 @@
 // natClass.cc - Implementation of java.lang.Class native methods.
 
-/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
    Free Software Foundation
 
    This file is part of libgcj.
@@ -50,6 +50,7 @@ details.  */
 #include <java/lang/NullPointerException.h>
 #include <java/lang/RuntimePermission.h>
 #include <java/lang/System.h>
+#include <java/lang/SecurityException.h>
 #include <java/lang/SecurityManager.h>
 #include <java/lang/StringBuffer.h>
 #include <java/lang/VMClassLoader.h>
@@ -690,6 +691,10 @@ java::lang::Class::initializeClass (void)
          {
            _Jv_Linker::wait_for_state(this, JV_STATE_LINKED);
          }
+       catch (java::lang::SecurityException *x)
+         {
+           throw x;
+         }
        catch (java::lang::Throwable *x)
          {
            // Turn into a NoClassDefFoundError.
@@ -727,6 +732,10 @@ java::lang::Class::initializeClass (void)
        {
          _Jv_InitClass (superclass);
        }
+      catch (java::lang::SecurityException *x)
+       {
+         throw x;
+       }
       catch (java::lang::Throwable *except)
        {
          // Caught an exception.
@@ -745,6 +754,10 @@ java::lang::Class::initializeClass (void)
       if (meth)
        ((void (*) (void)) meth->ncode) ();
     }
+  catch (java::lang::SecurityException *x)
+    {
+      throw x;
+    }
   catch (java::lang::Throwable *except)
     {
       if (! java::lang::Error::class$.isInstance(except))
@@ -1318,9 +1331,8 @@ java::lang::Class::getDeclaredAnnotations(jint /* jv_attr_type */ member_type,
   if (bytes == NULL)
     return 0;
 
-  ClassLoader *trueLoader = loader;
-  if (trueLoader == NULL)
-    trueLoader = (ClassLoader *)VMClassLoader::bootLoader;
+  if (loader == NULL)
+    loader = (ClassLoader *)VMClassLoader::bootLoader;
 
   result = (loader->getDeclaredAnnotations
            (this, member_type, member_index, kind_req));
@@ -2004,3 +2016,9 @@ _Jv_GetMethodDeclaringClass (jmethodID method)
   return reinterpret_cast<jclass> (_Jv_StackTrace::ncodeMap->get (obj));
 }
 
+jbyte
+_Jv_GetClassState (jclass klass)
+{
+  return klass->state;
+}
+