import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.List;
import java.util.Set;
ResolvedType ty1 = primitives[j];
if (ty.equals(ty1)) {
isCoerceableFromTest(ty, ty1, true);
- } else if (ty == ResolvedType.BOOLEAN || ty1 == ResolvedType.BOOLEAN || ty == ResolvedType.VOID
- || ty1 == ResolvedType.VOID) {
+ } else if (ty.equals(UnresolvedType.BOOLEAN) || ty1.equals(UnresolvedType.BOOLEAN)
+ || ty.equals(UnresolvedType.VOID) || ty1.equals(UnresolvedType.VOID)) {
isCoerceableFromTest(ty, ty1, false);
} else {
isCoerceableFromTest(ty, ty1, true);
}
private void primAssignTest(String sig, String[] lowers) {
- ResolvedType[] primitives = getWorld().resolve(primitiveTypes);
+ ResolvedType[] primitives = world.resolve(primitiveTypes);
UnresolvedType tx = UnresolvedType.forSignature(sig);
- ResolvedType ty = getWorld().resolve(tx, true);
+ ResolvedType ty = world.resolve(tx, true);
assertTrue("Couldnt find type " + tx, !ty.isMissing());
- ResolvedType[] lowerTyArray = getWorld().resolve(UnresolvedType.forSignatures(lowers));
- List lowerTys = new ArrayList(Arrays.asList(lowerTyArray));
+ ResolvedType[] lowerTyArray = world.resolve(UnresolvedType.forSignatures(lowers));
+ List<ResolvedType> lowerTys = new ArrayList<ResolvedType>(Arrays.asList(lowerTyArray));
lowerTys.add(ty);
- Set allLowerTys = new HashSet(lowerTys);
- Set allUpperTys = new HashSet(Arrays.asList(primitives));
+ Set<ResolvedType> allLowerTys = new HashSet<ResolvedType>(lowerTys);
+ Set<ResolvedType> allUpperTys = new HashSet<ResolvedType>(Arrays.asList(primitives));
allUpperTys.removeAll(allLowerTys);
- for (Iterator i = allLowerTys.iterator(); i.hasNext();) {
- ResolvedType other = (ResolvedType) i.next();
+ for (ResolvedType other : allLowerTys) {
isAssignableFromTest(ty, other, true);
}
- for (Iterator i = allUpperTys.iterator(); i.hasNext();) {
- ResolvedType other = (ResolvedType) i.next();
+ for (ResolvedType other : allUpperTys) {
isAssignableFromTest(ty, other, false);
}
}
for (int i = 0, len = primitives.length; i < len; i++) {
ResolvedType ty = primitives[i];
UnresolvedType tx = UnresolvedType.forSignature("[" + ty.getSignature());
- ResolvedType aty = getWorld().resolve(tx, true);
+ ResolvedType aty = world.resolve(tx, true);
assertTrue("Couldnt find type " + tx, !aty.isMissing());
modifiersTest(aty, Modifier.PUBLIC | Modifier.FINAL);
fieldsTest(aty, ResolvedMember.NONE);
for (int i = 0, len = primitives.length; i < len; i++) {
ResolvedType ty = primitives[i];
UnresolvedType tx = UnresolvedType.forSignature("[[" + ty.getSignature());
- ResolvedType aty = getWorld().resolve(tx, true);
+ ResolvedType aty = world.resolve(tx, true);
assertTrue("Couldnt find type " + tx, !aty.isMissing());
modifiersTest(aty, Modifier.PUBLIC | Modifier.FINAL);
fieldsTest(aty, ResolvedMember.NONE);
}
protected void isCoerceableFromTest(UnresolvedType ty0, UnresolvedType ty1, boolean x) {
- assertEquals(ty0 + " is coerceable from " + ty1, x, ty0.resolve(world).isCoerceableFrom(ty1.resolve(world)));
- assertEquals(ty1 + " is coerceable from " + ty0, x, ty1.resolve(world).isCoerceableFrom(ty0.resolve(world)));
+ assertEquals(ty0 + " is coerceable from " + ty1, ty0.resolve(world).isCoerceableFrom(ty1.resolve(world)), x);
+ assertEquals(ty1 + " is coerceable from " + ty0, ty1.resolve(world).isCoerceableFrom(ty0.resolve(world)), x);
}
protected void isAssignableFromTest(UnresolvedType ty0, UnresolvedType ty1, boolean x) {
- assertEquals(ty0 + " is assignable from " + ty1, x, ty0.resolve(world).isAssignableFrom(ty1.resolve(world)));
+ ResolvedType rty0 = ty0.resolve(world);
+ ResolvedType rty1 = ty1.resolve(world);
+ boolean result = rty0.isAssignableFrom(rty1);
+ assertEquals(ty0 + " is assignable from " + ty1, result, x);
}
// ---- tests for parts of ResolvedMethod objects
* PARC initial implementation
* ******************************************************************/
-
package org.aspectj.weaver;
import org.aspectj.bridge.ISourceLocation;
private final World world;
private final UnresolvedType thisType;
- public TestShadow(Kind kind, Member signature, UnresolvedType thisType, World world) {
- super(kind, signature, null);
- this.world = world;
- this.thisType = thisType;
- }
+ public TestShadow(Kind kind, Member signature, UnresolvedType thisType, World world) {
+ super(kind, signature, null);
+ this.world = world;
+ this.thisType = thisType;
+ }
- public World getIWorld() {
- return world;
- }
+ public World getIWorld() {
+ return world;
+ }
- /** this is subtly wrong. ha ha */
- public UnresolvedType getEnclosingType() {
- return thisType;
- }
+ /** this is subtly wrong. ha ha */
+ public UnresolvedType getEnclosingType() {
+ return thisType;
+ }
- public Var getThisVar() {
- // we should thorw if we don't have a this
- return new Var(getThisType().resolve(world));
- }
+ public Var getThisVar() {
+ // we should thorw if we don't have a this
+ return new Var(getThisType().resolve(world));
+ }
- public Var getTargetVar() {
- if (! hasTarget()) throw new RuntimeException("bad");
- return new Var(getTargetType().resolve(world));
- }
+ public Var getTargetVar() {
+ if (!hasTarget())
+ throw new RuntimeException("bad");
+ return new Var(getTargetType().resolve(world));
+ }
- public Var getArgVar(int i) {
- return new Var(getArgType(i).resolve(world));
- }
+ public Var getArgVar(int i) {
+ return new Var(getArgType(i).resolve(world));
+ }
public Var getThisEnclosingJoinPointStaticPartVar() {
throw new RuntimeException("unimplemented");
}
+ public Var getThisAspectInstanceVar(ResolvedType aspectType) {
+ throw new RuntimeException("unimplemented");
+ }
+
public Var getThisJoinPointStaticPartVar() {
throw new RuntimeException("unimplemented");
}
throw new RuntimeException("unimplemented");
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.aspectj.weaver.Shadow#getKindedAnnotationVar()
*/
public Var getKindedAnnotationVar(UnresolvedType annotationType) {
throw new RuntimeException("unimplemented");
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.aspectj.weaver.Shadow#getWithinAnnotationVar()
*/
public Var getWithinAnnotationVar(UnresolvedType annotationType) {
throw new RuntimeException("unimplemented");
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.aspectj.weaver.Shadow#getWithinCodeAnnotationVar()
*/
public Var getWithinCodeAnnotationVar(UnresolvedType annotationType) {
throw new RuntimeException("unimplemented");
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.aspectj.weaver.Shadow#getThisAnnotationVar()
*/
public Var getThisAnnotationVar(UnresolvedType annotationType) {
throw new RuntimeException("unimplemented");
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.aspectj.weaver.Shadow#getTargetAnnotationVar()
*/
public Var getTargetAnnotationVar(UnresolvedType annotationType) {
throw new RuntimeException("unimplemented");
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.aspectj.weaver.Shadow#getArgAnnotationVar(int)
*/
- public Var getArgAnnotationVar(int i,UnresolvedType annotationType) {
+ public Var getArgAnnotationVar(int i, UnresolvedType annotationType) {
throw new RuntimeException("unimplemented");
}