/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* This class is used to represent a constant table once
* it is read from a class file.
*
* WARNING: The contents of this source file are not part of any
* supported API. Code that depends on them does so at its own risk:
* they are subject to change or removal without notice.
*/
public final
private byte types[];
/**
* Constructor
*/
// JVM 4.1 ClassFile.constant_pool_count
int j = i;
// JVM 4.4 cp_info.tag
case CONSTANT_UTF8:
break;
case CONSTANT_INTEGER:
break;
case CONSTANT_FLOAT:
break;
case CONSTANT_LONG:
break;
case CONSTANT_DOUBLE:
break;
case CONSTANT_CLASS:
case CONSTANT_STRING:
// JVM 4.4.3 CONSTANT_String_info.string_index
// or JVM 4.4.1 CONSTANT_Class_info.name_index
break;
case CONSTANT_FIELD:
case CONSTANT_METHOD:
case CONSTANT_INTERFACEMETHOD:
case CONSTANT_NAMEANDTYPE:
// JVM 4.4.2 CONSTANT_*ref_info.class_index & name_and_type_index
break;
case 0:
default:
}
}
}
/**
* get a integer
*/
public int getInteger(int n) {
}
/**
* get a value
*/
}
/**
* get a string
*/
}
/**
* get an identifier
*/
}
/**
* get class declaration
*/
}
/**
* get class declaration
*/
}
/**
* get a type from a type signature
*/
}
/**
* get the type of constant given an index
*/
public int getConstantType(int n) {
return types[n];
}
/**
* get the n-th constant from the constant pool
*/
int constant_type = getConstantType(n);
switch (constant_type) {
case CONSTANT_INTEGER:
case CONSTANT_FLOAT:
case CONSTANT_LONG:
case CONSTANT_DOUBLE:
return getValue(n);
case CONSTANT_CLASS:
return getDeclaration(env, n);
case CONSTANT_STRING:
return getString(getInteger(n));
case CONSTANT_FIELD:
case CONSTANT_METHOD:
case CONSTANT_INTERFACEMETHOD:
try {
int key = getInteger(n);
if ((constant_type == CONSTANT_FIELD)
? (field_type == type)
return field;
}
} catch (ClassNotFound e) {
}
return null;
default:
throw new ClassFormatError("invalid constant type: " +
}
}
/**
* Get a list of dependencies, ie: all the classes referenced in this
* constant pool.
*/
switch(types[i]) {
case CONSTANT_CLASS:
break;
}
}
return v;
}
/**
* Find the index of an Object in the constant pool
*/
if (indexHashObject == null)
}
/**
* Find the index of an ascii string in the constant pool. If it's not in
* the constant pool, then add it at the end.
*/
if (indexHashObject == null)
}
}
/**
* Create a hash table of all the items in the constant pool that could
* possibly be referenced from the outside.
*/
indexHashObject = new Hashtable();
indexHashAscii = new Hashtable();
if (types[i] == CONSTANT_UTF8) {
} else {
try {
} catch (ClassFormatError e) { }
}
}
}
/**
* Write out the contents of the constant pool, including any additions
* that have been added.
*/
switch (type) {
case CONSTANT_UTF8:
break;
case CONSTANT_INTEGER:
break;
case CONSTANT_FLOAT:
break;
case CONSTANT_LONG:
i++;
break;
case CONSTANT_DOUBLE:
i++;
break;
case CONSTANT_CLASS:
case CONSTANT_STRING:
break;
case CONSTANT_FIELD:
case CONSTANT_METHOD:
case CONSTANT_INTERFACEMETHOD:
case CONSTANT_NAMEANDTYPE: {
break;
}
default:
throw new ClassFormatError("invalid constant type: "
+ (int)types[i]);
}
}
}
}
}