more errors/attributes
authorPiers Haken <piers@mono-cvs.ximian.com>
Tue, 2 Apr 2002 19:14:02 +0000 (19:14 -0000)
committerPiers Haken <piers@mono-cvs.ximian.com>
Tue, 2 Apr 2002 19:14:02 +0000 (19:14 -0000)
better handling of properties/events

svn path=/trunk/mcs/; revision=3556

mcs/tools/corcompare/MissingBase.cs
mcs/tools/corcompare/MissingEvent.cs
mcs/tools/corcompare/MissingField.cs
mcs/tools/corcompare/MissingMember.cs
mcs/tools/corcompare/MissingMethod.cs
mcs/tools/corcompare/MissingProperty.cs
mcs/tools/corcompare/MissingType.cs
mcs/tools/corcompare/ToDoAssembly.cs

index cbe3b3f1a28f10a77c4698f77650caa3181be8b4..ec62043a32a6e599c84720602c4e9eb153e3aa39 100644 (file)
@@ -24,6 +24,16 @@ namespace Mono.Util.CorCompare
                protected ArrayList rgAttributes;
                protected NodeStatus nsAttributes;
 
+               public enum Accessibility
+               {
+                       Public,
+                       Assembly,
+                       FamilyOrAssembly,
+                       Family,
+                       FamilyAndAssembly,
+                       Private,
+               }
+
                /// <summary>
                /// The name of the element (eg "System.Xml")
                /// </summary>
@@ -92,5 +102,33 @@ namespace Mono.Util.CorCompare
                                nsAttributes.AddChildren (ma.Status);
                        }
                }
+
+               protected void AddFlagWarning (bool fMono, bool fMS, string strName)
+               {
+                       if (!fMono && fMS)
+                               m_nodeStatus.AddWarning ("Should be " + strName);
+                       else if (fMono && !fMS)
+                               m_nodeStatus.AddWarning ("Should not be " + strName);
+               }
+
+               protected string AccessibilityToString (Accessibility ac)
+               {
+                       switch (ac)
+                       {
+                               case Accessibility.Public:
+                                       return "public";
+                               case Accessibility.Assembly:
+                                       return "internal";
+                               case Accessibility.FamilyOrAssembly:
+                                       return "protected internal";
+                               case Accessibility.Family:
+                                       return "protected";
+                               case Accessibility.FamilyAndAssembly:
+                                       return "protected";     // TODO:
+                               case Accessibility.Private:
+                                       return "private";
+                       }
+                       throw new Exception ("Invalid accessibility: "+ac.ToString ());
+               }
        }
 }
index 7cae2eb91fd21add453b822539920a7f18c9ba2f..fb037c2319b29e8e1d523b569a828b9a5ba2c3f4 100644 (file)
@@ -18,9 +18,11 @@ namespace Mono.Util.CorCompare {
        ///     created by - Nick
        ///     created on - 2/24/2002 10:43:57 PM
        /// </remarks>
-       class MissingEvent : MissingProperty {
+       class MissingEvent : MissingMember {
                // e.g. <method name="Equals" status="missing"/>
                public MissingEvent (MemberInfo infoMono, MemberInfo infoMS) : base (infoMono, infoMS) {}
+               MissingMethod mmAdd;
+               MissingMethod mmRemove;
                MissingMethod mmRaise;
 
                public override string Type {
@@ -28,20 +30,50 @@ namespace Mono.Util.CorCompare {
                                return "event";
                        }
                }
-               /// <summary>
-               /// a place holder for the method used to set the value of this property
-               /// </summary>
-               public virtual MissingMethod RaiseMethod
+
+               public override NodeStatus Analyze ()
                {
-                       get { return mmRaise; }
-                       set
+                       m_nodeStatus = base.Analyze ();
+
+                       EventInfo eiMono = (EventInfo) mInfoMono;
+                       EventInfo eiMS   = (EventInfo) mInfoMS;
+
+                       MemberInfo miAddMono, miRemoveMono, miRaiseMono;
+                       if (eiMono == null)
+                               miAddMono = miRemoveMono = miRaiseMono = null;
+                       else
                        {
-                               if (mmRaise != null)
-                                       m_nodeStatus.SubChildren (mmRaise.Status);
-                               mmRaise = value;
-                               if (mmRaise != null)
-                                       m_nodeStatus.AddChildren (mmRaise.Status);
+                               miAddMono = eiMono.GetAddMethod ();
+                               miRemoveMono = eiMono.GetRemoveMethod ();
+                               miRaiseMono = eiMono.GetRaiseMethod ();
+                       }
+
+                       MemberInfo miAddMS, miRemoveMS, miRaiseMS;
+                       if (eiMS == null)
+                               miAddMS = miRemoveMS = miRaiseMS = null;
+                       else
+                       {
+                               miAddMS = eiMS.GetAddMethod ();
+                               miRemoveMS = eiMS.GetRemoveMethod ();
+                               miRaiseMS = eiMS.GetRaiseMethod ();
+                       }
+
+                       if (miAddMono != null || miAddMS != null)
+                       {
+                               mmAdd = new MissingMethod (miAddMono, miAddMS);
+                               m_nodeStatus.AddChildren (mmAdd.Analyze ());
+                       }
+                       if (miRemoveMono != null || miRemoveMS != null)
+                       {
+                               mmRemove = new MissingMethod (miRemoveMono, miRemoveMS);
+                               m_nodeStatus.AddChildren (mmRemove.Analyze ());
+                       }
+                       if (miRaiseMono != null || miRaiseMS != null)
+                       {
+                               mmRaise = new MissingMethod (miRemoveMono, miRemoveMS);
+                               m_nodeStatus.AddChildren (mmRaise.Analyze ());
                        }
+                       return m_nodeStatus;
                }
 
                public override XmlElement CreateXML (XmlDocument doc)
@@ -56,7 +88,16 @@ namespace Mono.Util.CorCompare {
                                        eltAccessors = doc.CreateElement ("accessors");
                                        eltMember.AppendChild (eltAccessors);
                                }
-
+                               if (mmAdd != null)
+                               {
+                                       XmlElement eltAdd = mmAdd.CreateXML (doc);
+                                       eltAccessors.AppendChild (eltAdd);
+                               }
+                               if (mmRemove != null)
+                               {
+                                       XmlElement eltRemove = mmRemove.CreateXML (doc);
+                                       eltAccessors.AppendChild (eltRemove);
+                               }
                                if (mmRaise != null)
                                {
                                        XmlElement eltRaise = mmRaise.CreateXML (doc);
index f7f9f1bffef49a4ab27b8d5815235fc2fe850aaf..6c6aaa0e7468fb576a54e54d78f4e1ecc2ea3523 100644 (file)
@@ -37,6 +37,11 @@ namespace Mono.Util.CorCompare {
                                FieldInfo fiMS   = (FieldInfo) mInfoMS;
 
                                AddFakeAttribute (fiMono.IsNotSerialized, fiMS.IsNotSerialized, "System.NonSerializedAttribute");
+                               AddFakeAttribute (fiMono.IsPinvokeImpl, fiMS.IsPinvokeImpl, "System.PInvokeImplAttribute");
+
+                               AddFlagWarning (fiMono.IsStatic, fiMS.IsStatic, "static");
+                               AddFlagWarning (fiMono.IsLiteral, fiMS.IsLiteral, "const");
+                               AddFlagWarning (fiMono.IsInitOnly, fiMS.IsInitOnly, "readonly");
                        }
                        return m_nodeStatus;
                }
index 63964e27ea183b42411f338c1a850e9588945e49..2341c532b036b7e76c51b8937d9cb7aa21572343 100644 (file)
@@ -40,6 +40,15 @@ namespace Mono.Util.CorCompare
                                        (mInfoMono == null) ? null : mInfoMono.GetCustomAttributes (false),
                                        (mInfoMS   == null) ? null :   mInfoMS.GetCustomAttributes (false),
                                        rgAttributes);
+
+                               if (mInfoMono != null && mInfoMS != null)
+                               {
+                                       Accessibility acMono = GetAccessibility (mInfoMono);
+                                       Accessibility acMS = GetAccessibility (mInfoMS);
+                                       if (acMono != acMS)
+                                               Status.AddWarning ("Should be "+AccessibilityToString (acMS));
+                               }
+
                                m_nodeStatus.Add (nsAttributes);
                        }
                        return m_nodeStatus;
@@ -67,5 +76,63 @@ namespace Mono.Util.CorCompare
                        return (mi.MemberType).ToString () + mi.ToString ();
                }
 
+               public static Accessibility GetAccessibility (MemberInfo mi)
+               {
+                       switch (mi.MemberType)
+                       {
+                               case MemberTypes.Constructor:
+                               case MemberTypes.Method:
+                                       MethodBase mb = (MethodBase) mi;
+                                       if (mb.IsPublic)
+                                               return Accessibility.Public;
+                                       else if (mb.IsAssembly)
+                                               return Accessibility.Assembly;
+                                       else if (mb.IsFamilyOrAssembly)
+                                               return Accessibility.FamilyOrAssembly;
+                                       else if (mb.IsFamily)
+                                               return Accessibility.Family;
+                                       else if (mb.IsFamilyAndAssembly)
+                                               return Accessibility.FamilyAndAssembly;
+                                       else if (mb.IsPrivate)
+                                               return Accessibility.Private;
+                                       break;
+                               case MemberTypes.Field:
+                                       FieldInfo fi = (FieldInfo) mi;
+                                       if (fi.IsPublic)
+                                               return Accessibility.Public;
+                                       else if (fi.IsAssembly)
+                                               return Accessibility.Assembly;
+                                       else if (fi.IsFamilyOrAssembly)
+                                               return Accessibility.FamilyOrAssembly;
+                                       else if (fi.IsFamily)
+                                               return Accessibility.Family;
+                                       else if (fi.IsFamilyAndAssembly)
+                                               return Accessibility.FamilyAndAssembly;
+                                       else if (fi.IsPrivate)
+                                               return Accessibility.Private;
+                                       break;
+                               case MemberTypes.NestedType:
+                                       Type ti = (Type) mi;
+                                       if (ti.IsNestedPublic)
+                                               return Accessibility.Public;
+                                       if (ti.IsNestedAssembly)
+                                               return Accessibility.Assembly;
+                                       else if (ti.IsNestedFamORAssem)
+                                               return Accessibility.FamilyOrAssembly;
+                                       else if (ti.IsNestedFamily)
+                                               return Accessibility.Family;
+                                       else if (ti.IsNestedFamANDAssem)
+                                               return Accessibility.FamilyAndAssembly;
+                                       else if (ti.IsNestedPrivate)
+                                               return Accessibility.Private;
+                                       break;
+                               case MemberTypes.Event:
+                               case MemberTypes.Property:
+                                       return Accessibility.Public;
+                               default:
+                                       throw new Exception ("Missing handler for MemberType: "+mi.MemberType.ToString ());
+                       }
+                       throw new Exception ("Invalid accessibility: "+mi.ToString ());
+               }
        }
 }
index 4e4dbcb1ce5f10e71fc4b8c0eaee864ceb485727..306bbb66e8158c588f9a315b9d577463ea7570d3 100644 (file)
@@ -36,5 +36,23 @@ namespace Mono.Util.CorCompare {
                                return "method";
                        }
                }
+
+               public override NodeStatus Analyze ()
+               {
+                       m_nodeStatus = base.Analyze ();
+
+                       if (mInfoMono != null && mInfoMS != null)
+                       {
+                               MethodBase miMono = (MethodBase) mInfoMono;
+                               MethodBase miMS   = (MethodBase) mInfoMS;
+
+                               AddFlagWarning (miMono.IsAbstract, miMS.IsAbstract, "abstract");
+                               AddFlagWarning (miMono.IsStatic, miMS.IsStatic, "static");
+                               AddFlagWarning (miMono.IsVirtual && !miMono.IsFinal, miMS.IsVirtual && !miMS.IsFinal, "virtual");
+                               AddFlagWarning (miMono.IsConstructor, miMS.IsConstructor, "a constructor");
+                               //AddFlagWarning (miMono.IsFinal, miMS.IsFinal, "sealed");
+                       }
+                       return m_nodeStatus;
+               }
        }
 }
index 2c6ebe6a80909bcee266ebf712930e361d0d6cfe..d117d70614623d1e786174512f37afc7bc53bc9f 100644 (file)
@@ -32,37 +32,44 @@ namespace Mono.Util.CorCompare {
                protected MissingMethod mmGet;
                protected MissingMethod mmSet;
 
-               /// <summary>
-               /// a place holder for the method used to get the value of this property
-               /// </summary>
-               public virtual MissingMethod GetMethod
+               public override NodeStatus Analyze ()
                {
-                       get { return mmGet; }
-                       set
+                       m_nodeStatus = base.Analyze ();
+
+                       PropertyInfo piMono = (PropertyInfo) mInfoMono;
+                       PropertyInfo piMS   = (PropertyInfo) mInfoMS;
+
+                       MemberInfo miGetMono, miSetMono;
+                       if (piMono == null)
+                               miGetMono = miSetMono = null;
+                       else
                        {
-                               if (mmGet != null)
-                                       m_nodeStatus.SubChildren (mmGet.Status);
-                               mmGet = value;
-                               if (mmGet != null)
-                                       m_nodeStatus.AddChildren (mmGet.Status);
+                               miGetMono = piMono.GetGetMethod ();
+                               miSetMono = piMono.GetSetMethod ();
                        }
-               }
 
-               /// <summary>
-               /// a place holder for the method used to set the value of this property
-               /// </summary>
-               public virtual MissingMethod SetMethod
-               {
-                       get { return mmSet; }
-                       set
+                       MemberInfo miGetMS, miSetMS;
+                       if (piMS == null)
+                               miGetMS = miSetMS = null;
+                       else
+                       {
+                               miGetMS = piMS.GetGetMethod ();
+                               miSetMS = piMS.GetSetMethod ();
+                       }
+
+                       if (miGetMono != null || miGetMS != null)
                        {
-                               if (mmSet != null)
-                                       m_nodeStatus.SubChildren (mmSet.Status);
-                               mmSet = value;
-                               if (mmSet != null)
-                                       m_nodeStatus.AddChildren (mmSet.Status);
+                               mmGet = new MissingMethod (miGetMono, miGetMS);
+                               m_nodeStatus.AddChildren (mmGet.Analyze ());
                        }
+                       if (miSetMono != null || miSetMS != null)
+                       {
+                               mmSet = new MissingMethod (miSetMono, miSetMS);
+                               m_nodeStatus.AddChildren (mmSet.Analyze ());
+                       }
+                       return m_nodeStatus;
                }
+
                public override XmlElement CreateXML (XmlDocument doc)
                {
                        XmlElement eltMember = base.CreateXML (doc);
index e5fbda82db2146eeb971063936b4c6e8cf8594c0..822d61d25fd0b26d57674e4a30f812f8b58f8abc 100644 (file)
@@ -173,14 +173,8 @@ namespace Mono.Util.CorCompare
                public override XmlElement CreateXML (XmlDocument doc)
                {
                        XmlElement eltClass = base.CreateXML (doc);
-                       //m_nodeStatus.SetAttributes (eltClass);
-
                        XmlElement eltMember;
 
-//                     eltMember = MissingBase.CreateMemberCollectionElement ("attributes", rgAttributes, nsAttributes, doc);
-//                     if (eltMember != null) 
-//                             eltClass.AppendChild (eltMember);
-
                        eltMember = MissingBase.CreateMemberCollectionElement ("methods", rgMethods, nsMethods, doc);
                        if (eltMember != null) 
                                eltClass.AppendChild (eltMember);
@@ -217,21 +211,78 @@ namespace Mono.Util.CorCompare
                        Hashtable htMono = new Hashtable ();
                        if (typeMono != null)
                        {
+                               ArrayList rgIgnoreMono = new ArrayList ();
                                foreach (MemberInfo miMono in typeMono.GetMembers (BindingFlags.Static | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic))
                                {
                                        if (typeMono == miMono.DeclaringType)
                                        {
                                                string strName = MissingMember.GetUniqueName (miMono);
                                                htMono.Add (strName, miMono);
+
+                                               // ignore any property/event accessors
+                                               if (miMono.MemberType == MemberTypes.Property)
+                                               {
+                                                       PropertyInfo pi = (PropertyInfo) miMono;
+                                                       MemberInfo miGet = pi.GetGetMethod ();
+                                                       if (miGet != null)
+                                                               rgIgnoreMono.Add (miGet);
+                                                       MemberInfo miSet = pi.GetSetMethod ();
+                                                       if (miSet != null)
+                                                               rgIgnoreMono.Add (miSet);
+                                               }
+                                               else if (miMono.MemberType == MemberTypes.Event)
+                                               {
+                                                       EventInfo ei = (EventInfo) miMono;
+                                                       MemberInfo miAdd = ei.GetAddMethod ();
+                                                       if (miAdd != null)
+                                                               rgIgnoreMono.Add (miAdd);
+                                                       MemberInfo miRemove = ei.GetRemoveMethod ();
+                                                       if (miRemove != null)
+                                                               rgIgnoreMono.Add (miRemove);
+                                                       MemberInfo miRaise = ei.GetRaiseMethod ();
+                                                       if (miRaise != null)
+                                                               rgIgnoreMono.Add (miRaise);
+                                               }
                                        }
                                }
+                               foreach (MemberInfo miIgnore in rgIgnoreMono)
+                                       htMono.Remove (MissingMember.GetUniqueName (miIgnore));
                        }
                        Hashtable htMethodsMS = new Hashtable ();
                        if (typeMS != null)
                        {
-                               foreach (MemberInfo miMS in typeMS.GetMembers (BindingFlags.Static | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic))
+                               ICollection colMembersMS = typeMS.GetMembers (BindingFlags.Static | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
+                               Hashtable htIgnoreMS = new Hashtable ();
+                               foreach (MemberInfo miMS in colMembersMS)
+                               {
+                                       // ignore any property/event accessors
+                                       if (miMS.MemberType == MemberTypes.Property)
+                                       {
+                                               PropertyInfo pi = (PropertyInfo) miMS;
+                                               MemberInfo miGet = pi.GetGetMethod ();
+                                               if (miGet != null)
+                                                       htIgnoreMS.Add (miGet, miMS);
+                                               MemberInfo miSet = pi.GetSetMethod ();
+                                               if (miSet != null)
+                                                       htIgnoreMS.Add (miSet, miMS);
+                                       }
+                                       else if (miMS.MemberType == MemberTypes.Event)
+                                       {
+                                               EventInfo ei = (EventInfo) miMS;
+                                               MemberInfo miAdd = ei.GetAddMethod ();
+                                               if (miAdd != null)
+                                                       htIgnoreMS.Add (miAdd, miMS);
+                                               MemberInfo miRemove = ei.GetRemoveMethod ();
+                                               if (miRemove != null)
+                                                       htIgnoreMS.Add (miRemove, miMS);
+                                               MemberInfo miRaise = ei.GetRaiseMethod ();
+                                               if (miRaise != null)
+                                                       htIgnoreMS.Add (miRaise, miMS);
+                                       }
+                               }
+                               foreach (MemberInfo miMS in colMembersMS)
                                {
-                                       if (miMS != null && miMS.DeclaringType == typeMS)
+                                       if (miMS != null && miMS.DeclaringType == typeMS && !htIgnoreMS.Contains (miMS))
                                        {
                                                string strNameUnique = MissingMember.GetUniqueName (miMS);
                                                MemberInfo miMono = (MemberInfo) htMono [strNameUnique];
@@ -248,6 +299,7 @@ namespace Mono.Util.CorCompare
                                                {
                                                        bool fVisibleMono = IsVisible (miMono);
 
+                                       /*
                                                        if (fVisibleMS != fVisibleMono)
                                                        {
                                                                if (fVisibleMS)
@@ -255,6 +307,7 @@ namespace Mono.Util.CorCompare
                                                                else
                                                                        mm.Status.AddWarning ("Should be hidden");
                                                        }
+                                       */
 
                                                        if (miMono.MemberType != miMS.MemberType)
                                                        {
@@ -317,86 +370,6 @@ namespace Mono.Util.CorCompare
                                }
                        }
 
-                       // sort out the properties
-                       foreach (MissingProperty property in rgProperties)
-                       {
-                               MemberInfo infoBest = property.BestInfo;
-                               if (infoBest is PropertyInfo)
-                               {
-                                       PropertyInfo pi = (PropertyInfo) property.BestInfo;
-                                       MethodInfo miGet = pi.GetGetMethod (true);
-                                       MethodInfo miSet = pi.GetSetMethod (true);
-
-                                       if (miGet == null)
-                                               miGet = ((PropertyInfo) property.Info).GetGetMethod (true);
-
-                                       if (miSet == null)
-                                               miSet = ((PropertyInfo) property.Info).GetSetMethod (true);
-
-                                       MissingMethod mmGet = FindMethod (miGet);
-                                       MissingMethod mmSet = FindMethod (miSet);
-                                       
-                                       if (mmGet != null)
-                                       {
-                                               nsMethods.SubChildren (mmGet.Status);
-                                               rgMethods.Remove (mmGet);
-                                               property.GetMethod = mmGet;
-                                       }
-                                       if (mmSet != null)
-                                       {
-                                               nsMethods.SubChildren (mmSet.Status);
-                                               rgMethods.Remove (mmSet);
-                                               property.SetMethod = mmSet;
-                                       }
-                               }
-                               else
-                               {
-                                       // TODO: handle the mistmatch case.
-                                       Console.WriteLine ("FIXME: unhandled property mismatch.");
-                               }
-                       }
-
-                       // sort out the events
-                       foreach (MissingEvent evt in rgEvents)
-                       {
-                               MemberInfo infoBest = evt.BestInfo;
-                               if (infoBest is EventInfo)
-                               {
-                                       EventInfo ei = (EventInfo) evt.BestInfo;
-                                       MethodInfo miGet = ei.GetAddMethod ();
-                                       MethodInfo miSet = ei.GetRemoveMethod ();
-                                       MethodInfo miRaise = ei.GetRaiseMethod ();
-
-                                       MissingMethod mmGet = FindMethod (miGet);
-                                       MissingMethod mmSet = FindMethod (miSet);
-                                       MissingMethod mmRaise = FindMethod (miRaise);
-                                       
-                                       if (mmGet != null)
-                                       {
-                                               nsMethods.SubChildren (mmGet.Status);
-                                               rgMethods.Remove (mmGet);
-                                               evt.GetMethod = mmGet;
-                                       }
-                                       if (mmSet != null)
-                                       {
-                                               nsMethods.SubChildren (mmSet.Status);
-                                               rgMethods.Remove (mmSet);
-                                               evt.SetMethod = mmSet;
-                                       }
-                                       if (mmRaise != null)
-                                       {
-                                               nsMethods.SubChildren (mmRaise.Status);
-                                               rgMethods.Remove (mmRaise);
-                                               evt.RaiseMethod = mmRaise;
-                                       }
-                               }
-                               else
-                               {
-                                       // TODO: handle the mistmatch case.
-                                       Console.WriteLine ("FIXME: unhandled event mismatch.");
-                               }
-                       }
-
                        // compare the attributes
                        rgAttributes = new ArrayList ();
                        nsAttributes = MissingAttribute.AnalyzeAttributes (
@@ -453,6 +426,17 @@ namespace Mono.Util.CorCompare
 
                                // serializable attribute
                                AddFakeAttribute (typeMono.IsSerializable, typeMS.IsSerializable, "System.SerializableAttribute");
+                               AddFakeAttribute (typeMono.IsAutoLayout, typeMS.IsAutoLayout, "System.AutoLayoutAttribute");
+                               AddFakeAttribute (typeMono.IsExplicitLayout, typeMS.IsExplicitLayout, "System.ExplicitLayoutAttribute");
+                               AddFakeAttribute (typeMono.IsLayoutSequential, typeMS.IsLayoutSequential, "System.SequentialLayoutAttribute");
+
+                               Accessibility accessibilityMono = GetAccessibility (typeMono);
+                               Accessibility accessibilityMS   = GetAccessibility (typeMS);
+                               if (accessibilityMono != accessibilityMS)
+                                       m_nodeStatus.AddWarning ("Should be "+AccessibilityToString (accessibilityMono));
+
+                               AddFlagWarning (typeMono.IsSealed, typeMS.IsSealed, "sealed");
+                               AddFlagWarning (typeMono.IsAbstract, typeMS.IsAbstract, "abstract");
                        }
 
                        // sum up the sub-sections
@@ -484,6 +468,7 @@ namespace Mono.Util.CorCompare
 
                static bool IsVisible (MemberInfo mi)
                {
+                       // this is just embarrasing, couldn't they have virtualized this?
                        switch (mi.MemberType)
                        {
                                case MemberTypes.Constructor:
@@ -493,12 +478,36 @@ namespace Mono.Util.CorCompare
                                        return !((FieldInfo) mi).IsPrivate && !((FieldInfo) mi).IsFamilyAndAssembly && !((FieldInfo) mi).IsAssembly;
                                case MemberTypes.NestedType:
                                        return !((Type) mi).IsNestedPrivate;
-                               case MemberTypes.Event:
-                               case MemberTypes.Property:
-                                       return true;
+                               case MemberTypes.Property:      // great, now we have to look at the methods
+                                       PropertyInfo pi = (PropertyInfo) mi;
+                                       MethodInfo miAccessor = pi.GetGetMethod ();
+                                       if (miAccessor == null)
+                                               miAccessor = pi.GetSetMethod ();
+                                       if (miAccessor == null)
+                                               return false;
+                                       return IsVisible (miAccessor);
+                               case MemberTypes.Event: // ditto
+                                       EventInfo ei = (EventInfo) mi;
+                                       MethodInfo eiAccessor = ei.GetAddMethod ();
+                                       if (eiAccessor == null)
+                                               eiAccessor = ei.GetRemoveMethod ();
+                                       if (eiAccessor == null)
+                                               eiAccessor = ei.GetRaiseMethod ();
+                                       if (eiAccessor == null)
+                                               return false;
+                                       return IsVisible (eiAccessor);
                                default:
                                        throw new Exception ("Missing handler for MemberType: "+mi.MemberType.ToString ());
                        }
                }
+
+               static Accessibility GetAccessibility (Type type)
+               {
+                       if (type.IsPublic)
+                               return Accessibility.Public;
+                       else if (type.IsNotPublic)
+                               return Accessibility.Private;
+                       return MissingMember.GetAccessibility (type);
+               }
        }
 }
index 8283a7761e69b7e1443af5cb1621d9622013ffb2..d95c0a427835641ad9af5373daa65d1913f00d41 100644 (file)
@@ -27,6 +27,8 @@ namespace Mono.Util.CorCompare {
                ArrayList MissingTypes = new ArrayList();
                ArrayList rgNamespaces = new ArrayList();
                string strName;
+               Assembly assMono;
+               Assembly assMS;
                Type [] rgTypesMono;
                Type [] rgTypesMS;
 
@@ -47,20 +49,20 @@ namespace Mono.Util.CorCompare {
                public static ToDoAssembly Load (string strFileMono, string strName, string strNameMS)
                {
                        Assembly assemblyMono = Assembly.LoadFrom (strFileMono);
-                       Type [] rgTypesMono = assemblyMono.GetTypes ();
-
                        Assembly assemblyMS = Assembly.LoadWithPartialName (strNameMS);
-                       Type [] rgTypesMS = assemblyMS.GetTypes ();
 
-                       return new ToDoAssembly (strName, rgTypesMono, rgTypesMS);
+                       return new ToDoAssembly (strName, assemblyMono, assemblyMS);
                }
 
-               public ToDoAssembly (string _strName, Type [] _rgTypesMono, Type [] _rgTypesMS)
+               public ToDoAssembly (string _strName, Assembly _assMono, Assembly _assMS)
                {
                        strName = _strName;
-                       rgTypesMono = _rgTypesMono;
-                       rgTypesMS = _rgTypesMS;
-                       m_nodeStatus = new NodeStatus (_rgTypesMono, _rgTypesMS);
+                       assMono = _assMono;
+                       assMS = _assMS;
+
+                       rgTypesMono = assMono.GetTypes ();
+                       rgTypesMS = assMS.GetTypes ();
+                       m_nodeStatus = new NodeStatus (_assMono, _assMS);
                }
 
                public override string Name {
@@ -132,6 +134,13 @@ namespace Mono.Util.CorCompare {
                                }
                        }
 
+                       rgAttributes = new ArrayList ();
+                       NodeStatus nsAttributes = MissingAttribute.AnalyzeAttributes (
+                               assMono.GetCustomAttributes (true),
+                               assMS.GetCustomAttributes (true),
+                               rgAttributes);
+                       m_nodeStatus.Add (nsAttributes);
+
                        return m_nodeStatus;
                }
 
@@ -155,7 +164,6 @@ namespace Mono.Util.CorCompare {
                public override XmlElement CreateXML (XmlDocument doc)
                {
                        XmlElement assemblyElem = base.CreateXML (doc);
-//                     m_nodeStatus.SetAttributes (assemblyElem);
 
                        if (rgNamespaces.Count > 0)
                        {