diff options
author | jhugunin <jhugunin> | 2003-08-04 21:04:49 +0000 |
---|---|---|
committer | jhugunin <jhugunin> | 2003-08-04 21:04:49 +0000 |
commit | 29457c3d6d0b4cd7cca1d2867e6bd80a56a24722 (patch) | |
tree | 39c61e209f18d80a32c50220199ffcd75e4f237b | |
parent | 57445dd3ec8a67d06f16fe02e7c0eaefb8ea4051 (diff) | |
download | aspectj-29457c3d6d0b4cd7cca1d2867e6bd80a56a24722.tar.gz aspectj-29457c3d6d0b4cd7cca1d2867e6bd80a56a24722.zip |
fixes for Bugzilla Bug 40858
super-qualified pointcut reference cause weaver stack trace
and Bugzilla Bug 40814
no error when defining interface pointcuts
-rw-r--r-- | org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/PointcutDeclaration.java | 22 | ||||
-rw-r--r-- | tests/ajcTests.xml | 22 | ||||
-rw-r--r-- | tests/ajcTestsFailing.xml | 23 | ||||
-rw-r--r-- | tests/bugs/AbstractPointcutCE.java | 16 | ||||
-rw-r--r-- | tests/bugs/InterfacePointcutCE.java | 7 | ||||
-rw-r--r-- | tests/bugs/SuperPointcutCE.java | 4 | ||||
-rw-r--r-- | weaver/src/org/aspectj/weaver/patterns/ReferencePointcut.java | 2 |
7 files changed, 63 insertions, 33 deletions
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/PointcutDeclaration.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/PointcutDeclaration.java index 9579cc87e..b987c418b 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/PointcutDeclaration.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/PointcutDeclaration.java @@ -19,6 +19,8 @@ import org.aspectj.ajdt.internal.compiler.lookup.EclipseFactory; import org.aspectj.ajdt.internal.core.builder.EclipseSourceContext; import org.aspectj.weaver.AjAttribute; import org.aspectj.weaver.ResolvedPointcutDefinition; +import org.aspectj.weaver.ResolvedTypeX; +import org.aspectj.weaver.TypeX; import org.aspectj.weaver.patterns.Pointcut; import org.eclipse.jdt.internal.compiler.ClassFile; import org.eclipse.jdt.internal.compiler.CompilationResult; @@ -72,8 +74,20 @@ public class PointcutDeclaration extends MethodDeclaration { this.declaredName = new String(selector); selector = CharOperation.concat(mangledPrefix, '$', selector, '$', Integer.toHexString(sourceStart).toCharArray()); - if (pointcutDesignator == null) return; //XXX - pointcutDesignator.postParse(typeDec, this); + + if (Modifier.isAbstract(this.declaredModifiers) && + !(typeDec instanceof AspectDeclaration)) + { + typeDec.scope.problemReporter().signalError(sourceStart, sourceEnd, + "The abstract pointcut " + new String(declaredName) + + " can only be defined in an aspect"); + ignoreFurtherInvestigation = true; + return; + } + + if (pointcutDesignator != null) { + pointcutDesignator.postParse(typeDec, this); + } } public void resolveStatements() { @@ -86,7 +100,9 @@ public class PointcutDeclaration extends MethodDeclaration { if (Modifier.isAbstract(this.declaredModifiers)&& (pointcutDesignator != null)) { scope.problemReporter().signalError(sourceStart, sourceEnd, "abstract pointcut can't have body"); - } + ignoreFurtherInvestigation = true; + return; + } if (pointcutDesignator != null) { pointcutDesignator.finishResolveTypes(this, this.binding, arguments.length, diff --git a/tests/ajcTests.xml b/tests/ajcTests.xml index 0058ddf2c..d6ae4b455 100644 --- a/tests/ajcTests.xml +++ b/tests/ajcTests.xml @@ -6477,5 +6477,27 @@ <compile files="PointcutLibraryTest.java"/> <run class="PointcutLibraryTest"/> </ajc-test> + + <ajc-test dir="bugs" + pr="40858" + comment="super is not permitted in pointcuts in 1.1" + title="weaver trace on mis-qualified pointcut reference"> + <compile files="SuperPointcutCE.java"> + <message kind="error" line="23"/> + <message kind="error" line="26"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs" + pr="40814" + title="compile error expected for interface pointcuts"> + <compile files="AbstractPointcutCE.java"> + <message kind="error" line="7"/> + <message kind="error" line="11"/> + <message kind="error" line="15"/> + </compile> + </ajc-test> + + </suite> diff --git a/tests/ajcTestsFailing.xml b/tests/ajcTestsFailing.xml index 2ac4c8bbe..f1fd611a1 100644 --- a/tests/ajcTestsFailing.xml +++ b/tests/ajcTestsFailing.xml @@ -5,24 +5,6 @@ <suite> <ajc-test dir="bugs" - pr="40858" - comment="shouldn't super ref be permitted?" - title="weaver trace on mis-qualified pointcut reference"> - <compile files="SuperPointcutCE.java"> - <message kind="error" line="26"/> - </compile> - </ajc-test> - - <ajc-test dir="bugs" - pr="40814" - title="compile error expected for interface pointcuts"> - <compile files="InterfacePointcutCE.java"> - <message kind="error" line="5"/> - <message kind="error" line="6"/> - </compile> - </ajc-test> - - <ajc-test dir="bugs" pr="40805" title="interface call signatures when declaring method in aspect"> <compile files="DeclareWarningAndInterfaceMethodCW.java"> @@ -36,7 +18,6 @@ <message kind="warning" line="35" text="call ICanGetSomething.getSomething"/> <message kind="warning" line="38" text="call getSomething"/> <message kind="warning" line="38" text="call ICanGetSomething.getSomething"/> - </compile> - </ajc-test> - + </compile> + </ajc-test> </suite> diff --git a/tests/bugs/AbstractPointcutCE.java b/tests/bugs/AbstractPointcutCE.java new file mode 100644 index 000000000..898a72b0a --- /dev/null +++ b/tests/bugs/AbstractPointcutCE.java @@ -0,0 +1,16 @@ + + +/** @testcase PR#40814 compile error expected for pointcuts in interfaces + * revised to check for error on abstract pointcuts in interfaces or classes + **/ +interface I { + abstract pointcut pc(); // CE +} + +abstract class C { + abstract pointcut pc(); // CE +} + +class Concrete { + abstract pointcut pc(); // CE +} diff --git a/tests/bugs/InterfacePointcutCE.java b/tests/bugs/InterfacePointcutCE.java deleted file mode 100644 index 49bcd33de..000000000 --- a/tests/bugs/InterfacePointcutCE.java +++ /dev/null @@ -1,7 +0,0 @@ - - -/** @testcase PR#40814 compile error expected for pointcuts in interfaces */ -interface I { - abstract pointcut pc(); // CE - pointcut publicCalls() : call(public * *(..)) || call(public new(..)); // CE -}
\ No newline at end of file diff --git a/tests/bugs/SuperPointcutCE.java b/tests/bugs/SuperPointcutCE.java index 7231fb00e..be6111e16 100644 --- a/tests/bugs/SuperPointcutCE.java +++ b/tests/bugs/SuperPointcutCE.java @@ -1,6 +1,6 @@ -public class MissingTypeSigatureCE { +public class SuperPointcutCE { public static void main(String[] a) { new C().run(); } @@ -20,7 +20,7 @@ abstract aspect AA { /** @testcase PR#40858 weaver trace on mis-qualified pointcut reference */ aspect B extends AA { - pointcut pc() : super.pc() + pointcut pc() : super.pc() // CE super not allowed in 1.1 && !call(void println(..)); pointcut blah() : UnknownType.pc(); // CE diff --git a/weaver/src/org/aspectj/weaver/patterns/ReferencePointcut.java b/weaver/src/org/aspectj/weaver/patterns/ReferencePointcut.java index 2d3291792..8c9d546f3 100644 --- a/weaver/src/org/aspectj/weaver/patterns/ReferencePointcut.java +++ b/weaver/src/org/aspectj/weaver/patterns/ReferencePointcut.java @@ -113,6 +113,8 @@ public class ReferencePointcut extends Pointcut { public void resolveBindings(IScope scope, Bindings bindings) { if (onTypeSymbolic != null) { onType = onTypeSymbolic.resolveExactType(scope, bindings); + // in this case we've already signalled an error + if (onType == ResolvedTypeX.MISSING) return; } ResolvedTypeX searchType; |