From f2cd94f88a9976fc98786955a764522a8ccb37f1 Mon Sep 17 00:00:00 2001 From: aclement Date: Thu, 16 Mar 2006 11:01:54 +0000 Subject: [PATCH] test and fix for 131933 --- tests/bugs151/pr131933.aj | 11 +++++++++++ .../org/aspectj/systemtest/ajc151/Ajc151Tests.java | 5 +++++ tests/src/org/aspectj/systemtest/ajc151/ajc151.xml | 7 +++++++ .../src/org/aspectj/weaver/patterns/TypePattern.java | 3 +-- 4 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 tests/bugs151/pr131933.aj diff --git a/tests/bugs151/pr131933.aj b/tests/bugs151/pr131933.aj new file mode 100644 index 000000000..a374c13af --- /dev/null +++ b/tests/bugs151/pr131933.aj @@ -0,0 +1,11 @@ +import java.util.List; + +aspect Slide71 { + before(): GenericType.foo() {} + before(): GenericType.foo() {} + //before(): GenericType.foo() {} +} + +class GenericType { + public pointcut foo(): execution(* T.*(..)); +} diff --git a/tests/src/org/aspectj/systemtest/ajc151/Ajc151Tests.java b/tests/src/org/aspectj/systemtest/ajc151/Ajc151Tests.java index 49ccd33c5..c431e763a 100644 --- a/tests/src/org/aspectj/systemtest/ajc151/Ajc151Tests.java +++ b/tests/src/org/aspectj/systemtest/ajc151/Ajc151Tests.java @@ -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 */ diff --git a/tests/src/org/aspectj/systemtest/ajc151/ajc151.xml b/tests/src/org/aspectj/systemtest/ajc151/ajc151.xml index f935c4da9..129c1b434 100644 --- a/tests/src/org/aspectj/systemtest/ajc151/ajc151.xml +++ b/tests/src/org/aspectj/systemtest/ajc151/ajc151.xml @@ -246,6 +246,13 @@ + + + + + + + diff --git a/weaver/src/org/aspectj/weaver/patterns/TypePattern.java b/weaver/src/org/aspectj/weaver/patterns/TypePattern.java index 3098f05de..671adcf94 100644 --- a/weaver/src/org/aspectj/weaver/patterns/TypePattern.java +++ b/weaver/src/org/aspectj/weaver/patterns/TypePattern.java @@ -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(); } -- 2.39.5