You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by he...@apache.org on 2011/05/21 13:49:45 UTC
svn commit: r1125670 - in
/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/internal/introspection:
ClassMap.java IntrospectorBase.java MethodKey.java MethodMap.java
Author: henrib
Date: Sat May 21 11:49:45 2011
New Revision: 1125670
URL: http://svn.apache.org/viewvc?rev=1125670&view=rev
Log:
Removed @author;
Misc formatting
Modified:
commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/internal/introspection/ClassMap.java
commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/internal/introspection/IntrospectorBase.java
commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/internal/introspection/MethodKey.java
commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/internal/introspection/MethodMap.java
Modified: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/internal/introspection/ClassMap.java
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/internal/introspection/ClassMap.java?rev=1125670&r1=1125669&r2=1125670&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/internal/introspection/ClassMap.java (original)
+++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/internal/introspection/ClassMap.java Sat May 21 11:49:45 2011
@@ -33,13 +33,6 @@ import org.apache.commons.logging.Log;
* Originally taken from the Velocity tree so we can be self-sufficient.
* </p>
* @see MethodKey
- *
- * @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
- * @author <a href="mailto:bob@werken.com">Bob McWhirter</a>
- * @author <a href="mailto:szegedia@freemail.hu">Attila Szegedi</a>
- * @author <a href="mailto:geirm@optonline.net">Geir Magnusson Jr.</a>
- * @author <a href="mailto:henning@apache.org">Henning P. Schmiedehausen</a>
- * @version $Id$
* @since 1.0
*/
final class ClassMap {
@@ -195,9 +188,6 @@ final class ClassMap {
/**
* This is the cache to store and look up the method information.
- *
- * @author <a href="mailto:henning@apache.org">Henning P. Schmiedehausen</a>
- * @version $Id$
* <p>
* It stores the association between:
* - a key made of a method name & an array of argument types.
@@ -208,7 +198,6 @@ final class ClassMap {
* foo(int,int) & foo(Integer,Integer) since in practise, only the latter form will be used through a call.
* This of course, applies to all 8 primitive types.
* </p>
- * @version $Id$
*/
static final class MethodCache {
/**
Modified: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/internal/introspection/IntrospectorBase.java
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/internal/introspection/IntrospectorBase.java?rev=1125670&r1=1125669&r2=1125670&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/internal/introspection/IntrospectorBase.java (original)
+++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/internal/introspection/IntrospectorBase.java Sat May 21 11:49:45 2011
@@ -20,6 +20,7 @@ package org.apache.commons.jexl2.interna
import java.lang.reflect.Method;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
+import java.util.Arrays;
import java.util.Map;
import java.util.HashMap;
import java.util.Iterator;
@@ -46,14 +47,7 @@ import org.apache.commons.logging.Log;
*
* "method" + "java.lang.String" + "java.lang.StringBuffer"
*
- * This mapping is performed for all the methods in a class and stored for
- *
- * @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
- * @author <a href="mailto:bob@werken.com">Bob McWhirter</a>
- * @author <a href="mailto:szegedia@freemail.hu">Attila Szegedi</a>
- * @author <a href="mailto:paulo.gaspar@krankikom.de">Paulo Gaspar</a>
- * @author <a href="mailto:henning@apache.org">Henning P. Schmiedehausen</a>
- * @version $Id$
+ * This mapping is performed for all the methods in a class and stored.
* @since 1.0
*/
public class IntrospectorBase {
@@ -259,10 +253,7 @@ public class IntrospectorBase {
// add it to list of known loaded classes
constructibleClasses.put(cname, clazz);
}
- List<Constructor<?>> l = new LinkedList<Constructor<?>>();
- for(Constructor<?> ictor : clazz.getConstructors()) {
- l.add(ictor);
- }
+ List<Constructor<?>> l = new LinkedList<Constructor<?>>(Arrays.asList(clazz.getConstructors()));
// try to find one
ctor = key.getMostSpecificConstructor(l);
if (ctor != null) {
Modified: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/internal/introspection/MethodKey.java
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/internal/introspection/MethodKey.java?rev=1125670&r1=1125669&r2=1125670&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/internal/introspection/MethodKey.java (original)
+++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/internal/introspection/MethodKey.java Sat May 21 11:49:45 2011
@@ -40,14 +40,6 @@ import java.util.Arrays;
* A key can be constructed either from arguments (array of objects) or from parameters
* (array of class).
* Roughly 3x faster than string key to access the map & uses less memory.
- *
- * For the parameters methods:
- * @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
- * @author <a href="mailto:bob@werken.com">Bob McWhirter</a>
- * @author <a href="mailto:Christoph.Reck@dlr.de">Christoph Reck</a>
- * @author <a href="mailto:geirm@optonline.net">Geir Magnusson Jr.</a>
- * @author <a href="mailto:szegedia@freemail.hu">Attila Szegedi</a>
- * @author Nathan Bubna
*/
public final class MethodKey {
/** The hash code. */
@@ -221,8 +213,8 @@ public final class MethodKey {
* the formal type.
*/
public static boolean isInvocationConvertible(Class<?> formal,
- Class<?> actual,
- boolean possibleVarArg) {
+ Class<?> actual,
+ boolean possibleVarArg) {
/* if it's a null, it means the arg was null */
if (actual == null && !formal.isPrimitive()) {
return true;
@@ -233,39 +225,45 @@ public final class MethodKey {
return true;
}
- // CSOFF: NeedBraces
/* Check for boxing with widening primitive conversion. Note that
* actual parameters are never primitives. */
if (formal.isPrimitive()) {
- if (formal == Boolean.TYPE && actual == Boolean.class)
+ if (formal == Boolean.TYPE && actual == Boolean.class) {
return true;
- if (formal == Character.TYPE && actual == Character.class)
+ }
+ if (formal == Character.TYPE && actual == Character.class) {
return true;
- if (formal == Byte.TYPE && actual == Byte.class)
+ }
+ if (formal == Byte.TYPE && actual == Byte.class) {
return true;
+ }
if (formal == Short.TYPE
- && (actual == Short.class || actual == Byte.class))
+ && (actual == Short.class || actual == Byte.class)) {
return true;
+ }
if (formal == Integer.TYPE
- && (actual == Integer.class || actual == Short.class
- || actual == Byte.class))
+ && (actual == Integer.class || actual == Short.class
+ || actual == Byte.class)) {
return true;
+ }
if (formal == Long.TYPE
- && (actual == Long.class || actual == Integer.class
- || actual == Short.class || actual == Byte.class))
+ && (actual == Long.class || actual == Integer.class
+ || actual == Short.class || actual == Byte.class)) {
return true;
+ }
if (formal == Float.TYPE
- && (actual == Float.class || actual == Long.class
+ && (actual == Float.class || actual == Long.class
|| actual == Integer.class || actual == Short.class
- || actual == Byte.class))
+ || actual == Byte.class)) {
return true;
+ }
if (formal == Double.TYPE
- && (actual == Double.class || actual == Float.class
+ && (actual == Double.class || actual == Float.class
|| actual == Long.class || actual == Integer.class
- || actual == Short.class || actual == Byte.class))
+ || actual == Short.class || actual == Byte.class)) {
return true;
+ }
}
- // CSON: NeedBraces
/* Check for vararg conversion. */
if (possibleVarArg && formal.isArray()) {
@@ -295,8 +293,8 @@ public final class MethodKey {
* subject to widening conversion to formal.
*/
public static boolean isStrictInvocationConvertible(Class<?> formal,
- Class<?> actual,
- boolean possibleVarArg) {
+ Class<?> actual,
+ boolean possibleVarArg) {
/* we shouldn't get a null into, but if so */
if (actual == null && !formal.isPrimitive()) {
return true;
@@ -307,29 +305,32 @@ public final class MethodKey {
return true;
}
- // CSOFF: NeedBraces
/* Check for widening primitive conversion. */
if (formal.isPrimitive()) {
- if (formal == Short.TYPE && (actual == Byte.TYPE))
+ if (formal == Short.TYPE && (actual == Byte.TYPE)) {
return true;
+ }
if (formal == Integer.TYPE
- && (actual == Short.TYPE || actual == Byte.TYPE))
+ && (actual == Short.TYPE || actual == Byte.TYPE)) {
return true;
+ }
if (formal == Long.TYPE
&& (actual == Integer.TYPE || actual == Short.TYPE
- || actual == Byte.TYPE))
+ || actual == Byte.TYPE)) {
return true;
+ }
if (formal == Float.TYPE
&& (actual == Long.TYPE || actual == Integer.TYPE
- || actual == Short.TYPE || actual == Byte.TYPE))
+ || actual == Short.TYPE || actual == Byte.TYPE)) {
return true;
+ }
if (formal == Double.TYPE
&& (actual == Float.TYPE || actual == Long.TYPE
- || actual == Integer.TYPE || actual == Short.TYPE
- || actual == Byte.TYPE))
+ || actual == Integer.TYPE || actual == Short.TYPE
+ || actual == Byte.TYPE)) {
return true;
+ }
}
- // CSON: NeedBraces
/* Check for vararg conversion. */
if (possibleVarArg && formal.isArray()) {
Modified: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/internal/introspection/MethodMap.java
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/internal/introspection/MethodMap.java?rev=1125670&r1=1125669&r2=1125670&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/internal/introspection/MethodMap.java (original)
+++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/internal/introspection/MethodMap.java Sat May 21 11:49:45 2011
@@ -24,12 +24,7 @@ import java.util.List;
import java.util.Map;
/**
- * @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
- * @author <a href="mailto:bob@werken.com">Bob McWhirter</a>
- * @author <a href="mailto:Christoph.Reck@dlr.de">Christoph Reck</a>
- * @author <a href="mailto:geirm@optonline.net">Geir Magnusson Jr.</a>
- * @author <a href="mailto:szegedia@freemail.hu">Attila Szegedi</a>
- * @version $Id$
+ * A map of method names to methods.
* @since 1.0
*/
final class MethodMap {