Copyright (c) 2000, 2009 IBM Corporation and others.
This program and the accompanying materials
are made available under the terms of the Eclipse Public License 2.0
which accompanies this distribution, and is available at
https://www.eclipse.org/legal/epl-2.0/
SPDX-License-Identifier: EPL-2.0
Contributors:
IBM Corporation - initial API and implementation
/*******************************************************************************
* Copyright (c) 2000, 2009 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.jdt.internal.core.util;
import org.eclipse.jdt.core.util.ClassFormatException;
import org.eclipse.jdt.core.util.IConstantPool;
import org.eclipse.jdt.core.util.IConstantPoolConstant;
import org.eclipse.jdt.core.util.IConstantPoolEntry;
import org.eclipse.jdt.core.util.IExceptionTableEntry;
This class describes an entry in the exception table attribute according
to the JVM specifications.
/**
* This class describes an entry in the exception table attribute according
* to the JVM specifications.
*/
public class ExceptionTableEntry
extends ClassFileStruct
implements IExceptionTableEntry {
private int startPC;
private int endPC;
private int handlerPC;
private int catchTypeIndex;
private char[] catchType;
ExceptionTableEntry(byte[] classFileBytes, IConstantPool constantPool, int offset) throws ClassFormatException {
this.startPC = u2At(classFileBytes, 0, offset);
this.endPC = u2At(classFileBytes, 2, offset);
this.handlerPC = u2At(classFileBytes, 4, offset);
this.catchTypeIndex = u2At(classFileBytes, 6, offset);
if (this.catchTypeIndex != 0) {
IConstantPoolEntry constantPoolEntry = constantPool.decodeEntry(this.catchTypeIndex);
if (constantPoolEntry.getKind() != IConstantPoolConstant.CONSTANT_Class) {
throw new ClassFormatException(ClassFormatException.INVALID_CONSTANT_POOL_ENTRY);
}
this.catchType = constantPoolEntry.getClassInfoName();
}
}
See Also: - getStartPC.getStartPC()
/**
* @see IExceptionTableEntry#getStartPC()
*/
@Override
public int getStartPC() {
return this.startPC;
}
See Also: - getEndPC.getEndPC()
/**
* @see IExceptionTableEntry#getEndPC()
*/
@Override
public int getEndPC() {
return this.endPC;
}
See Also: - getHandlerPC.getHandlerPC()
/**
* @see IExceptionTableEntry#getHandlerPC()
*/
@Override
public int getHandlerPC() {
return this.handlerPC;
}
See Also: - getCatchTypeIndex.getCatchTypeIndex()
/**
* @see IExceptionTableEntry#getCatchTypeIndex()
*/
@Override
public int getCatchTypeIndex() {
return this.catchTypeIndex;
}
See Also: - getCatchType.getCatchType()
/**
* @see IExceptionTableEntry#getCatchType()
*/
@Override
public char[] getCatchType() {
return this.catchType;
}
}