ConstPool constPool = getConstPool(); int pos = currentPos; CtClass retType; if (opcode == Opcode.NEWARRAY) { index = iterator.byteAt(currentPos + 1); // atype CtPrimitiveType cpt = (CtPrimitiveType)getPrimitiveType(index); desc = "[" + cpt.getDescriptor(); codeLength = 2; true, paramVar, withinStatic()); checkResultValue(retType, statement); int retVar = jc.recordReturnType(retType, true); jc.recordProceed(new ProceedForArray(retType, opcode, index, dim)); storeStack(params, true, paramVar, bytecode); jc.recordLocalVariables(ca, pos); bytecode.addAload(retVar); replace0(pos, bytecode, codeLength);
/** * Replaces the array creation with the bytecode derived from * the given source text. * * <p>$0 is available even if the called method is static. * If the field access is writing, $_ is available but the value * of $_ is ignored. * * @param statement a Java statement except try-catch. */ public void replace(String statement) throws CannotCompileException { try { replace2(statement); } catch (CompileError e) { throw new CannotCompileException(e); } catch (NotFoundException e) { throw new CannotCompileException(e); } catch (BadBytecode e) { throw new CannotCompileException("broken method"); } }
/** * Returns the type of array components. If the created array is * a two-dimensional array of <tt>int</tt>, * the type returned by this method is * not <tt>int[]</tt> but <tt>int</tt>. */ public CtClass getComponentType() throws NotFoundException { if (opcode == Opcode.NEWARRAY) { int atype = iterator.byteAt(currentPos + 1); return getPrimitiveType(atype); } else if (opcode == Opcode.ANEWARRAY || opcode == Opcode.MULTIANEWARRAY) { int index = iterator.u16bitAt(currentPos + 1); String desc = getConstPool().getClassInfo(index); int dim = Descriptor.arrayDimension(desc); desc = Descriptor.toArrayComponent(desc, dim); return Descriptor.toCtClass(desc, thisClass.getClassPool()); } else throw new RuntimeException("bad opcode: " + opcode); }
/** * Returns the dimension of the created array. */ public int getDimension() { if (opcode == Opcode.NEWARRAY) return 1; else if (opcode == Opcode.ANEWARRAY || opcode == Opcode.MULTIANEWARRAY) { int index = iterator.u16bitAt(currentPos + 1); String desc = getConstPool().getClassInfo(index); return Descriptor.arrayDimension(desc) + (opcode == Opcode.ANEWARRAY ? 1 : 0); } else throw new RuntimeException("bad opcode: " + opcode); }
if (c == Opcode.NEWARRAY || c == Opcode.ANEWARRAY || c == Opcode.MULTIANEWARRAY) { expr = new NewArray(pos, iterator, clazz, minfo, c); edit((NewArray)expr);
/** * Returns the type of array components. If the created array is * a two-dimensional array of <code>int</code>, * the type returned by this method is * not <code>int[]</code> but <code>int</code>. */ public CtClass getComponentType() throws NotFoundException { if (opcode == Opcode.NEWARRAY) { int atype = iterator.byteAt(currentPos + 1); return getPrimitiveType(atype); } else if (opcode == Opcode.ANEWARRAY || opcode == Opcode.MULTIANEWARRAY) { int index = iterator.u16bitAt(currentPos + 1); String desc = getConstPool().getClassInfo(index); int dim = Descriptor.arrayDimension(desc); desc = Descriptor.toArrayComponent(desc, dim); return Descriptor.toCtClass(desc, thisClass.getClassPool()); } else throw new RuntimeException("bad opcode: " + opcode); }
/** * Returns the dimension of the created array. */ public int getDimension() { if (opcode == Opcode.NEWARRAY) return 1; else if (opcode == Opcode.ANEWARRAY || opcode == Opcode.MULTIANEWARRAY) { int index = iterator.u16bitAt(currentPos + 1); String desc = getConstPool().getClassInfo(index); return Descriptor.arrayDimension(desc) + (opcode == Opcode.ANEWARRAY ? 1 : 0); } else throw new RuntimeException("bad opcode: " + opcode); }
if (c == Opcode.NEWARRAY || c == Opcode.ANEWARRAY || c == Opcode.MULTIANEWARRAY) { expr = new NewArray(pos, iterator, clazz, minfo, c); edit((NewArray)expr);
ConstPool constPool = getConstPool(); int pos = currentPos; CtClass retType; if (opcode == Opcode.NEWARRAY) { index = iterator.byteAt(currentPos + 1); // atype CtPrimitiveType cpt = (CtPrimitiveType)getPrimitiveType(index); desc = "[" + cpt.getDescriptor(); codeLength = 2; true, paramVar, withinStatic()); checkResultValue(retType, statement); int retVar = jc.recordReturnType(retType, true); jc.recordProceed(new ProceedForArray(retType, opcode, index, dim)); storeStack(params, true, paramVar, bytecode); jc.recordLocalVariables(ca, pos); bytecode.addAload(retVar); replace0(pos, bytecode, codeLength);
/** * Returns the type of array components. If the created array is * a two-dimensional array of <tt>int</tt>, * the type returned by this method is * not <tt>int[]</tt> but <tt>int</tt>. */ public CtClass getComponentType() throws NotFoundException { if (opcode == Opcode.NEWARRAY) { int atype = iterator.byteAt(currentPos + 1); return getPrimitiveType(atype); } else if (opcode == Opcode.ANEWARRAY || opcode == Opcode.MULTIANEWARRAY) { int index = iterator.u16bitAt(currentPos + 1); String desc = getConstPool().getClassInfo(index); int dim = Descriptor.arrayDimension(desc); desc = Descriptor.toArrayComponent(desc, dim); return Descriptor.toCtClass(desc, thisClass.getClassPool()); } else throw new RuntimeException("bad opcode: " + opcode); }
/** * Returns the dimension of the created array. */ public int getDimension() { if (opcode == Opcode.NEWARRAY) return 1; else if (opcode == Opcode.ANEWARRAY || opcode == Opcode.MULTIANEWARRAY) { int index = iterator.u16bitAt(currentPos + 1); String desc = getConstPool().getClassInfo(index); return Descriptor.arrayDimension(desc) + (opcode == Opcode.ANEWARRAY ? 1 : 0); } else throw new RuntimeException("bad opcode: " + opcode); }
/** * Replaces the array creation with the bytecode derived from * the given source text. * * <p>$0 is available even if the called method is static. * If the field access is writing, $_ is available but the value * of $_ is ignored. * * @param statement a Java statement except try-catch. */ @Override public void replace(String statement) throws CannotCompileException { try { replace2(statement); } catch (CompileError e) { throw new CannotCompileException(e); } catch (NotFoundException e) { throw new CannotCompileException(e); } catch (BadBytecode e) { throw new CannotCompileException("broken method"); } }
if (c == Opcode.NEWARRAY || c == Opcode.ANEWARRAY || c == Opcode.MULTIANEWARRAY) { expr = new NewArray(pos, iterator, clazz, minfo, c); edit((NewArray)expr);
ConstPool constPool = getConstPool(); int pos = currentPos; CtClass retType; if (opcode == Opcode.NEWARRAY) { index = iterator.byteAt(currentPos + 1); // atype CtPrimitiveType cpt = (CtPrimitiveType)getPrimitiveType(index); desc = "[" + cpt.getDescriptor(); codeLength = 2; true, paramVar, withinStatic()); checkResultValue(retType, statement); int retVar = jc.recordReturnType(retType, true); jc.recordProceed(new ProceedForArray(retType, opcode, index, dim)); storeStack(params, true, paramVar, bytecode); jc.recordLocalVariables(ca, pos); bytecode.addAload(retVar); replace0(pos, bytecode, codeLength);
/** * Returns the type of array components. If the created array is * a two-dimensional array of <tt>int</tt>, * the type returned by this method is * not <tt>int[]</tt> but <tt>int</tt>. */ public CtClass getComponentType() throws NotFoundException { if (opcode == Opcode.NEWARRAY) { int atype = iterator.byteAt(currentPos + 1); return getPrimitiveType(atype); } else if (opcode == Opcode.ANEWARRAY || opcode == Opcode.MULTIANEWARRAY) { int index = iterator.u16bitAt(currentPos + 1); String desc = getConstPool().getClassInfo(index); int dim = Descriptor.arrayDimension(desc); desc = Descriptor.toArrayComponent(desc, dim); return Descriptor.toCtClass(desc, thisClass.getClassPool()); } else throw new RuntimeException("bad opcode: " + opcode); }
/** * Returns the dimension of the created array. */ public int getDimension() { if (opcode == Opcode.NEWARRAY) return 1; else if (opcode == Opcode.ANEWARRAY || opcode == Opcode.MULTIANEWARRAY) { int index = iterator.u16bitAt(currentPos + 1); String desc = getConstPool().getClassInfo(index); return Descriptor.arrayDimension(desc) + (opcode == Opcode.ANEWARRAY ? 1 : 0); } else throw new RuntimeException("bad opcode: " + opcode); }
/** * Replaces the array creation with the bytecode derived from * the given source text. * * <p>$0 is available even if the called method is static. * If the field access is writing, $_ is available but the value * of $_ is ignored. * * @param statement a Java statement except try-catch. */ public void replace(String statement) throws CannotCompileException { try { replace2(statement); } catch (CompileError e) { throw new CannotCompileException(e); } catch (NotFoundException e) { throw new CannotCompileException(e); } catch (BadBytecode e) { throw new CannotCompileException("broken method"); } }
if (c == Opcode.NEWARRAY || c == Opcode.ANEWARRAY || c == Opcode.MULTIANEWARRAY) { expr = new NewArray(pos, iterator, clazz, minfo, c); edit((NewArray)expr);
ConstPool constPool = getConstPool(); int pos = currentPos; CtClass retType; if (opcode == Opcode.NEWARRAY) { index = iterator.byteAt(currentPos + 1); // atype CtPrimitiveType cpt = (CtPrimitiveType)getPrimitiveType(index); desc = "[" + cpt.getDescriptor(); codeLength = 2; true, paramVar, withinStatic()); checkResultValue(retType, statement); int retVar = jc.recordReturnType(retType, true); jc.recordProceed(new ProceedForArray(retType, opcode, index, dim)); storeStack(params, true, paramVar, bytecode); jc.recordLocalVariables(ca, pos); bytecode.addAload(retVar); replace0(pos, bytecode, codeLength);
/** * Returns the type of array components. If the created array is * a two-dimensional array of <tt>int</tt>, * the type returned by this method is * not <tt>int[]</tt> but <tt>int</tt>. */ public CtClass getComponentType() throws NotFoundException { if (opcode == Opcode.NEWARRAY) { int atype = iterator.byteAt(currentPos + 1); return getPrimitiveType(atype); } else if (opcode == Opcode.ANEWARRAY || opcode == Opcode.MULTIANEWARRAY) { int index = iterator.u16bitAt(currentPos + 1); String desc = getConstPool().getClassInfo(index); int dim = Descriptor.arrayDimension(desc); desc = Descriptor.toArrayComponent(desc, dim); return Descriptor.toCtClass(desc, thisClass.getClassPool()); } else throw new RuntimeException("bad opcode: " + opcode); }