/** * Reads <code>CONSTANT_Integer_info</code>, <code>_Float_info</code>, * <code>_Long_info</code>, <code>_Double_info</code>, or * <code>_String_info</code> structure. * These are used with the LDC instruction. * * @return a <code>String</code> value or a wrapped primitive-type * value. */ public Object getLdcValue(int index) { ConstInfo constInfo = this.getItem(index); Object value = null; if (constInfo instanceof StringInfo) value = this.getStringInfo(index); else if (constInfo instanceof FloatInfo) value = new Float(getFloatInfo(index)); else if (constInfo instanceof IntegerInfo) value = new Integer(getIntegerInfo(index)); else if (constInfo instanceof LongInfo) value = new Long(getLongInfo(index)); else if (constInfo instanceof DoubleInfo) value = new Double(getDoubleInfo(index)); else value = null; return value; }
/** * Reads <code>CONSTANT_Integer_info</code>, <code>_Float_info</code>, * <code>_Long_info</code>, <code>_Double_info</code>, or * <code>_String_info</code> structure. * These are used with the LDC instruction. * * @return a <code>String</code> value or a wrapped primitive-type * value. */ public Object getLdcValue(int index) { ConstInfo constInfo = this.getItem(index); Object value = null; if (constInfo instanceof StringInfo) value = this.getStringInfo(index); else if (constInfo instanceof FloatInfo) value = Float.valueOf(getFloatInfo(index)); else if (constInfo instanceof IntegerInfo) value = Integer.valueOf(getIntegerInfo(index)); else if (constInfo instanceof LongInfo) value = Long.valueOf(getLongInfo(index)); else if (constInfo instanceof DoubleInfo) value = Double.valueOf(getDoubleInfo(index)); return value; }
return new Integer(value); case ConstPool.CONST_String : return cp.getStringInfo(index); default : throw new RuntimeException("bad tag: " + cp.getTag(index)
private static String ldc(ConstPool pool, int index) { int tag = pool.getTag(index); switch (tag) { case ConstPool.CONST_String: return "#" + index + " = \"" + pool.getStringInfo(index) + "\""; case ConstPool.CONST_Integer: return "#" + index + " = int " + pool.getIntegerInfo(index); case ConstPool.CONST_Float: return "#" + index + " = float " + pool.getFloatInfo(index); case ConstPool.CONST_Long: return "#" + index + " = long " + pool.getLongInfo(index); case ConstPool.CONST_Double: return "#" + index + " = int " + pool.getDoubleInfo(index); case ConstPool.CONST_Class: return classInfo(pool, index); default: throw new RuntimeException("bad LDC: " + tag); } } }
return Integer.valueOf(value); case ConstPool.CONST_String : return cp.getStringInfo(index); default : throw new RuntimeException("bad tag: " + cp.getTag(index)
private static String ldc(ConstPool pool, int index) { int tag = pool.getTag(index); switch (tag) { case ConstPool.CONST_String: return "#" + index + " = \"" + pool.getStringInfo(index) + "\""; case ConstPool.CONST_Integer: return "#" + index + " = int " + pool.getIntegerInfo(index); case ConstPool.CONST_Float: return "#" + index + " = float " + pool.getFloatInfo(index); case ConstPool.CONST_Long: return "#" + index + " = long " + pool.getLongInfo(index); case ConstPool.CONST_Double: return "#" + index + " = int " + pool.getDoubleInfo(index); case ConstPool.CONST_Class: return classInfo(pool, index); default: throw new RuntimeException("bad LDC: " + tag); } } }
/** * Reads <code>CONSTANT_Integer_info</code>, <code>_Float_info</code>, * <code>_Long_info</code>, <code>_Double_info</code>, or * <code>_String_info</code> structure. * These are used with the LDC instruction. * * @return a <code>String</code> value or a wrapped primitive-type * value. */ public Object getLdcValue(int index) { ConstInfo constInfo = this.getItem(index); Object value = null; if (constInfo instanceof StringInfo) value = this.getStringInfo(index); else if (constInfo instanceof FloatInfo) value = new Float(getFloatInfo(index)); else if (constInfo instanceof IntegerInfo) value = new Integer(getIntegerInfo(index)); else if (constInfo instanceof LongInfo) value = new Long(getLongInfo(index)); else if (constInfo instanceof DoubleInfo) value = new Double(getDoubleInfo(index)); else value = null; return value; }
/** * Reads <code>CONSTANT_Integer_info</code>, <code>_Float_info</code>, * <code>_Long_info</code>, <code>_Double_info</code>, or * <code>_String_info</code> structure. * These are used with the LDC instruction. * * @return a <code>String</code> value or a wrapped primitive-type * value. */ public Object getLdcValue(int index) { ConstInfo constInfo = this.getItem(index); Object value = null; if (constInfo instanceof StringInfo) value = this.getStringInfo(index); else if (constInfo instanceof FloatInfo) value = new Float(getFloatInfo(index)); else if (constInfo instanceof IntegerInfo) value = new Integer(getIntegerInfo(index)); else if (constInfo instanceof LongInfo) value = new Long(getLongInfo(index)); else if (constInfo instanceof DoubleInfo) value = new Double(getDoubleInfo(index)); else value = null; return value; }
/** * Reads <code>CONSTANT_Integer_info</code>, <code>_Float_info</code>, * <code>_Long_info</code>, <code>_Double_info</code>, or * <code>_String_info</code> structure. * These are used with the LDC instruction. * * @return a <code>String</code> value or a wrapped primitive-type * value. */ public Object getLdcValue(int index) { ConstInfo constInfo = this.getItem(index); Object value = null; if (constInfo instanceof StringInfo) value = this.getStringInfo(index); else if (constInfo instanceof FloatInfo) value = new Float(getFloatInfo(index)); else if (constInfo instanceof IntegerInfo) value = new Integer(getIntegerInfo(index)); else if (constInfo instanceof LongInfo) value = new Long(getLongInfo(index)); else if (constInfo instanceof DoubleInfo) value = new Double(getDoubleInfo(index)); else value = null; return value; }
/** * Reads <code>CONSTANT_Integer_info</code>, <code>_Float_info</code>, * <code>_Long_info</code>, <code>_Double_info</code>, or * <code>_String_info</code> structure. * These are used with the LDC instruction. * * @return a <code>String</code> value or a wrapped primitive-type * value. */ public Object getLdcValue(int index) { ConstInfo constInfo = this.getItem(index); Object value = null; if (constInfo instanceof StringInfo) value = this.getStringInfo(index); else if (constInfo instanceof FloatInfo) value = new Float(getFloatInfo(index)); else if (constInfo instanceof IntegerInfo) value = new Integer(getIntegerInfo(index)); else if (constInfo instanceof LongInfo) value = new Long(getLongInfo(index)); else if (constInfo instanceof DoubleInfo) value = new Double(getDoubleInfo(index)); else value = null; return value; }
/** * Reads <code>CONSTANT_Integer_info</code>, <code>_Float_info</code>, * <code>_Long_info</code>, <code>_Double_info</code>, or * <code>_String_info</code> structure. * These are used with the LDC instruction. * * @return a <code>String</code> value or a wrapped primitive-type * value. */ public Object getLdcValue(int index) { ConstInfo constInfo = this.getItem(index); Object value = null; if (constInfo instanceof StringInfo) value = this.getStringInfo(index); else if (constInfo instanceof FloatInfo) value = new Float(getFloatInfo(index)); else if (constInfo instanceof IntegerInfo) value = new Integer(getIntegerInfo(index)); else if (constInfo instanceof LongInfo) value = new Long(getLongInfo(index)); else if (constInfo instanceof DoubleInfo) value = new Double(getDoubleInfo(index)); else value = null; return value; }
return new Integer(value); case ConstPool.CONST_String : return cp.getStringInfo(index); default : throw new RuntimeException("bad tag: " + cp.getTag(index)
return new Integer(value); case ConstPool.CONST_String : return cp.getStringInfo(index); default : throw new RuntimeException("bad tag: " + cp.getTag(index)
private static String ldc(ConstPool pool, int index) { int tag = pool.getTag(index); switch (tag) { case ConstPool.CONST_String: return "#" + index + " = \"" + pool.getStringInfo(index) + "\""; case ConstPool.CONST_Integer: return "#" + index + " = int " + pool.getIntegerInfo(index); case ConstPool.CONST_Float: return "#" + index + " = float " + pool.getFloatInfo(index); case ConstPool.CONST_Long: return "#" + index + " = long " + pool.getLongInfo(index); case ConstPool.CONST_Double: return "#" + index + " = int " + pool.getDoubleInfo(index); case ConstPool.CONST_Class: return classInfo(pool, index); default: throw new RuntimeException("bad LDC: " + tag); } } }
private static String ldc(ConstPool pool, int index) { int tag = pool.getTag(index); switch (tag) { case ConstPool.CONST_String: return "#" + index + " = \"" + pool.getStringInfo(index) + "\""; case ConstPool.CONST_Integer: return "#" + index + " = int " + pool.getIntegerInfo(index); case ConstPool.CONST_Float: return "#" + index + " = float " + pool.getFloatInfo(index); case ConstPool.CONST_Long: return "#" + index + " = long " + pool.getLongInfo(index); case ConstPool.CONST_Double: return "#" + index + " = int " + pool.getDoubleInfo(index); case ConstPool.CONST_Class: return classInfo(pool, index); default: throw new RuntimeException("bad LDC: " + tag); } } }
private static String ldc(ConstPool pool, int index) { int tag = pool.getTag(index); switch (tag) { case ConstPool.CONST_String: return "#" + index + " = \"" + pool.getStringInfo(index) + "\""; case ConstPool.CONST_Integer: return "#" + index + " = int " + pool.getIntegerInfo(index); case ConstPool.CONST_Float: return "#" + index + " = float " + pool.getFloatInfo(index); case ConstPool.CONST_Long: return "#" + index + " = long " + pool.getLongInfo(index); case ConstPool.CONST_Double: return "#" + index + " = int " + pool.getDoubleInfo(index); case ConstPool.CONST_Class: return classInfo(pool, index); default: throw new RuntimeException("bad LDC: " + tag); } } }
private static String ldc(ConstPool pool, int index) { int tag = pool.getTag(index); switch (tag) { case ConstPool.CONST_String: return "#" + index + " = \"" + pool.getStringInfo(index) + "\""; case ConstPool.CONST_Integer: return "#" + index + " = int " + pool.getIntegerInfo(index); case ConstPool.CONST_Float: return "#" + index + " = float " + pool.getFloatInfo(index); case ConstPool.CONST_Long: return "#" + index + " = long " + pool.getLongInfo(index); case ConstPool.CONST_Double: return "#" + index + " = int " + pool.getDoubleInfo(index); case ConstPool.CONST_Class: return classInfo(pool, index); default: throw new RuntimeException("bad LDC: " + tag); } } }
protected String getLatestArg(MethodCall call, int skip) throws BadBytecode { int[] indices = new int[skip + 1]; int counter = 0; MethodInfo info = ((CtMethod)call.where()).getMethodInfo(); CodeIterator iterator = info.getCodeAttribute().iterator(); int currentPos = call.indexOfBytecode(); while (iterator.hasNext()) { int pos = iterator.next(); if (pos >= currentPos) break; switch (iterator.byteAt(pos)) { case Opcode.LDC: indices[(counter++) % indices.length] = iterator.byteAt(pos + 1); break; case Opcode.LDC_W: indices[(counter++) % indices.length] = iterator.u16bitAt(pos + 1); break; } } if (counter < skip) return null; return info.getConstPool().getStringInfo(indices[(indices.length + counter - skip) % indices.length]); }
private String getLastConstantArgument(final MethodCall call, final int skip) throws BadBytecode { final int[] indices = new int[skip + 1]; int counter = 0; final MethodInfo info = ((CtMethod) call.where()).getMethodInfo(); final CodeIterator iterator = info.getCodeAttribute().iterator(); final int currentPos = call.indexOfBytecode(); while (iterator.hasNext()) { final int pos = iterator.next(); if (pos >= currentPos) break; switch (iterator.byteAt(pos)) { case Opcode.LDC: indices[(counter++) % indices.length] = iterator.byteAt(pos + 1); break; case Opcode.LDC_W: indices[(counter++) % indices.length] = iterator.u16bitAt(pos + 1); break; } } if (counter < skip) { return null; } counter %= indices.length; if (skip > 0) { counter -= skip; if (counter < 0) counter += indices.length; } return info.getConstPool().getStringInfo(indices[counter]); }
private String getLastConstantArgument(final MethodCall call, final int skip) throws BadBytecode { final int[] indices = new int[skip + 1]; int counter = 0; final MethodInfo info = ((CtMethod) call.where()).getMethodInfo(); final CodeIterator iterator = info.getCodeAttribute().iterator(); final int currentPos = call.indexOfBytecode(); while (iterator.hasNext()) { final int pos = iterator.next(); if (pos >= currentPos) break; switch (iterator.byteAt(pos)) { case Opcode.LDC: indices[(counter++) % indices.length] = iterator.byteAt(pos + 1); break; case Opcode.LDC_W: indices[(counter++) % indices.length] = iterator.u16bitAt(pos + 1); break; } } if (counter < skip) { return null; } counter %= indices.length; if (skip > 0) { counter -= skip; if (counter < 0) counter += indices.length; } return info.getConstPool().getStringInfo(indices[counter]); }