diff options
author | jhugunin <jhugunin> | 2003-03-12 23:37:01 +0000 |
---|---|---|
committer | jhugunin <jhugunin> | 2003-03-12 23:37:01 +0000 |
commit | 03448a7d4363abe6cd99da99a050fecef9cf8f72 (patch) | |
tree | 11e966fadcf97f0814ddf95b0d7fe4d9ba109353 | |
parent | d5731957188b6280e850cf2bbc238469244b6d86 (diff) | |
download | aspectj-03448a7d4363abe6cd99da99a050fecef9cf8f72.tar.gz aspectj-03448a7d4363abe6cd99da99a050fecef9cf8f72.zip |
fix for class not allowed to extend aspect and moving corresponding test out of failing
-rw-r--r-- | org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java | 9 | ||||
-rw-r--r-- | tests/ajcTests.xml | 7 | ||||
-rw-r--r-- | tests/ajcTestsFailing.xml | 8 | ||||
-rw-r--r-- | tests/jimTests.xml | 3 |
4 files changed, 17 insertions, 10 deletions
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java index 522b80197..797ae15c3 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java @@ -122,6 +122,15 @@ public class AjLookupEnvironment extends LookupEnvironment { } SourceTypeBinding sourceType = s.referenceContext.binding; + // test classes don't extend aspects + if (sourceType.superclass != null) { + ResolvedTypeX parent = factory.fromEclipse(sourceType.superclass); + if (parent.isAspect() && !(dec instanceof AspectDeclaration)) { + factory.showMessage(IMessage.ERROR, "class \'" + new String(sourceType.sourceName) + + "\' can not extend aspect \'" + parent.getName() + "\'", + factory.fromEclipse(sourceType).getSourceLocation(), null); + } + } ReferenceBinding[] memberTypes = sourceType.memberTypes; for (int i = 0, length = memberTypes.length; i < length; i++) { diff --git a/tests/ajcTests.xml b/tests/ajcTests.xml index 1e192ba8a..5f477a19b 100644 --- a/tests/ajcTests.xml +++ b/tests/ajcTests.xml @@ -5711,4 +5711,11 @@ <message kind="error" line="6"/> </compile> </ajc-test> + + <ajc-test dir="errors" keywords="error" + title="class extending abstract aspect"> + <compile files="ClassExtendingAbstractAspectCE.java"> + <message kind="error" line="20"/> + </compile> + </ajc-test> </suite> diff --git a/tests/ajcTestsFailing.xml b/tests/ajcTestsFailing.xml index 578f0aa75..30dfe9160 100644 --- a/tests/ajcTestsFailing.xml +++ b/tests/ajcTestsFailing.xml @@ -11,13 +11,6 @@ </compile> </ajc-test> - <ajc-test dir="errors" keywords="error" - title="class extending abstract aspect"> - <compile files="ClassExtendingAbstractAspectCE.java"> - <message kind="error" line="20"/> - </compile> - </ajc-test> - <ajc-test dir="incremental/stringliteral" title="incrementally change string size and wire in injar classes"> <compile staging="true" options="-incremental" @@ -43,6 +36,7 @@ before main packageOne.Main"/> </ajc-test> + <!-- The correct behavior of this case needs to be thought through --> <ajc-test dir="bugs" pr="34206" title="before():execution(new(..)) does not throw NoAspectBoundException"> <compile files="AspectInitError.java"/> diff --git a/tests/jimTests.xml b/tests/jimTests.xml index f4adb0f97..7c1c4af1f 100644 --- a/tests/jimTests.xml +++ b/tests/jimTests.xml @@ -1,9 +1,6 @@ <!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"> <suite> - - - <!-- <ajc-test dir="new" pr="885" |