aboutsummaryrefslogtreecommitdiffstats
path: root/tests/src/org
diff options
context:
space:
mode:
authoraclement <aclement>2006-08-25 12:37:49 +0000
committeraclement <aclement>2006-08-25 12:37:49 +0000
commit07e6e9a1767c860b483540ac165108983dc1e1f4 (patch)
treefd180b83ddb86ca9637df6afd9b1d75bb7c1a4a3 /tests/src/org
parent5787d0e82f32648f30f4677c13aef68d4615e300 (diff)
downloadaspectj-07e6e9a1767c860b483540ac165108983dc1e1f4.tar.gz
aspectj-07e6e9a1767c860b483540ac165108983dc1e1f4.zip
last of the dreaded jdtlikehandleprovider changes - 141730#22
Diffstat (limited to 'tests/src/org')
-rw-r--r--tests/src/org/aspectj/systemtest/ajc153/JDTLikeHandleProviderTests.java75
-rw-r--r--tests/src/org/aspectj/systemtest/ajc153/jdtlikehandleprovider.xml20
-rw-r--r--tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java9
3 files changed, 102 insertions, 2 deletions
diff --git a/tests/src/org/aspectj/systemtest/ajc153/JDTLikeHandleProviderTests.java b/tests/src/org/aspectj/systemtest/ajc153/JDTLikeHandleProviderTests.java
index 0e6b70166..4dd33640e 100644
--- a/tests/src/org/aspectj/systemtest/ajc153/JDTLikeHandleProviderTests.java
+++ b/tests/src/org/aspectj/systemtest/ajc153/JDTLikeHandleProviderTests.java
@@ -240,6 +240,81 @@ public class JDTLikeHandleProviderTests extends XMLBasedAjcTestCase {
"*DeclareWarnings.aj}DeclareWarnings`declare warning!10");
}
+
+ // these two handles are the same unless we have added a counter
+ // on the end
+ public void testIPEsWithSameNameHaveUniqueHandles_methodCall() {
+ runTest("ipes with same name have unique handles - method-call");
+ IHierarchy top = AsmManager.getDefault().getHierarchy();
+ String handle1 = "*TwoMethodCalls.aj[Main~main~\\[QString;?method-call(" +
+ "void java.io.PrintStream.println(java.lang.String))";
+ assertNotNull("expected to find node with handle " + handle1
+ + ", but did not",top.getElement(handle1));
+
+ String handle2 = "*TwoMethodCalls.aj[Main~main~\\[QString;?method-call(" +
+ "void java.io.PrintStream.println(java.lang.String))!2";
+ assertNotNull("expected to find node with handle " + handle2
+ + ", but did not",top.getElement(handle2));
+
+ String handle3 = "*TwoMethodCalls.aj[Main~main~\\[QString;?method-call(" +
+ "void java.io.PrintStream.println(java.lang.String))!3";
+ assertNull("expected not to find node with handle " + handle3
+ + ", but found one",top.getElement(handle3));
+ }
+
+ // these two handles should be different anyway so second one
+ // shouldn't have the "2"
+ public void testIPEsWithDiffNamesDontHaveCounter_methodCall() {
+ runTest("ipes with different names do not have counter - method-call");
+ IHierarchy top = AsmManager.getDefault().getHierarchy();
+ String handle1 = "*TwoDiffMethodCalls.aj[Main~main~\\[QString;?method-call(" +
+ "void java.io.PrintStream.println(java.lang.String))";
+ assertNotNull("expected to find node with handle " + handle1
+ + ", but did not",top.getElement(handle1));
+
+ String handle2 = "*TwoDiffMethodCalls.aj[Main~method~\\[QString;?method-call(" +
+ "void java.io.PrintStream.println(java.lang.String))";
+ assertNotNull("expected to find node with handle " + handle2
+ + ", but did not",top.getElement(handle2));
+ }
+
+ public void testIPEsWithSameNameHaveUniqueHandles_handler() {
+ runTest("ipes with same name have unique handles - handler");
+ IHierarchy top = AsmManager.getDefault().getHierarchy();
+ String handle1 = "*Handler.aj[C~method?exception-handler(void C." +
+ "<catch>(java.io.FileNotFoundException))";
+ assertNotNull("expected to find node with handle " + handle1
+ + ", but did not",top.getElement(handle1));
+
+ String handle2 = "*Handler.aj[C~method?exception-handler(void C." +
+ "<catch>(java.io.FileNotFoundException))!2";
+ assertNotNull("expected to find node with handle " + handle2
+ + ", but did not",top.getElement(handle2));
+ }
+
+ public void testIPEsWithSameNameHaveUniqueHandles_get() {
+ runTest("ipes with same name have unique handles - get");
+ IHierarchy top = AsmManager.getDefault().getHierarchy();
+ String handle1 = "*Get.aj[C1~method1?field-get(int C1.x)";
+ assertNotNull("expected to find node with handle " + handle1
+ + ", but did not",top.getElement(handle1));
+
+ String handle2 = "*Get.aj[C1~method1?field-get(int C1.x)!2";
+ assertNotNull("expected to find node with handle " + handle2
+ + ", but did not",top.getElement(handle2));
+ }
+
+ public void testIPEsWithSameNameHaveUniqueHandles_set() {
+ runTest("ipes with same name have unique handles - set");
+ IHierarchy top = AsmManager.getDefault().getHierarchy();
+ String handle1 = "*Set.aj[C1~method?field-set(int C1.x)";
+ assertNotNull("expected to find node with handle " + handle1
+ + ", but did not",top.getElement(handle1));
+
+ String handle2 = "*Set.aj[C1~method?field-set(int C1.x)!2";
+ assertNotNull("expected to find node with handle " + handle2
+ + ", but did not",top.getElement(handle2));
+ }
//---------- following tests ensure we produce the same handles as jdt -----//
//---------- (apart from the prefix)
diff --git a/tests/src/org/aspectj/systemtest/ajc153/jdtlikehandleprovider.xml b/tests/src/org/aspectj/systemtest/ajc153/jdtlikehandleprovider.xml
index ba52be4d3..3d0172e0a 100644
--- a/tests/src/org/aspectj/systemtest/ajc153/jdtlikehandleprovider.xml
+++ b/tests/src/org/aspectj/systemtest/ajc153/jdtlikehandleprovider.xml
@@ -208,4 +208,24 @@
<compile files="Java5Class.java" options="-emacssym -1.5"/>
</ajc-test>
+ <ajc-test dir="features153/jdtlikehandleprovider" title="ipes with same name have unique handles - method-call">
+ <compile files="TwoMethodCalls.aj" options="-emacssym"/>
+ </ajc-test>
+
+ <ajc-test dir="features153/jdtlikehandleprovider" title="ipes with different names do not have counter - method-call">
+ <compile files="TwoDiffMethodCalls.aj" options="-emacssym"/>
+ </ajc-test>
+
+ <ajc-test dir="features153/jdtlikehandleprovider" title="ipes with same name have unique handles - handler">
+ <compile files="Handler.aj" options="-emacssym"/>
+ </ajc-test>
+
+ <ajc-test dir="features153/jdtlikehandleprovider" title="ipes with same name have unique handles - get">
+ <compile files="Get.aj" options="-emacssym"/>
+ </ajc-test>
+
+ <ajc-test dir="features153/jdtlikehandleprovider" title="ipes with same name have unique handles - set">
+ <compile files="Set.aj" options="-emacssym"/>
+ </ajc-test>
+
</suite>
diff --git a/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java b/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java
index 84145e176..43c4bf3a5 100644
--- a/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java
+++ b/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java
@@ -1494,7 +1494,12 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa
warnings.isEmpty());
alter("PR152589","inc1");
build("PR152589");
- checkWasFullBuild();
+ if (AsmManager.getDefault().getHandleProvider().dependsOnLocation())
+ checkWasFullBuild(); // the line number has changed... but nothing structural about the code
+ else
+ checkWasntFullBuild(); // the line number has changed... but nothing structural about the code
+
+// checkWasFullBuild();
warnings = MyTaskListManager.getWarningMessages();
assertTrue("There should be no warnings after adding a whitespace:\n"
+warnings,warnings.isEmpty());
@@ -1698,4 +1703,4 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa
return new File(projDir,"bin"+File.separator+filename);
}
-}
+} \ No newline at end of file