aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraclement <aclement>2006-06-22 08:04:54 +0000
committeraclement <aclement>2006-06-22 08:04:54 +0000
commit76d1bc7bdfe7665c6d4fd04c852b92f17d255ddb (patch)
tree7c301671771a1346f4daccfc3f8d7899e135d974
parent685d347782772e00d14b078c065162b44e79d40d (diff)
downloadaspectj-76d1bc7bdfe7665c6d4fd04c852b92f17d255ddb.tar.gz
aspectj-76d1bc7bdfe7665c6d4fd04c852b92f17d255ddb.zip
148027: dont generate usespointcut relationship (for now...)
-rw-r--r--ajde/testsrc/org/aspectj/ajde/AsmRelationshipsTest.java4
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AsmHierarchyBuilder.java4
-rw-r--r--tests/bugs152/pr148027/A.aj15
-rw-r--r--tests/bugs152/pr148027/C.aj10
-rw-r--r--tests/src/org/aspectj/systemtest/ajc152/Ajc152Tests.java24
-rw-r--r--tests/src/org/aspectj/systemtest/ajc152/ajc152.xml6
-rw-r--r--tests/src/org/aspectj/systemtest/incremental/model/IncrementalModelTests.java32
-rw-r--r--tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java13
8 files changed, 94 insertions, 14 deletions
diff --git a/ajde/testsrc/org/aspectj/ajde/AsmRelationshipsTest.java b/ajde/testsrc/org/aspectj/ajde/AsmRelationshipsTest.java
index f2fcca34b..cb32415ed 100644
--- a/ajde/testsrc/org/aspectj/ajde/AsmRelationshipsTest.java
+++ b/ajde/testsrc/org/aspectj/ajde/AsmRelationshipsTest.java
@@ -14,6 +14,7 @@ package org.aspectj.ajde;
import java.util.Iterator;
import java.util.List;
+import org.aspectj.ajdt.internal.core.builder.AsmHierarchyBuilder;
import org.aspectj.asm.AsmManager;
import org.aspectj.asm.IProgramElement;
import org.aspectj.asm.IRelationship;
@@ -31,7 +32,10 @@ public class AsmRelationshipsTest extends AjdeTestCase {
super(name);
}
+ // see pr148027
public void testUsesPointcut() {
+ if (!AsmHierarchyBuilder.shouldAddUsesPointcut) return;
+
IProgramElement ptUsage = AsmManager.getDefault().getHierarchy().findElementForType(null, "PointcutUsage");
assertNotNull(ptUsage);
IProgramElement pts = AsmManager.getDefault().getHierarchy().findElementForType(null, "Pointcuts");
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AsmHierarchyBuilder.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AsmHierarchyBuilder.java
index a65cfbf77..f97f4d647 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AsmHierarchyBuilder.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AsmHierarchyBuilder.java
@@ -52,7 +52,9 @@ import org.aspectj.weaver.patterns.*;
public class AsmHierarchyBuilder extends ASTVisitor {
protected AsmElementFormatter formatter = new AsmElementFormatter();
- public static boolean shouldAddUsesPointcut = true;
+ // pr148027 - stop generating uses pointcut/pointcut used by relationship
+ // until we do it in the same way as other relationships.
+ public static boolean shouldAddUsesPointcut = false;
/**
* Reset for every compilation unit.
*/
diff --git a/tests/bugs152/pr148027/A.aj b/tests/bugs152/pr148027/A.aj
new file mode 100644
index 000000000..306f14b68
--- /dev/null
+++ b/tests/bugs152/pr148027/A.aj
@@ -0,0 +1,15 @@
+package pkg;
+
+public aspect A {
+
+ before() : C.pointcutInClass() {
+ }
+
+ pointcut pointcutInAspect() : execution(void aMethod());
+
+ before() : pointcutInAspect() {
+ }
+
+ public void aMethod() {
+ }
+}
diff --git a/tests/bugs152/pr148027/C.aj b/tests/bugs152/pr148027/C.aj
new file mode 100644
index 000000000..63b4e6cb6
--- /dev/null
+++ b/tests/bugs152/pr148027/C.aj
@@ -0,0 +1,10 @@
+package pkg;
+
+public class C {
+
+ pointcut pointcutInClass() : execution(void cMethod());
+
+ public void cMethod() {
+
+ }
+}
diff --git a/tests/src/org/aspectj/systemtest/ajc152/Ajc152Tests.java b/tests/src/org/aspectj/systemtest/ajc152/Ajc152Tests.java
index 79a3dc233..906695d5f 100644
--- a/tests/src/org/aspectj/systemtest/ajc152/Ajc152Tests.java
+++ b/tests/src/org/aspectj/systemtest/ajc152/Ajc152Tests.java
@@ -17,6 +17,7 @@ import java.util.List;
import junit.framework.Test;
+import org.aspectj.ajdt.internal.core.builder.AsmHierarchyBuilder;
import org.aspectj.asm.AsmManager;
import org.aspectj.asm.IHierarchy;
import org.aspectj.asm.IProgramElement;
@@ -295,6 +296,29 @@ public class Ajc152Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
}
}
+ public void testPCDInClassAppearsInModel_pr148027() {
+ // only want to test that its there if we're creating the uses pointcut
+ // relationship. This should be addressed by pr148027
+ if (!AsmHierarchyBuilder.shouldAddUsesPointcut) return;
+ World.createInjarHierarchy = false;
+ try {
+ runTest("ensure pcd declare in class appears in model");
+ IHierarchy top = AsmManager.getDefault().getHierarchy();
+ IProgramElement pcd = top.findElementForLabel(top.getRoot(),IProgramElement.Kind.POINTCUT,"pointcutInClass()");
+ IRelationshipMap relMap = AsmManager.getDefault().getRelationshipMap();
+ List relationships = relMap.get(pcd);
+ assertNotNull("expected relationships for pointcut " + pcd.toLinkLabelString()
+ + " but didn't", relationships);
+
+ pcd = top.findElementForLabel(top.getRoot(),IProgramElement.Kind.POINTCUT,"pointcutInAspect()");
+ relationships = relMap.get(pcd);
+ assertNotNull("expected relationships for pointcut " + pcd.toLinkLabelString()
+ + " but didn't", relationships);
+ } finally {
+ World.createInjarHierarchy = true;
+ }
+ }
+
// public void testFunkyGenericErrorWithITDs_pr126355_2() {
// runTest("bizarre generic error with itds - 2");
// // public class Pair<F,S> affected by pertarget aspect
diff --git a/tests/src/org/aspectj/systemtest/ajc152/ajc152.xml b/tests/src/org/aspectj/systemtest/ajc152/ajc152.xml
index da553bad9..b4244e827 100644
--- a/tests/src/org/aspectj/systemtest/ajc152/ajc152.xml
+++ b/tests/src/org/aspectj/systemtest/ajc152/ajc152.xml
@@ -729,7 +729,11 @@
</stderr>
</run>
</ajc-test>
-
+
+ <ajc-test dir="bugs152/pr148027" title="ensure pcd declare in class appears in model">
+ <compile files="A.aj, C.aj" options="-emacssym"/>
+ </ajc-test>
+
<ajc-test dir="bugs152/pr148007" title="jrockit boolean fun">
<compile files="test/BooleanUnitTest.java, test/LoggingAspect.aj"/>
<run class="test.BooleanUnitTest"/>
diff --git a/tests/src/org/aspectj/systemtest/incremental/model/IncrementalModelTests.java b/tests/src/org/aspectj/systemtest/incremental/model/IncrementalModelTests.java
index 0324aab99..e6507e6e1 100644
--- a/tests/src/org/aspectj/systemtest/incremental/model/IncrementalModelTests.java
+++ b/tests/src/org/aspectj/systemtest/incremental/model/IncrementalModelTests.java
@@ -14,6 +14,7 @@ import java.io.File;
import junit.framework.Test;
import org.aspectj.ajde.ui.StructureModelUtil;
+import org.aspectj.ajdt.internal.core.builder.AsmHierarchyBuilder;
import org.aspectj.asm.AsmManager;
import org.aspectj.testing.XMLBasedAjcTestCase;
@@ -58,17 +59,29 @@ public class IncrementalModelTests extends org.aspectj.testing.XMLBasedAjcTestCa
// <!-- BetaA has a new piece of handler advice added -->
nextIncrement(true);
copyFileAndDoIncrementalBuild("changes/primary/BetaA.20.java","src/primary/BetaA.java");
- StructureModelUtil.checkModel("code=1,advice=1,RelationshipMapSize=3");
+ if (AsmHierarchyBuilder.shouldAddUsesPointcut) {
+ StructureModelUtil.checkModel("code=1,advice=1,RelationshipMapSize=3");
+ } else {
+ StructureModelUtil.checkModel("code=1,advice=1,RelationshipMapSize=2");
+ }
// <!-- secondary.GammaA added, also advises the same handler -->
nextIncrement(true);
copyFileAndDoIncrementalBuild("changes/secondary/GammaA.30.java","src/secondary/GammaA.java");
- StructureModelUtil.checkModel("code=1,advice=2,RelationshipMapSize=5");
+ if (AsmHierarchyBuilder.shouldAddUsesPointcut) {
+ StructureModelUtil.checkModel("code=1,advice=2,RelationshipMapSize=5");
+ } else {
+ StructureModelUtil.checkModel("code=1,advice=2,RelationshipMapSize=3");
+ }
// <!-- primary.BetaA deleted -->
nextIncrement(true);
deleteFileAndDoIncrementalBuild("src/primary/BetaA.java");
- StructureModelUtil.checkModel("code=1,advice=1,RelationshipMapSize=3");
+ if (AsmHierarchyBuilder.shouldAddUsesPointcut) {
+ StructureModelUtil.checkModel("code=1,advice=1,RelationshipMapSize=3");
+ } else {
+ StructureModelUtil.checkModel("code=1,advice=1,RelationshipMapSize=2");
+ }
}
@@ -79,12 +92,21 @@ public class IncrementalModelTests extends org.aspectj.testing.XMLBasedAjcTestCa
// <!-- BetaA has a new piece of advice added -->
nextIncrement(true);
copyFileAndDoIncrementalBuild("changes/primary/BetaA.20.java","src/primary/BetaA.java");
- StructureModelUtil.checkModel("code=2,advice=2,java source file=3,RelationshipMapSize=6");
+ if (AsmHierarchyBuilder.shouldAddUsesPointcut) {
+ StructureModelUtil.checkModel("code=2,advice=2,java source file=3,RelationshipMapSize=6");
+ } else {
+ StructureModelUtil.checkModel("code=2,advice=2,java source file=3,RelationshipMapSize=4");
+ }
+
// <!-- BetaA has a piece of advice removed -->
nextIncrement(true);
copyFileAndDoIncrementalBuild("changes/primary/BetaA.30.java","src/primary/BetaA.java");
- StructureModelUtil.checkModel("code=1,advice=1,RelationshipMapSize=3");
+ if (AsmHierarchyBuilder.shouldAddUsesPointcut) {
+ StructureModelUtil.checkModel("code=1,advice=1,RelationshipMapSize=3");
+ } else {
+ StructureModelUtil.checkModel("code=1,advice=1,RelationshipMapSize=2");
+ }
// <!-- BetaA other piece of advice removed (now empty) -->
nextIncrement(true);
diff --git a/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java b/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java
index 1f5793688..454dd9e69 100644
--- a/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java
+++ b/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java
@@ -23,7 +23,6 @@ import java.util.Set;
import org.aspectj.ajdt.internal.compiler.lookup.EclipseFactory;
import org.aspectj.ajdt.internal.core.builder.AjState;
-import org.aspectj.ajdt.internal.core.builder.AsmHierarchyBuilder;
import org.aspectj.ajdt.internal.core.builder.IncrementalStateManager;
import org.aspectj.asm.AsmManager;
import org.aspectj.asm.IProgramElement;
@@ -76,7 +75,7 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa
}*/
public void testDontLoseAdviceMarkers_pr134471() {
try {
- AsmHierarchyBuilder.shouldAddUsesPointcut=false;
+ // see pr148027 AsmHierarchyBuilder.shouldAddUsesPointcut=false;
configureBuildStructureModel(true);
initialiseProject("P4");
build("P4");
@@ -144,7 +143,7 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa
}
} finally {
- AsmHierarchyBuilder.shouldAddUsesPointcut=true;
+ // see pr148027 AsmHierarchyBuilder.shouldAddUsesPointcut=true;
configureBuildStructureModel(false);
}
}
@@ -1042,7 +1041,7 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa
// 134471 related tests perform incremental compilation and verify features of the structure model post compile
public void testPr134471_IncrementalCompilationAndModelUpdates() {
try {
- AsmHierarchyBuilder.shouldAddUsesPointcut=false;
+ // see pr148027 AsmHierarchyBuilder.shouldAddUsesPointcut=false;
configureBuildStructureModel(true);
configureNonStandardCompileOptions("-showWeaveInfo -emacssym");
@@ -1074,7 +1073,7 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa
line = programElement.getSourceLocation().getLine();
assertTrue("advice should be at line 7 - but is at line "+line,line==7);
} finally {
- AsmHierarchyBuilder.shouldAddUsesPointcut=true;
+ // see pr148027 AsmHierarchyBuilder.shouldAddUsesPointcut=true;
}
}
@@ -1123,7 +1122,7 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa
// same as first test with an extra stage that asks for C to be recompiled, it should still be advised...
public void testPr134471_IncrementallyRecompilingTheAffectedClass() {
try {
- AsmHierarchyBuilder.shouldAddUsesPointcut=false;
+ // see pr148027 AsmHierarchyBuilder.shouldAddUsesPointcut=false;
configureBuildStructureModel(true);
configureNonStandardCompileOptions("-showWeaveInfo -emacssym");
@@ -1155,7 +1154,7 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa
line = programElement.getSourceLocation().getLine();
assertTrue("advice should be at line 7 - but is at line "+line,line==7);
} finally {
- AsmHierarchyBuilder.shouldAddUsesPointcut=true;
+ // see pr148027 AsmHierarchyBuilder.shouldAddUsesPointcut=true;
}
}