From edb41e385f232f7aebe1f6517d9a201221175a55 Mon Sep 17 00:00:00 2001 From: Andy Clement Date: Tue, 5 Feb 2013 11:14:40 -0800 Subject: [PATCH] 391384: fix --- .../src/org/aspectj/weaver/WeaverMessages.java | 2 ++ .../patterns/WildAnnotationTypePattern.java | 4 ++-- .../aspectj/weaver/weaver-messages.properties | 1 + tests/bugs172/pr391384/Code.java | 17 +++++++++++++++++ .../aspectj/systemtest/ajc172/Ajc172Tests.java | 4 ++++ .../org/aspectj/systemtest/ajc172/ajc172.xml | 6 ++++++ 6 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 tests/bugs172/pr391384/Code.java diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/WeaverMessages.java b/org.aspectj.matcher/src/org/aspectj/weaver/WeaverMessages.java index d4a8f4c7f..736220cd2 100644 --- a/org.aspectj.matcher/src/org/aspectj/weaver/WeaverMessages.java +++ b/org.aspectj.matcher/src/org/aspectj/weaver/WeaverMessages.java @@ -141,6 +141,8 @@ public class WeaverMessages { public static final String CANT_DECP_TO_MAKE_ANNOTATION_SUPERTYPE = "cantDecpToMakeAnnotationSupertype"; public static final String REFERENCE_TO_NON_ANNOTATION_TYPE = "referenceToNonAnnotationType"; public static final String BINDING_NON_RUNTIME_RETENTION_ANNOTATION = "bindingNonRuntimeRetentionAnnotation"; + + public static final String UNSUPPORTED_ANNOTATION_VALUE_TYPE = "unsupportedAnnotationValueType"; public static final String INCORRECT_TARGET_FOR_DECLARE_ANNOTATION = "incorrectTargetForDeclareAnnotation"; public static final String NO_MATCH_BECAUSE_SOURCE_RETENTION = "noMatchBecauseSourceRetention"; diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/WildAnnotationTypePattern.java b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/WildAnnotationTypePattern.java index 62dd896ee..c08073580 100644 --- a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/WildAnnotationTypePattern.java +++ b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/WildAnnotationTypePattern.java @@ -228,8 +228,8 @@ public class WildAnnotationTypePattern extends AnnotationTypePattern { replacementValues.put(k, rt.getSignature()); break; } else { - throw new RuntimeException("Compiler limitation: annotation value support not implemented for type " - + t); + scope.message(MessageUtil.error(WeaverMessages.format(WeaverMessages.UNSUPPORTED_ANNOTATION_VALUE_TYPE,t), getSourceLocation())); + replacementValues.put(k,""); } } } diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/weaver-messages.properties b/org.aspectj.matcher/src/org/aspectj/weaver/weaver-messages.properties index 3657964f1..f47b3e38b 100644 --- a/org.aspectj.matcher/src/org/aspectj/weaver/weaver-messages.properties +++ b/org.aspectj.matcher/src/org/aspectj/weaver/weaver-messages.properties @@ -111,6 +111,7 @@ noAroundOnSynchronization=Around advice is not supported on the lock and unlock aroundOnPreInit=around on pre-initialization not supported (compiler limitation) aroundOnInit=around on initialization not supported (compiler limitation) aroundOnInterfaceStaticInit=around on staticinitialization of interface ''{0}'' not supported (compiler limitation) +unsupportedAnnotationValueType=Compiler limitation: annotation value support not implemented for type {0} # Bytecode generation nasties... problemGeneratingMethod=problem generating method {0}.{1} : {2} diff --git a/tests/bugs172/pr391384/Code.java b/tests/bugs172/pr391384/Code.java new file mode 100644 index 000000000..e213586f4 --- /dev/null +++ b/tests/bugs172/pr391384/Code.java @@ -0,0 +1,17 @@ +import java.lang.annotation.*; + +@Retention(RetentionPolicy.RUNTIME) +@interface Anno { + String[] value(); +} + +aspect Code { + + @Anno({"xyz","abc"}) + public void m() {} + + pointcut p(): execution(public * @Anno(value="xyz=abc") *..*(..)); + + before() : p() { } + +} diff --git a/tests/src/org/aspectj/systemtest/ajc172/Ajc172Tests.java b/tests/src/org/aspectj/systemtest/ajc172/Ajc172Tests.java index 059faf8a5..083c56caf 100644 --- a/tests/src/org/aspectj/systemtest/ajc172/Ajc172Tests.java +++ b/tests/src/org/aspectj/systemtest/ajc172/Ajc172Tests.java @@ -23,6 +23,10 @@ import org.aspectj.testing.XMLBasedAjcTestCase; */ public class Ajc172Tests extends org.aspectj.testing.XMLBasedAjcTestCase { + public void testUnsupportedShouldBeNormalError_pr391384() { + runTest("unsupported should be normal error"); + } + // if the test is failing because the classes won't run, remove the run blocks from the ajc172.xml entry and re-run to check signatures. public void testSignatures_pr394535() throws Exception { runTest("signatures"); diff --git a/tests/src/org/aspectj/systemtest/ajc172/ajc172.xml b/tests/src/org/aspectj/systemtest/ajc172/ajc172.xml index 5c0739fb2..0393ce54d 100644 --- a/tests/src/org/aspectj/systemtest/ajc172/ajc172.xml +++ b/tests/src/org/aspectj/systemtest/ajc172/ajc172.xml @@ -2,6 +2,12 @@ + + + + + + -- 2.39.5