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>2013-02-24 11:01:21 +0400
committerjfrijters <jfrijters>2013-02-24 11:01:21 +0400
commit4b7fe573da7a7d4093de2e618b8d476f4d4591bc (patch)
tree610f683806976fbaff39b25d2eb4bedc0dcd222a
parentfecbee25fdf5bf5223249f755f40138ae48edc92 (diff)
Added MethodWrapper.IsConstructor property.
-rw-r--r--runtime/MemberWrapper.cs9
-rw-r--r--runtime/compiler.cs8
-rw-r--r--runtime/stubgen/SerialVersionUID.cs4
3 files changed, 13 insertions, 8 deletions
diff --git a/runtime/MemberWrapper.cs b/runtime/MemberWrapper.cs
index d5c5abcb..a2197703 100644
--- a/runtime/MemberWrapper.cs
+++ b/runtime/MemberWrapper.cs
@@ -476,7 +476,7 @@ namespace IKVM.Internal
parameterTypes[i] = argTypes[i].EnsureLoadable(loader).ClassObject;
}
java.lang.Class[] checkedExceptions = GetExceptions();
- if (this.Name == StringConstants.INIT)
+ if (this.IsConstructor)
{
method = new java.lang.reflect.Constructor(
this.DeclaringType.ClassObject,
@@ -786,7 +786,7 @@ namespace IKVM.Internal
#if FIRST_PASS
return null;
#else
- if (ReferenceEquals(Name, StringConstants.INIT))
+ if (IsConstructor)
{
java.lang.reflect.Constructor cons = (java.lang.reflect.Constructor)ToMethodOrConstructor(false);
if (obj == null)
@@ -1007,6 +1007,11 @@ namespace IKVM.Internal
{
get { return false; }
}
+
+ internal bool IsConstructor
+ {
+ get { return (object)Name == (object)StringConstants.INIT; }
+ }
}
// placeholder for <clinit> method that exist in ClassFile but not in TypeWrapper
diff --git a/runtime/compiler.cs b/runtime/compiler.cs
index 82c081a0..da11fd9f 100644
--- a/runtime/compiler.cs
+++ b/runtime/compiler.cs
@@ -462,7 +462,7 @@ sealed class Compiler
this.ilGenerator = ilGenerator;
this.debug = classLoader.EmitDebugInfo;
this.strictfp = m.IsStrictfp;
- if(ReferenceEquals(mw.Name, StringConstants.INIT))
+ if(mw.IsConstructor)
{
MethodWrapper finalize = clazz.GetMethodWrapper(StringConstants.FINALIZE, StringConstants.SIG_VOID, true);
keepAlive = finalize != null && finalize.DeclaringType != java_lang_Object && finalize.DeclaringType != cli_System_Object && finalize.DeclaringType != java_lang_Throwable && finalize.DeclaringType != cli_System_Exception;
@@ -1611,7 +1611,7 @@ sealed class Compiler
// if the stack values don't match the argument types (for interface argument types)
// we must emit code to cast the stack value to the interface type
- if(isinvokespecial && ReferenceEquals(cpi.Name, StringConstants.INIT) && VerifierTypeWrapper.IsNew(type))
+ if(isinvokespecial && method.IsConstructor && VerifierTypeWrapper.IsNew(type))
{
CastInterfaceArgs(method.DeclaringType, method.GetParameters(), i, false);
}
@@ -1641,7 +1641,7 @@ sealed class Compiler
CastInterfaceArgs(method.DeclaringType, args, i, true);
}
- if(isinvokespecial && ReferenceEquals(cpi.Name, StringConstants.INIT))
+ if(isinvokespecial && method.IsConstructor)
{
if(VerifierTypeWrapper.IsNew(type))
{
@@ -3551,7 +3551,7 @@ sealed class Compiler
{
ClassFile.ConstantPoolItemMI cpi = classFile.GetMethodref(code[index].Arg1);
MethodWrapper mw = cpi.GetMethodForInvokespecial();
- return mw.Name != StringConstants.INIT || mw.DeclaringType != tw;
+ return !mw.IsConstructor || mw.DeclaringType != tw;
}
if ((flags[index] & InstructionFlags.BranchTarget) != 0
|| ByteCodeMetaData.IsBranch(code[index].NormalizedOpCode)
diff --git a/runtime/stubgen/SerialVersionUID.cs b/runtime/stubgen/SerialVersionUID.cs
index fc972d28..c445030f 100644
--- a/runtime/stubgen/SerialVersionUID.cs
+++ b/runtime/stubgen/SerialVersionUID.cs
@@ -141,7 +141,7 @@ namespace IKVM.StubGen
List<MethodWrapper> list = new List<MethodWrapper>();
foreach (MethodWrapper mw in tw.GetMethods())
{
- if (mw.Name == StringConstants.INIT && !mw.IsHideFromReflection && !mw.IsPrivate)
+ if (mw.IsConstructor && !mw.IsHideFromReflection && !mw.IsPrivate)
{
list.Add(mw);
}
@@ -161,7 +161,7 @@ namespace IKVM.StubGen
List<MethodWrapper> list = new List<MethodWrapper>();
foreach (MethodWrapper mw in tw.GetMethods())
{
- if (mw.Name != StringConstants.INIT && !mw.IsHideFromReflection && !mw.IsPrivate)
+ if (!mw.IsConstructor && !mw.IsHideFromReflection && !mw.IsPrivate)
{
list.Add(mw);
}