Browse Source

test and fix for 131933

tags/V1_5_1_final
aclement 18 years ago
parent
commit
f2cd94f88a

+ 11
- 0
tests/bugs151/pr131933.aj View File

@@ -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.*(..));
}

+ 5
- 0
tests/src/org/aspectj/systemtest/ajc151/Ajc151Tests.java View 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
*/

+ 7
- 0
tests/src/org/aspectj/systemtest/ajc151/ajc151.xml View File

@@ -246,6 +246,13 @@
</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">

+ 1
- 2
weaver/src/org/aspectj/weaver/patterns/TypePattern.java View 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();
}

Loading…
Cancel
Save