IKVM11  11
Java SE 11 Virtual Machine for .NET
Loading...
Searching...
No Matches
SecurityManager.cs
Go to the documentation of this file.
1/*
2 Copyright (C) 2007-2014 Jeroen Frijters
3
4 This software is provided 'as-is', without any express or implied
5 warranty. In no event will the authors be held liable for any damages
6 arising from the use of this software.
7
8 Permission is granted to anyone to use this software for any purpose,
9 including commercial applications, and to alter it and redistribute it
10 freely, subject to the following restrictions:
11
12 1. The origin of this software must not be misrepresented; you must not
13 claim that you wrote the original software. If you use this software
14 in a product, an acknowledgment in the product documentation would be
15 appreciated but is not required.
16 2. Altered source versions must be plainly marked as such, and must not be
17 misrepresented as being the original software.
18 3. This notice may not be removed or altered from any source distribution.
19
20 Jeroen Frijters
21 jeroen@frijters.net
22
23*/
24
25using System;
26using System.Collections.Generic;
27using System.Diagnostics;
28
29using IKVM.Runtime;
30
32{
33
34 static class SecurityManager
35 {
36
37 public static global::java.lang.Class[] getClassContext(object thisSecurityManager)
38 {
39#if FIRST_PASS
40 throw new NotImplementedException();
41#else
42 var stack = new List<global::java.lang.Class>();
43 var trace = new StackTrace();
44 for (int i = 0; i < trace.FrameCount; i++)
45 {
46 var frame = trace.GetFrame(i);
47 var method = frame.GetMethod();
48
49 if (IKVM.Java.Externs.sun.reflect.Reflection.IsHideFromStackWalk(method))
50 continue;
51
52 var type = method.DeclaringType;
53 if (type == typeof(global::java.lang.SecurityManager))
54 continue;
55
56 stack.Add(JVM.Context.ClassLoaderFactory.GetJavaTypeFromType(type).ClassObject);
57 }
58
59 return stack.ToArray();
60#endif
61 }
62
63 public static object currentClassLoader0(object thisSecurityManager)
64 {
65 var currentClass = currentLoadedClass0(thisSecurityManager);
66 if (currentClass != null)
67 return RuntimeJavaType.FromClass(currentClass).ClassLoader.GetJavaClassLoader();
68
69 return null;
70 }
71
72 public static int classDepth(object thisSecurityManager, string name)
73 {
74 throw new NotImplementedException();
75 }
76
77 public static int classLoaderDepth0(object thisSecurityManager)
78 {
79 throw new NotImplementedException();
80 }
81
82 public static global::java.lang.Class currentLoadedClass0(object thisSecurityManager)
83 {
84 throw new NotImplementedException();
85 }
86
87 }
88
89}
static global::java.lang.Class[] getClassContext(object thisSecurityManager)
static object currentClassLoader0(object thisSecurityManager)
static int classLoaderDepth0(object thisSecurityManager)
static global::java.lang.Class currentLoadedClass0(object thisSecurityManager)
static int classDepth(object thisSecurityManager, string name)
Provides the implementations of the native methods in global::sun.reflect.Reflection.
Definition Reflection.cs:40
Main state of the running JVM.
RuntimeClassLoaderFactory ClassLoaderFactory
Gets the RuntimeClassLoaderFactory associated with this instance of the runtime.