]> source.dussan.org Git - aspectj.git/commitdiff
tests and fix for pr108826, not correctly converting from T[] to ResolvedType.
authoracolyer <acolyer>
Fri, 9 Sep 2005 14:19:19 +0000 (14:19 +0000)
committeracolyer <acolyer>
Fri, 9 Sep 2005 14:19:19 +0000 (14:19 +0000)
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseFactory.java
tests/bugs150/pr106874.aj [new file with mode: 0644]
tests/bugs150/pr108826.aj [new file with mode: 0644]
tests/pr108826.aj [new file with mode: 0644]
tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java
tests/src/org/aspectj/systemtest/ajc150/ajc150.xml

index de3f7b0283a797d20dc8c57c179a76c8f9c977ee..406542ec13f8db499c3bd3c6f2c3e0a98471ee22 100644 (file)
@@ -36,6 +36,7 @@ import org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
 import org.aspectj.org.eclipse.jdt.internal.compiler.ast.Wildcard;
 import org.aspectj.org.eclipse.jdt.internal.compiler.impl.Constant;
 import org.aspectj.org.eclipse.jdt.internal.compiler.impl.ReferenceContext;
+import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ArrayBinding;
 import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.BaseTypes;
 import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.Binding;
 import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.FieldBinding;
@@ -199,6 +200,12 @@ public class EclipseFactory {
                        return fromTypeVariableBinding((TypeVariableBinding)binding);
                }
                
+               // handle arrays since the component type may need special treatment too...
+               if (binding instanceof ArrayBinding) {
+                       ArrayBinding aBinding = (ArrayBinding) binding;
+                       UnresolvedType componentType = fromBinding(aBinding.leafComponentType);
+                       return UnresolvedType.makeArray(componentType, aBinding.dimensions);
+               }
                
                if (binding instanceof WildcardBinding) {
                        WildcardBinding eWB = (WildcardBinding) binding;
diff --git a/tests/bugs150/pr106874.aj b/tests/bugs150/pr106874.aj
new file mode 100644 (file)
index 0000000..94bcb15
--- /dev/null
@@ -0,0 +1,24 @@
+public class pr106874 {
+  class Inner { // works if static
+    private Integer field;
+    void bug() {
+      field = new Integer(0);
+    }
+  }
+
+  public static void main(String[] args) {
+    new pr106874().new Inner().bug();
+  }
+}
+
+aspect Aspect {
+  before(Object t) :
+    // target(Object) && // works
+    // this(t) && // works
+    target(t) && // fails
+    // set(* Bug.Inner.field) // works
+    // set(Integer Bug.Inner.*) // works
+    // get(* Bug.Inner.*) // works
+    set(* pr106874.Inner.*) // fails
+  {}
+}
\ No newline at end of file
diff --git a/tests/bugs150/pr108826.aj b/tests/bugs150/pr108826.aj
new file mode 100644 (file)
index 0000000..4ddf145
--- /dev/null
@@ -0,0 +1,5 @@
+class CantFindType {
+    public <T> T[] method(T[] array) {
+        return null;
+    }
+}
diff --git a/tests/pr108826.aj b/tests/pr108826.aj
new file mode 100644 (file)
index 0000000..e69de29
index 08dba80f33491a723cef1d7afbfece0417693e30..ca3e41eee56ae1d15e73ecbee04c90941ccdd3c8 100644 (file)
@@ -413,6 +413,10 @@ public class Ajc150Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
   public void testNoVerifyErrorWithSetOnInnerType() {
          runTest("no verify error with set on inner type");
   }
+  
+  public void testCantFindTypeErrorWithGenericReturnTypeOrParameter() {
+         runTest("cant find type error with generic return type or parameter");
+  }
   // helper methods.....
   
   public SyntheticRepository createRepos(File cpentry) {
index b8ba23212feb961ce5ac32813aa230b9fe81838c..49c4681127c38c2ddb9942d439b5b2c383f3f9af 100644 (file)
         <compile files="VerifyErrorOnSet.aj" options="-1.5" >
         </compile>
         <run class="test.VerifyErrorOnSet"/>
+        <compile files="pr106874.aj" options="-1.5" >
+        </compile>
+        <run class="pr106874"/>    
     </ajc-test>  
         
-    
+    <ajc-test dir="bugs150" pr="108826" title="cant find type error with generic return type or parameter">
+        <compile files="pr108826.aj" options="-1.5 -emacssym" >
+        </compile>
+    </ajc-test> 
     <!-- ============================================================================ -->
     <!-- ============================================================================ -->