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
009 import java.util.ArrayList;
010
011 /**
012 * Represents an unknown attribute in a class file.
013 *
014 * @author Mathias Ricken
015 */
016 public class UnknownAttributeInfo extends AAttributeInfo {
017 /**
018 * Constructor.
019 *
020 * @param name attribute name
021 * @param data attribute data
022 * @param cp constant pool
023 *
024 * @throws ClassFormatError
025 */
026 public UnknownAttributeInfo(AUTFPoolInfo name, byte[] data, ConstantPool cp) throws ClassFormatError {
027 super(name, data, cp);
028 }
029
030 /**
031 * Execute a visitor on this attribute.
032 *
033 * @param visitor visitor
034 * @param param visitor-specific parameter
035 *
036 * @return visitor-specific return value
037 */
038 public <R, D> R execute(IAttributeVisitor<R, D> visitor, D param) {
039 return visitor.unknownCase(this, param);
040 }
041
042 /**
043 * Adjust program counter values contained in this attribute, starting at startPC, by adding deltaPC to them.
044 *
045 * @param startPC program counter to start at
046 * @param deltaPC change in program counter values
047 */
048 public void adjustPC(int startPC, int deltaPC) {
049 // nothing to do
050 }
051
052 /**
053 * Translate the program counter values contained in this attribute from an old line number table to a new one.
054 *
055 * @param index critical point (insertion or deletion point)
056 * @param deltaIndex delta value to add to all old line numbers greater than the critical point
057 * @param oldLnt old line number table
058 * @param newLnt new line number table
059 */
060 public void translatePC(int index, int deltaIndex, LineNumberTable oldLnt, LineNumberTable newLnt) {
061 // nothing to do
062 }
063
064 /**
065 * Creates and returns a copy of this object.
066 */
067 public Object clone() throws CloneNotSupportedException {
068 return super.clone();
069 }
070
071 /**
072 * Returns the name of the attribute as it appears in the class file.
073 *
074 * @return name of the attribute.
075 */
076 public static String getAttributeName() {
077 throw new Error("This is not an actual attribute. Should never query for it!");
078 }
079 }