This commit is contained in:
jfrijters 2004-06-17 09:14:51 +00:00
Родитель 8dca7d8d4d
Коммит 5c01368207
2 изменённых файлов: 21 добавлений и 0 удалений

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

@ -339,6 +339,8 @@ public class Starter
}
else
{
// if clazz isn't public, we can still call main
method.setAccessible(true);
if(saveAssembly)
{
java.lang.Runtime.getRuntime().addShutdownHook(new SaveAssemblyShutdownHook(clazz));

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

@ -525,6 +525,24 @@ class MethodWrapper : MemberWrapper
throw JavaException.InvocationTargetException(ExceptionHelper.MapExceptionFast(x.InnerException));
}
}
else if(!method.DeclaringType.IsInstanceOfType(obj))
{
// we're trying to initialize an existing instance of a remapped type
// HACK special case for deserialization of java.lang.Throwable subclasses
if(obj is System.Exception && (args == null || args.Length == 0))
{
// TODO this isn't the right constructor. We should be calling Exception(ExceptionHelper.get_NullString()).
method = typeof(System.Exception).GetConstructor(Type.EmptyTypes);
}
else
{
// NOTE this will also happen if you try to deserialize a .NET object
// (i.e. a type that doesn't derive from our java.lang.Object).
// We might want to support that in the future (it's fairly easy, because
// the call to Object.<init> can just be ignored)
throw new NotSupportedException("Unable to partially construct object of type " + obj.GetType().FullName + " to type " + method.DeclaringType.FullName);
}
}
}
else if(nonVirtual && !method.IsStatic)
{
@ -947,6 +965,7 @@ class FieldWrapper : MemberWrapper
{
bindings |= BindingFlags.Instance;
}
// TODO instead of looking up the field by name, we should use the Token to find it.
field = DeclaringType.TypeAsTBD.GetField(name, bindings);
Debug.Assert(field != null);
}