001: /*
002: * Bytecode Analysis Framework
003: * Copyright (C) 2005, University of Maryland
004: *
005: * This library is free software; you can redistribute it and/or
006: * modify it under the terms of the GNU Lesser General Public
007: * License as published by the Free Software Foundation; either
008: * version 2.1 of the License, or (at your option) any later version.
009: *
010: * This library is distributed in the hope that it will be useful,
011: * but WITHOUT ANY WARRANTY; without even the implied warranty of
012: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
013: * Lesser General Public License for more details.
014: *
015: * You should have received a copy of the GNU Lesser General Public
016: * License along with this library; if not, write to the Free Software
017: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
018: */
019: package edu.umd.cs.findbugs.ba;
020:
021: import java.util.Collection;
022:
023: import edu.umd.cs.findbugs.classfile.ClassDescriptor;
024: import edu.umd.cs.findbugs.classfile.MethodDescriptor;
025: import edu.umd.cs.findbugs.classfile.analysis.AnnotatedObject;
026: import edu.umd.cs.findbugs.classfile.analysis.AnnotationValue;
027:
028: /**
029: * An XMethod represents symbolic information about a particular method.
030: *
031: * <p>
032: * If the resolved() method returns true, then any information queried
033: * from this object can be assumed to be accurate.
034: * If the resolved() method returns false, then FindBugs can't
035: * find the method and any information other than name/signature/etc.
036: * cannot be trusted.
037: * </p>
038: *
039: * @author David Hovemeyer
040: * @author Bill Pugh
041: */
042: public interface XMethod extends ClassMember, AnnotatedObject {
043: public boolean isNative();
044:
045: public boolean isAbstract();
046:
047: public boolean isSynchronized();
048:
049: public int getNumParams();
050:
051: /**
052: * @return the MethodDescriptor identifying this object
053: */
054: public MethodDescriptor getMethodDescriptor();
055:
056: /**
057: *
058: * @return the exceptions this method is declared to throw
059: */
060: public String[] getThrownExceptions();
061:
062: /**
063: * @return does this mention unconditionally throw an exception?
064: */
065: public boolean isUnconditionalThrower();
066:
067: /**
068: * @return true if method's return type is a reference type, false otherwise
069: */
070: public boolean isReturnTypeReferenceType();
071:
072: /**
073: * Get ClassDescriptors (annotation classes) of annotations applied
074: * directly to this method's parameters.
075: *
076: * @param param parameter number (0 for first parameter)
077: * @return ClassDescriptors of annotations applied directly to this method's parameters
078: */
079: public Collection<ClassDescriptor> getParameterAnnotationDescriptors(
080: int param);
081:
082: /**
083: * Get the AnnotationValue of annotation applied directly to given parameter.
084: *
085: * @param param parameter number (0 for first parameter)
086: * @param desc ClassDescriptor of the annotation class
087: * @return AnnotationValue annotating the parameter,
088: * or null if parameter is not annotated with this kind of annotation
089: */
090: public AnnotationValue getParameterAnnotation(int param,
091: ClassDescriptor desc);
092:
093: /**
094: * Get collection of all AnnotationValues applied directly
095: * to given parameter.
096: *
097: * @param param parameter number (0 for first parameter)
098: * @return Collection of all AnnotationValues applied directly
099: * to given parameter
100: */
101: public Collection<AnnotationValue> getParameterAnnotations(int param);
102:
103: /**
104: * Get ClassDescriptors (annotation classes) of annotations applied
105: * directly to this method.
106: *
107: * @return ClassDescriptors of annotations applied directly to this method
108: */
109: public Collection<ClassDescriptor> getAnnotationDescriptors();
110:
111: /**
112: * Get the AnnotationValue of annotation applied directly to the method.
113: *
114: * @param desc ClassDescriptor of the annotation class
115: * @return AnnotationValue annotating the method,
116: * or null if method is not annotated with this kind of annotation
117: */
118: public AnnotationValue getAnnotation(ClassDescriptor desc);
119:
120: /**
121: * Get collection of all AnnotationValues applied directly
122: * to the method.
123: *
124: * @return Collection of all AnnotationValues applied directly
125: * to the method
126: */
127: public Collection<AnnotationValue> getAnnotations();
128: }
|