001: /*
002: * FindBugs - Find Bugs in Java programs
003: * Copyright (C) 2003-2007 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:
020: package edu.umd.cs.findbugs.ba;
021:
022: import java.lang.annotation.ElementType;
023: import java.util.Collection;
024: import java.util.Collections;
025:
026: import edu.umd.cs.findbugs.classfile.ClassDescriptor;
027: import edu.umd.cs.findbugs.classfile.DescriptorFactory;
028: import edu.umd.cs.findbugs.classfile.FieldDescriptor;
029: import edu.umd.cs.findbugs.classfile.analysis.AnnotatedObject;
030: import edu.umd.cs.findbugs.classfile.analysis.AnnotationValue;
031: import edu.umd.cs.findbugs.internalAnnotations.DottedClassName;
032:
033: /**
034: * @author pugh
035: */
036: public class UnresolvedXField extends AbstractField implements XField {
037:
038: protected UnresolvedXField(@DottedClassName
039: String className, String methodName, String methodSig,
040: int accessFlags) {
041: super (className, methodName, methodSig, accessFlags);
042: if (XFactory.DEBUG_UNRESOLVED) {
043: System.out.println("Unresolved xmethod: " + this );
044: }
045: }
046:
047: protected UnresolvedXField(FieldDescriptor m) {
048: super (m.getClassDescriptor().getDottedClassName(), m.getName(),
049: m.getSignature(), 0);
050: if (XFactory.DEBUG_UNRESOLVED) {
051: System.out.println("Unresolved xmethod: " + this );
052: }
053: }
054:
055: /* (non-Javadoc)
056: * @see java.lang.Comparable#compareTo(java.lang.Object)
057: */
058: public int compareTo(Object o) {
059: if (o instanceof XField) {
060: return XFactory.compare((XField) this , (XField) o);
061: }
062: throw new ClassCastException("Don't know how to compare "
063: + this .getClass().getName() + " to "
064: + o.getClass().getName());
065:
066: }
067:
068: /* (non-Javadoc)
069: * @see edu.umd.cs.findbugs.classfile.analysis.AnnotatedObject#getAnnotation(edu.umd.cs.findbugs.classfile.ClassDescriptor)
070: */
071: public AnnotationValue getAnnotation(ClassDescriptor desc) {
072: return null;
073: }
074:
075: /* (non-Javadoc)
076: * @see edu.umd.cs.findbugs.classfile.analysis.AnnotatedObject#getAnnotationDescriptors()
077: */
078: public Collection<ClassDescriptor> getAnnotationDescriptors() {
079: return Collections.emptyList();
080: }
081:
082: /* (non-Javadoc)
083: * @see edu.umd.cs.findbugs.classfile.analysis.AnnotatedObject#getAnnotations()
084: */
085: public Collection<AnnotationValue> getAnnotations() {
086: return Collections.emptyList();
087: }
088:
089: /* (non-Javadoc)
090: * @see edu.umd.cs.findbugs.classfile.analysis.AnnotatedObject#getContainingScope()
091: */
092: public AnnotatedObject getContainingScope() {
093: // TODO Auto-generated method stub
094: return AnalysisContext
095: .currentXFactory()
096: .getXClass(
097: DescriptorFactory
098: .createClassDescriptorFromDottedClassName(getClassName()));
099: }
100:
101: /* (non-Javadoc)
102: * @see edu.umd.cs.findbugs.classfile.analysis.AnnotatedObject#getElementType()
103: */
104: public ElementType getElementType() {
105: return ElementType.FIELD;
106: }
107:
108: /* (non-Javadoc)
109: * @see edu.umd.cs.findbugs.ba.AccessibleEntity#isDeprecated()
110: */
111: public boolean isDeprecated() {
112: // TODO Auto-generated method stub
113: return false;
114: }
115:
116: }
|