Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/ikvm-fork.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjfrijters <jfrijters>2015-06-29 13:12:11 +0300
committerjfrijters <jfrijters>2015-06-29 13:12:11 +0300
commit7aaec377650ec7eae81fa536b69e9b335fb250e3 (patch)
tree48dc68b3fd849203024d740f0455fa37d04b9bfa
parent51969ec73b9e0d4a0a55fb85674789c0f13d22e1 (diff)
Added FieldWrapper.IsSerialVersionUID property to properly (and consistently) detect serialVersionUID fields.
-rw-r--r--runtime/DynamicTypeWrapper.cs2
-rw-r--r--runtime/MemberWrapper.cs15
-rw-r--r--runtime/stubgen/StubGenerator.cs2
3 files changed, 17 insertions, 2 deletions
diff --git a/runtime/DynamicTypeWrapper.cs b/runtime/DynamicTypeWrapper.cs
index 43b27622..15d7759b 100644
--- a/runtime/DynamicTypeWrapper.cs
+++ b/runtime/DynamicTypeWrapper.cs
@@ -1524,7 +1524,7 @@ namespace IKVM.Internal
&& fw.IsPrivate
&& fw.IsStatic
&& fw.IsFinal
- && fw.Name != "serialVersionUID"
+ && !fw.IsSerialVersionUID
&& classFile.Fields[fieldIndex].Annotations == null
&& !classFile.IsReferenced(classFile.Fields[fieldIndex]))
{
diff --git a/runtime/MemberWrapper.cs b/runtime/MemberWrapper.cs
index e74283a8..09941d31 100644
--- a/runtime/MemberWrapper.cs
+++ b/runtime/MemberWrapper.cs
@@ -1531,6 +1531,21 @@ namespace IKVM.Internal
}
}
+ internal bool IsSerialVersionUID
+ {
+ get
+ {
+ // a serialVersionUID field must be static and final to be recognized (see ObjectStreamClass.getDeclaredSUID())
+ return (Modifiers & (Modifiers.Static | Modifiers.Final)) == (Modifiers.Static | Modifiers.Final)
+ && Name == "serialVersionUID"
+ && (FieldTypeWrapper == PrimitiveTypeWrapper.LONG
+ || FieldTypeWrapper == PrimitiveTypeWrapper.INT
+ || FieldTypeWrapper == PrimitiveTypeWrapper.CHAR
+ || FieldTypeWrapper == PrimitiveTypeWrapper.SHORT
+ || FieldTypeWrapper == PrimitiveTypeWrapper.BYTE);
+ }
+ }
+
internal static FieldWrapper Create(TypeWrapper declaringType, TypeWrapper fieldType, FieldInfo fi, string name, string sig, ExModifiers modifiers)
{
// volatile long & double field accesses must be made atomic
diff --git a/runtime/stubgen/StubGenerator.cs b/runtime/stubgen/StubGenerator.cs
index 2f693842..54ba8c92 100644
--- a/runtime/stubgen/StubGenerator.cs
+++ b/runtime/stubgen/StubGenerator.cs
@@ -228,7 +228,7 @@ namespace IKVM.StubGen
{
if (!fw.IsHideFromReflection)
{
- bool isSerialVersionUID = includeSerialVersionUID && fw.Name == "serialVersionUID" && fw.FieldTypeWrapper == PrimitiveTypeWrapper.LONG;
+ bool isSerialVersionUID = includeSerialVersionUID && fw.IsSerialVersionUID;
hasSerialVersionUID |= isSerialVersionUID;
if (fw.IsPublic || fw.IsProtected || isSerialVersionUID || includeNonPublicMembers)
{