internal static TypeWrapper GetTypeWrapperFromObject(object o) { TypeWrapper ghostType = GhostTag.GetTag(o); if (ghostType != null) { return(ghostType); } Type t = o.GetType(); if (t.IsPrimitive || (ClassLoaderWrapper.IsRemappedType(t) && !t.IsSealed)) { return(DotNetTypeWrapper.GetWrapperFromDotNetType(t)); } for (; ;) { TypeWrapper tw = ClassLoaderWrapper.GetWrapperFromType(t); // if GetWrapperFromType returns null (or if tw.IsAbstract), that // must mean that the Type of the object is an implementation helper class // (e.g. an AtomicReferenceFieldUpdater or ThreadLocal instrinsic subclass) if (tw != null && (!tw.IsAbstract || tw.IsArray)) { return(tw); } t = t.BaseType; } }
private static int ProcessAssembly(Assembly assembly, bool continueOnError) { int rc = 0; foreach (Type t in assembly.GetTypes()) { if (t.IsPublic && !t.IsGenericTypeDefinition && !AttributeHelper.IsHideFromJava(t) && (!t.IsGenericType || !AttributeHelper.IsJavaModule(t.Module))) { TypeWrapper c; if (ClassLoaderWrapper.IsRemappedType(t) || t.IsPrimitive || t == Types.Void) { c = DotNetTypeWrapper.GetWrapperFromDotNetType(t); } else { c = ClassLoaderWrapper.GetWrapperFromType(t); } if (c != null) { AddToExportList(c); } } } bool keepGoing; do { keepGoing = false; foreach (TypeWrapper c in new List <TypeWrapper>(todo.Values)) { if (!done.ContainsKey(c.Name)) { keepGoing = true; done.Add(c.Name, null); try { ProcessClass(c); } catch (Exception x) { if (continueOnError) { rc = 1; Console.WriteLine(x); } else { throw; } } WriteClass(c); } } } while(keepGoing); return(rc); }
public static jlClass getClassFromTypeHandle(RuntimeTypeHandle handle, int rank) { Type t = Type.GetTypeFromHandle(handle); if (t.IsPrimitive || ClassLoaderWrapper.IsRemappedType(t) || t == typeof(void)) { return(DotNetTypeWrapper.GetWrapperFromDotNetType(t).MakeArrayType(rank).ClassObject); } if (!IsVisibleAsClass(t)) { return(null); } TypeWrapper tw = ClassLoaderWrapper.GetWrapperFromType(t); if (tw != null) { return(tw.MakeArrayType(rank).ClassObject); } return(null); }