1 22 package org.aspectj.tools.ajdoc; 23 24 import org.aspectj.compiler.base.ast.MethodDec; 25 import org.aspectj.compiler.base.ast.NameType; 26 import org.aspectj.compiler.base.ast.TypeDec; 27 28 import com.sun.javadoc.ClassDoc; 29 30 import java.lang.reflect.Modifier ; 31 32 public class MethodDocImpl 33 extends CodeDocImpl 34 implements org.aspectj.ajdoc.MethodDoc { 35 36 40 private org.aspectj.compiler.base.ast.Type type; 41 public void setType(org.aspectj.compiler.base.ast.Type type) { 42 this.type = type; 43 } 44 45 public MethodDocImpl(ClassDoc containingClass, MethodDec methodDec) { 46 super(containingClass, methodDec); 47 setType(codeDec().getResultTypeD().getType()); 48 } 49 50 protected MethodDec methodDec() { 51 return (MethodDec)codeDec(); 52 } 53 54 59 public boolean isMethod() { 60 return true; 61 } 62 63 68 public boolean isAbstract() { 69 return methodDec().isAbstract(); 70 } 71 72 78 public com.sun.javadoc.Type returnType() { 79 return TypeImpl.getInstance(type); 80 } 82 83 90 public ClassDoc overriddenClass() { 91 TypeDec where = methodDec().getDeclaringType().getTypeDec(); 93 NameType superType = (NameType)where.getSuperClassType(); 94 while (superType != null) { 95 MethodDec method = Util.methodDec(superType, 96 methodDec().getId(), 97 methodDec().getFormals()); 98 if (method != null && !method.getId().equals("not$found")) { 99 if (method.getDeclaringType().equals(superType)) { 100 return null; 101 } 102 } 103 if (superType.getTypeDec().getFullName(). 104 equals("java.lang.Object")) { 105 return null; 106 } 107 superType = (NameType)superType.getTypeDec().getSuperClassType(); 108 } 109 return null; 110 } 111 112 118 public int modifierSpecifier() { 119 if (containingClass().isInterface()) { 121 return super.modifierSpecifier() & ~Modifier.ABSTRACT; 122 } 123 return super.modifierSpecifier(); 124 } 125 } 126 | Popular Tags |