diff options
author | aclement <aclement> | 2009-03-27 17:35:13 +0000 |
---|---|---|
committer | aclement <aclement> | 2009-03-27 17:35:13 +0000 |
commit | 2c0e14ac955fdea50dd5cf82baf186415d9a17c4 (patch) | |
tree | b825e38232decdb8c4e41a7fc1dbc338411cf577 | |
parent | 127e468b74f1c1a99ae1917f64b5f251c45c4520 (diff) | |
download | aspectj-2c0e14ac955fdea50dd5cf82baf186415d9a17c4.tar.gz aspectj-2c0e14ac955fdea50dd5cf82baf186415d9a17c4.zip |
269286: handles for anno style elements: less than optimal fix but need something quick
2 files changed, 18 insertions, 0 deletions
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AsmElementFormatter.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AsmElementFormatter.java index bbcb19957..789f4b9a9 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AsmElementFormatter.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AsmElementFormatter.java @@ -214,6 +214,7 @@ public class AsmElementFormatter { if (annotationSig.charAt(1) == 'o') { if ("Lorg/aspectj/lang/annotation/Pointcut;".equals(annotationSig)) { node.setKind(IProgramElement.Kind.POINTCUT); + node.setAnnotationStyleDeclaration(true); // pointcuts don't seem to get handled quite right... break; } else if ("Lorg/aspectj/lang/annotation/Before;".equals(annotationSig) || "Lorg/aspectj/lang/annotation/After;".equals(annotationSig) @@ -221,6 +222,7 @@ public class AsmElementFormatter { || "Lorg/aspectj/lang/annotation/AfterThrowing;".equals(annotationSig) || "Lorg/aspectj/lang/annotation/Around;".equals(annotationSig)) { node.setKind(IProgramElement.Kind.ADVICE); + node.setAnnotationStyleDeclaration(true); // TODO AV - all are considered anonymous - is that ok? node.setDetails(AsmRelationshipUtils.POINTCUT_ANONYMOUS); break; diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AsmHierarchyBuilder.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AsmHierarchyBuilder.java index 07a5c1d0a..357169b0e 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AsmHierarchyBuilder.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AsmHierarchyBuilder.java @@ -295,6 +295,7 @@ public class AsmHierarchyBuilder extends ASTVisitor { else if (TypeDeclaration.kind(typeDeclaration.modifiers) == TypeDeclaration.ANNOTATION_TYPE_DECL) kind = IProgramElement.Kind.ANNOTATION; + boolean isAnnotationStyleAspect = false; // @AJ support if (typeDeclaration.annotations != null) { for (int i = 0; i < typeDeclaration.annotations.length; i++) { @@ -302,6 +303,9 @@ public class AsmHierarchyBuilder extends ASTVisitor { if (Arrays.equals(annotation.type.getTypeBindingPublic(scope).signature(), "Lorg/aspectj/lang/annotation/Aspect;" .toCharArray())) { kind = IProgramElement.Kind.ASPECT; + if (!(typeDeclaration instanceof AspectDeclaration)) { + isAnnotationStyleAspect = true; + } } else if (annotation.resolvedType != null) { // Fix for the case where in a privileged aspect a parent declaration : // declare parents: (@A C+) implements (B); @@ -339,6 +343,7 @@ public class AsmHierarchyBuilder extends ASTVisitor { null, null); peNode.setSourceSignature(genSourceSignature(typeDeclaration)); peNode.setFormalComment(generateJavadocComment(typeDeclaration)); + peNode.setAnnotationStyleDeclaration(isAnnotationStyleAspect); ((IProgramElement) stack.peek()).addChild(peNode); stack.push(peNode); @@ -385,6 +390,8 @@ public class AsmHierarchyBuilder extends ASTVisitor { else if (typeDeclarationKind == TypeDeclaration.ANNOTATION_TYPE_DECL) kind = IProgramElement.Kind.ANNOTATION; + + boolean isAnnotationStyleAspect = false; // @AJ support if (memberTypeDeclaration.annotations != null) { for (int i = 0; i < memberTypeDeclaration.annotations.length; i++) { @@ -392,6 +399,9 @@ public class AsmHierarchyBuilder extends ASTVisitor { if (Arrays.equals(annotation.type.getTypeBindingPublic(scope).signature(), "Lorg/aspectj/lang/annotation/Aspect;" .toCharArray())) { kind = IProgramElement.Kind.ASPECT; + if (!(memberTypeDeclaration instanceof AspectDeclaration)) { + isAnnotationStyleAspect = true; + } } } } @@ -405,6 +415,7 @@ public class AsmHierarchyBuilder extends ASTVisitor { typeModifiers, null, null); peNode.setSourceSignature(genSourceSignature(memberTypeDeclaration)); peNode.setFormalComment(generateJavadocComment(memberTypeDeclaration)); + peNode.setAnnotationStyleDeclaration(isAnnotationStyleAspect); ((IProgramElement) stack.peek()).addChild(peNode); stack.push(peNode); @@ -440,12 +451,16 @@ public class AsmHierarchyBuilder extends ASTVisitor { kind = IProgramElement.Kind.ANNOTATION; // @AJ support + boolean isAnnotationStyleAspect= false; if (memberTypeDeclaration.annotations != null) { for (int i = 0; i < memberTypeDeclaration.annotations.length; i++) { Annotation annotation = memberTypeDeclaration.annotations[i]; if (Arrays.equals(annotation.type.getTypeBindingPublic(scope).signature(), "Lorg/aspectj/lang/annotation/Aspect;" .toCharArray())) { kind = IProgramElement.Kind.ASPECT; + if (!(memberTypeDeclaration instanceof AspectDeclaration)) { + isAnnotationStyleAspect = true; + } break; } } @@ -455,6 +470,7 @@ public class AsmHierarchyBuilder extends ASTVisitor { memberTypeDeclaration.modifiers, null, null); peNode.setSourceSignature(genSourceSignature(memberTypeDeclaration)); peNode.setFormalComment(generateJavadocComment(memberTypeDeclaration)); + peNode.setAnnotationStyleDeclaration(isAnnotationStyleAspect); // if we're something like 'new Runnable(){..}' then set the // bytecodeSignature to be the typename so we can match it later // when creating the structure model |