source: trunk/gcc/libjava/java/lang/VMSecurityManager.java

Last change on this file was 1392, checked in by bird, 21 years ago

This commit was generated by cvs2svn to compensate for changes in r1391,
which included commits to RCS files with non-trunk default branches.

  • Property cvs2svn:cvs-rev set to 1.1.1.2
  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 2.1 KB
Line 
1/*
2 * java.lang.SecurityManager: part of the Java Class Libraries project.
3 * Copyright (C) 1998, 2001, 2002 Free Software Foundation
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
14 *
15 * You should have received a copy of the GNU Library General Public
16 * License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 * Boston, MA 02111-1307, USA.
19 */
20
21package java.lang;
22
23import java.net.*;
24import java.util.*;
25import java.io.*;
26
27/**
28 ** VMSecurityManager is a helper class for SecurityManager the VM must
29 ** implement.
30 **
31 ** @author John Keiser
32 ** @version 1.1.0, 31 May 1998
33 **/
34class VMSecurityManager
35{
36 /** Get a list of all the classes currently executing
37 ** methods on the Java stack. getClassContext()[0] is
38 ** the currently executing method
39 ** <STRONG>Spec Note:</STRONG> does not say whether
40 ** the stack will include the getClassContext() call or
41 ** the one just before it.
42 **
43 ** @return an array containing all the methods on classes
44 ** on the Java execution stack.
45 **/
46 static native Class[] getClassContext();
47
48 /** Get the current ClassLoader--the one nearest to the
49 ** top of the stack.
50 ** @return the current ClassLoader.
51 **/
52 static ClassLoader currentClassLoader()
53 {
54 // The docs above are wrong. See the online docs.
55 // FIXME this implementation is a bit wrong too -- the docs say we
56 // must also consider ancestors of the system class loader.
57 Class[] classStack = getClassContext ();
58 for (int i = 0; i < classStack.length; i++)
59 {
60 ClassLoader loader = classStack[i].getClassLoader();
61 if (loader != null)
62 return loader;
63 }
64
65 return null;
66 }
67}
Note: See TracBrowser for help on using the repository browser.