]> source.dussan.org Git - aspectj.git/commitdiff
Fixed generation and access of return types on IProgramElements(s).
authormkersten <mkersten>
Wed, 10 Mar 2004 21:18:21 +0000 (21:18 +0000)
committermkersten <mkersten>
Wed, 10 Mar 2004 21:18:21 +0000 (21:18 +0000)
asm/src/org/aspectj/asm/IProgramElement.java
asm/src/org/aspectj/asm/internal/ProgramElement.java
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AsmElementFormatter.java
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AsmHierarchyBuilder.java

index f45493e4ec41ca436c906d69ca64c749fdb2f736..8bf641ce802de9fa987475302c38424aec6547ed 100644 (file)
@@ -49,8 +49,15 @@ public interface IProgramElement extends Serializable {
        public String getDeclaringType();  // TODO: remove (Emacs uses it)
        public String getPackageName();
 
-       public void setReturnType(String returnType);
-       public String getReturnType();
+       /**
+        * @param method return types or field types
+        */
+       public void setCorrespondingType(String returnType);
+
+       /** 
+        * This correponds to both method return types and field types.
+        */
+       public String getCorrespondingType();
        
        public String toSignatureString();
        
@@ -71,6 +78,11 @@ public interface IProgramElement extends Serializable {
        
        public String toString();
 
+       /**
+        * @return the javadoc comment for this program element, null if not available
+        */
+       public String getFormalComment();
+       
        /**
         * Includes information about the origin of the node.
         */
index 559abd35358bf6dc04d58e1c82c7c7e85b23913a..6f83e3be9c50f1f3642f7f3001132448e210a956 100644 (file)
@@ -33,7 +33,7 @@ public class ProgramElement implements IProgramElement {
        protected List children = new ArrayList();
        protected IMessage message = null;
        protected ISourceLocation sourceLocation = null;
-               
+
        private List modifiers = new ArrayList();
        private List relations = new ArrayList();
 
@@ -281,11 +281,11 @@ public class ProgramElement implements IProgramElement {
                this.kind = kind;
        }
 
-       public void setReturnType(String returnType) {
+       public void setCorrespondingType(String returnType) {
                this.returnType = returnType;
        }
 
-       public String getReturnType() {
+       public String getCorrespondingType() {
                return returnType;
        }
 
index eddc09cded83b19fd9b5f40e1dc3dd90bfd6503f..14e89d2320d0bbbd350f45977fe7b2c401fab329 100644 (file)
@@ -38,7 +38,7 @@ public class AsmElementFormatter {
                        node.setKind(IProgramElement.Kind.ADVICE);
 
                        if (ad.kind == AdviceKind.Around) {
-                               node.setReturnType(ad.returnType.toString()); //returnTypeToString(0));
+                               node.setCorrespondingType(ad.returnType.toString()); //returnTypeToString(0));
                        }
        
                        String details = "";
@@ -131,7 +131,7 @@ public class AsmElementFormatter {
                                node.setKind(IProgramElement.Kind.ERROR);
                        }
                        node.setName(name);
-                       node.setReturnType(itd.returnType.toString());
+                       node.setCorrespondingType(itd.returnType.toString());
                        if (node.getKind() != IProgramElement.Kind.INTER_TYPE_FIELD) {
                                setParameters(methodDeclaration, node);
                        }               
index 3091094d738b25d886ca106889341611c5f9b326..2aa2e07ca8498d9f77877a7cb7b8f181286cac4a 100644 (file)
@@ -276,6 +276,7 @@ public class AsmHierarchyBuilder extends ASTVisitor {
                formatter.genLabelAndKind(methodDeclaration, peNode);
                genBytecodeInfo(methodDeclaration, peNode);
                peNode.setModifiers(methodDeclaration.modifiers);
+               peNode.setCorrespondingType(methodDeclaration.returnType.toString());
 
                // TODO: add return type test
                if (peNode.getKind().equals(IProgramElement.Kind.METHOD)) {
@@ -285,6 +286,7 @@ public class AsmHierarchyBuilder extends ASTVisitor {
                                ((IProgramElement)stack.peek()).setRunnable(true);
                        }       
                }
+               
                stack.push(peNode);
                return true;
        }
@@ -351,7 +353,10 @@ public class AsmHierarchyBuilder extends ASTVisitor {
                        makeLocation(fieldDeclaration),
                        fieldDeclaration.modifiers,
                        "",
-                       new ArrayList());       
+                       new ArrayList());
+               
+               peNode.setCorrespondingType(fieldDeclaration.type.toString());
+               
                ((IProgramElement)stack.peek()).addChild(peNode);
                stack.push(peNode);
                return true;