source: trunk/src/gcc/libjava/java/lang/VMSecurityManager.java@ 1213

Last change on this file since 1213 was 2, checked in by bird, 23 years ago

Initial revision

  • Property cvs2svn:cvs-rev set to 1.1
  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 2.2 KB
Line 
1/*
2 * java.lang.SecurityManager: part of the Java Class Libraries project.
3 * Copyright (C) 1998, 2001 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 Class[] getClassContext()
47 {
48 // FIXME: can't yet implement this for libgcj.
49 return new Class[0];
50 }
51
52 /** Get the current ClassLoader--the one nearest to the
53 ** top of the stack.
54 ** @return the current ClassLoader.
55 **/
56 static ClassLoader currentClassLoader()
57 {
58 // The docs above are wrong. See the online docs.
59 // FIXME this implementation is a bit wrong too -- the docs say we
60 // must also consider ancestors of the system class loader.
61 Class[] classStack = getClassContext ();
62 for (int i = 0; i < classStack.length; i++)
63 {
64 ClassLoader loader = classStack[i].getClassLoader();
65 if (loader != null)
66 return loader;
67 }
68
69 return null;
70 }
71}
Note: See TracBrowser for help on using the repository browser.