Author: simonetripodi
Date: Wed May 18 09:16:10 2011
New Revision: 1124120

URL: http://svn.apache.org/viewvc?rev=1124120&view=rev
Log:
fixed generics warning

Modified:
    
incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/enhance/ExpressionCompiler.java
    
incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/enhance/OgnlExpressionCompiler.java

Modified: 
incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/enhance/ExpressionCompiler.java
URL: 
http://svn.apache.org/viewvc/incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/enhance/ExpressionCompiler.java?rev=1124120&r1=1124119&r2=1124120&view=diff
==============================================================================
--- 
incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/enhance/ExpressionCompiler.java
 (original)
+++ 
incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/enhance/ExpressionCompiler.java
 Wed May 18 09:16:10 2011
@@ -51,6 +51,7 @@ import org.apache.commons.ognl.ASTStatic
 import org.apache.commons.ognl.ASTStaticMethod;
 import org.apache.commons.ognl.ASTThisVarRef;
 import org.apache.commons.ognl.ASTVarRef;
+import org.apache.commons.ognl.ClassResolver;
 import org.apache.commons.ognl.ExpressionNode;
 import org.apache.commons.ognl.Node;
 import org.apache.commons.ognl.OgnlContext;
@@ -72,7 +73,7 @@ public class ExpressionCompiler
     /**
      * {@link ClassLoader} instances.
      */
-    protected Map _loaders = new HashMap();
+    protected Map<ClassResolver, EnhancedClassLoader> _loaders = new 
HashMap<ClassResolver, EnhancedClassLoader>();
 
     /**
      * Javassist class definition poool.
@@ -123,7 +124,7 @@ public class ExpressionCompiler
      * @param type The class to cast a string expression for.
      * @return The converted raw string version of the class name.
      */
-    public static String getCastString( Class type )
+    public static String getCastString( Class<?> type )
     {
         if ( type == null )
         {
@@ -161,7 +162,7 @@ public class ExpressionCompiler
             || ( root != null && ASTRootVarRef.class.isInstance( expression ) 
) )
         {
 
-            Class castClass = 
OgnlRuntime.getCompiler().getRootExpressionClass( expression, context );
+            Class<?> castClass = 
OgnlRuntime.getCompiler().getRootExpressionClass( expression, context );
 
             if ( castClass.isArray() || ASTRootVarRef.class.isInstance( 
expression )
                 || ASTThisVarRef.class.isInstance( expression ) )
@@ -206,6 +207,9 @@ public class ExpressionCompiler
         return !ASTConst.class.isInstance( expression );
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public String castExpression( OgnlContext context, Node expression, String 
body )
     {
         // ok - so this looks really f-ed up ...and it is ..eh if you can do 
it better I'm all for it :)
@@ -241,7 +245,10 @@ public class ExpressionCompiler
         return ")" + body;
     }
 
-    public String getClassName( Class clazz )
+    /**
+     * {@inheritDoc}
+     */
+    public String getClassName( Class<?> clazz )
     {
         if ( clazz.getName().equals( "java.util.AbstractList$Itr" ) )
         {
@@ -253,7 +260,7 @@ public class ExpressionCompiler
             return clazz.getName();
         }
 
-        Class[] intf = clazz.getInterfaces();
+        Class<?>[] intf = clazz.getInterfaces();
 
         for ( int i = 0; i < intf.length; i++ )
         {
@@ -275,12 +282,15 @@ public class ExpressionCompiler
         return clazz.getName();
     }
 
-    public Class getSuperOrInterfaceClass( Method m, Class clazz )
+    /**
+     * {@inheritDoc}
+     */
+    public Class<?> getSuperOrInterfaceClass( Method m, Class<?> clazz )
     {
         if ( clazz.getInterfaces() != null && clazz.getInterfaces().length > 0 
)
         {
-            Class[] intfs = clazz.getInterfaces();
-            Class intClass;
+            Class<?>[] intfs = clazz.getInterfaces();
+            Class<?> intClass;
 
             for ( int i = 0; i < intfs.length; i++ )
             {
@@ -300,7 +310,7 @@ public class ExpressionCompiler
 
         if ( clazz.getSuperclass() != null )
         {
-            Class superClass = getSuperOrInterfaceClass( m, 
clazz.getSuperclass() );
+            Class<?> superClass = getSuperOrInterfaceClass( m, 
clazz.getSuperclass() );
 
             if ( superClass != null )
             {
@@ -324,7 +334,7 @@ public class ExpressionCompiler
      * @param clazz The class to check for the existance of a matching method 
definition to the method passed in.
      * @return True if the class contains the specified method, false 
otherwise.
      */
-    public boolean containsMethod( Method m, Class clazz )
+    public boolean containsMethod( Method m, Class<?> clazz )
     {
         Method[] methods = clazz.getMethods();
 
@@ -337,13 +347,13 @@ public class ExpressionCompiler
         {
             if ( methods[i].getName().equals( m.getName() ) && 
methods[i].getReturnType() == m.getReturnType() )
             {
-                Class[] parms = m.getParameterTypes();
+                Class<?>[] parms = m.getParameterTypes();
                 if ( parms == null )
                 {
                     continue;
                 }
 
-                Class[] mparms = methods[i].getParameterTypes();
+                Class<?>[] mparms = methods[i].getParameterTypes();
                 if ( mparms == null || mparms.length != parms.length )
                 {
                     continue;
@@ -364,13 +374,13 @@ public class ExpressionCompiler
                     continue;
                 }
 
-                Class[] exceptions = m.getExceptionTypes();
+                Class<?>[] exceptions = m.getExceptionTypes();
                 if ( exceptions == null )
                 {
                     continue;
                 }
 
-                Class[] mexceptions = methods[i].getExceptionTypes();
+                Class<?>[] mexceptions = methods[i].getExceptionTypes();
                 if ( mexceptions == null || mexceptions.length != 
exceptions.length )
                 {
                     continue;
@@ -398,7 +408,10 @@ public class ExpressionCompiler
         return false;
     }
 
-    public Class getInterfaceClass( Class clazz )
+    /**
+     * {@inheritDoc}
+     */
+    public Class<?> getInterfaceClass( Class<?> clazz )
     {
         if ( clazz.getName().equals( "java.util.AbstractList$Itr" ) )
         {
@@ -410,7 +423,7 @@ public class ExpressionCompiler
             return clazz;
         }
 
-        Class[] intf = clazz.getInterfaces();
+        Class<?>[] intf = clazz.getInterfaces();
 
         for ( int i = 0; i < intf.length; i++ )
         {
@@ -444,14 +457,17 @@ public class ExpressionCompiler
         return clazz;
     }
 
-    public Class getRootExpressionClass( Node rootNode, OgnlContext context )
+    /**
+     * {@inheritDoc}
+     */
+    public Class<?> getRootExpressionClass( Node rootNode, OgnlContext context 
)
     {
         if ( context.getRoot() == null )
         {
             return null;
         }
 
-        Class ret = context.getRoot().getClass();
+        Class<?> ret = context.getRoot().getClass();
 
         if ( context.getFirstAccessor() != null && 
context.getFirstAccessor().isInstance( context.getRoot() ) )
         {
@@ -461,9 +477,8 @@ public class ExpressionCompiler
         return ret;
     }
 
-    /*
-     * (non-Javadoc)
-     * @see 
ognl.enhance.OgnlExpressionCompiler#compileExpression(ognl.OgnlContext, 
ognl.Node, java.lang.Object)
+    /**
+     * {@inheritDoc}
      */
     public void compileExpression( OgnlContext context, Node expression, 
Object root )
         throws Exception
@@ -548,7 +563,7 @@ public class ExpressionCompiler
         {
             newClass.addConstructor( CtNewConstructor.defaultConstructor( 
newClass ) );
 
-            Class clazz = pool.toClass( newClass );
+            Class<?> clazz = pool.toClass( newClass );
             newClass.detach();
 
             expression.setAccessor( (ExpressionAccessor) clazz.newInstance() );
@@ -643,7 +658,10 @@ public class ExpressionCompiler
         return body;
     }
 
-    public String createLocalReference( OgnlContext context, String 
expression, Class type )
+    /**
+     * {@inheritDoc}
+     */
+    public String createLocalReference( OgnlContext context, String 
expression, Class<?> type )
     {
         String referenceName = "ref" + 
context.incrementLocalReferenceCounter();
         context.addLocalReference( referenceName, new LocalReferenceImpl( 
referenceName, expression, type ) );
@@ -792,7 +810,7 @@ public class ExpressionCompiler
      */
     protected EnhancedClassLoader getClassLoader( OgnlContext context )
     {
-        EnhancedClassLoader ret = (EnhancedClassLoader) _loaders.get( 
context.getClassResolver() );
+        EnhancedClassLoader ret = _loaders.get( context.getClassResolver() );
 
         if ( ret != null )
         {
@@ -814,7 +832,7 @@ public class ExpressionCompiler
      * @return The javassist class equivalent.
      * @throws NotFoundException When the class definition can't be found.
      */
-    protected CtClass getCtClass( Class searchClass )
+    protected CtClass getCtClass( Class<?> searchClass )
         throws NotFoundException
     {
         return _pool.get( searchClass.getName() );

Modified: 
incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/enhance/OgnlExpressionCompiler.java
URL: 
http://svn.apache.org/viewvc/incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/enhance/OgnlExpressionCompiler.java?rev=1124120&r1=1124119&r2=1124120&view=diff
==============================================================================
--- 
incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/enhance/OgnlExpressionCompiler.java
 (original)
+++ 
incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/enhance/OgnlExpressionCompiler.java
 Wed May 18 09:16:10 2011
@@ -56,7 +56,7 @@ public interface OgnlExpressionCompiler
      * @param clazz The class to get a string equivalent javassist compatible 
string reference for.
      * @return The string equivalent of the class.
      */
-    String getClassName( Class clazz );
+    String getClassName( Class<?> clazz );
 
     /**
      * Used in places where the preferred {@link 
#getSuperOrInterfaceClass(java.lang.reflect.Method, Class)} isn't
@@ -67,7 +67,7 @@ public interface OgnlExpressionCompiler
      * @param clazz The class to attempt to find a compatible interface for.
      * @return The same class if no higher level interface could be matched 
against or the interface equivalent class.
      */
-    Class getInterfaceClass( Class clazz );
+    Class<?> getInterfaceClass( Class<?> clazz );
 
     /**
      * For the given {@link Method} and class finds the highest level 
interface class this combination can be cast to.
@@ -76,7 +76,7 @@ public interface OgnlExpressionCompiler
      * @param clazz The current class being worked with.
      * @return The highest level interface / class that the referenced {@link 
Method} is declared in.
      */
-    Class getSuperOrInterfaceClass( Method m, Class clazz );
+    Class<?> getSuperOrInterfaceClass( Method m, Class<?> clazz );
 
     /**
      * For a given root object type returns the base class type to be used in 
root referenced expressions. This helps in
@@ -87,7 +87,7 @@ public interface OgnlExpressionCompiler
      * @param context The current execution context.
      * @return The root expression class type to cast to for this node.
      */
-    Class getRootExpressionClass( Node rootNode, OgnlContext context );
+    Class<?> getRootExpressionClass( Node rootNode, OgnlContext context );
 
     /**
      * Used primarily by AST types like {@link 
org.apache.commons.ognl.ASTChain} where <code>foo.bar.id</code> type
@@ -121,5 +121,5 @@ public interface OgnlExpressionCompiler
      * @return The method name that will be used to reference the sub 
expression in place of the actual sub expression
      *         itself.
      */
-    String createLocalReference( OgnlContext context, String expression, Class 
type );
+    String createLocalReference( OgnlContext context, String expression, 
Class<?> type );
 }


Reply via email to