]> source.dussan.org Git - aspectj.git/commitdiff
256937: test and fix
authoraclement <aclement>
Fri, 28 Nov 2008 20:44:35 +0000 (20:44 +0000)
committeraclement <aclement>
Fri, 28 Nov 2008 20:44:35 +0000 (20:44 +0000)
tests/bugs163/pr256937/Ship.java [new file with mode: 0644]
tests/bugs163/pr256937/ShipAccessor.java [new file with mode: 0644]
tests/src/org/aspectj/systemtest/ajc163/Ajc163Tests.java
tests/src/org/aspectj/systemtest/ajc163/ajc163.xml

diff --git a/tests/bugs163/pr256937/Ship.java b/tests/bugs163/pr256937/Ship.java
new file mode 100644 (file)
index 0000000..866271b
--- /dev/null
@@ -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 (file)
index 0000000..c1f0e52
--- /dev/null
@@ -0,0 +1,14 @@
+public privileged aspect ShipAccessor {
+
+
+
+
+
+
+
+
+              public java.util.List<String> Ship.h() {
+                                     return null;
+                                            }
+}
+
index 6107200dfb880ec40ad834401c070465ebc45a21..48b904560e9e71130227d08c571e244d820f9b6a 100644 (file)
@@ -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");
        }
index ac29d0aa348aa5e51b60efcc6d3b1fd12e8a2de7..a35e25473747fb0d8dd5d3cba02e66d6c458aa73 100644 (file)
@@ -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"/>