[Adapdev-commits] Adapdev/src/Adapdev.NVelocity/Util/Introspection ClassMap.cs,1.5,1.6 Introspector.
Status: Beta
Brought to you by:
intesar66
From: Sean M. <int...@us...> - 2005-11-26 08:09:33
|
Update of /cvsroot/adapdev/Adapdev/src/Adapdev.NVelocity/Util/Introspection In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18792/src/Adapdev.NVelocity/Util/Introspection Modified Files: ClassMap.cs Introspector.cs MethodMap.cs Log Message: Cleaned up several warnings Restored some lingering files Index: MethodMap.cs =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.NVelocity/Util/Introspection/MethodMap.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** MethodMap.cs 16 Nov 2005 07:01:52 -0000 1.5 --- MethodMap.cs 26 Nov 2005 08:09:23 -0000 1.6 *************** *** 83,87 **** int numMethods = methodList.Count; - int bestDistance = - 2; MethodInfo bestMethod = null; Twonk bestTwonk = null; --- 83,86 ---- *************** *** 182,187 **** Twonk twonk = new Twonk(set.Length); - int distance = 0; - for (int i = 0; i < set.Length; i++) { --- 181,184 ---- Index: ClassMap.cs =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.NVelocity/Util/Introspection/ClassMap.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ClassMap.cs 16 Nov 2005 07:01:52 -0000 1.5 --- ClassMap.cs 26 Nov 2005 08:09:23 -0000 1.6 *************** *** 140,145 **** private void populateMethodCache() { - StringBuilder methodKey; - /* * get all publicly accessible methods --- 140,143 ---- *************** *** 177,182 **** private void populatePropertyCache() { - StringBuilder methodKey; - /* * get all publicly accessible methods --- 175,178 ---- *************** *** 302,350 **** // TODO: the rest of this method is trying to determine what is supposed to be callable - I think .Net just returns what is callable return methods; - - /* - * Short circuit for the (hopefully) majority of cases where the - * clazz is public - */ - - //UPGRADE_TODO: Method java.lang.reflect.Modifier.isPublic was not converted. 'ms-help://MS.VSCC/commoner/redir/redirect.htm?keyword="jlca1095"' - //UPGRADE_ISSUE: Method 'java.lang.Class.getModifiers' was not converted. 'ms-help://MS.VSCC/commoner/redir/redirect.htm?keyword="jlca1000_javalangClassgetModifiers"' - if (clazz.IsPublic) - { - return methods; - } - - /* - * No luck - the class is not public, so we're going the longer way. - */ - - MethodInfo[] methodInfos = new MethodInfo[methods.Length]; - - for (int i = methods.Length; i-- > 0; ) - { - methodInfos[i] = new MethodInfo(methods[i]); - } - - int upcastCount = getAccessibleMethods(clazz, methodInfos, 0); - - /* - * Reallocate array in case some method had no accessible counterpart. - */ - - if (upcastCount < methods.Length) - { - methods = new System.Reflection.MethodInfo[upcastCount]; - } - - int j = 0; - for (int i = 0; i < methodInfos.Length; ++i) - { - MethodInfo methodInfo = methodInfos[i]; - if (methodInfo.upcast) - { - methods[j++] = methodInfo.method; - } - } - return methods; } --- 298,301 ---- *************** *** 355,400 **** //TODO return properties; - - /* - * Short circuit for the (hopefully) majority of cases where the - * clazz is public - */ - if (clazz.IsPublic) - { - return properties; - } - - /* - * No luck - the class is not public, so we're going the longer way. - */ - - properties = new PropertyInfo[0]; - return properties; - - // TODO - // MethodInfo[] methodInfos = new MethodInfo[methods.Length]; - // - // for (int i = methods.Length; i-- > 0; ) { - // methodInfos[i] = new MethodInfo(methods[i]); - // } - // - // int upcastCount = getAccessibleMethods(clazz, methodInfos, 0); - // - // /* - // * Reallocate array in case some method had no accessible counterpart. - // */ - // - // if (upcastCount < methods.Length) { - // methods = new System.Reflection.MethodInfo[upcastCount]; - // } - // - // int j = 0; - // for (int i = 0; i < methodInfos.Length; ++i) { - // MethodInfo methodInfo = methodInfos[i]; - // if (methodInfo.upcast) { - // methods[j++] = methodInfo.method; - // } - // } - // return methods; } --- 306,309 ---- *************** *** 433,437 **** } } ! catch (MethodAccessException e) { /* --- 342,346 ---- } } ! catch (MethodAccessException) { /* *************** *** 515,529 **** return method; - /* - * Short circuit for (hopefully the majority of) cases where the declaring - * class is public. - */ - - if (clazz.IsPublic) - { - return method; - } - - return getPublicMethod(clazz, method.Name, GetMethodParameterTypes(method)); } --- 424,427 ---- *************** *** 534,551 **** // TODO: return property; - - /* - * Short circuit for (hopefully the majority of) cases where the declaring - * class is public. - */ - if (clazz.IsPublic) - { - return property; - } - - - //TODO - return null; - // return getPublicMethod(clazz, method.Name, GetMethodParameterTypes(method)); } --- 432,435 ---- *************** *** 572,576 **** return clazz.GetMethod(name, (Type[]) paramTypes); } ! catch (MethodAccessException e) { /* --- 456,460 ---- return clazz.GetMethod(name, (Type[]) paramTypes); } ! catch (MethodAccessException) { /* Index: Introspector.cs =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.NVelocity/Util/Introspection/Introspector.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Introspector.cs 16 Nov 2005 07:01:52 -0000 1.5 --- Introspector.cs 26 Nov 2005 08:09:23 -0000 1.6 *************** *** 69,76 **** catch (AmbiguousException ae) { - /* - * whoops. Ambiguous. Make a nice log message and return null... - */ - String msg = "Introspection Error : Ambiguous method invocation " + name + "( "; --- 69,72 ---- *************** *** 85,88 **** --- 81,86 ---- msg = msg + ") for class " + c; + Console.WriteLine(ae.Message); + rsvc.error(msg); } *************** *** 115,124 **** catch (AmbiguousException ae) { - /* - * whoops. Ambiguous. Make a nice log message and return null... - */ - String msg = "Introspection Error : Ambiguous property invocation " + name + " "; msg = msg + " for class " + c; rsvc.error(msg); } --- 113,119 ---- catch (AmbiguousException ae) { String msg = "Introspection Error : Ambiguous property invocation " + name + " "; msg = msg + " for class " + c; + Console.WriteLine(ae.Message); rsvc.error(msg); } |