001 package edu.rice.cs.cunit.classFile.attributes; 002 003 import edu.rice.cs.cunit.classFile.attributes.visitors.IAttributeVisitor; 004 import edu.rice.cs.cunit.classFile.code.instructions.LineNumberTable; 005 import edu.rice.cs.cunit.classFile.constantPool.APoolInfo; 006 import edu.rice.cs.cunit.classFile.constantPool.AUTFPoolInfo; 007 import edu.rice.cs.cunit.classFile.constantPool.ConstantPool; 008 import edu.rice.cs.cunit.classFile.constantPool.visitors.CheckUTFVisitor; 009 import edu.rice.cs.cunit.classFile.ClassFile; 010 import edu.rice.cs.cunit.util.Types; 011 012 import java.util.ArrayList; 013 014 /** 015 * Represents the Deprecated attribute in a class file. 016 * 017 * @author Mathias Ricken 018 */ 019 public class DeprecatedAttributeInfo extends AAttributeInfo { 020 /** 021 * Constructor. 022 * 023 * @param name attribute name 024 * @param data attribute data 025 * @param cp constant pool 026 * 027 * @throws ClassFormatError 028 */ 029 public DeprecatedAttributeInfo(AUTFPoolInfo name, byte[] data, ConstantPool cp) throws ClassFormatError { 030 super(name, data, cp); 031 } 032 033 /** 034 * Execute a visitor on this attribute. 035 * 036 * @param visitor visitor 037 * @param param visitor-specific parameter 038 * 039 * @return visitor-specific return value 040 */ 041 public <R, D> R execute(IAttributeVisitor<R, D> visitor, D param) { 042 return visitor.deprecatedCase(this, param); 043 } 044 045 /** 046 * Adjust program counter values contained in this attribute, starting at startPC, by adding deltaPC to them. 047 * 048 * @param startPC program counter to start at 049 * @param deltaPC change in program counter values 050 */ 051 public void adjustPC(int startPC, int deltaPC) { 052 // nothing to do 053 } 054 055 /** 056 * Translate the program counter values contained in this attribute from an old line number table to a new one. 057 * 058 * @param index critical point (insertion or deletion point) 059 * @param deltaIndex delta value to add to all old line numbers greater than the critical point 060 * @param oldLnt old line number table 061 * @param newLnt new line number table 062 */ 063 public void translatePC(int index, int deltaIndex, LineNumberTable oldLnt, LineNumberTable newLnt) { 064 // nothing to do 065 } 066 067 /** 068 * Creates and returns a copy of this object. 069 */ 070 public Object clone() throws CloneNotSupportedException { 071 return super.clone(); 072 } 073 074 /** 075 * Return a human-readable version of this attribute. 076 * 077 * @return string 078 */ 079 public String toString() { 080 return "Deprecated"; 081 } 082 083 /** 084 * Returns the name of the attribute as it appears in the class file. 085 * 086 * @return name of the attribute. 087 */ 088 public static String getAttributeName() { 089 return "Deprecated"; 090 } 091 }