]> source.dussan.org Git - aspectj.git/commitdiff
test and fix for 131933
authoraclement <aclement>
Thu, 16 Mar 2006 11:01:54 +0000 (11:01 +0000)
committeraclement <aclement>
Thu, 16 Mar 2006 11:01:54 +0000 (11:01 +0000)
tests/bugs151/pr131933.aj [new file with mode: 0644]
tests/src/org/aspectj/systemtest/ajc151/Ajc151Tests.java
tests/src/org/aspectj/systemtest/ajc151/ajc151.xml
weaver/src/org/aspectj/weaver/patterns/TypePattern.java

diff --git a/tests/bugs151/pr131933.aj b/tests/bugs151/pr131933.aj
new file mode 100644 (file)
index 0000000..a374c13
--- /dev/null
@@ -0,0 +1,11 @@
+import java.util.List;
+
+aspect Slide71 {
+        before(): GenericType<String>.foo() {}
+        before(): GenericType<MyList>.foo() {}
+        //before(): GenericType.foo() {}
+}
+
+class GenericType<T> {
+        public pointcut foo(): execution(* T.*(..));
+}
index 49ccd33c532faaf2445aaa148eed1418899dbc76..c431e763ad5bb4ae72b4a1c906b218c02e74a6dd 100644 (file)
@@ -107,6 +107,11 @@ public class Ajc151Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
   public void testSwallowedExceptionIgnored() {
          runTest("swallowed exceptions with xlint");
   }
+  
+  public void testGenericAspectWithUnknownType_pr131933() {
+         runTest("no ClassCastException with generic aspect and unknown type");
+  }
+  
   /*
    * @AspectJ bugs and enhancements
    */
index f935c4da92e5d880209fcd1ed647b5f65c973ae3..129c1b43495f7e2d43dbf80a70d21673a432aad5 100644 (file)
         </compile>
     </ajc-test>
 
+    <ajc-test dir="bugs151" title="no ClassCastException with generic aspect and unknown type">
+        <compile files="pr131933.aj" options="-1.5">
+          <message kind="error" line="5" text="can't bind type name 'MyList'"/>
+        </compile>
+    </ajc-test> 
+
+
     <!-- New features down here... when they arent big enough to have their own test file -->
     
     <ajc-test dir="features151/ptw" title="exposing withintype">
index 3098f05de9f1a259889f94f91418a484b2e6b28c..671adcf940e2c3e0ca4b453f6909905e3dbb0bb6 100644 (file)
@@ -188,8 +188,7 @@ public abstract class TypePattern extends PatternNode {
        
        public UnresolvedType resolveExactType(IScope scope, Bindings bindings) {
                TypePattern p = resolveBindings(scope, bindings, false, true);
-               if (p == NO) return ResolvedType.MISSING;
-               
+               if (!(p instanceof ExactTypePattern)) return ResolvedType.MISSING;
                return ((ExactTypePattern)p).getType();
        }