IKVM11  11
Java SE 11 Virtual Machine for .NET
Loading...
Searching...
No Matches
ClassLiteral.cs
Go to the documentation of this file.
1using System.Threading;
2
4
5namespace IKVM.Runtime
6{
7
12 public static class ClassLiteral<T>
13 {
14
15#if FIRST_PASS == false && IMPORTER == false && EXPORTER == false
16
17 static ClassAccessor classAccessor;
18 static object value;
19
20 static ClassAccessor ClassAccessor => JVM.Internal.BaseAccessors.Get(ref classAccessor);
21
25 public static object Value => GetValue();
26
31 static object GetValue()
32 {
33 if (value == null)
34 Interlocked.CompareExchange(ref value, ClassAccessor.Init(typeof(T)), null);
35
36 return value;
37 }
38
39#else
40
41 public static object Value => null;
42
43#endif
44
45 }
46
47}
System.Threading.Interlocked Interlocked
Provides a static cache of java.lang.Class instances per .NET type.
static object Value
Gets the class literal value, caching the result.
Main state of the running JVM.