public static final String ASPECT_NEEDED = "aspectNeeded";
public static final String CANT_FIND_TYPE = "cantFindType";
+ public static final String CANT_FIND_CORE_TYPE = "cantFindCoreType";
public static final String DECP_BINARY_LIMITATION = "decpBinaryLimitation";
public static final String OVERWRITE_JSR45 = "overwriteJSR45";
public ResolvedTypeX resolve(TypeX ty) {
return resolve(ty, false);
}
+
+ public ResolvedTypeX getCoreType(TypeX tx) {
+ ResolvedTypeX coreTy = resolve(tx,true);
+ if (coreTy == ResolvedTypeX.MISSING) {
+ MessageUtil.error(messageHandler,
+ WeaverMessages.format(WeaverMessages.CANT_FIND_CORE_TYPE,tx.getName()));
+ }
+ return coreTy;
+ }
public ResolvedTypeX resolve(TypeX ty, boolean allowMissing) {
//System.out.println("resolve: " + ty + " world " + typeMap.keySet());
# The infamous and deserving a category all of its own...
cantFindType=can''t find type {0}
+cantFindCoreType=can''t find critical required type {0}
# Implementation limitations...
decpBinaryLimitation=can''t use declare parents to change superclass of binary form ''{0}'' (implementation limitation)
}
private void primAssignTest(String sig, String[] lowers) {
ResolvedTypeX[] primitives = getWorld().resolve(primitiveTypeXs);
- ResolvedTypeX ty = getWorld().resolve(TypeX.forSignature(sig));
+ TypeX tx = TypeX.forSignature(sig);
+ ResolvedTypeX ty = getWorld().resolve(tx,true);
+ assertTrue("Couldnt find type "+tx,ty!=ResolvedTypeX.MISSING);
ResolvedTypeX[] lowerTyArray =
getWorld().resolve(TypeX.forSignatures(lowers));
List lowerTys = new ArrayList(Arrays.asList(lowerTyArray));
ResolvedTypeX[] primitives = getWorld().resolve(primitiveTypeXs);
for(int i = 0, len = primitives.length; i < len; i++) {
ResolvedTypeX ty = primitives[i];
- ResolvedTypeX aty = getWorld().resolve(TypeX.forSignature("[" + ty.getSignature()));
+ TypeX tx = TypeX.forSignature("["+ty.getSignature());
+ ResolvedTypeX aty = getWorld().resolve(tx,true);
+ assertTrue("Couldnt find type "+tx,aty!=ResolvedTypeX.MISSING);
modifiersTest(aty, Modifier.PUBLIC | Modifier.FINAL);
fieldsTest(aty, ResolvedMember.NONE);
methodsTest(aty, ResolvedMember.NONE);
interfacesTest(aty, new ResolvedTypeX[] {
- getWorld().resolve(TypeX.CLONEABLE),
- getWorld().resolve(TypeX.SERIALIZABLE) });
+ getWorld().getCoreType(TypeX.CLONEABLE),
+ getWorld().getCoreType(TypeX.SERIALIZABLE) });
superclassTest(aty, TypeX.OBJECT);
pointcutsTest(aty, ResolvedMember.NONE);
for (int j = 0; j < len; j++) {
ResolvedTypeX ty1 = primitives[j];
isCoerceableFromTest(aty, ty1, false);
- ResolvedTypeX aty1 = getWorld().resolve(TypeX.forSignature("[" + ty1.getSignature()));
+ tx = TypeX.forSignature("[" + ty1.getSignature());
+ ResolvedTypeX aty1 = getWorld().resolve(tx,true);
+ assertTrue("Couldnt find type "+tx,aty1!=ResolvedTypeX.MISSING);
if (ty.equals(ty1)) {
isCoerceableFromTest(aty, aty1, true);
isAssignableFromTest(aty, aty1, true);
import org.apache.bcel.generic.Type;
import org.aspectj.weaver.AdviceKind;
import org.aspectj.weaver.Member;
+import org.aspectj.weaver.ResolvedTypeX;
import org.aspectj.weaver.Shadow;
import org.aspectj.weaver.TypeX;
}
private BcelAdvice makeArgsMunger(final String kindx) {
+ ResolvedTypeX rtx = world.resolve(TypeX.forName("Aspect"),true);
+ assertTrue("Cant find required type Aspect",rtx!=ResolvedTypeX.MISSING);
return new BcelAdvice(AdviceKind.stringToKind(kindx), makePointcutNoZeroArg(),
Member.method(TypeX.forName("Aspect"), 0, "foo", "()V"), 0, -1, -1, null,
- world.resolve(TypeX.forName("Aspect"))) {
+ rtx) {
public void specializeOn(Shadow shadow) {
super.specializeOn(shadow);
shadow.getArgVar(0);
import java.io.IOException;
import java.util.Arrays;
+import javax.print.attribute.ResolutionSyntax;
+
import org.aspectj.weaver.Advice;
import org.aspectj.weaver.AdviceKind;
import org.aspectj.weaver.Member;
+import org.aspectj.weaver.ResolvedTypeX;
import org.aspectj.weaver.TypeX;
public class TjpWeaveTestCase extends WeaveTestCase {
}
public void testAround2Tjp() throws IOException {
+ ResolvedTypeX rtx = world.resolve(TypeX.forName("Aspect"),true);
+ assertTrue("Couldnt find type Aspect",rtx!=ResolvedTypeX.MISSING);
BcelAdvice munger1 = new BcelAdvice(
AdviceKind.stringToKind("around"),
makePointcutAll(),
Member.methodFromString("static java.lang.Object Aspect.ajc_around(org.aspectj.runtime.internal.AroundClosure, org.aspectj.lang.JoinPoint)"),
Advice.ThisJoinPoint | Advice.ExtraArgument, -1, -1, null,
- world.resolve(TypeX.forName("Aspect")));
+ rtx);
BcelAdvice munger2 = new BcelAdvice(
AdviceKind.stringToKind("around"),
makePointcutAll(),
Member.methodFromString("static java.lang.Object Aspect.ajc_around(org.aspectj.runtime.internal.AroundClosure, org.aspectj.lang.JoinPoint)"),
Advice.ThisJoinPoint | Advice.ExtraArgument, -1, -1, null,
- world.resolve(TypeX.forName("Aspect")));
+ rtx);
weaveTest("HelloWorld", "TjpAround2HelloWorld", Arrays.asList(new BcelAdvice[] {munger1, munger2}));
}
// XXX fix the various XXXs before expecting this test to work
public void xtestTraceJar() {
- ResolvedTypeX trace = world.resolve(TypeX.forName("Trace"));
-
+ ResolvedTypeX trace = world.resolve(TypeX.forName("Trace"),true);
+ assertTrue("Couldnt find type Trace",trace!=ResolvedTypeX.MISSING);
fieldsTest(trace, Member.NONE);
/*Member constr = */Member.methodFromString("void Trace.<init>()");
//XXX need attribute fix -
Advice.ExtraArgument),
});
- ResolvedTypeX myTrace = world.resolve(TypeX.forName("MyTrace"));
+ ResolvedTypeX myTrace = world.resolve(TypeX.forName("MyTrace"),true);
+ assertTrue("Couldnt find type MyTrace",myTrace!=ResolvedTypeX.MISSING);
interfacesTest(myTrace, ResolvedTypeX.NONE);
superclassTest(myTrace, trace);
public void testIterator() {
int abstractPublic = Modifier.ABSTRACT | Modifier.PUBLIC;
- ResolvedTypeX iter = world.resolve(TypeX.forName("java.util.Iterator"));
+ ResolvedTypeX iter = world.getCoreType(TypeX.forName("java.util.Iterator"));
modifiersTest(iter, abstractPublic | Modifier.INTERFACE);
fieldsTest(iter, ResolvedMember.NONE);