IKVM11  11
Java SE 11 Virtual Machine for .NET
Loading...
Searching...
No Matches
VerifyAccess.cs
Go to the documentation of this file.
1/*
2 Copyright (C) 2007-2015 Jeroen Frijters
3 Copyright (C) 2009 Volker Berlin (i-net software)
4
5 This software is provided 'as-is', without any express or implied
6 warranty. In no event will the authors be held liable for any damages
7 arising from the use of this software.
8
9 Permission is granted to anyone to use this software for any purpose,
10 including commercial applications, and to alter it and redistribute it
11 freely, subject to the following restrictions:
12
13 1. The origin of this software must not be misrepresented; you must not
14 claim that you wrote the original software. If you use this software
15 in a product, an acknowledgment in the product documentation would be
16 appreciated but is not required.
17 2. Altered source versions must be plainly marked as such, and must not be
18 misrepresented as being the original software.
19 3. This notice may not be removed or altered from any source distribution.
20
21 Jeroen Frijters
22 jeroen@frijters.net
23
24*/
25using System;
26
27using IKVM.Runtime;
28
30{
31
32 static class VerifyAccess
33 {
34
40 public static global::java.lang.ClassLoader Class_getClassLoader(global::java.lang.Class clazz)
41 {
42#if FIRST_PASS
43 throw new NotImplementedException();
44#else
45 var tw = RuntimeJavaType.FromClass(clazz);
46 if (JVM.Context.ClassLoaderFactory.GetBootstrapClassLoader().TryLoadClassByName(tw.Name) == tw)
47 {
48 // if a class is visible from the bootstrap class loader, we have to return null to allow the visibility check to succeed
49 return null;
50 }
51
52 return tw.ClassLoader.GetJavaClassLoader();
53#endif
54 }
55
56 }
57
58}
static global::java.lang.ClassLoader Class_getClassLoader(global::java.lang.Class clazz)
Called from map.xml as a replacement for Class.getClassLoader() in the context of sun....
Main state of the running JVM.
RuntimeClassLoaderFactory ClassLoaderFactory
Gets the RuntimeClassLoaderFactory associated with this instance of the runtime.