]> source.dussan.org Git - aspectj.git/commitdiff
source locations for declare annos (not persisted) and fqname of handles for itds
authoraclement <aclement>
Wed, 18 Aug 2010 17:01:00 +0000 (17:01 +0000)
committeraclement <aclement>
Wed, 18 Aug 2010 17:01:00 +0000 (17:01 +0000)
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/DeclareAnnotationDeclaration.java
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AsmElementFormatter.java
org.aspectj.ajdt.core/src/org/aspectj/org/eclipse/jdt/core/dom/AjASTConverter.java

index 37a015a19fcde3fb213afc128b77888e4c50b012..f1cc2f1664264cbc89c9edc8e3c53342696205f2 100644 (file)
@@ -35,7 +35,7 @@ public class DeclareAnnotationDeclaration extends DeclareDeclaration {
                        return; // there is an error that will already be getting reported (e.g. incorrect pattern on decaf/decac)
                }
                symbolicDeclare.setAnnotationString(annotation.toString());
-
+               symbolicDeclare.setAnnotationLocation(annotation.sourceStart, annotation.sourceEnd);
        }
 
        public void analyseCode(ClassScope classScope, InitializationFlowContext initializationContext, FlowInfo flowInfo) {
index 537db3acef18b4fd7b482fca76e7e16f6dc2a0c9..1c2ea5616bfab94383e3eea77b98a472516eb629 100644 (file)
@@ -172,6 +172,8 @@ public class AsmElementFormatter {
                        InterTypeDeclaration itd = (InterTypeDeclaration) methodDeclaration;
                        String fqname = itd.getOnType().toString();
                        if (fqname.indexOf(".") != -1) {
+                               // TODO the string handling round here is embarrassing
+                               node.addFullyQualifiedName(fqname + "." + new String(itd.getDeclaredSelector()));
                                fqname = fqname.substring(fqname.lastIndexOf(".") + 1);
                        }
                        String name = fqname + "." + new String(itd.getDeclaredSelector());
index efa780a1ea4abc46e1167bbc857f25c0aa3fee82..cdb504d730eec34b6de885751af359fd6fa7ecf4 100644 (file)
@@ -400,24 +400,32 @@ public class AjASTConverter extends ASTConverter {
                                declareDeclaration = new DeclareAtTypeDeclaration(this.ast);
                                ((DeclareAtTypeDeclaration) declareDeclaration).setPatternNode(convert(da.getTypePattern()));
                                SimpleName annotationName = new SimpleName(this.ast);
+                               annotationName.setSourceRange(da.getAnnotationSourceStart(),
+                                               da.getAnnotationSourceEnd() - da.getAnnotationSourceStart());
                                annotationName.internalSetIdentifier(da.getAnnotationString());
                                ((DeclareAtTypeDeclaration) declareDeclaration).setAnnotationName(annotationName);
                        } else if (da.getKind().equals(DeclareAnnotation.AT_CONSTRUCTOR)) {
                                declareDeclaration = new DeclareAtConstructorDeclaration(this.ast);
                                ((DeclareAtConstructorDeclaration) declareDeclaration).setPatternNode(convert(da.getSignaturePattern()));
                                SimpleName annotationName = new SimpleName(this.ast);
+                               annotationName.setSourceRange(da.getAnnotationSourceStart(),
+                                               da.getAnnotationSourceEnd() - da.getAnnotationSourceStart());
                                annotationName.internalSetIdentifier(da.getAnnotationString());
                                ((DeclareAtConstructorDeclaration) declareDeclaration).setAnnotationName(annotationName);
                        } else if (da.getKind().equals(DeclareAnnotation.AT_FIELD)) {
                                declareDeclaration = new DeclareAtFieldDeclaration(this.ast);
                                ((DeclareAtFieldDeclaration) declareDeclaration).setPatternNode(convert(da.getSignaturePattern()));
                                SimpleName annotationName = new SimpleName(this.ast);
+                               annotationName.setSourceRange(da.getAnnotationSourceStart(),
+                                               da.getAnnotationSourceEnd() - da.getAnnotationSourceStart());
                                annotationName.internalSetIdentifier(da.getAnnotationString());
                                ((DeclareAtFieldDeclaration) declareDeclaration).setAnnotationName(annotationName);
                        } else if (da.getKind().equals(DeclareAnnotation.AT_METHOD)) {
                                declareDeclaration = new DeclareAtMethodDeclaration(this.ast);
                                ((DeclareAtMethodDeclaration) declareDeclaration).setPatternNode(convert(da.getSignaturePattern()));
                                SimpleName annotationName = new SimpleName(this.ast);
+                               annotationName.setSourceRange(da.getAnnotationSourceStart(),
+                                               da.getAnnotationSourceEnd() - da.getAnnotationSourceStart());
                                annotationName.internalSetIdentifier(da.getAnnotationString());
                                ((DeclareAtMethodDeclaration) declareDeclaration).setAnnotationName(annotationName);
                        }
@@ -750,7 +758,7 @@ public class AjASTConverter extends ASTConverter {
        // }
        // arrayCreation.setSourceRange(expression.sourceStart, expression.sourceEnd - expression.sourceStart + 1);
        // org.aspectj.org.eclipse.jdt.internal.compiler.ast.Expression[] dimensions = expression.dimensions;
-       //              
+       //
        // int dimensionsLength = dimensions.length;
        // for (int i = 0; i < dimensionsLength; i++) {
        // if (dimensions[i] != null) {
@@ -971,7 +979,7 @@ public class AjASTConverter extends ASTConverter {
        // case org.aspectj.org.eclipse.jdt.internal.compiler.ast.OperatorIds.LESS :
        // infixExpression.setOperator(InfixExpression.Operator.LESS);
        // }
-       //              
+       //
        // if (expression.left instanceof org.aspectj.org.eclipse.jdt.internal.compiler.ast.BinaryExpression
        // && ((expression.left.bits & org.aspectj.org.eclipse.jdt.internal.compiler.ast.ASTNode.ParenthesizedMASK) == 0)) {
        // // create an extended string literal equivalent => use the extended operands list
@@ -1000,7 +1008,7 @@ public class AjASTConverter extends ASTConverter {
        // for (int i = 0; i < size - 1; i++) {
        // Expression expr = temp;
        // temp = new InfixExpression(this.ast);
-       //                                              
+       //
        // if (this.resolveBindings) {
        // this.recordNodes(temp, expression);
        // }
@@ -1559,8 +1567,7 @@ public class AjASTConverter extends ASTConverter {
                                for (int i = 1; i < initializationsLength; i++) {
                                        variableDeclarationExpression
                                                        .fragments()
-                                                       .add(
-                                                                       convertToVariableDeclarationFragment((org.aspectj.org.eclipse.jdt.internal.compiler.ast.LocalDeclaration) initializations[i]));
+                                                       .add(convertToVariableDeclarationFragment((org.aspectj.org.eclipse.jdt.internal.compiler.ast.LocalDeclaration) initializations[i]));
                                }
                                if (initializationsLength != 1) {
                                        int start = variableDeclarationExpression.getStartPosition();
@@ -2178,8 +2185,7 @@ public class AjASTConverter extends ASTConverter {
                if (typeDeclaration.modifiersSourceStart != -1) {
                        setModifiers(typeDecl, typeDeclaration);
                }
-               typeDecl
-                               .setInterface(org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.kind(typeDeclaration.modifiers) == org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.INTERFACE_DECL);
+               typeDecl.setInterface(org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.kind(typeDeclaration.modifiers) == org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.INTERFACE_DECL);
                final SimpleName typeName = new SimpleName(this.ast);
                typeName.internalSetIdentifier(new String(typeDeclaration.name));
                typeName.setSourceRange(typeDeclaration.sourceStart, typeDeclaration.sourceEnd - typeDeclaration.sourceStart + 1);
@@ -2350,8 +2356,8 @@ public class AjASTConverter extends ASTConverter {
                variableDeclarationExpression.setSourceRange(localDeclaration.declarationSourceStart, localDeclaration.declarationSourceEnd
                                - localDeclaration.declarationSourceStart + 1);
                Type type = convertType(localDeclaration.type);
-               setTypeForVariableDeclarationExpression(variableDeclarationExpression, type, variableDeclarationFragment
-                               .getExtraDimensions());
+               setTypeForVariableDeclarationExpression(variableDeclarationExpression, type,
+                               variableDeclarationFragment.getExtraDimensions());
                if (localDeclaration.modifiersSourceStart != -1) {
                        setModifiers(variableDeclarationExpression, localDeclaration);
                }