IKVM11  11
Java SE 11 Virtual Machine for .NET
Loading...
Searching...
No Matches
FieldInfoWithReflectedType.cs
Go to the documentation of this file.
1/*
2 Copyright (C) 2009-2012 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*/
24using System;
25using System.Diagnostics;
26
27namespace IKVM.Reflection
28{
29
30 sealed class FieldInfoWithReflectedType : FieldInfo
31 {
32
33 readonly Type reflectedType;
34 readonly FieldInfo field;
35
41 internal FieldInfoWithReflectedType(Type reflectedType, FieldInfo field)
42 {
43 Debug.Assert(reflectedType != field.DeclaringType);
44 this.reflectedType = reflectedType;
45 this.field = field;
46 }
47
48 public override FieldAttributes Attributes
49 {
50 get { return field.Attributes; }
51 }
52
53 public override bool __TryGetFieldOffset(out int offset)
54 {
55 return field.__TryGetFieldOffset(out offset);
56 }
57
58 public override object GetRawConstantValue()
59 {
60 return field.GetRawConstantValue();
61 }
62
63 internal override FieldSignature FieldSignature
64 {
65 get { return field.FieldSignature; }
66 }
67
68 public override FieldInfo __GetFieldOnTypeDefinition()
69 {
70 return field.__GetFieldOnTypeDefinition();
71 }
72
73 internal override int ImportTo(Emit.ModuleBuilder module)
74 {
75 return field.ImportTo(module);
76 }
77
78 internal override FieldInfo BindTypeParameters(Type type)
79 {
80 return field.BindTypeParameters(type);
81 }
82
83 public override bool __IsMissing
84 {
85 get { return field.__IsMissing; }
86 }
87
88 public override Type DeclaringType
89 {
90 get { return field.DeclaringType; }
91 }
92
93 public override Type ReflectedType
94 {
95 get { return reflectedType; }
96 }
97
98 public override bool Equals(object obj)
99 {
100 var other = obj as FieldInfoWithReflectedType;
101 return other != null
102 && other.reflectedType == reflectedType
103 && other.field == field;
104 }
105
106 public override int GetHashCode()
107 {
108 return reflectedType.GetHashCode() ^ field.GetHashCode();
109 }
110
111 public override int MetadataToken
112 {
113 get { return field.MetadataToken; }
114 }
115
116 public override Module Module
117 {
118 get { return field.Module; }
119 }
120
121 public override string Name
122 {
123 get { return field.Name; }
124 }
125
126 public override string ToString()
127 {
128 return field.ToString();
129 }
130
131 internal override int GetCurrentToken()
132 {
133 return field.GetCurrentToken();
134 }
135
136 internal override bool IsBaked
137 {
138 get { return field.IsBaked; }
139 }
140
141 }
142
143}
IKVM.Reflection.Type Type
IKVM.Reflection.FieldInfo FieldInfo
global::java.lang.invoke.LambdaForm.Name Name