- Removed BaseTypeWrapper.Finish() call from DotNetTypeWrapper.LazyPublishMembers(), because it is the wrong place to call Finish.

- Added explicit Link() calls where necessary.
This commit is contained in:
jfrijters 2011-12-14 09:46:55 +00:00
Родитель 2a62a767ca
Коммит b8a9511680
4 изменённых файлов: 16 добавлений и 4 удалений

Просмотреть файл

@ -904,6 +904,7 @@ static class NetExp
{
if (mw.IsPublic || mw.IsProtected)
{
mw.Link();
AddToExportListIfNeeded(mw.ReturnType);
AddToExportListIfNeeded(mw.GetParameters());
}
@ -912,6 +913,7 @@ static class NetExp
{
if (fw.IsPublic || fw.IsProtected)
{
fw.Link();
AddToExportListIfNeeded(fw.FieldTypeWrapper);
}
}

Просмотреть файл

@ -2158,8 +2158,6 @@ namespace IKVM.Internal
// methods, which don't really exist).
if (ClassLoaderWrapper.IsRemappedType(type) && !type.IsSealed && !type.IsInterface)
{
// Finish the type, to make sure the methods are populated
this.BaseTypeWrapper.Finish();
TypeWrapper baseTypeWrapper = this.BaseTypeWrapper;
while (baseTypeWrapper != null)
{
@ -2242,11 +2240,15 @@ namespace IKVM.Internal
private MethodWrapper m;
internal BaseFinalMethodWrapper(DotNetTypeWrapper tw, MethodWrapper m)
: base(tw, m.Name, m.Signature, m.GetMethod(), m.ReturnType, m.GetParameters(), (m.Modifiers & ~Modifiers.Abstract) | Modifiers.Final, MemberFlags.None)
: base(tw, m.Name, m.Signature, null, null, null, (m.Modifiers & ~Modifiers.Abstract) | Modifiers.Final, MemberFlags.None)
{
this.m = m;
}
protected override void DoLinkMethod()
{
}
#if !STUB_GENERATOR
internal override void EmitCall(CodeEmitter ilgen)
{

Просмотреть файл

@ -2297,7 +2297,7 @@ namespace IKVM.Internal
((TryGetClassFileVersion(baseMethod.DeclaringType, out majorVersion) && majorVersion < 51)
// if TryGetClassFileVersion fails, we know that it is safe to call GetMethod() so we look at the actual method attributes here,
// because access widing ensures that if the method had overridden the top level method it would also be public or protected
|| (baseMethod.GetMethod().Attributes & MethodAttributes.MemberAccessMask) == MethodAttributes.Assembly))
|| (LinkAndGetMethod(baseMethod).Attributes & MethodAttributes.MemberAccessMask) == MethodAttributes.Assembly))
{
// the method we're overriding is not public or protected, but there is a public or protected top level method,
// this means that baseMethod is part of a class with a major version < 51, so we have to explicitly override the top level method as well
@ -2344,6 +2344,12 @@ namespace IKVM.Internal
return null;
}
private static MethodBase LinkAndGetMethod(MethodWrapper mw)
{
mw.Link();
return mw.GetMethod();
}
private static bool TryGetClassFileVersion(TypeWrapper tw, out int majorVersion)
{
DynamicTypeWrapper dtw = tw as DynamicTypeWrapper;

Просмотреть файл

@ -510,6 +510,7 @@ namespace IKVM.Internal
object method = reflectionMethod;
if (method == null)
{
Link();
ClassLoaderWrapper loader = this.DeclaringType.GetClassLoader();
TypeWrapper[] argTypes = GetParameters();
java.lang.Class[] parameterTypes = new java.lang.Class[argTypes.Length];
@ -1331,6 +1332,7 @@ namespace IKVM.Internal
java.lang.reflect.Field field = reflectionField;
if (field == null)
{
Link();
field = new java.lang.reflect.Field(
this.DeclaringType.ClassObject,
this.Name,