org.eclipse.jdt.core.util.IExtendedAnnotation Maven / Gradle / Ivy
/*******************************************************************************
* Copyright (c) 2012, 2013 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
* Andy Clement (GoPivotal, Inc) [email protected] - Contributions for
* Bug 383624 - [1.8][compiler] Revive code generation support for type annotations (from Olivier's work)
* Bug 409250 - [1.8][compiler] Various loose ends in 308 code generation
*******************************************************************************/
package org.eclipse.jdt.core.util;
/**
* Description of an extended annotation structure as described in the JVM specifications
* (added in JavaSE-1.8).
*
* This interface may be implemented by clients.
*
* @since 3.10
*/
public interface IExtendedAnnotation extends IAnnotation {
/**
* Answer back the target type as described in the JVM specifications.
*
* @return the target type
*/
int getTargetType();
/**
* Answer back the offset.
*
* For a target_type value equals to:
*
*
* target_type
* offset description
*
*
* 0x43 (INSTANCE_OF), 0x44 (NEW), 0x45 (CONSTRUCTOR_REFERENCE), 0x46 (METHOD_REFERENCE)
* The offset within the bytecodes of the instanceof
bytecode for INSTANCE_OF,
* the new
bytecode for NEW and the implementing instruction for either a
* CONSTRUCTOR_REFERENCE or METHOD_REFERENCE.
*
*
* 0x47 (CAST), 0x48 (CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT), 0x49 (METHOD_INVOCATION_TYPE_ARGUMENT),
* 0x4A (CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT), 0x4B (METHOD_REFERENCE_TYPE_ARGUMENT)
* The offset within the bytecodes of the new
bytecode for constructor call, or the
* relevant bytecode for method invocation or method reference. For CAST the offset may
* point to the checkcast
or another instruction as it is possible the cast
* may have been discarded by the compiler if it were a no-op.
*
*
*
*
* @return the offset
*/
int getOffset();
/**
* Answer back the exception table index when the target_type is EXCEPTION_PARAMETER.
*
* @return the exception table index
*/
int getExceptionTableIndex();
/**
* Answer back the local variable reference info table length of this entry as specified in
* the JVM specifications.
*
* This is defined only for annotations related to a local variable.
*
* @return the local variable reference info table length of this entry as specified in
* the JVM specifications
*/
int getLocalVariableRefenceInfoLength();
/**
* Answer back the local variable reference info table of this entry as specified in
* the JVM specifications. Answer an empty array if none.
*
* This is defined only for annotations related to a local variable.
*
* @return the local variable reference info table of this entry as specified in
* the JVM specifications. Answer an empty array if none
*/
ILocalVariableReferenceInfo[] getLocalVariableTable();
/**
* Answer back the method parameter index.
*
* The index is 0-based.
*
* @return the method parameter index
*/
int getParameterIndex();
/**
* Answer back the index of the type parameter of the class or method
*
* The index is 0-based.
*
* @return the index of the type parameter of the class or method
*/
int getTypeParameterIndex();
/**
* Answer back the index of the bound of the type parameter of the method or class
*
* The index is 0-based.
*
* @return the index of the bound of the type parameter of the method or class
*/
int getTypeParameterBoundIndex();
/**
* Answer back the index in the given different situations.
*
* The index is 0-based.
*
*
*
* target_type
* offset description
*
*
* 0x10 (CLASS_EXTENDS)
* the index of the type in the clause: -1 (65535)
is used if the annotation is on
* the superclass type, and the value i
is used if the annotation is on the i
th
* superinterface type (counting from zero).
*
*
* 0x17 (THROWS)
* the index of the exception type in the clause: the value i
denotes an annotation of the
* i
th exception type (counting from zero).
*
*
* 0x47 (CAST), 0x48 (CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT), 0x49 (METHOD_INVOCATION_TYPE_ARGUMENT),
* 0x4A (CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT), 0x4B (METHOD_REFERENCE_TYPE_ARGUMENT)
* the type argument index in the expression
*
*
* @return the index in the given different situations
*/
int getAnnotationTypeIndex();
/**
* Answer back the locations of the annotated type as described in the JVM specifications.
*
* This is used for parameterized and array types.
*
* @return the locations of the annotated type
*/
int[][] getTypePath();
}