fixes for host gcc 4.6.1
[zpugcc/jano.git] / toolchain / gcc / libjava / java / lang / natVMSecurityManager.cc
blob8fd2875aedcd04c1eb45a4a30643b0678016f9c7
1 /* Copyright (C) 2002 Free Software Foundation
3 This file is part of libgcj.
5 This software is copyrighted work licensed under the terms of the
6 Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
7 details. */
9 // Written by Tom Tromey <tromey@redhat.com>
11 #include <config.h>
13 #include <gcj/cni.h>
14 #include <jvm.h>
15 #include <java/lang/VMSecurityManager.h>
16 #include <java/lang/SecurityManager.h>
17 #include <java/lang/ClassLoader.h>
18 #include <java/lang/Class.h>
19 #include <gnu/gcj/runtime/StackTrace.h>
21 JArray<jclass> *
22 java::lang::VMSecurityManager::getClassContext ()
24 JArray<jclass> *result = NULL;
25 gnu::gcj::runtime::StackTrace *t = new gnu::gcj::runtime::StackTrace();
26 if (t)
28 int maxlen = t->length();
30 int len = 0;
31 for (int i=0; i<maxlen; i++)
33 jclass klass = t->classAt(i);
34 if (klass != NULL && klass != &java::lang::VMSecurityManager::class$
35 && klass != &java::lang::SecurityManager::class$)
36 ++len;
39 result =
40 (JArray<jclass> *) _Jv_NewObjectArray (len, &java::lang::Class::class$,
41 NULL);
43 len = 0;
44 for (int i=0; i<maxlen; i++)
46 jclass klass = t->classAt(i);
47 if (klass != NULL && klass != &java::lang::VMSecurityManager::class$
48 && klass != &java::lang::SecurityManager::class$)
49 elements(result)[len++] = klass;
53 return result;