String lvtname = ((ConstantUtf8) cp.getConstant(lvt.getNameIndex())).getBytes();
if (! lvtname.equals("LocalVariableTable")){
throw new ClassConstraintException("The LocalVariableTable attribute '"+tostring(lvt)+"' is not correctly named 'LocalVariableTable' but '"+lvtname+"'.");
}
Code code = obj;
//In JustIce, the check for correct offsets into the code array is delayed to Pass 3a.
LocalVariable[] localvariables = lvt.getLocalVariableTable();
for (int i=0; i<localvariables.length; i++){
checkIndex(lvt, localvariables[i].getNameIndex(), CONST_Utf8);
String localname = ((ConstantUtf8) cp.getConstant(localvariables[i].getNameIndex())).getBytes();
if (!validJavaIdentifier(localname)){
throw new ClassConstraintException("LocalVariableTable '"+tostring(lvt)+"' references a local variable by the name '"+localname+"' which is not a legal Java simple name.");
}
checkIndex(lvt, localvariables[i].getSignatureIndex(), CONST_Utf8);
String localsig = ((ConstantUtf8) (cp.getConstant(localvariables[i].getSignatureIndex()))).getBytes(); // Local signature(=descriptor)
Type t;
try{
t = Type.getType(localsig);
}
catch (ClassFormatException cfe){
throw new ClassConstraintException("Illegal descriptor (==signature) '"+localsig+"' used by LocalVariable '"+tostring(localvariables[i])+"' referenced by '"+tostring(lvt)+"'.");
}
int localindex = localvariables[i].getIndex();
if ( ( (t==Type.LONG || t==Type.DOUBLE)? localindex+1:localindex) >= code.getMaxLocals()){
throw new ClassConstraintException("LocalVariableTable attribute '"+tostring(lvt)+"' references a LocalVariable '"+tostring(localvariables[i])+"' with an index that exceeds the surrounding Code attribute's max_locals value of '"+code.getMaxLocals()+"'.");
}
try{
localVariablesInfos[method_number].add(localindex, localname, localvariables[i].getStartPC(), localvariables[i].getLength(), t);
}