286N/A * reserved comment block 286N/A * DO NOT REMOVE OR ALTER! 286N/A/* ==================================================================== 286N/A * The Apache Software License, Version 1.1 286N/A * Copyright (c) 2001 The Apache Software Foundation. All rights 286N/A * Redistribution and use in source and binary forms, with or without 286N/A * modification, are permitted provided that the following conditions 286N/A * 1. Redistributions of source code must retain the above copyright 286N/A * notice, this list of conditions and the following disclaimer. 286N/A * 2. Redistributions in binary form must reproduce the above copyright 286N/A * notice, this list of conditions and the following disclaimer in 286N/A * the documentation and/or other materials provided with the 286N/A * 3. The end-user documentation included with the redistribution, 286N/A * if any, must include the following acknowledgment: 286N/A * "This product includes software developed by the 286N/A * Alternately, this acknowledgment may appear in the software itself, 286N/A * if and wherever such third-party acknowledgments normally appear. 286N/A * 4. The names "Apache" and "Apache Software Foundation" and 286N/A * "Apache BCEL" must not be used to endorse or promote products 286N/A * derived from this software without prior written permission. For 286N/A * written permission, please contact apache@apache.org. 286N/A * 5. Products derived from this software may not be called "Apache", 286N/A * "Apache BCEL", nor may "Apache" appear in their name, without 286N/A * prior written permission of the Apache Software Foundation. 286N/A * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED 286N/A * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 286N/A * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 286N/A * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR 286N/A * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 286N/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 286N/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 286N/A * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 286N/A * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 286N/A * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 286N/A * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 286N/A * ==================================================================== 286N/A * This software consists of voluntary contributions made by many 286N/A * individuals on behalf of the Apache Software Foundation. For more 286N/A * information on the Apache Software Foundation, please see 286N/A * This class is used to build up a constant pool. The user adds 286N/A * constants via `addXXX' methods, `addString', `addClass', 286N/A * etc.. These methods return an index into the constant 286N/A * pool. Finally, `getFinalConstantPool()' returns the constant pool 286N/A * built up. Intermediate versions of the constant pool can be 286N/A * obtained with `getConstantPool()'. A constant pool has capacity for 286N/A * Constants.MAX_SHORT entries. Note that the first (0) is used by the 286N/A * JVM and that Double and Long constants need two slots. 286N/A * @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A> 286N/A protected int size =
1024;
// Inital size, sufficient in most cases 286N/A protected int index =
1;
// First entry (0) used by JVM 286N/A * Initialize with given array of constants. 286N/A * @param c array of given constants, new ones will be appended 286N/A * Initialize with given constant pool. 286N/A * Create empty constant pool. 286N/A /** Resize internal array of constants. 286N/A * Look for ConstantString in ConstantPool containing String `str'. 286N/A * @param str String to search for 286N/A * @return index on success, -1 otherwise 286N/A * Add a new String constant to the ConstantPool, if it is not already in there. 286N/A * @param str String to add 286N/A * @return index of entry 286N/A * Look for ConstantClass in ConstantPool named `str'. 286N/A * @param str String to search for 286N/A * @return index on success, -1 otherwise 286N/A * Add a new Class reference to the ConstantPool, if it is not already in there. 286N/A * @param str Class to add 286N/A * @return index of entry 286N/A * Add a new Class reference to the ConstantPool for a given type. 286N/A * @param str Class to add 286N/A * @return index of entry 286N/A * Add a reference to an array class (e.g. String[][]) as needed by MULTIANEWARRAY 286N/A * instruction, e.g. to the ConstantPool. 286N/A * @param type type of array class 286N/A * @return index of entry 286N/A * Look for ConstantInteger in ConstantPool. 286N/A * @param n integer number to look for 286N/A * @return index on success, -1 otherwise 286N/A * Add a new Integer constant to the ConstantPool, if it is not already in there. 286N/A * @param n integer number to add 286N/A * @return index of entry 286N/A * Look for ConstantFloat in ConstantPool. 286N/A * @param n Float number to look for 286N/A * @return index on success, -1 otherwise 286N/A * Add a new Float constant to the ConstantPool, if it is not already in there. 286N/A * @param n Float number to add 286N/A * @return index of entry 286N/A * Look for ConstantUtf8 in ConstantPool. 286N/A * @param n Utf8 string to look for 286N/A * @return index on success, -1 otherwise 286N/A * Add a new Utf8 constant to the ConstantPool, if it is not already in there. 286N/A * @param n Utf8 string to add 286N/A * @return index of entry 286N/A * Look for ConstantLong in ConstantPool. 286N/A * @param n Long number to look for 286N/A * @return index on success, -1 otherwise 286N/A * Add a new long constant to the ConstantPool, if it is not already in there. 286N/A * @param n Long number to add 286N/A * @return index of entry 286N/A index +=
2;
// Wastes one entry according to spec 286N/A * Look for ConstantDouble in ConstantPool. 286N/A * @param n Double number to look for 286N/A * @return index on success, -1 otherwise 286N/A * Add a new double constant to the ConstantPool, if it is not already in there. 286N/A * @param n Double number to add 286N/A * @return index of entry 286N/A index +=
2;
// Wastes one entry according to spec 286N/A * Look for ConstantNameAndType in ConstantPool. 286N/A * @return index on success, -1 otherwise 286N/A * Add a new NameAndType constant to the ConstantPool if it is not already 286N/A * @param n NameAndType string to add 286N/A * @return index of entry 286N/A * Look for ConstantMethodref in ConstantPool. 286N/A * @param class_name Where to find method 286N/A * @param method_name Guess what 286N/A * @param signature return and argument types 286N/A * @return index on success, -1 otherwise 286N/A * Add a new Methodref constant to the ConstantPool, if it is not already 286N/A * @param n Methodref string to add 286N/A * @return index of entry 286N/A * Look for ConstantInterfaceMethodref in ConstantPool. 286N/A * @param class_name Where to find method 286N/A * @param method_name Guess what 286N/A * @param signature return and argument types 286N/A * @return index on success, -1 otherwise 286N/A * Add a new InterfaceMethodref constant to the ConstantPool, if it is not already 286N/A * @param n InterfaceMethodref string to add 286N/A * @return index of entry 286N/A * Look for ConstantFieldref in ConstantPool. 286N/A * @param class_name Where to find method 286N/A * @param field_name Guess what 286N/A * @param signature return and argument types 286N/A * @return index on success, -1 otherwise 286N/A * Add a new Fieldref constant to the ConstantPool, if it is not already 286N/A * @param n Fieldref string to add 286N/A * @return index of entry 286N/A * @param i index in constant pool 286N/A * @return constant pool entry at index i 286N/A * @param i index in constant pool 286N/A * @param c new constant pool entry at index i 286N/A * @return intermediate constant pool 286N/A * @return current size of constant pool 286N/A * @return constant pool with proper length 286N/A * @return String representation. 286N/A /** Import constant from another ConstantPool and return new index. 286N/A default:
// Never reached 286N/A default:
// Never reached