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