You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Daniel Pitts <da...@coloraura.com> on 2011/09/20 18:18:23 UTC

[OGNL] OGNL-21 Potentially removing methods from OgnlRuntime class.

Hello everyone,
For https://issues.apache.org/jira/browse/OGNL-21, I'm proposing that the
following methods get removed from the OgnlRuntime class.

I've done a quick search in google codesearch (
http://www.google.com/codesearch) and didn't come across anything that used
these (with two exceptions I'll discuss below.)

-    public static final Class<?>[] NoArgumentTypes = new Class<?>[] {};
-    public static String getNumericCast( Class<? extends Number> type )
-    public static String getBaseName( Object o )
-    public static String getClassBaseName( Class<?> c )
-    public static String getClassName( Object o, boolean fullyQualified )
-    public static String getClassName( Class<?> c, boolean fullyQualified )
-    public static String getPackageName( Object o )
-    public static String getClassPackageName( Class<?> c )
-    public static String getPointerString( int num )
-    public static String getPointerString( Object o )
-    public static String getUniqueDescriptor( Object object, boolean
fullyQualified )
-    public static String getUniqueDescriptor( Object object )
-    public static <T> Object[] toArray( List<T> list )
-    public static String getModifierString( int modifiers )
-    public static Object callMethod( OgnlContext context, Object target,
String methodName, String propertyName, Object[] args )
-    public static final Object getMethodValue( OgnlContext context, Object
target, String propertyName )
-    public static boolean setMethodValue( OgnlContext context, Object
target, String propertyName, Object value )
-    public static Object getFieldValue( OgnlContext context, Object target,
String propertyName )
-    public static boolean isFieldAccessible( OgnlContext context, Object
target, Class<?> inClass, String propertyName )
-    public static PropertyDescriptor[] getPropertyDescriptorsArray(
Class<?> targetClass )
-    public static PropertyDescriptor getPropertyDescriptorFromArray(
Class<?> targetClass, String name )


The exceptions that I found are:

callMethod is used in a few places, but it is deprecated and easily replaced
with callMethod(context, target, methodName == null ? propertyName :
methodName)
getPropertyDescriptorsArray is used in some obscure project where the
JavaDocs appear to be Chinese characters.  Also, getPropertyDescriptorsArray
is broken and can cause class-cast exceptions elsewhere (it stores the wrong
object type into a shared cache).

Simone Tripodi wanted me to take this to the community for discussion, so
please feel free to let us know "Hey, we're using that!" :-)