[jboss-cvs] JBossAS SVN: r63894 - in projects/aop/trunk/aop/src: test/org/jboss/test/aop/unit/assignability and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Jul 6 21:07:51 EDT 2007
Author: flavia.rainone at jboss.com
Date: 2007-07-06 21:07:51 -0400 (Fri, 06 Jul 2007)
New Revision: 63894
Added:
projects/aop/trunk/aop/src/main/org/jboss/aop/advice/annotation/assignability/AssignabilityAlgorithm.java
Removed:
projects/aop/trunk/aop/src/main/org/jboss/aop/advice/annotation/assignability/Algorithm.java
Modified:
projects/aop/trunk/aop/src/main/org/jboss/aop/advice/annotation/assignability/VariableNode.java
projects/aop/trunk/aop/src/test/org/jboss/test/aop/unit/assignability/FromVariableAlgorithmTest.java
projects/aop/trunk/aop/src/test/org/jboss/test/aop/unit/assignability/VariableTargetAlgorithmTest.java
Log:
[JBAOP-420] More refactoring.
Deleted: projects/aop/trunk/aop/src/main/org/jboss/aop/advice/annotation/assignability/Algorithm.java
===================================================================
--- projects/aop/trunk/aop/src/main/org/jboss/aop/advice/annotation/assignability/Algorithm.java 2007-07-07 00:34:47 UTC (rev 63893)
+++ projects/aop/trunk/aop/src/main/org/jboss/aop/advice/annotation/assignability/Algorithm.java 2007-07-07 01:07:51 UTC (rev 63894)
@@ -1,367 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.aop.advice.annotation.assignability;
-
-import java.lang.reflect.GenericArrayType;
-import java.lang.reflect.ParameterizedType;
-import java.lang.reflect.Type;
-import java.lang.reflect.TypeVariable;
-import java.lang.reflect.WildcardType;
-
-/**
- *
- * @author <a href="flavia.rainone at jboss.com">Flavia Rainone</a>
- */
-public enum Algorithm
-{
-
- VARIABLE_TARGET()
- {
- protected Algorithm getInverseAlgorithm()
- {
- return FROM_VARIABLE;
- }
-
- protected boolean isVariableOperationApplicable(Type type, Type fromType)
- {
- return type instanceof TypeVariable;
- }
-
- protected boolean assignValue(Type type, Type fromType,
- VariableHierarchy variableHierarchy)
- {
- VariableNode node = variableHierarchy.getVariableNode((TypeVariable) type);
- return node.assignValue(fromType);
- }
-
- protected boolean addBound(Type type, Type fromType,
- VariableHierarchy variableHierarchy)
- {
- VariableNode node = variableHierarchy.getVariableNode((TypeVariable) type);
- return node.addLowerBound(fromType);
- }
- },
- FROM_VARIABLE()
- {
- protected Algorithm getInverseAlgorithm()
- {
- return VARIABLE_TARGET;
- }
-
- protected boolean isVariableOperationApplicable(Type type, Type fromType)
- {
- return fromType instanceof TypeVariable;
- }
-
- protected boolean assignValue(Type type, Type fromType,
- VariableHierarchy variableHierarchy)
- {
- VariableNode fromNode = variableHierarchy.getVariableNode((TypeVariable) fromType);
- return fromNode.addMaximumUpperBound(type);
- }
-
- protected boolean addBound(Type type, Type fromType,
- VariableHierarchy variableHierarchy)
- {
- VariableNode fromNode = variableHierarchy.getVariableNode((TypeVariable) fromType);
- return fromNode.addUpperBound(type);
- }
- };
-
- protected abstract Algorithm getInverseAlgorithm();
- protected abstract boolean isVariableOperationApplicable(Type type, Type fromType);
-
- protected abstract boolean assignValue(Type type, Type fromType,
- VariableHierarchy variableHierarchy);
-
- protected abstract boolean addBound(Type type, Type fromType,
- VariableHierarchy variableHierarchy);
-
- public boolean isAssignable(Type type, Type fromType,
- VariableHierarchy variableHierarchy)
- {
- // special case, check fromType
- if (fromType instanceof WildcardType)
- {
- return isAssignable(type, (WildcardType) fromType, variableHierarchy);
- }
- if (isVariableOperationApplicable(type, fromType))
- {
- return addBound(type, fromType, variableHierarchy);
- }
- if (type instanceof Class)
- {
- return isAssignable((Class<?>) type, fromType, variableHierarchy);
- }
- if (type instanceof ParameterizedType)
- {
- return isAssignable((ParameterizedType) type, fromType, variableHierarchy);
- }
- if (type instanceof WildcardType)
- {
- throw new RuntimeException("This comparison should never happen");
- }
- if (type instanceof TypeVariable)
- {
- return false;
- }
- else
- {
- return isAssignable((GenericArrayType) type, fromType,
- variableHierarchy);
- }
- }
-
- private boolean isAssignable(Type type, WildcardType fromWildcardType,
- VariableHierarchy variableHierarchy)
- {
- boolean boundOk = false;
- for (Type upperBound: fromWildcardType.getUpperBounds())
- {
- if (isAssignable(type, upperBound, variableHierarchy))
- {
- boundOk = true;
- break;
- }
- }
- if (!boundOk)
- {
- return false;
- }
- for (Type lowerBound: fromWildcardType.getLowerBounds())
- {
- if (isAssignable(type, lowerBound, variableHierarchy))
- {
- return true;
- }
- }
- return fromWildcardType.getLowerBounds().length == 0;
- }
-
- // is classType super of fromType?
- private boolean isAssignable(Class<?> classType, Type fromType,
- VariableHierarchy variableHierarchy)
- {
- if (fromType instanceof Class)
- {
- return classType.isAssignableFrom((Class<?>) fromType);
- }
- else if (fromType instanceof ParameterizedType)
- {
- return classType.isAssignableFrom(
- (Class<?>) ((ParameterizedType) fromType).getRawType());
- }
- else if (fromType instanceof TypeVariable)
- {
- Type[] bounds = getConcreteBounds(fromType);
- boolean inside = false;
- for (int i = 0; i < bounds.length && !inside; i++)
- {
- if (bounds[i] instanceof Class)
- {
- if (classType.isAssignableFrom((Class<?>) bounds[i]))
- {
- inside = true;
- }
- }
- else
- {
- // bound must be a parameterized type
- if (classType.isAssignableFrom(
- (Class<?>) ((ParameterizedType) bounds[i]).getRawType()))
- {
- inside = true;
- }
- }
- }
- return inside;
- }
- // type instanceof GenericArrayType (ommitting check for performance
- // reasons)
- if (classType == Object.class)
- {
- return true;
- }
- if (classType.isArray())
- {
- return isAssignable(classType.getComponentType(),
- ((GenericArrayType) fromType).getGenericComponentType(),
- variableHierarchy);
- }
- return false;
- }
-
- /**
- * @param type
- * @return
- */
- public static Type[] getConcreteBounds(Type type)
- {
- TypeVariable current = (TypeVariable) type;
- Type[] bounds = current.getBounds();
- while (bounds.length == 1 && bounds[0] instanceof TypeVariable)
- {
- current = (TypeVariable) bounds[0];
- bounds = current.getBounds();
- }
- return bounds;
- }
-
- private boolean isAssignable(ParameterizedType paramType, Type fromType,
- VariableHierarchy variableHierarchy)
- {
- if (fromType instanceof TypeVariable)
- {
- Type[] concreteBounds = getConcreteBounds((TypeVariable) fromType);
- try
- {
- variableHierarchy.startRealBoundComparation();
- for (int i = 0; i < concreteBounds.length; i++)
- {
- if (isAssignable(paramType, concreteBounds[i], variableHierarchy))
- {
- return true;
- }
- }
- }
- finally
- {
- variableHierarchy.finishRealBoundComparation();
- }
- return false;
- }
- return ParamTypeAssignabilityAlgorithm.isAssignable(
- paramType, fromType, CHECKER, this, variableHierarchy);
- }
-
- private boolean isAssignable(GenericArrayType arrayType, Type fromType,
- VariableHierarchy variableHierarchy)
- {
- if (fromType instanceof Class)
- {
- Class<?> fromClass = (Class<?>) fromType;
- if (!fromClass.isArray())
- {
- return false;
- }
- return isAssignable(arrayType.getGenericComponentType(),
- fromClass.getComponentType(), variableHierarchy);
- }
- if (fromType instanceof GenericArrayType)
- {
- GenericArrayType fromArrayType = (GenericArrayType) fromType;
- return isAssignable(arrayType.getGenericComponentType(),
- fromArrayType.getGenericComponentType(), variableHierarchy);
- }
- return false;
- }
-
- //////////////////////////////////////////////////////////
- private static final ParamTypeAssignabilityAlgorithm.EqualityChecker<Algorithm, VariableHierarchy> CHECKER
- = new ParamTypeAssignabilityAlgorithm.EqualityChecker<Algorithm, VariableHierarchy>()
- {
- public boolean isSame(Type type, Type fromType, Algorithm client, VariableHierarchy variableHierarchy)
- {
- if(client.isVariableOperationApplicable(type, fromType))
- {
- return client.assignValue(type, fromType, variableHierarchy);
- }
- if (type instanceof Class)
- {
- return type.equals(fromType);
- }
- if (type instanceof ParameterizedType)
- {
- if (!(fromType instanceof ParameterizedType))
- {
- return false;
- }
- ParameterizedType fromParamType = (ParameterizedType) fromType;
- ParameterizedType paramType = (ParameterizedType) type;
- if (!isSame(paramType.getRawType(), fromParamType.getRawType(), client,
- variableHierarchy))
- {
- return false;
- }
- return isSame(paramType.getActualTypeArguments(),
- fromParamType.getActualTypeArguments(), client, variableHierarchy);
- }
- if (type instanceof WildcardType)
- {
- Type[] upperBounds = ((WildcardType) type).getUpperBounds();
- Type[] lowerBounds = ((WildcardType) type).getLowerBounds();
- if (fromType instanceof WildcardType)
- {
- Type[] fromUpperBounds = ((WildcardType) fromType).getUpperBounds();
- outer: for (int i = 0; i < upperBounds.length; i++)
- {
- for (int j = 0; j < fromUpperBounds.length; j++)
- {
- if (client.isAssignable(upperBounds[i],
- fromUpperBounds[i], variableHierarchy))
- {
- continue outer;
- }
- }
- return false;
- }
- Type[] fromLowerBounds = ((WildcardType) fromType).getLowerBounds();
- outer: for (int i = 0; i < lowerBounds.length; i++)
- {
- for (int j = 0; j < fromLowerBounds.length; j++)
- {
- if (client.getInverseAlgorithm().isAssignable(
- fromLowerBounds[i],
- lowerBounds[i], variableHierarchy))
- {
- continue outer;
- }
- }
- return false;
- }
- return true;
- }
- else
- {
- for (int i = 0; i < upperBounds.length; i++)
- {
- if (!client.isAssignable(upperBounds[i], fromType,
- variableHierarchy))
- {
- return false;
- }
- }
- for (int i = 0; i < lowerBounds.length; i++)
- {
- if (!client.getInverseAlgorithm().isAssignable(
- fromType, lowerBounds[i], variableHierarchy))
- {
- return false;
- }
- }
- return true;
- }
- }
- return true;
- }
- };
-}
\ No newline at end of file
Copied: projects/aop/trunk/aop/src/main/org/jboss/aop/advice/annotation/assignability/AssignabilityAlgorithm.java (from rev 63893, projects/aop/trunk/aop/src/main/org/jboss/aop/advice/annotation/assignability/Algorithm.java)
===================================================================
--- projects/aop/trunk/aop/src/main/org/jboss/aop/advice/annotation/assignability/AssignabilityAlgorithm.java (rev 0)
+++ projects/aop/trunk/aop/src/main/org/jboss/aop/advice/annotation/assignability/AssignabilityAlgorithm.java 2007-07-07 01:07:51 UTC (rev 63894)
@@ -0,0 +1,367 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.aop.advice.annotation.assignability;
+
+import java.lang.reflect.GenericArrayType;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.lang.reflect.TypeVariable;
+import java.lang.reflect.WildcardType;
+
+/**
+ *
+ * @author <a href="flavia.rainone at jboss.com">Flavia Rainone</a>
+ */
+public enum AssignabilityAlgorithm
+{
+
+ VARIABLE_TARGET()
+ {
+ protected AssignabilityAlgorithm getInverseAlgorithm()
+ {
+ return FROM_VARIABLE;
+ }
+
+ protected boolean isVariableOperationApplicable(Type type, Type fromType)
+ {
+ return type instanceof TypeVariable;
+ }
+
+ protected boolean assignValue(Type type, Type fromType,
+ VariableHierarchy variableHierarchy)
+ {
+ VariableNode node = variableHierarchy.getVariableNode((TypeVariable) type);
+ return node.assignValue(fromType);
+ }
+
+ protected boolean addBound(Type type, Type fromType,
+ VariableHierarchy variableHierarchy)
+ {
+ VariableNode node = variableHierarchy.getVariableNode((TypeVariable) type);
+ return node.addLowerBound(fromType);
+ }
+ },
+ FROM_VARIABLE()
+ {
+ protected AssignabilityAlgorithm getInverseAlgorithm()
+ {
+ return VARIABLE_TARGET;
+ }
+
+ protected boolean isVariableOperationApplicable(Type type, Type fromType)
+ {
+ return fromType instanceof TypeVariable;
+ }
+
+ protected boolean assignValue(Type type, Type fromType,
+ VariableHierarchy variableHierarchy)
+ {
+ VariableNode fromNode = variableHierarchy.getVariableNode((TypeVariable) fromType);
+ return fromNode.addMaximumUpperBound(type);
+ }
+
+ protected boolean addBound(Type type, Type fromType,
+ VariableHierarchy variableHierarchy)
+ {
+ VariableNode fromNode = variableHierarchy.getVariableNode((TypeVariable) fromType);
+ return fromNode.addUpperBound(type);
+ }
+ };
+
+ protected abstract AssignabilityAlgorithm getInverseAlgorithm();
+ protected abstract boolean isVariableOperationApplicable(Type type, Type fromType);
+
+ protected abstract boolean assignValue(Type type, Type fromType,
+ VariableHierarchy variableHierarchy);
+
+ protected abstract boolean addBound(Type type, Type fromType,
+ VariableHierarchy variableHierarchy);
+
+ public boolean isAssignable(Type type, Type fromType,
+ VariableHierarchy variableHierarchy)
+ {
+ // special case, check fromType
+ if (fromType instanceof WildcardType)
+ {
+ return isAssignable(type, (WildcardType) fromType, variableHierarchy);
+ }
+ if (isVariableOperationApplicable(type, fromType))
+ {
+ return addBound(type, fromType, variableHierarchy);
+ }
+ if (type instanceof Class)
+ {
+ return isAssignable((Class<?>) type, fromType, variableHierarchy);
+ }
+ if (type instanceof ParameterizedType)
+ {
+ return isAssignable((ParameterizedType) type, fromType, variableHierarchy);
+ }
+ if (type instanceof WildcardType)
+ {
+ throw new RuntimeException("This comparison should never happen");
+ }
+ if (type instanceof TypeVariable)
+ {
+ return false;
+ }
+ else
+ {
+ return isAssignable((GenericArrayType) type, fromType,
+ variableHierarchy);
+ }
+ }
+
+ private boolean isAssignable(Type type, WildcardType fromWildcardType,
+ VariableHierarchy variableHierarchy)
+ {
+ boolean boundOk = false;
+ for (Type upperBound: fromWildcardType.getUpperBounds())
+ {
+ if (isAssignable(type, upperBound, variableHierarchy))
+ {
+ boundOk = true;
+ break;
+ }
+ }
+ if (!boundOk)
+ {
+ return false;
+ }
+ for (Type lowerBound: fromWildcardType.getLowerBounds())
+ {
+ if (isAssignable(type, lowerBound, variableHierarchy))
+ {
+ return true;
+ }
+ }
+ return fromWildcardType.getLowerBounds().length == 0;
+ }
+
+ // is classType super of fromType?
+ private boolean isAssignable(Class<?> classType, Type fromType,
+ VariableHierarchy variableHierarchy)
+ {
+ if (fromType instanceof Class)
+ {
+ return classType.isAssignableFrom((Class<?>) fromType);
+ }
+ else if (fromType instanceof ParameterizedType)
+ {
+ return classType.isAssignableFrom(
+ (Class<?>) ((ParameterizedType) fromType).getRawType());
+ }
+ else if (fromType instanceof TypeVariable)
+ {
+ Type[] bounds = getConcreteBounds(fromType);
+ boolean inside = false;
+ for (int i = 0; i < bounds.length && !inside; i++)
+ {
+ if (bounds[i] instanceof Class)
+ {
+ if (classType.isAssignableFrom((Class<?>) bounds[i]))
+ {
+ inside = true;
+ }
+ }
+ else
+ {
+ // bound must be a parameterized type
+ if (classType.isAssignableFrom(
+ (Class<?>) ((ParameterizedType) bounds[i]).getRawType()))
+ {
+ inside = true;
+ }
+ }
+ }
+ return inside;
+ }
+ // type instanceof GenericArrayType (ommitting check for performance
+ // reasons)
+ if (classType == Object.class)
+ {
+ return true;
+ }
+ if (classType.isArray())
+ {
+ return isAssignable(classType.getComponentType(),
+ ((GenericArrayType) fromType).getGenericComponentType(),
+ variableHierarchy);
+ }
+ return false;
+ }
+
+ /**
+ * @param type
+ * @return
+ */
+ public static Type[] getConcreteBounds(Type type)
+ {
+ TypeVariable current = (TypeVariable) type;
+ Type[] bounds = current.getBounds();
+ while (bounds.length == 1 && bounds[0] instanceof TypeVariable)
+ {
+ current = (TypeVariable) bounds[0];
+ bounds = current.getBounds();
+ }
+ return bounds;
+ }
+
+ private boolean isAssignable(ParameterizedType paramType, Type fromType,
+ VariableHierarchy variableHierarchy)
+ {
+ if (fromType instanceof TypeVariable)
+ {
+ Type[] concreteBounds = getConcreteBounds((TypeVariable) fromType);
+ try
+ {
+ variableHierarchy.startRealBoundComparation();
+ for (int i = 0; i < concreteBounds.length; i++)
+ {
+ if (isAssignable(paramType, concreteBounds[i], variableHierarchy))
+ {
+ return true;
+ }
+ }
+ }
+ finally
+ {
+ variableHierarchy.finishRealBoundComparation();
+ }
+ return false;
+ }
+ return ParamTypeAssignabilityAlgorithm.isAssignable(
+ paramType, fromType, CHECKER, this, variableHierarchy);
+ }
+
+ private boolean isAssignable(GenericArrayType arrayType, Type fromType,
+ VariableHierarchy variableHierarchy)
+ {
+ if (fromType instanceof Class)
+ {
+ Class<?> fromClass = (Class<?>) fromType;
+ if (!fromClass.isArray())
+ {
+ return false;
+ }
+ return isAssignable(arrayType.getGenericComponentType(),
+ fromClass.getComponentType(), variableHierarchy);
+ }
+ if (fromType instanceof GenericArrayType)
+ {
+ GenericArrayType fromArrayType = (GenericArrayType) fromType;
+ return isAssignable(arrayType.getGenericComponentType(),
+ fromArrayType.getGenericComponentType(), variableHierarchy);
+ }
+ return false;
+ }
+
+ //////////////////////////////////////////////////////////
+ private static final ParamTypeAssignabilityAlgorithm.EqualityChecker<AssignabilityAlgorithm, VariableHierarchy> CHECKER
+ = new ParamTypeAssignabilityAlgorithm.EqualityChecker<AssignabilityAlgorithm, VariableHierarchy>()
+ {
+ public boolean isSame(Type type, Type fromType, AssignabilityAlgorithm client, VariableHierarchy variableHierarchy)
+ {
+ if(client.isVariableOperationApplicable(type, fromType))
+ {
+ return client.assignValue(type, fromType, variableHierarchy);
+ }
+ if (type instanceof Class)
+ {
+ return type.equals(fromType);
+ }
+ if (type instanceof ParameterizedType)
+ {
+ if (!(fromType instanceof ParameterizedType))
+ {
+ return false;
+ }
+ ParameterizedType fromParamType = (ParameterizedType) fromType;
+ ParameterizedType paramType = (ParameterizedType) type;
+ if (!isSame(paramType.getRawType(), fromParamType.getRawType(), client,
+ variableHierarchy))
+ {
+ return false;
+ }
+ return isSame(paramType.getActualTypeArguments(),
+ fromParamType.getActualTypeArguments(), client, variableHierarchy);
+ }
+ if (type instanceof WildcardType)
+ {
+ Type[] upperBounds = ((WildcardType) type).getUpperBounds();
+ Type[] lowerBounds = ((WildcardType) type).getLowerBounds();
+ if (fromType instanceof WildcardType)
+ {
+ Type[] fromUpperBounds = ((WildcardType) fromType).getUpperBounds();
+ outer: for (int i = 0; i < upperBounds.length; i++)
+ {
+ for (int j = 0; j < fromUpperBounds.length; j++)
+ {
+ if (client.isAssignable(upperBounds[i],
+ fromUpperBounds[i], variableHierarchy))
+ {
+ continue outer;
+ }
+ }
+ return false;
+ }
+ Type[] fromLowerBounds = ((WildcardType) fromType).getLowerBounds();
+ outer: for (int i = 0; i < lowerBounds.length; i++)
+ {
+ for (int j = 0; j < fromLowerBounds.length; j++)
+ {
+ if (client.getInverseAlgorithm().isAssignable(
+ fromLowerBounds[i],
+ lowerBounds[i], variableHierarchy))
+ {
+ continue outer;
+ }
+ }
+ return false;
+ }
+ return true;
+ }
+ else
+ {
+ for (int i = 0; i < upperBounds.length; i++)
+ {
+ if (!client.isAssignable(upperBounds[i], fromType,
+ variableHierarchy))
+ {
+ return false;
+ }
+ }
+ for (int i = 0; i < lowerBounds.length; i++)
+ {
+ if (!client.getInverseAlgorithm().isAssignable(
+ fromType, lowerBounds[i], variableHierarchy))
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+ }
+ return true;
+ }
+ };
+}
\ No newline at end of file
Modified: projects/aop/trunk/aop/src/main/org/jboss/aop/advice/annotation/assignability/VariableNode.java
===================================================================
--- projects/aop/trunk/aop/src/main/org/jboss/aop/advice/annotation/assignability/VariableNode.java 2007-07-07 00:34:47 UTC (rev 63893)
+++ projects/aop/trunk/aop/src/main/org/jboss/aop/advice/annotation/assignability/VariableNode.java 2007-07-07 01:07:51 UTC (rev 63894)
@@ -245,7 +245,7 @@
{
for (int i = 0; i < bounds.length; i++)
{
- if (!Algorithm.VARIABLE_TARGET.isAssignable(bounds[i], lowerBound, hierarchy))
+ if (!AssignabilityAlgorithm.VARIABLE_TARGET.isAssignable(bounds[i], lowerBound, hierarchy))
{
return false;
}
@@ -369,7 +369,7 @@
}
return false;
}
- Type[] fromBounds = Algorithm.getConcreteBounds(fromVariable);
+ Type[] fromBounds = AssignabilityAlgorithm.getConcreteBounds(fromVariable);
for (Type fromBound: fromBounds)
{
if (isAssignable(type, fromBound))
Modified: projects/aop/trunk/aop/src/test/org/jboss/test/aop/unit/assignability/FromVariableAlgorithmTest.java
===================================================================
--- projects/aop/trunk/aop/src/test/org/jboss/test/aop/unit/assignability/FromVariableAlgorithmTest.java 2007-07-07 00:34:47 UTC (rev 63893)
+++ projects/aop/trunk/aop/src/test/org/jboss/test/aop/unit/assignability/FromVariableAlgorithmTest.java 2007-07-07 01:07:51 UTC (rev 63894)
@@ -27,7 +27,7 @@
import junit.framework.TestCase;
-import org.jboss.aop.advice.annotation.assignability.Algorithm;
+import org.jboss.aop.advice.annotation.assignability.AssignabilityAlgorithm;
import org.jboss.aop.advice.annotation.assignability.VariableHierarchy;
/**
@@ -36,13 +36,13 @@
*/
public class FromVariableAlgorithmTest extends TestCase
{
- Algorithm algorithm;
+ AssignabilityAlgorithm algorithm;
VariableHierarchy hierarchy;
private static Class[] NO_ARGS = new Class[0];
public void setUp()
{
- this.algorithm = Algorithm.FROM_VARIABLE;
+ this.algorithm = AssignabilityAlgorithm.FROM_VARIABLE;
hierarchy = new VariableHierarchy();
}
@@ -164,7 +164,7 @@
{
Method caller = this.getClass().getDeclaredMethod("caller8", new Class[]{Collection.class});
Method called = this.getClass().getDeclaredMethod("called8", new Class[]{Collection.class});
- assertTrue(Algorithm.VARIABLE_TARGET.isAssignable(called.getGenericParameterTypes()[0],
+ assertTrue(AssignabilityAlgorithm.VARIABLE_TARGET.isAssignable(called.getGenericParameterTypes()[0],
caller.getGenericParameterTypes()[0], hierarchy));
assertTrue(algorithm.isAssignable(caller.getGenericReturnType(),
called.getGenericReturnType(), hierarchy));
@@ -181,7 +181,7 @@
{
Method caller = this.getClass().getDeclaredMethod("caller9", new Class[]{Collection.class});
Method called = this.getClass().getDeclaredMethod("called8", new Class[]{Collection.class});
- assertTrue(Algorithm.VARIABLE_TARGET.isAssignable(called.getGenericParameterTypes()[0],
+ assertTrue(AssignabilityAlgorithm.VARIABLE_TARGET.isAssignable(called.getGenericParameterTypes()[0],
caller.getGenericParameterTypes()[0], hierarchy));
assertTrue(algorithm.isAssignable(caller.getGenericReturnType(),
called.getGenericReturnType(), hierarchy));
@@ -198,7 +198,7 @@
{
Method caller = this.getClass().getDeclaredMethod("caller10", new Class[]{Collection.class});
Method called = this.getClass().getDeclaredMethod("called8", new Class[]{Collection.class});
- assertTrue(Algorithm.VARIABLE_TARGET.isAssignable(called.getGenericParameterTypes()[0],
+ assertTrue(AssignabilityAlgorithm.VARIABLE_TARGET.isAssignable(called.getGenericParameterTypes()[0],
caller.getGenericParameterTypes()[0], hierarchy));
assertTrue(algorithm.isAssignable(caller.getGenericReturnType(),
called.getGenericReturnType(), hierarchy));
@@ -216,7 +216,7 @@
{
Method caller = this.getClass().getDeclaredMethod("caller11", new Class[]{Collection.class});
Method called = this.getClass().getDeclaredMethod("called8", new Class[]{Collection.class});
- assertTrue(Algorithm.VARIABLE_TARGET.isAssignable(called.getGenericParameterTypes()[0],
+ assertTrue(AssignabilityAlgorithm.VARIABLE_TARGET.isAssignable(called.getGenericParameterTypes()[0],
caller.getGenericParameterTypes()[0], hierarchy));
assertFalse(algorithm.isAssignable(caller.getGenericReturnType(),
called.getGenericReturnType(), hierarchy));
Modified: projects/aop/trunk/aop/src/test/org/jboss/test/aop/unit/assignability/VariableTargetAlgorithmTest.java
===================================================================
--- projects/aop/trunk/aop/src/test/org/jboss/test/aop/unit/assignability/VariableTargetAlgorithmTest.java 2007-07-07 00:34:47 UTC (rev 63893)
+++ projects/aop/trunk/aop/src/test/org/jboss/test/aop/unit/assignability/VariableTargetAlgorithmTest.java 2007-07-07 01:07:51 UTC (rev 63894)
@@ -23,7 +23,7 @@
import junit.framework.TestCase;
-import org.jboss.aop.advice.annotation.assignability.Algorithm;
+import org.jboss.aop.advice.annotation.assignability.AssignabilityAlgorithm;
import org.jboss.aop.advice.annotation.assignability.VariableHierarchy;
/**
@@ -34,7 +34,7 @@
public abstract class VariableTargetAlgorithmTest extends TestCase
{
- protected Algorithm algorithm;
+ protected AssignabilityAlgorithm algorithm;
protected VariableHierarchy hierarchy;
/**
@@ -47,7 +47,7 @@
public void setUp()
{
- algorithm = Algorithm.VARIABLE_TARGET;
+ algorithm = AssignabilityAlgorithm.VARIABLE_TARGET;
hierarchy = new VariableHierarchy();
}
}
\ No newline at end of file
More information about the jboss-cvs-commits
mailing list