// Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/kpdus/jad.html
// Decompiler options: packimports(3) deadcode 
// Source File Name:   MethodDocImpl.java

package com.sun.tools.javadoc;

import com.sun.javadoc.ClassDoc;
import com.sun.javadoc.MethodDoc;
import com.sun.tools.javac.v8.code.Scope;
import com.sun.tools.javac.v8.code.Symbol;
import com.sun.tools.javac.v8.code.Type;
import com.sun.tools.javac.v8.util.List;
import com.sun.tools.javac.v8.util.Name;
import java.lang.reflect.Modifier;

// Referenced classes of package com.sun.tools.javadoc:
//            ExecutableMemberDocImpl, DocEnv, TypeMaker

public class MethodDocImpl extends ExecutableMemberDocImpl
    implements MethodDoc
{

    public boolean isAbstract()
    {
        if(containingClass().isInterface())
            return false;
        else
            return Modifier.isAbstract(getModifiers());
    }

    public boolean isMethod()
    {
        return true;
    }

    public ClassDoc overriddenClass()
    {
        MethodDoc methoddoc = overriddenMethod();
        return methoddoc != null ? methoddoc.containingClass() : null;
    }

    public MethodDoc overriddenMethod()
    {
        if((sym.flags() & 8L) != 0L)
            return null;
        com.sun.tools.javac.v8.code.Symbol.ClassSymbol classsymbol = (com.sun.tools.javac.v8.code.Symbol.ClassSymbol)sym.owner;
        for(Type type = classsymbol.type.supertype(); type.tag == 10; type = type.supertype())
        {
            com.sun.tools.javac.v8.code.Symbol.ClassSymbol classsymbol1 = (com.sun.tools.javac.v8.code.Symbol.ClassSymbol)type.tsym;
            for(com.sun.tools.javac.v8.code.Scope.Entry entry = classsymbol1.members().lookup(sym.name); entry.scope != null; entry = entry.next())
                if(sym.overrides(entry.sym, classsymbol))
                    return env.getMethodDoc((com.sun.tools.javac.v8.code.Symbol.MethodSymbol)entry.sym);

        }

        return null;
    }

    public com.sun.javadoc.Type returnType()
    {
        return TypeMaker.getType(env, sym.type.restype());
    }

    private String genericParameters()
    {
        return sym.type.typarams().isEmpty() ? "" : "<" + sym.type.typarams() + ">";
    }

    public String name()
    {
        return genericParameters() + sym.name.toString();
    }

    public String qualifiedName()
    {
        return genericParameters() + sym.enclClass().fullName().toString() + '.' + sym.name.toString();
    }

    public MethodDocImpl(DocEnv docenv, com.sun.tools.javac.v8.code.Symbol.MethodSymbol methodsymbol)
    {
        ExecutableMemberDocImpl(docenv, methodsymbol);
    }

    public MethodDocImpl(DocEnv docenv, com.sun.tools.javac.v8.code.Symbol.MethodSymbol methodsymbol, String s, List list)
    {
        ExecutableMemberDocImpl(docenv, methodsymbol, s, list);
    }
}
