aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authoraclement <aclement>2008-11-28 20:44:35 +0000
committeraclement <aclement>2008-11-28 20:44:35 +0000
commitee2a860fcdf78383350e33c2a1d16be814e30f83 (patch)
tree9aa1662affdf8131a98c93993fd5deecfa747d68 /tests
parent7cc89195decaf1f2b862f24872ee387973e76cac (diff)
downloadaspectj-ee2a860fcdf78383350e33c2a1d16be814e30f83.tar.gz
aspectj-ee2a860fcdf78383350e33c2a1d16be814e30f83.zip
256937: test and fix
Diffstat (limited to 'tests')
-rw-r--r--tests/bugs163/pr256937/Ship.java5
-rw-r--r--tests/bugs163/pr256937/ShipAccessor.java14
-rw-r--r--tests/src/org/aspectj/systemtest/ajc163/Ajc163Tests.java34
-rw-r--r--tests/src/org/aspectj/systemtest/ajc163/ajc163.xml4
4 files changed, 57 insertions, 0 deletions
diff --git a/tests/bugs163/pr256937/Ship.java b/tests/bugs163/pr256937/Ship.java
new file mode 100644
index 000000000..866271b22
--- /dev/null
+++ b/tests/bugs163/pr256937/Ship.java
@@ -0,0 +1,5 @@
+public class Ship {
+ public void moveTo(int newX, int newY) {
+ this.h();
+ }
+}
diff --git a/tests/bugs163/pr256937/ShipAccessor.java b/tests/bugs163/pr256937/ShipAccessor.java
new file mode 100644
index 000000000..c1f0e5280
--- /dev/null
+++ b/tests/bugs163/pr256937/ShipAccessor.java
@@ -0,0 +1,14 @@
+public privileged aspect ShipAccessor {
+
+
+
+
+
+
+
+
+ public java.util.List<String> Ship.h() {
+ return null;
+ }
+}
+
diff --git a/tests/src/org/aspectj/systemtest/ajc163/Ajc163Tests.java b/tests/src/org/aspectj/systemtest/ajc163/Ajc163Tests.java
index 6107200df..48b904560 100644
--- a/tests/src/org/aspectj/systemtest/ajc163/Ajc163Tests.java
+++ b/tests/src/org/aspectj/systemtest/ajc163/Ajc163Tests.java
@@ -11,6 +11,8 @@
package org.aspectj.systemtest.ajc163;
import java.io.File;
+import java.util.Iterator;
+import java.util.List;
import junit.framework.Test;
@@ -18,11 +20,43 @@ import org.aspectj.apache.bcel.classfile.JavaClass;
import org.aspectj.apache.bcel.classfile.LocalVariable;
import org.aspectj.apache.bcel.classfile.LocalVariableTable;
import org.aspectj.apache.bcel.classfile.Method;
+import org.aspectj.asm.AsmManager;
+import org.aspectj.asm.IHierarchy;
+import org.aspectj.asm.IProgramElement;
import org.aspectj.testing.Utils;
import org.aspectj.testing.XMLBasedAjcTestCase;
public class Ajc163Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
+ public void testFQType_pr256937() {
+ runTest("fully qualified return type");
+ IHierarchy top = AsmManager.lastActiveStructureModel.getHierarchy();
+ IProgramElement itd = findElementAtLine(top.getRoot(), 10);
+ String type = itd.getCorrespondingType(true);
+ assertEquals("java.util.List<java.lang.String>", type);
+ }
+
+ private IProgramElement findElementAtLine(IProgramElement whereToLook, int line) {
+ if (whereToLook == null) {
+ return null;
+ }
+ if (whereToLook.getSourceLocation() != null && whereToLook.getSourceLocation().getLine() == line) {
+ return whereToLook;
+ }
+ List kids = whereToLook.getChildren();
+ for (Iterator iterator = kids.iterator(); iterator.hasNext();) {
+ IProgramElement object = (IProgramElement) iterator.next();
+ if (object.getSourceLocation() != null && object.getSourceLocation().getLine() == line) {
+ return object;
+ }
+ IProgramElement gotSomething = findElementAtLine(object, line);
+ if (gotSomething != null) {
+ return gotSomething;
+ }
+ }
+ return null;
+ }
+
public void testParameterAnnotationsOnITDs_pr256669() { // regular itd
runTest("parameter annotations on ITDs");
}
diff --git a/tests/src/org/aspectj/systemtest/ajc163/ajc163.xml b/tests/src/org/aspectj/systemtest/ajc163/ajc163.xml
index ac29d0aa3..a35e25473 100644
--- a/tests/src/org/aspectj/systemtest/ajc163/ajc163.xml
+++ b/tests/src/org/aspectj/systemtest/ajc163/ajc163.xml
@@ -2,6 +2,10 @@
<suite>
+ <ajc-test dir="bugs163/pr256937" title="fully qualified return type">
+ <compile files="Ship.java ShipAccessor.java" options="-emacssym -1.5"/>
+ </ajc-test>
+
<ajc-test dir="bugs163/pr254207" title="ordering issue">
<compile files="Abstract.java Concrete.java" options="-1.5 -proceedOnError -Xset:pipelineCompilation=false">
<message kind="error" line="1" text="Bound mismatch"/>