зеркало из https://github.com/mono/ikvm-fork.git
- Removed CallerID from ICustomInvoke.
- Removed ICustomInvoke constructor invocation path, because there aren't any dynamic only constructors.
This commit is contained in:
Родитель
92d12dde39
Коммит
06685fbc51
|
@ -468,7 +468,7 @@ namespace IKVM.Internal
|
|||
}
|
||||
|
||||
#if !STATIC_COMPILER && !FIRST_PASS && !STUB_GENERATOR
|
||||
object ICustomInvoke.Invoke(object obj, object[] args, ikvm.@internal.CallerID callerID)
|
||||
object ICustomInvoke.Invoke(object obj, object[] args)
|
||||
{
|
||||
// a DynamicOnlyMethodWrapper is an interface method, but now that we've been called on an actual object instance,
|
||||
// we can resolve to a real method and call that instead
|
||||
|
@ -482,9 +482,14 @@ namespace IKVM.Internal
|
|||
{
|
||||
throw new java.lang.IllegalAccessError(tw.Name + "." + this.Name + this.Signature);
|
||||
}
|
||||
if (mw.HasCallerID)
|
||||
{
|
||||
// an interface method cannot require a CallerID
|
||||
throw new InvalidOperationException();
|
||||
}
|
||||
java.lang.reflect.Method m = (java.lang.reflect.Method)mw.ToMethodOrConstructor(true);
|
||||
m.@override = true;
|
||||
return m.invoke(obj, args, callerID);
|
||||
return m.invoke(obj, args, null);
|
||||
}
|
||||
#endif // !STATIC_COMPILER && !FIRST_PASS && !STUB_GENERATOR
|
||||
}
|
||||
|
@ -570,7 +575,7 @@ namespace IKVM.Internal
|
|||
}
|
||||
|
||||
#if !STATIC_COMPILER && !FIRST_PASS && !STUB_GENERATOR
|
||||
object ICustomInvoke.Invoke(object obj, object[] args, ikvm.@internal.CallerID callerID)
|
||||
object ICustomInvoke.Invoke(object obj, object[] args)
|
||||
{
|
||||
FieldWrapper[] values = this.DeclaringType.GetFields();
|
||||
object[] array = (object[])Array.CreateInstance(this.DeclaringType.TypeAsArrayType, values.Length);
|
||||
|
@ -599,7 +604,7 @@ namespace IKVM.Internal
|
|||
}
|
||||
|
||||
#if !STATIC_COMPILER && !FIRST_PASS && !STUB_GENERATOR
|
||||
object ICustomInvoke.Invoke(object obj, object[] args, ikvm.@internal.CallerID callerID)
|
||||
object ICustomInvoke.Invoke(object obj, object[] args)
|
||||
{
|
||||
FieldWrapper[] values = this.DeclaringType.GetFields();
|
||||
for (int i = 0; i < values.Length; i++)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2002-2012 Jeroen Frijters
|
||||
Copyright (C) 2002-2013 Jeroen Frijters
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
@ -356,7 +356,7 @@ namespace IKVM.Internal
|
|||
interface ICustomInvoke
|
||||
{
|
||||
#if !STATIC_COMPILER && !FIRST_PASS && !STUB_GENERATOR
|
||||
object Invoke(object obj, object[] args, ikvm.@internal.CallerID callerID);
|
||||
object Invoke(object obj, object[] args);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -6315,7 +6315,7 @@ namespace IKVM.NativeCode.sun.reflect
|
|||
object retval;
|
||||
try
|
||||
{
|
||||
retval = ((ICustomInvoke)mw).Invoke(obj, args, callerID);
|
||||
retval = ((ICustomInvoke)mw).Invoke(obj, args);
|
||||
}
|
||||
catch (MethodAccessException x)
|
||||
{
|
||||
|
@ -6762,31 +6762,6 @@ namespace IKVM.NativeCode.sun.reflect
|
|||
}
|
||||
}
|
||||
|
||||
private sealed class ConstructorAccessorImpl : srConstructorAccessor
|
||||
{
|
||||
private readonly MethodWrapper mw;
|
||||
|
||||
internal ConstructorAccessorImpl(jlrConstructor constructor)
|
||||
{
|
||||
mw = MethodWrapper.FromMethodOrConstructor(constructor);
|
||||
}
|
||||
|
||||
[IKVM.Attributes.HideFromJava]
|
||||
public object newInstance(object[] args)
|
||||
{
|
||||
args = ConvertArgs(mw.DeclaringType.GetClassLoader(), mw.GetParameters(), args);
|
||||
try
|
||||
{
|
||||
return ((ICustomInvoke)mw).Invoke(null, args, null);
|
||||
}
|
||||
catch (MethodAccessException x)
|
||||
{
|
||||
// this can happen if we're calling a non-public method and the call stack doesn't have ReflectionPermission.MemberAccess
|
||||
throw new jlIllegalAccessException().initCause(x);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private sealed class FastConstructorAccessorImpl : srConstructorAccessor
|
||||
{
|
||||
private delegate object Invoker(object[] args);
|
||||
|
@ -8172,11 +8147,7 @@ namespace IKVM.NativeCode.sun.reflect
|
|||
#else
|
||||
jlrConstructor cons = (jlrConstructor)constructor;
|
||||
MethodWrapper mw = MethodWrapper.FromMethodOrConstructor(constructor);
|
||||
if (mw is ICustomInvoke)
|
||||
{
|
||||
return new ConstructorAccessorImpl(cons);
|
||||
}
|
||||
else if (ActivatorConstructorAccessor.IsSuitable(mw))
|
||||
if (ActivatorConstructorAccessor.IsSuitable(mw))
|
||||
{
|
||||
// we special case public default constructors, because in that case using Activator.CreateInstance()
|
||||
// is almost as fast as FastConstructorAccessorImpl, but it saves us significantly in working set and
|
||||
|
|
Загрузка…
Ссылка в новой задаче