[monop] Port to use IKVM.Reflection, add -xi and -xa options to easily lookup Xamarin...
authorMiguel de Icaza <miguel@gnome.org>
Sun, 8 Feb 2015 03:44:32 +0000 (22:44 -0500)
committerMiguel de Icaza <miguel@gnome.org>
Sun, 8 Feb 2015 03:44:50 +0000 (22:44 -0500)
man/monop.1
mcs/tools/monop/Makefile
mcs/tools/monop/TypeSorter.cs
mcs/tools/monop/monop.cs
mcs/tools/monop/monop.exe.sources
mcs/tools/monop/options.cs
mcs/tools/monop/outline.cs

index fa913978dc0ea59b7c8ab6b61dab70331f43d1fe..cea422fd0e1c9141e0aed591b57750c5304a27e2 100644 (file)
@@ -30,6 +30,14 @@ Show private members.
 .TP
 .I \-\-runtime\-version
 Print runtime version.
+.TP
+.I \-xa
+Sets the lookup path to the Xamarin.Android directory.   This will
+load both the mscorlib from there, and search assemblies in that directory.
+.TP
+.I \-xi
+Sets the lookup path to the Xamarin.iOS directory. This will
+load both the mscorlib from there, and search assemblies in that directory.
 .PP
 .SH DESCRIPTION
 Monop is a tool that allows you to view the outline of a class. You can see the
index a9e79a8e9fa0aad2e0e72aa162deeb42fcc2102d..4be186fbcb7e90e09422b40d751f327fc385ef74 100644 (file)
@@ -3,6 +3,7 @@ SUBDIRS =
 include ../../build/rules.make
 
 PROGRAM = monop.exe
+LOCAL_MCS_FLAGS += -d:NO_AUTHENTICODE,STATIC,NO_SYMBOL_WRITER
 
 CLEAN_FILES = monop.exe monop2.exe *.mdb
 
index cd1f6967e76767b981b1c8d7cb9c4ff62ec64d18..b7fc35fb9218ad923399f7c319c9ece0af022d6b 100644 (file)
@@ -26,6 +26,9 @@
 
 using System;
 using System.Collections;
+#if STATIC
+using Type=IKVM.Reflection.Type;
+#endif
 
 class TypeSorter : IComparer
 {
index af9012a90444aefcb2c438dfa97ec38f2a5ecb15..9fe98ed6d19ffb59b9cb48b4569c19b4190bd86f 100644 (file)
@@ -1,6 +1,9 @@
 //
 // monop -- a semi-clone of javap
 //
+// TODO:
+//   Dump all attributes.
+//
 // Authors:
 //     Ben Maurer (bmaurer@users.sourceforge.net)
 //     John Luke  (john.luke@gmail.com)
@@ -36,11 +39,15 @@ using System.CodeDom.Compiler;
 using System.Collections;
 using System.Diagnostics;
 using System.IO;
-using System.Reflection;
+using IKVM.Reflection;
 using System.Text;
 using Mono.CSharp;
+using Type=IKVM.Reflection.Type;
 
 class MonoP {
+       static Universe universe = new Universe(UniverseOptions.EnableFunctionPointers | UniverseOptions.ResolveMissingMembers | UniverseOptions.DisablePseudoCustomAttributeRetrieval);
+       static Assembly mscorlib;
+       static Type obsolete_attribute;
        static string assembly;
        
        // very common namespaces, all in corlib
@@ -49,7 +56,7 @@ class MonoP {
                "System.Collections",
                "System.Reflection",
                "System.Text",
-               "System.IO"
+               "System.IO",
        };
        
        static readonly string [] common_assemblies = {
@@ -62,8 +69,12 @@ class MonoP {
        static readonly string [] common_ns = {
                "System.Xml",
                "System.Web",
+               "Foundation",
+               "CoreFoundation",
+               "CoreGraphics",
+               "UIKit",
                "Gtk",
-               "GLib"
+               "GLib",
        };
        
        static Type GetType (string tname, bool ignoreCase)
@@ -72,9 +83,9 @@ class MonoP {
                if (assembly != null) {
                        Assembly a = GetAssembly (assembly, true);
                        t = a.GetType (tname, false, ignoreCase);
-               } else 
-                       t = Type.GetType (tname, false, ignoreCase);
-
+               } else {
+                       t = mscorlib.GetType (tname, false, ignoreCase);
+               }
                return t;
        }
        
@@ -86,6 +97,7 @@ class MonoP {
 
                string [] assemblies = GetKnownAssemblyNames ();
                for (int i = 0; i < assemblies.Length; i++) {
+                       Console.WriteLine ("Loading {0}", assemblies[i]);
                        Assembly a = GetAssembly (assemblies [i], false);
                        if (a == null)
                                continue;
@@ -117,6 +129,11 @@ class MonoP {
 
        static string [] GetKnownAssemblyNames ()
        {
+               Console.WriteLine (options.PublicDir);
+               if (options.Style == "xios" || options.Style == "xand"){
+                       return Directory.GetFiles (options.PublicDir, "*.dll");
+               }
+               
                Process p = new Process ();
                p.StartInfo.UseShellExecute = false;
                p.StartInfo.RedirectStandardOutput = true;
@@ -157,22 +174,13 @@ class MonoP {
                try {
                        // if it exists try to use LoadFrom
                        if (File.Exists (assembly))
-                               a = Assembly.LoadFrom (assembly);
-                       // if it looks like a fullname try that
-                       else if (assembly.Split (',').Length == 4)
-                               a = Assembly.Load (assembly);
-                       // see if MONO_PATH has it
+                               a = universe.LoadFile (assembly);
                        else
                                a = LoadFromMonoPath (assembly);
                } catch {
                        // ignore exception it gets handled below
                }
 
-               // last try partial name
-               // this (apparently) is exception safe
-               if (a == null)
-                       a = Assembly.LoadWithPartialName (assembly);
-
                if (a == null && exit) {
                        Console.WriteLine ("Could not load {0}", MonoP.assembly);
                        Environment.Exit (1);
@@ -189,7 +197,7 @@ class MonoP {
                foreach (string path in paths) {        
                        string apath = Path.Combine (path, assembly);
                        if (File.Exists (apath))
-                               return Assembly.LoadFrom (apath);       
+                               return universe.LoadFile (apath);       
                }
                return null;
        }
@@ -213,13 +221,6 @@ class MonoP {
                Console.WriteLine ();
                Console.WriteLine ("Assembly Information:");
 
-               object[] cls = a.GetCustomAttributes (typeof (CLSCompliantAttribute), false);
-               if (cls.Length > 0) {
-                       CLSCompliantAttribute cca = cls[0] as CLSCompliantAttribute;
-                       if (cca.IsCompliant)
-                               Console.WriteLine ("[CLSCompliant]");
-               }
-
                foreach (string ai in a.ToString ().Split (','))
                        Console.WriteLine (ai.Trim ());
                        
@@ -229,9 +230,9 @@ class MonoP {
 
                int obsolete_count = 0;
                foreach (Type t in types) {
-                       if (filter_obsolete && t.IsDefined (typeof (ObsoleteAttribute), false))
-                               obsolete_count ++;
-                       else 
+                       if (filter_obsolete && t.IsDefined (obsolete_attribute, false))
+                               obsolete_count++;
+                       else
                                Console.WriteLine (t.FullName);
                }
 
@@ -240,7 +241,7 @@ class MonoP {
        
        internal static void Completion (string prefix)
        {
-               foreach (Type t in typeof (object).Assembly.GetExportedTypes ()) {
+               foreach (Type t in mscorlib.GetExportedTypes ()) {
                        if (t.Name.StartsWith (prefix)) {
                                if (Array.IndexOf (v_common_ns, t.Namespace) != -1) {
                                        Console.WriteLine (t.Name);
@@ -281,13 +282,6 @@ class MonoP {
        {
                Assembly a = GetAssembly (assembly, true);
 
-               object[] cls = a.GetCustomAttributes (typeof (CLSCompliantAttribute), false);
-               if (cls.Length > 0) {
-                       CLSCompliantAttribute cca = cls[0] as CLSCompliantAttribute;
-                       if (cca.IsCompliant)
-                               Console.WriteLine ("[CLSCompliant]");
-               }
-
                foreach (string ai in a.ToString ().Split (','))
                        Console.WriteLine (ai.Trim ());
                        
@@ -297,20 +291,28 @@ class MonoP {
                
                var sw = new StreamWriter (Console.OpenStandardOutput (), Console.Out.Encoding);                                
                foreach (Type t in types) {
-                       if (filter_obsolete && t.IsDefined (typeof (ObsoleteAttribute), false))
+                       if (filter_obsolete && t.IsDefined (obsolete_attribute, false))
                                continue;
 
-                       new Outline (t, sw, true, show_private, filter_obsolete).OutlineType ();
+                       new Outline (universe, mscorlib, t, sw, true, show_private, filter_obsolete).OutlineType ();
                }
                sw.Flush ();
        }
+
+       static Options options = new Options ();
        
        static void Main (string [] args)
        {
-               Options options = new Options ();
                if (!options.ProcessArgs (args))
                        return;
                
+               if (options.Style == null)
+                       mscorlib = universe.LoadFile (typeof (int).Assembly.Location);
+               else
+                       mscorlib = universe.LoadFile (Path.Combine (options.PublicDir, "mscorlib.dll"));
+                                                     
+               obsolete_attribute = mscorlib.GetType ("System.ObsoleteAttribute");
+               
                if (options.AssemblyReference != null) {
                        assembly = options.AssemblyReference;
 
@@ -327,12 +329,13 @@ class MonoP {
                                }
                        }
                }
-
+               
                string message = null;
                string tname = options.Type;
                Type t = null;
                int count;
 
+
                if (options.Search) {
                        string matches = SearchTypes (tname, ref t, out count);
 
@@ -364,6 +367,8 @@ class MonoP {
                        foreach (string assm in GetKnownAssemblyNames ()) {
                                try {
                                        Assembly a = GetAssembly (assm, false);
+                                       if (a == null)
+                                               continue;
                                        t = a.GetType (tname, false, true);
                                        if (t != null) {
                                                message = String.Format ("{0} is included in the {1} assembly.",
@@ -380,7 +385,8 @@ class MonoP {
                                                        goto found;
                                                }
                                        }
-                               } catch {
+                               } catch (Exception e){
+                                       Console.WriteLine ("Failure: " + e);
                                }
                        }
                }
@@ -395,7 +401,7 @@ class MonoP {
                // This gets us nice buffering
                //
                StreamWriter sw = new StreamWriter (Console.OpenStandardOutput (), Console.Out.Encoding);                               
-               new Outline (t, sw, options.DeclaredOnly, options.ShowPrivate, options.FilterObsolete).OutlineType ();
+               new Outline (universe, mscorlib, t, sw, options.DeclaredOnly, options.ShowPrivate, options.FilterObsolete).OutlineType ();
                sw.Flush ();
 
                if (message != null)
index f3ec5b1d560e7a76cfb1b00040acf865855fba11..4b9bc5adf7a3cc4cf91b4ef881e6b7f2ecbdcb0a 100644 (file)
@@ -2,3 +2,15 @@ monop.cs
 options.cs
 outline.cs
 TypeSorter.cs
+../../class/Mono.CompilerServices.SymbolWriter/MonoSymbolFile.cs
+../../class/Mono.CompilerServices.SymbolWriter/MonoSymbolTable.cs
+../../class/Mono.CompilerServices.SymbolWriter/SourceMethodBuilder.cs
+
+../../class/Mono.Security/Mono.Security.Cryptography/CryptoConvert.cs
+../../../external/ikvm/reflect/*.cs
+../../../external/ikvm/reflect/Emit/*.cs
+../../../external/ikvm/reflect/Metadata/*.cs
+../../../external/ikvm/reflect/Reader/*.cs
+../../../external/ikvm/reflect/Writer/*.cs
+../../../external/ikvm/reflect/Impl/ITypeOwner.cs
+../../../external/ikvm/reflect/Impl/SymbolSupport.cs
index fa1a10dda3460f0322c9ec13357830d3071f2076..92b6f7d2933e95b9723656b4b0f035fb373d4e87 100644 (file)
@@ -36,6 +36,8 @@ public class Options
        public bool ShowPrivate = false;
        public string AssemblyReference = null;
        public string Type = null;
+       public string PublicDir = null;
+       public string Style = null;
 
        public Options ()
        {
@@ -52,62 +54,70 @@ public class Options
 
                for (int i = 0; i < args.Length; i++) {
                        switch (args[i]) {
-                               case "-h":
-                               case "--help":
-                                       PrintHelp ();
-                                       return false;
-                               case "--runtime-version":
-                                       PrintRuntimeVersion ();
-                                       return false;
-                               case "-d":
-                               case "--declared-only":
-                                       DeclaredOnly = true;
-                                       break;
-                               case "--filter-obsolete":
-                               case "-f":
-                                       FilterObsolete = true;
-                                       break;
-                               case "-p":
-                               case "--private":
-                                       ShowPrivate = true;
-                                       break;
-                               case "--refs":
-                                       PrintRefs = true;
-                                       break;
-                               case "-s":
-                               case "-k":
-                               case "--search":
-                                       Search = true;
-                                       break;
-                               case "-c":
-                                       i++;
-                                       if (i < args.Length)
-                                               MonoP.Completion (args[i]);
-                                       return false;
-                               case "-r":
-                                       i++;
-                                       if (i < args.Length)
-                                               AssemblyReference = args[i];
-                                       break;
-                               case "-a":
-                                       ShowAll = true;
+                       case "-h":
+                       case "--help":
+                               PrintHelp ();
+                       return false;
+                       case "--runtime-version":
+                               PrintRuntimeVersion ();
+                               return false;
+                       case "-d":
+                       case "--declared-only":
+                               DeclaredOnly = true;
+                       break;
+                       case "--filter-obsolete":
+                       case "-f":
+                               FilterObsolete = true;
+                       break;
+                       case "-p":
+                       case "--private":
+                               ShowPrivate = true;
+                       break;
+                       case "--refs":
+                               PrintRefs = true;
+                               break;
+                       case "-xi":
+                               PublicDir = "/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mono/Xamarin.iOS";
+                               Style = "xios";
+                               break;
+                       case "-xa":
+                               PublicDir = "/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mono/2.1";
+                               Style = "xand";
+                               break;
+                       case "-s":
+                       case "-k":
+                       case "--search":
+                               Search = true;
+                       break;
+                       case "-c":
+                               i++;
+                               if (i < args.Length)
+                                       MonoP.Completion (args[i]);
+                               return false;
+                       case "-r":
+                               i++;
+                               if (i < args.Length)
+                                       AssemblyReference = args[i];
+                               break;
+                       case "-a":
+                               ShowAll = true;
+                               break;
+                       default:
+                               if (args[i].StartsWith ("-r:") || args[i].StartsWith ("/r:")) {
+                                       AssemblyReference = args [i].Substring (3);
                                        break;
-                               default:
-                                       if (args[i].StartsWith ("-r:") || args[i].StartsWith ("/r:")) {
-                                               AssemblyReference = args [i].Substring (3);
-                                               break;
-                                       }
-
-                                       // The first unrecognizable option becomes
-                                       // the type to look up
-                                       if (Type == null) {
-                                               Type = args[i];
-                                               break;
-                                       }
-
-                                       // others are ignored
-                                       Console.WriteLine ("ignored: {0}", args[i]);
+                               }
+                               
+                               // The first unrecognizable option becomes
+                               // the type to look up
+                               if (Type == null) {
+                                       Type = args[i];
                                        break;
+                               }
+                               
+                               // others are ignored
+                               Console.WriteLine ("ignored: {0}", args[i]);
+                               break;
                        }
                }
 
@@ -135,6 +145,8 @@ public class Options
                Console.WriteLine ("\t--refs\t\t\tPrint a list of the referenced assemblies for an assembly");
                Console.WriteLine ("\t--runtime-version\tPrint runtime version");
                Console.WriteLine ("\t--search,-s,-k\t\tSearch through all known namespaces");
+               Console.WriteLine ("\t--xi\t\tSet search style to Xamarin.iOS");
+               Console.WriteLine ("\t--xa\t\tSet search style to Xamarin.Android");
                Console.WriteLine ("\t--a\t\tShows all the types declare in the specified assembly");
        }
 }
index db055e726d5ac07873bf423a4c606c377ca9e684..67e72d29f81bf9cd653c24f8b59c6b80ffbbbceb 100644 (file)
 //
 
 using System;
-using System.Reflection;
 using System.Collections;
 using System.CodeDom.Compiler;
 using System.IO;
 using System.Text;
+#if STATIC
+using IKVM.Reflection;
+using Type=IKVM.Reflection.Type;
+#else
+using System.Reflection;
+#endif
 
 namespace Mono.CSharp {
 public class Outline {
-
        bool declared_only;
        bool show_private;
        bool filter_obsolete;
        
        IndentedTextWriter o;
        Type t;
+       Type type_multicast_delegate, type_object, type_value_type, type_int, type_flags_attribute, type_obsolete_attribute, type_param_array_attribute;
        
+#if STATIC
+       Universe universe;
+       Assembly mscorlib;
+
+       public Outline (Universe universe, Assembly mscorlib, Type t, TextWriter output, bool declared_only, bool show_private, bool filter_obsolete)
+       {
+               if (universe == null)
+                       throw new ArgumentNullException ("universe");
+               if (mscorlib == null)
+                       throw new ArgumentNullException ("mscorlib");
+               this.universe = universe;
+               this.mscorlib = mscorlib;
+               this.t = t;
+               this.o = new IndentedTextWriter (output, "\t");
+               this.declared_only = declared_only;
+               this.show_private = show_private;
+               this.filter_obsolete = filter_obsolete;
+
+               type_multicast_delegate = mscorlib.GetType("System.MulticastDelegate");
+               type_object = mscorlib.GetType ("System.Object");
+               type_value_type = mscorlib.GetType ("System.ValueType");
+               type_int = mscorlib.GetType ("System.Int32");
+               type_flags_attribute = mscorlib.GetType ("System.FlagsAttribute");
+               type_obsolete_attribute = mscorlib.GetType ("System.ObsoleteAttribute");
+               type_param_array_attribute = mscorlib.GetType ("System.ParamArrayAttribute");
+       }
+#else
        public Outline (Type t, TextWriter output, bool declared_only, bool show_private, bool filter_obsolete)
        {
                this.t = t;
@@ -53,7 +85,16 @@ public class Outline {
                this.declared_only = declared_only;
                this.show_private = show_private;
                this.filter_obsolete = filter_obsolete;
+
+               type_multicast_delegate = typeof (System.MulticastDelegate);
+               type_object = typeof (object);
+               type_value_type = typeof (ValueType);
+               type_int = typeof (int);
+               type_flags_attribute = typeof (FlagsAttribute);
+               type_obsolete_attribute = typeof (ObsoleteAttribuet);
+               type_param_array_attribute = typeof (ParamArrayAttribute);
        }
+#endif
 
        public void OutlineType ()
         {
@@ -62,7 +103,7 @@ public class Outline {
                OutlineAttributes ();
                o.Write (GetTypeVisibility (t));
                
-               if (t.IsClass && !t.IsSubclassOf (typeof (System.MulticastDelegate))) {
+               if (t.IsClass && !t.IsSubclassOf (type_multicast_delegate)) {
                        if (t.IsSealed)
                                o.Write (t.IsAbstract ? " static" : " sealed");
                        else if (t.IsAbstract)
@@ -76,7 +117,7 @@ public class Outline {
                Type [] interfaces = (Type []) Comparer.Sort (TypeGetInterfaces (t, declared_only));
                Type parent = t.BaseType;
 
-               if (t.IsSubclassOf (typeof (System.MulticastDelegate))) {
+               if (t.IsSubclassOf (type_multicast_delegate)) {
                        MethodInfo method;
 
                        method = t.GetMethod ("Invoke");
@@ -95,11 +136,11 @@ public class Outline {
                }
                
                o.Write (GetTypeName (t));
-               if (((parent != null && parent != typeof (object) && parent != typeof (ValueType)) || interfaces.Length != 0) && ! t.IsEnum) {
+               if (((parent != null && parent != type_object && parent != type_value_type) || interfaces.Length != 0) && ! t.IsEnum) {
                        first = true;
                        o.Write (" : ");
                        
-                       if (parent != null && parent != typeof (object) && parent != typeof (ValueType)) {
+                       if (parent != null && parent != type_object && parent != type_value_type) {
                                o.Write (FormatType (parent));
                                first = false;
                        }
@@ -113,8 +154,8 @@ public class Outline {
                }
 
                if (t.IsEnum) {
-                       Type underlyingType = System.Enum.GetUnderlyingType (t);
-                       if (underlyingType != typeof (int))
+                       Type underlyingType = t.GetEnumUnderlyingType ();
+                       if (underlyingType != type_int)
                                o.Write (" : {0}", FormatType (underlyingType));
                }
                WriteGenericConstraints (t.GetGenericArguments ());
@@ -256,8 +297,12 @@ public class Outline {
                        if (first)
                                o.WriteLine ();
                        first = false;
-                       
+
+#if STATIC
+                       new Outline (universe, mscorlib, ntype, o, declared_only, show_private, filter_obsolete).OutlineType ();
+#else
                        new Outline (ntype, o, declared_only, show_private, filter_obsolete).OutlineType ();
+#endif
                }
                
                o.Indent--; o.WriteLine ("}");
@@ -280,20 +325,21 @@ public class Outline {
                if (t.IsSerializable)
                        o.WriteLine ("[Serializable]");
 
-               if (t.IsDefined (typeof (System.FlagsAttribute), true))
+               if (t.IsDefined (type_flags_attribute, true))
                        o.WriteLine ("[Flags]");
 
-               if (t.IsDefined (typeof (System.ObsoleteAttribute), true))
+               if (t.IsDefined (type_obsolete_attribute, true))
                        o.WriteLine ("[Obsolete]");
        }
 
        void OutlineMemberAttribute (MemberInfo mi)
        {
-               if (!mi.IsDefined (typeof (System.ObsoleteAttribute), false))
-                       return;
-               var oa = mi.GetCustomAttributes (typeof (System.ObsoleteAttribute), false) [0] as ObsoleteAttribute;
-               var msg = oa.Message;
-               o.WriteLine ("[Obsolete{0}]", msg == null || msg == "" ? "" : string.Format ("(\"{0}\")", msg));
+               var attrs = mi.GetCustomAttributesData ();
+               if (attrs.Count > 0)
+                       o.WriteLine ("");
+               
+               foreach (var attr in attrs)
+                       o.WriteLine (attr);
        }
        
        void OutlineEvent (EventInfo ei)
@@ -425,7 +471,7 @@ public class Outline {
                        if (p.ParameterType.IsByRef) {
                                o.Write (p.IsOut ? "out " : "ref ");
                                o.Write (FormatType (p.ParameterType.GetElementType ()));
-                       } else if (p.IsDefined (typeof (ParamArrayAttribute), false)) {
+                       } else if (p.IsDefined (type_param_array_attribute, false)) {
                                o.Write ("params ");
                                o.Write (FormatType (p.ParameterType));
                        } else {
@@ -454,7 +500,7 @@ public class Outline {
                o.Write (" ");
                o.Write (fi.Name);
                if (fi.IsLiteral) { 
-                       object v = fi.GetValue (this);
+                       object v = fi.GetRawConstantValue ();
 
                        // TODO: Escape values here
                        o.Write (" = ");
@@ -463,7 +509,7 @@ public class Outline {
                        else if (v is string)
                                o.Write ("\"{0}\"", v);
                        else
-                               o.Write (fi.GetValue (this));
+                               o.Write (fi.GetRawConstantValue ());
                }
                o.Write (";");
        }
@@ -521,12 +567,12 @@ public class Outline {
                return null;
        }
 
-       static string GetTypeKind (Type t)
+       string GetTypeKind (Type t)
        {
                if (t.IsEnum)
                        return "enum";
                if (t.IsClass) {
-                       if (t.IsSubclassOf (typeof (System.MulticastDelegate)))
+                       if (t.IsSubclassOf (type_multicast_delegate))
                                return "delegate";
                        else
                                return "class";
@@ -583,6 +629,8 @@ public class Outline {
                        return t.ToString ();
                
                if (!type.StartsWith ("System.")) {
+                       if (type.IndexOf (".") == -1)
+                               return type;
                        if (t.Namespace == this.t.Namespace)
                                return t.Name;
                        return type;
@@ -716,13 +764,13 @@ public class Outline {
                                GenericParameterAttributes.DefaultConstructorConstraint
                        };
                        
-                       if (t.BaseType != typeof (object) || ifaces.Length != 0 || attrs != 0) {
+                       if (t.BaseType != type_object || ifaces.Length != 0 || attrs != 0) {
                                o.Write (" where ");
                                o.Write (FormatType (t));
                                o.Write (" : ");
                        }
 
-                       if (t.BaseType != typeof (object)) {
+                       if (t.BaseType != type_object) {
                                o.Write (FormatType (t.BaseType));
                                first = false;
                        }
@@ -817,7 +865,7 @@ public class Outline {
                if (show_private)
                        return true;
 
-               if (filter_obsolete && mi.IsDefined (typeof (ObsoleteAttribute), false))
+               if (filter_obsolete && mi.IsDefined (type_obsolete_attribute, false))
                        return false;
                
                switch (mi.MemberType) {
@@ -905,8 +953,6 @@ public class Comparer : IComparer  {
                Type type1 = (Type) a;
                Type type2 = (Type) b;
 
-               if (type1.IsSubclassOf (typeof (System.MulticastDelegate)) != type2.IsSubclassOf (typeof (System.MulticastDelegate)))
-                               return (type1.IsSubclassOf (typeof (System.MulticastDelegate)))? -1:1;
                return string.Compare (type1.Name, type2.Name);
                        
        }