package org.aspectj.systemtest.ajc151;
import java.io.File;
+import java.util.List;
import junit.framework.Test;
+import org.aspectj.asm.AsmManager;
+import org.aspectj.asm.IProgramElement;
import org.aspectj.testing.XMLBasedAjcTestCase;
/*
public void testBasicWithAMultiDimensionalArray() { runTest("multi dimensional array creation"); }
public void testArgsWithAMultiDimensionalArray() { runTest("multi dimensional array args");}
- // complicated
+ // various
+ public void testOptionoff() { runTest("option deactivated - no match expected");}
public void testUsingTargetAndAfterReturningAdvice() { runTest("using target and after returning");}
public void testUsingItForReal() { runTest("using it for real");}
public void testDifferentiatingArrayTypes() { runTest("differentiating array types");}
- public void testStructureModel() { runTest("structure model");}
+
+ public void testStructureModel() {
+ //AsmManager.setReporting("c:/foo.txt",true,true,true,true);
+ runTest("structure model");
+ IProgramElement ipe = AsmManager.getDefault().getHierarchy().findElementForType("","Five");
+ assertTrue("Couldnt find 'Five' type in the model",ipe!=null);
+ List kids = ipe.getChildren();
+ assertTrue("Couldn't find 'main' method in the 'Five' type",kids!=null && kids.size()==1);
+ List codenodes = ((IProgramElement)kids.get(0)).getChildren();
+ assertTrue("Couldn't find nodes below 'main' method",codenodes!=null && codenodes.size()==1);
+ IProgramElement arrayCtorCallNode = (IProgramElement)codenodes.get(0);
+ String exp = "constructor-call(void java.lang.Integer[].<init>(int))";
+ assertTrue("Expected '"+exp+"' but found "+arrayCtorCallNode.toString(),arrayCtorCallNode.toString().equals(exp));
+ List rels = AsmManager.getDefault().getRelationshipMap().get(arrayCtorCallNode);
+ assertTrue("Should have a relationship from the ctorcall node, but didn't find one?",rels!=null && rels.size()==1);
+ }
- public void testOptionoff() { runTest("option deactivated - no match expected");}
//
public static Test suite() {
public static final String CANT_BIND_TYPE = "cantBindType";
public static final String WILDCARD_NOT_ALLOWED = "wildcardTypePatternNotAllowed";
public static final String FIELDS_CANT_HAVE_VOID_TYPE = "fieldCantBeVoid";
+ public static final String NO_NEWARRAY_JOINPOINTS_BY_DEFAULT = "noNewArrayJoinpointsByDefault";
public static final String DECP_OBJECT = "decpObject";
public static final String CANT_EXTEND_SELF="cantExtendSelf";
if (visitor.wellHasItThen/*?*/()) {
scope.message(MessageUtil.error(WeaverMessages.format(WeaverMessages.NO_GENERIC_THROWABLES),
getSourceLocation()));
- }
+ }
+ if (!scope.getWorld().isJoinpointArrayConstructionEnabled() &&
+ kind==Shadow.ConstructorCall &&
+ signature.getDeclaringType().isArray()) {
+ scope.message(MessageUtil.warn(WeaverMessages.format(WeaverMessages.NO_NEWARRAY_JOINPOINTS_BY_DEFAULT),getSourceLocation()));
+ }
}
}
cantBindType=can''t bind type name ''{0}''
wildcardTypePatternNotAllowed=wildcard type pattern not allowed, must use type name
fieldCantBeVoid=fields cannot have a void type
+noNewArrayJoinpointsByDefault=There are no join points for array construction unless -Xjoinpoints:arrayconstruction is specified
# Declare parents messages...
decpObject=can''t change the parents of java.lang.Object