summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--aspectj5rt/java5-src/org/aspectj/lang/annotation/DeclareAnnotation.java31
-rw-r--r--docs/adk15ProgGuideDB/ataspectj.xml5
-rw-r--r--docs/adk15ProgGuideDB/ltw.xml6
-rw-r--r--tests/java5/ataspectj/ataspectj/SingletonAspectBindingsTest.java8
-rw-r--r--tests/src/org/aspectj/systemtest/ajc150/ataspectj/AtAjSyntaxTests.java4
-rw-r--r--weaver/src/org/aspectj/weaver/bcel/AtAjAttributes.java47
6 files changed, 74 insertions, 27 deletions
diff --git a/aspectj5rt/java5-src/org/aspectj/lang/annotation/DeclareAnnotation.java b/aspectj5rt/java5-src/org/aspectj/lang/annotation/DeclareAnnotation.java
new file mode 100644
index 000000000..ffecb91a2
--- /dev/null
+++ b/aspectj5rt/java5-src/org/aspectj/lang/annotation/DeclareAnnotation.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2005 Contributors.
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Alexandre Vasseur initial implementation
+ *******************************************************************************/
+package org.aspectj.lang.annotation;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import java.lang.annotation.ElementType;
+
+/**
+ * @author <a href="mailto:alex AT gnilux DOT com">Alexandre Vasseur</a>
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.TYPE, ElementType.FIELD, ElementType.METHOD, ElementType.CONSTRUCTOR})
+public @interface DeclareAnnotation {
+
+ /**
+ * pointcut (type pattern for type, or method/ctor/field signature pattern)
+ */
+ public String value();
+
+}
diff --git a/docs/adk15ProgGuideDB/ataspectj.xml b/docs/adk15ProgGuideDB/ataspectj.xml
index 37e48de06..717d5edb9 100644
--- a/docs/adk15ProgGuideDB/ataspectj.xml
+++ b/docs/adk15ProgGuideDB/ataspectj.xml
@@ -702,6 +702,11 @@
}
]]></programlisting>
+ <para>
+ Note: Declare annotation is not available in AspectJ 1.5 M3 and syntax might change
+ when it will be available.
+ </para>
+
<para>We also support annotation style declarations for declare warning and
declare error - any corresponding warnings and errors will be emitted at
weave time, not when the aspects containing the declarations are compiled.
diff --git a/docs/adk15ProgGuideDB/ltw.xml b/docs/adk15ProgGuideDB/ltw.xml
index e822a5d20..05aef43f6 100644
--- a/docs/adk15ProgGuideDB/ltw.xml
+++ b/docs/adk15ProgGuideDB/ltw.xml
@@ -186,7 +186,11 @@
auxiliary aspects where the pointcut definitions themselves can be
considered part of the configuration of the service.
</para>
-
+
+ <para>
+ Note: concrete-aspect is not available in AspectJ 1.5 M3.
+ </para>
+
<para>
The aspects element may optionally contain one or more include and
exclude elements (by default, all defined aspects are used for weaving).
diff --git a/tests/java5/ataspectj/ataspectj/SingletonAspectBindingsTest.java b/tests/java5/ataspectj/ataspectj/SingletonAspectBindingsTest.java
index d94d2af0a..c141e95b2 100644
--- a/tests/java5/ataspectj/ataspectj/SingletonAspectBindingsTest.java
+++ b/tests/java5/ataspectj/ataspectj/SingletonAspectBindingsTest.java
@@ -11,17 +11,11 @@
*******************************************************************************/
package ataspectj;
-import org.aspectj.lang.annotation.Before;
-import org.aspectj.lang.annotation.Aspect;
-import org.aspectj.lang.annotation.After;
-import org.aspectj.lang.annotation.Around;
+import org.aspectj.lang.annotation.*;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;
import junit.framework.TestCase;
-import java.io.File;
-import java.io.FileReader;
-
/**
* Test various advice and JoinPoint + binding, without pc ref
*
diff --git a/tests/src/org/aspectj/systemtest/ajc150/ataspectj/AtAjSyntaxTests.java b/tests/src/org/aspectj/systemtest/ajc150/ataspectj/AtAjSyntaxTests.java
index 8d3813021..0560e2fb5 100644
--- a/tests/src/org/aspectj/systemtest/ajc150/ataspectj/AtAjSyntaxTests.java
+++ b/tests/src/org/aspectj/systemtest/ajc150/ataspectj/AtAjSyntaxTests.java
@@ -41,11 +41,11 @@ public class AtAjSyntaxTests extends XMLBasedAjcTestCase {
public void testSingletonAspectBindings() {
//Note AV: uncomment setReporting to get it in modules/tests folder
- //org.aspectj.asm.AsmManager.setReporting("debug.txt",true,true,true,true);
+ org.aspectj.asm.AsmManager.setReporting("debug.txt",true,true,true,true);
runTest("singletonAspectBindings");
// same stuff with AJ
//org.aspectj.asm.AsmManager.setReporting("debug-aj.txt",true,true,true,true);
- runTest("singletonAspectBindings2");
+ //runTest("singletonAspectBindings2");
}
diff --git a/weaver/src/org/aspectj/weaver/bcel/AtAjAttributes.java b/weaver/src/org/aspectj/weaver/bcel/AtAjAttributes.java
index a7cc76df9..7f752210a 100644
--- a/weaver/src/org/aspectj/weaver/bcel/AtAjAttributes.java
+++ b/weaver/src/org/aspectj/weaver/bcel/AtAjAttributes.java
@@ -17,31 +17,18 @@ import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
-import org.aspectj.apache.bcel.classfile.Attribute;
-import org.aspectj.apache.bcel.classfile.Field;
-import org.aspectj.apache.bcel.classfile.JavaClass;
-import org.aspectj.apache.bcel.classfile.LocalVariable;
-import org.aspectj.apache.bcel.classfile.LocalVariableTable;
-import org.aspectj.apache.bcel.classfile.Method;
+import org.aspectj.apache.bcel.classfile.*;
import org.aspectj.apache.bcel.classfile.annotation.Annotation;
import org.aspectj.apache.bcel.classfile.annotation.ElementNameValuePair;
import org.aspectj.apache.bcel.classfile.annotation.RuntimeAnnotations;
import org.aspectj.apache.bcel.classfile.annotation.RuntimeVisibleAnnotations;
import org.aspectj.apache.bcel.generic.Type;
+import org.aspectj.apache.bcel.Constants;
import org.aspectj.bridge.IMessage;
import org.aspectj.bridge.IMessageHandler;
import org.aspectj.bridge.ISourceLocation;
import org.aspectj.bridge.Message;
-import org.aspectj.weaver.Advice;
-import org.aspectj.weaver.AdviceKind;
-import org.aspectj.weaver.AjAttribute;
-import org.aspectj.weaver.AjcMemberMaker;
-import org.aspectj.weaver.IHasPosition;
-import org.aspectj.weaver.ISourceContext;
-import org.aspectj.weaver.NameMangler;
-import org.aspectj.weaver.ResolvedPointcutDefinition;
-import org.aspectj.weaver.ResolvedType;
-import org.aspectj.weaver.UnresolvedType;
+import org.aspectj.weaver.*;
import org.aspectj.weaver.patterns.AndPointcut;
import org.aspectj.weaver.patterns.DeclareErrorOrWarning;
import org.aspectj.weaver.patterns.DeclarePrecedence;
@@ -171,7 +158,33 @@ public class AtAjAttributes {
* @param msgHandler
* @return list of AjAttributes
*/
- public static List readAj5ClassAttributes(JavaClass javaClass, ResolvedType type, ISourceContext context, IMessageHandler msgHandler, boolean isCodeStyleAspect) {
+ public static List readAj5ClassAttributes(JavaClass javaClass, ReferenceType type, ISourceContext context, IMessageHandler msgHandler, boolean isCodeStyleAspect) {
+ //FIXME AV - 1.5 M3 feature limitation, kick after M3 ships
+ try {
+ Constant[] cpool = javaClass.getConstantPool().getConstantPool();
+ for (int i = 0; i < cpool.length; i++) {
+ Constant constant = cpool[i];
+ if (constant != null && constant.getTag() == Constants.CONSTANT_Utf8) {
+ if (!javaClass.getClassName().startsWith("org.aspectj.lang.annotation")) {
+ ConstantUtf8 constantUtf8 = (ConstantUtf8) constant;
+ if ("Lorg/aspectj/lang/annotation/DeclareAnnotation;".equals(constantUtf8.getBytes())) {
+ msgHandler.handleMessage(
+ new Message(
+ "Found @DeclareAnnotation while current release does not support it (see '" + type.getName() + "')",
+ IMessage.WARNING,
+ null,
+ type.getSourceLocation()
+ )
+ );
+ }
+ }
+ }
+ }
+ } catch (Throwable t) {
+ ;
+ }
+
+
AjAttributeStruct struct = new AjAttributeStruct(type, context, msgHandler);
Attribute[] attributes = javaClass.getAttributes();
boolean hasAtAspectAnnotation = false;