Browse Source

269286: handles for anno style elements: less than optimal fix but need something quick

tags/V1_6_4
aclement 15 years ago
parent
commit
2c0e14ac95

+ 2
- 0
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AsmElementFormatter.java View File

@@ -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;

+ 16
- 0
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AsmHierarchyBuilder.java View File

@@ -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

Loading…
Cancel
Save