Java Code Examples for org.apache.bcel.Const#T_OBJECT
The following examples show how to use
org.apache.bcel.Const#T_OBJECT .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: InstructionFactory.java From commons-bcel with Apache License 2.0 | 6 votes |
public Instruction createAppend( final Type type ) { final byte t = type.getType(); if (isString(type)) { return createInvoke(append_mos[0], Const.INVOKEVIRTUAL); } switch (t) { case Const.T_BOOLEAN: case Const.T_CHAR: case Const.T_FLOAT: case Const.T_DOUBLE: case Const.T_BYTE: case Const.T_SHORT: case Const.T_INT: case Const.T_LONG: return createInvoke(append_mos[t], Const.INVOKEVIRTUAL); case Const.T_ARRAY: case Const.T_OBJECT: return createInvoke(append_mos[1], Const.INVOKEVIRTUAL); default: throw new IllegalArgumentException("No append for this type? " + type); } }
Example 2
Source File: InstructionFactory.java From commons-bcel with Apache License 2.0 | 6 votes |
/** Create typed return */ public static ReturnInstruction createReturn( final Type type ) { switch (type.getType()) { case Const.T_ARRAY: case Const.T_OBJECT: return InstructionConst.ARETURN; case Const.T_INT: case Const.T_SHORT: case Const.T_BOOLEAN: case Const.T_CHAR: case Const.T_BYTE: return InstructionConst.IRETURN; case Const.T_FLOAT: return InstructionConst.FRETURN; case Const.T_DOUBLE: return InstructionConst.DRETURN; case Const.T_LONG: return InstructionConst.LRETURN; case Const.T_VOID: return InstructionConst.RETURN; default: throw new IllegalArgumentException("Invalid type: " + type); } }
Example 3
Source File: InstructionFactory.java From commons-bcel with Apache License 2.0 | 6 votes |
/** * @param index index of local variable */ public static LocalVariableInstruction createStore( final Type type, final int index ) { switch (type.getType()) { case Const.T_BOOLEAN: case Const.T_CHAR: case Const.T_BYTE: case Const.T_SHORT: case Const.T_INT: return new ISTORE(index); case Const.T_FLOAT: return new FSTORE(index); case Const.T_DOUBLE: return new DSTORE(index); case Const.T_LONG: return new LSTORE(index); case Const.T_ARRAY: case Const.T_OBJECT: return new ASTORE(index); default: throw new IllegalArgumentException("Invalid type " + type); } }
Example 4
Source File: InstructionFactory.java From commons-bcel with Apache License 2.0 | 6 votes |
/** * @param index index of local variable */ public static LocalVariableInstruction createLoad( final Type type, final int index ) { switch (type.getType()) { case Const.T_BOOLEAN: case Const.T_CHAR: case Const.T_BYTE: case Const.T_SHORT: case Const.T_INT: return new ILOAD(index); case Const.T_FLOAT: return new FLOAD(index); case Const.T_DOUBLE: return new DLOAD(index); case Const.T_LONG: return new LLOAD(index); case Const.T_ARRAY: case Const.T_OBJECT: return new ALOAD(index); default: throw new IllegalArgumentException("Invalid type " + type); } }
Example 5
Source File: InstructionFactory.java From commons-bcel with Apache License 2.0 | 6 votes |
/** * @param type type of elements of array, i.e., array.getElementType() */ public static ArrayInstruction createArrayLoad( final Type type ) { switch (type.getType()) { case Const.T_BOOLEAN: case Const.T_BYTE: return InstructionConst.BALOAD; case Const.T_CHAR: return InstructionConst.CALOAD; case Const.T_SHORT: return InstructionConst.SALOAD; case Const.T_INT: return InstructionConst.IALOAD; case Const.T_FLOAT: return InstructionConst.FALOAD; case Const.T_DOUBLE: return InstructionConst.DALOAD; case Const.T_LONG: return InstructionConst.LALOAD; case Const.T_ARRAY: case Const.T_OBJECT: return InstructionConst.AALOAD; default: throw new IllegalArgumentException("Invalid type " + type); } }
Example 6
Source File: InstructionFactory.java From commons-bcel with Apache License 2.0 | 6 votes |
/** * @param type type of elements of array, i.e., array.getElementType() */ public static ArrayInstruction createArrayStore( final Type type ) { switch (type.getType()) { case Const.T_BOOLEAN: case Const.T_BYTE: return InstructionConst.BASTORE; case Const.T_CHAR: return InstructionConst.CASTORE; case Const.T_SHORT: return InstructionConst.SASTORE; case Const.T_INT: return InstructionConst.IASTORE; case Const.T_FLOAT: return InstructionConst.FASTORE; case Const.T_DOUBLE: return InstructionConst.DASTORE; case Const.T_LONG: return InstructionConst.LASTORE; case Const.T_ARRAY: case Const.T_OBJECT: return InstructionConst.AASTORE; default: throw new IllegalArgumentException("Invalid type " + type); } }
Example 7
Source File: InstructionFactory.java From commons-bcel with Apache License 2.0 | 6 votes |
/** Create "null" value for reference types, 0 for basic types like int */ public static Instruction createNull( final Type type ) { switch (type.getType()) { case Const.T_ARRAY: case Const.T_OBJECT: return InstructionConst.ACONST_NULL; case Const.T_INT: case Const.T_SHORT: case Const.T_BOOLEAN: case Const.T_CHAR: case Const.T_BYTE: return InstructionConst.ICONST_0; case Const.T_FLOAT: return InstructionConst.FCONST_0; case Const.T_DOUBLE: return InstructionConst.DCONST_0; case Const.T_LONG: return InstructionConst.LCONST_0; case Const.T_VOID: return InstructionConst.NOP; default: throw new IllegalArgumentException("Invalid type: " + type); } }
Example 8
Source File: ExceptionObjectType.java From spotbugs with GNU Lesser General Public License v2.1 | 5 votes |
/** * Initialize object from an exception set. * * @param exceptionSet * the exception set * @return a Type that is a supertype of all of the exceptions in the * exception set */ public static Type fromExceptionSet(ExceptionSet exceptionSet) throws ClassNotFoundException { Type commonSupertype = exceptionSet.getCommonSupertype(); if (commonSupertype.getType() != Const.T_OBJECT) { return commonSupertype; } ObjectType exceptionSupertype = (ObjectType) commonSupertype; String className = exceptionSupertype.getClassName(); if ("java.lang.Throwable".equals(className)) { return exceptionSupertype; } return new ExceptionObjectType(className, exceptionSet); }
Example 9
Source File: ReferenceType.java From commons-bcel with Apache License 2.0 | 4 votes |
/** Class is non-abstract but not instantiable from the outside */ ReferenceType() { super(Const.T_OBJECT, "<null object>"); }
Example 10
Source File: StandardTypeMerger.java From spotbugs with GNU Lesser General Public License v2.1 | 2 votes |
/** * Determine if the given typecode refers to a reference type. This * implementation just checks that the type code is T_OBJECT, T_ARRAY, * T_NULL, or T_EXCEPTION. Subclasses should override this if they have * defined new object types with different type codes. */ protected boolean isReferenceType(byte type) { return type == Const.T_OBJECT || type == Const.T_ARRAY || type == T_NULL || type == T_EXCEPTION; }
Example 11
Source File: StandardTypeMerger.java From spotbugs with GNU Lesser General Public License v2.1 | 2 votes |
/** * Determine if the given typecode refers to an Object type. Subclasses * should override with any new object types. */ protected boolean isObjectType(byte type) { return type == Const.T_OBJECT || type == T_EXCEPTION; }