aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authoraclement <aclement>2011-06-13 18:21:34 +0000
committeraclement <aclement>2011-06-13 18:21:34 +0000
commit9f1b97eb6fc1040442b4f0a1398611cb410dbe49 (patch)
tree45b91f3edb19d86265e1c3ababec61f4f6e291e4 /tests
parentba10175fffd15edec820de7db0ce76d900b77722 (diff)
downloadaspectj-9f1b97eb6fc1040442b4f0a1398611cb410dbe49.tar.gz
aspectj-9f1b97eb6fc1040442b4f0a1398611cb410dbe49.zip
type demotion fixes. -Xset:avoidFinal=true to avoid final methods for around infra methods
Diffstat (limited to 'tests')
-rw-r--r--tests/src/org/aspectj/systemtest/incremental/tools/AbstractMultiProjectIncrementalAjdeInteractionTestbed.java5
-rw-r--r--tests/src/org/aspectj/systemtest/incremental/tools/IncrementalCompilationTests.java61
-rw-r--r--tests/src/org/aspectj/systemtest/incremental/tools/IncrementalPerformanceTests.java5
-rw-r--r--tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java50
4 files changed, 91 insertions, 30 deletions
diff --git a/tests/src/org/aspectj/systemtest/incremental/tools/AbstractMultiProjectIncrementalAjdeInteractionTestbed.java b/tests/src/org/aspectj/systemtest/incremental/tools/AbstractMultiProjectIncrementalAjdeInteractionTestbed.java
index 9a54a926c..a87d563c6 100644
--- a/tests/src/org/aspectj/systemtest/incremental/tools/AbstractMultiProjectIncrementalAjdeInteractionTestbed.java
+++ b/tests/src/org/aspectj/systemtest/incremental/tools/AbstractMultiProjectIncrementalAjdeInteractionTestbed.java
@@ -255,6 +255,11 @@ public class AbstractMultiProjectIncrementalAjdeInteractionTestbed extends AjdeI
pw.flush();
}
+ protected File getProjectRelativePath(String p, String filename) {
+ File projDir = new File(getWorkingDir(), p);
+ return new File(projDir, filename);
+ }
+
protected void assertNoErrors(String projectName) {
assertTrue("Should be no errors, but got " + getErrorMessages(projectName), getErrorMessages(projectName).size() == 0);
}
diff --git a/tests/src/org/aspectj/systemtest/incremental/tools/IncrementalCompilationTests.java b/tests/src/org/aspectj/systemtest/incremental/tools/IncrementalCompilationTests.java
index 25642f6f3..a9f45ef6c 100644
--- a/tests/src/org/aspectj/systemtest/incremental/tools/IncrementalCompilationTests.java
+++ b/tests/src/org/aspectj/systemtest/incremental/tools/IncrementalCompilationTests.java
@@ -36,6 +36,12 @@ import org.aspectj.weaver.World.TypeMap;
*/
public class IncrementalCompilationTests extends AbstractMultiProjectIncrementalAjdeInteractionTestbed {
+ @Override
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ TypeMap.useExpendableMap = true;
+ }
+
public void testAdditionalDependencies328649_1() throws Exception {
String p = "pr328649_1";
initialiseProject(p);
@@ -464,6 +470,51 @@ public class IncrementalCompilationTests extends AbstractMultiProjectIncremental
assertEquals("Pjava/util/List<Ljava/lang/Integer;>;", fields[3].getGenericReturnType().getSignature());
}
+ /**
+ * This test is verifying the treatment of array types (here, String[]). These should be expendable but because the
+ * ArrayReferenceType wasnt overriding isExposedToWeaver() an array had an apparent null delegate - this caused the isExpendable
+ * check to fail when choosing whether to put something in the permanent or expendable map. Leaving something in the permanent
+ * map that would never be cleared out.
+ */
+ public void testWorldDemotion_278496_10() throws Exception {
+ String p = "PR278496_10";
+ TypeMap.useExpendableMap = false;
+ initialiseProject(p);
+ configureNonStandardCompileOptions(p, "-Xset:typeDemotion=true,typeDemotionDebug=true");
+ build(p);
+ checkWasFullBuild();
+ AjdeCoreBuildManager buildManager = getCompilerForProjectWithName(p).getBuildManager();
+ AjBuildManager ajBuildManager = buildManager.getAjBuildManager();
+ World w = ajBuildManager.getWorld();
+
+ assertNotInTypeMap(w, "Lcom/Foo;");
+ assertNotInTypeMap(w, "[Ljava/lang/String;");
+ assertInTypeMap(w, "Lcom/Asp;");
+ assertInTypeMap(w, "[I");
+ assertInTypeMap(w, "[[F");
+ }
+
+ public void testWorldDemotion_278496_11() throws Exception {
+ String asp = "PR278496_11_a";
+ initialiseProject(asp);
+ build(asp);
+
+ String p = "PR278496_11";
+ TypeMap.useExpendableMap = false;
+ initialiseProject(p);
+ configureNonStandardCompileOptions(p, "-Xset:typeDemotion=true,typeDemotionDebug=true");
+ configureAspectPath(p, getProjectRelativePath(asp, "bin"));
+ build(p);
+ checkWasFullBuild();
+ AjdeCoreBuildManager buildManager = getCompilerForProjectWithName(p).getBuildManager();
+ AjBuildManager ajBuildManager = buildManager.getAjBuildManager();
+ World w = ajBuildManager.getWorld();
+
+ assertNotInTypeMap(w, "Lcom/Foo;");
+ assertInTypeMap(w, "Lcom/Asp;");
+ assertNotInTypeMap(w, "Lcom/Dibble;");
+ }
+
public void testWorldDemotion_278496_6() throws Exception {
String p = "PR278496_6";
initialiseProject(p);
@@ -528,12 +579,6 @@ public class IncrementalCompilationTests extends AbstractMultiProjectIncremental
// World w = ajBuildManager.getWorld();
// }
- @Override
- protected void tearDown() throws Exception {
- super.tearDown();
- TypeMap.useExpendableMap = true;
- }
-
public void testWorldDemotion_278496_4() throws Exception {
String p = "PR278496_4";
// Setting this ensures types are forced out when demoted - we are not at the mercy of weak reference GC
@@ -705,6 +750,10 @@ public class IncrementalCompilationTests extends AbstractMultiProjectIncremental
assertNull(w.getTypeMap().get(string));
}
+ private void assertInTypeMap(World w, String string) {
+ assertNotNull(w.getTypeMap().get(string));
+ }
+
private String stringify(Object[] arr) {
StringBuilder s = new StringBuilder();
for (int i = 0; i < arr.length; i++) {
diff --git a/tests/src/org/aspectj/systemtest/incremental/tools/IncrementalPerformanceTests.java b/tests/src/org/aspectj/systemtest/incremental/tools/IncrementalPerformanceTests.java
index 05cca27c6..c5e53cdeb 100644
--- a/tests/src/org/aspectj/systemtest/incremental/tools/IncrementalPerformanceTests.java
+++ b/tests/src/org/aspectj/systemtest/incremental/tools/IncrementalPerformanceTests.java
@@ -10,7 +10,6 @@
*******************************************************************/
package org.aspectj.systemtest.incremental.tools;
-import java.io.File;
import java.io.IOException;
import org.aspectj.ajde.core.ICompilerConfiguration;
@@ -168,8 +167,4 @@ public class IncrementalPerformanceTests extends AbstractMultiProjectIncremental
testdataSrcDir = "../tests/multiIncremental";
}
- private File getProjectRelativePath(String p, String filename) {
- File projDir = new File(getWorkingDir(), p);
- return new File(projDir, filename);
- }
} \ No newline at end of file
diff --git a/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java b/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java
index 71d5d876f..8c37e68d8 100644
--- a/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java
+++ b/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java
@@ -67,6 +67,19 @@ import org.aspectj.weaver.World;
*/
public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementalAjdeInteractionTestbed {
+ public void testIncremental_344326() throws Exception {
+ AjdeInteractionTestbed.VERBOSE = true;
+ String p = "pr344326";
+ initialiseProject(p);
+ build(p);
+ checkWasFullBuild();
+ checkCompileWeaveCount(p, 3, 4);
+ alter(p, "inc1");
+ build(p);
+ checkWasntFullBuild();
+ checkCompileWeaveCount(p, 1, 1);
+ }
+
public void testMissingRel_328121() throws Exception {
String p = "pr328121";
initialiseProject(p);
@@ -74,10 +87,10 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa
checkWasFullBuild();
assertNoErrors(p);
// Check the annotations:
- runMethod(p,"TestRequirements.TestRequirements","foo");
- assertEquals(4,getRelationshipCount(p));
+ runMethod(p, "TestRequirements.TestRequirements", "foo");
+ assertEquals(4, getRelationshipCount(p));
}
-
+
public void testEncoding_pr290741() throws Exception {
String p = "pr290741";
initialiseProject(p);
@@ -275,27 +288,31 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa
String lib = "pr343001_lib";
initialiseProject(lib);
build(lib);
-
- // Check the 'standard build' - the library also has a type affected by the decp so we can check what happens on an 'all source' build
- IProgramElement theAspect = getModelFor(lib).getHierarchy().findElementForHandleOrCreate("=pr343001_lib<{Super.java'Super",false);
+
+ // Check the 'standard build' - the library also has a type affected by the decp so we can check what happens on an 'all
+ // source' build
+ IProgramElement theAspect = getModelFor(lib).getHierarchy().findElementForHandleOrCreate("=pr343001_lib<{Super.java'Super",
+ false);
assertNotNull(theAspect);
- IProgramElement sourcelevelDecp = getModelFor(lib).getHierarchy().findElementForHandleOrCreate("=pr343001_lib<{Super.java'Super`declare parents",false);
+ IProgramElement sourcelevelDecp = getModelFor(lib).getHierarchy().findElementForHandleOrCreate(
+ "=pr343001_lib<{Super.java'Super`declare parents", false);
assertNotNull(sourcelevelDecp);
- assertEquals("[java.io.Serializable]",sourcelevelDecp.getParentTypes().toString());
-
+ assertEquals("[java.io.Serializable]", sourcelevelDecp.getParentTypes().toString());
+
String p = "pr343001";
initialiseProject(p);
configureAspectPath(p, getProjectRelativePath(lib, "bin"));
build(p);
-
- IProgramElement theBinaryAspect = getModelFor(p).getHierarchy().findElementForHandleOrCreate("=pr343001/binaries<(Super.class'Super",false);
+
+ IProgramElement theBinaryAspect = getModelFor(p).getHierarchy().findElementForHandleOrCreate(
+ "=pr343001/binaries<(Super.class'Super", false);
assertNotNull(theBinaryAspect);
- IProgramElement binaryDecp = getModelFor(p).getHierarchy().findElementForHandleOrCreate("=pr343001/binaries<(Super.class'Super`declare parents",false);
+ IProgramElement binaryDecp = getModelFor(p).getHierarchy().findElementForHandleOrCreate(
+ "=pr343001/binaries<(Super.class'Super`declare parents", false);
assertNotNull(binaryDecp);
- assertEquals("[java.io.Serializable]",(binaryDecp.getParentTypes()==null?"":binaryDecp.getParentTypes().toString()));
+ assertEquals("[java.io.Serializable]", (binaryDecp.getParentTypes() == null ? "" : binaryDecp.getParentTypes().toString()));
}
-
// found whilst looking at 322446 hence that is the testdata name
public void testAspectInheritance_322664() throws Exception {
AjdeInteractionTestbed.VERBOSE = true;
@@ -4000,11 +4017,6 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa
}
}
- private File getProjectRelativePath(String p, String filename) {
- File projDir = new File(getWorkingDir(), p);
- return new File(projDir, filename);
- }
-
protected File getProjectOutputRelativePath(String p, String filename) {
File projDir = new File(getWorkingDir(), p);
return new File(projDir, "bin" + File.separator + filename);