Tabnine Logo
MULTIANEWARRAY
Code IndexAdd Tabnine to your IDE (free)

How to use
MULTIANEWARRAY
in
org.apache.bcel.generic

Best Java code snippets using org.apache.bcel.generic.MULTIANEWARRAY (Showing top 16 results out of 315)

origin: spotbugs/spotbugs

@Override
public void visitMULTIANEWARRAY(MULTIANEWARRAY obj) {
  consumeStack(obj);
  Type elementType = obj.getType(getCPG());
  pushValue(elementType);
  // We now have an exact type for this value.
  setTopOfStackIsExact();
}
origin: bcel/bcel

/** Checks if the constraints of operands of the said instruction(s) are satisfied. */
public void visitMULTIANEWARRAY(MULTIANEWARRAY o){
  indexValid(o, o.getIndex());
  Constant c = cpg.getConstant(o.getIndex());
  if (!	(c instanceof ConstantClass)){
    constraintViolated(o, "Expecting a CONSTANT_Class operand, but found a '"+c+"'.");
  }
  int dimensions2create = o.getDimensions();
  if (dimensions2create < 1){
    constraintViolated(o, "Number of dimensions to create must be greater than zero.");
  }
  Type t = o.getType(cpg);
  if (t instanceof ArrayType){
    int dimensions = ((ArrayType) t).getDimensions();
    if (dimensions < dimensions2create){
      constraintViolated(o, "Not allowed to create array with more dimensions ('+dimensions2create+') than the one referenced by the CONSTANT_Class '"+t+"'.");
    }
  }
  else{
    constraintViolated(o, "Expecting a CONSTANT_Class referencing an array type. [Constraint not found in The Java Virtual Machine Specification, Second Edition, 4.8.1]");
  }
}
origin: org.apache.bcel/bcel

/** Symbolically executes the corresponding Java Virtual Machine instruction. */
@Override
public void visitMULTIANEWARRAY(final MULTIANEWARRAY o) {
  for (int i=0; i<o.getDimensions(); i++) {
    stack().pop();
  }
  stack().push(o.getType(cpg));
}
/** Symbolically executes the corresponding Java Virtual Machine instruction. */
origin: bcel/bcel

/** Create new array of given size and type.
 * @return an instruction that creates the corresponding array at runtime, i.e. is an AllocationInstruction
 */
public Instruction createNewArray(Type t, short dim) {
 if(dim == 1) {
  if(t instanceof ObjectType)
 return new ANEWARRAY(cp.addClass((ObjectType)t));
  else if(t instanceof ArrayType)
 return new ANEWARRAY(cp.addArrayClass((ArrayType)t));
  else
 return new NEWARRAY(((BasicType)t).getType());
 } else {
  ArrayType at;
  if(t instanceof ArrayType)
 at = (ArrayType)t;
  else
 at = new ArrayType(t, dim);
  return new MULTIANEWARRAY(cp.addArrayClass(at), dim);
 }
}
origin: bcel/bcel

/**
 * Ensures the specific preconditions of the said instruction.
 */
public void visitMULTIANEWARRAY(MULTIANEWARRAY o){
  int dimensions = o.getDimensions();
  // Dimensions argument is okay: see Pass 3a.
  for (int i=0; i<dimensions; i++){
    if (stack().peek(i) != Type.INT){
      constraintViolated(o, "The '"+dimensions+"' upper stack types should be 'int' but aren't.");
    }
  }
  // The runtime constant pool item at that index must be a symbolic reference to a class,
  // array, or interface type. See Pass 3a.
}
origin: org.apache.bcel/bcel

/** Checks if the constraints of operands of the said instruction(s) are satisfied. */
@Override
public void visitMULTIANEWARRAY(final MULTIANEWARRAY o) {
  indexValid(o, o.getIndex());
  final Constant c = cpg.getConstant(o.getIndex());
  if (!    (c instanceof ConstantClass)) {
    constraintViolated(o, "Expecting a CONSTANT_Class operand, but found a '"+c+"'.");
  }
  final int dimensions2create = o.getDimensions();
  if (dimensions2create < 1) {
    constraintViolated(o, "Number of dimensions to create must be greater than zero.");
  }
  final Type t = o.getType(cpg);
  if (t instanceof ArrayType) {
    final int dimensions = ((ArrayType) t).getDimensions();
    if (dimensions < dimensions2create) {
      constraintViolated(o,
        "Not allowed to create array with more dimensions ('"+dimensions2create+
        "') than the one referenced by the CONSTANT_Class '"+t+"'.");
    }
  }
  else{
    constraintViolated(o, "Expecting a CONSTANT_Class referencing an array type."+
      " [Constraint not found in The Java Virtual Machine Specification, Second Edition, 4.8.1]");
  }
}
origin: bcel/bcel

/** Symbolically executes the corresponding Java Virtual Machine instruction. */ 
public void visitMULTIANEWARRAY(MULTIANEWARRAY o){
  for (int i=0; i<o.getDimensions(); i++){
    stack().pop();
  }
  stack().push(o.getType(cpg));
}
/** Symbolically executes the corresponding Java Virtual Machine instruction. */ 
origin: org.apache.bcel/bcel

/** Create new array of given size and type.
 * @return an instruction that creates the corresponding array at runtime, i.e. is an AllocationInstruction
 */
public Instruction createNewArray( final Type t, final short dim ) {
  if (dim == 1) {
    if (t instanceof ObjectType) {
      return new ANEWARRAY(cp.addClass((ObjectType) t));
    } else if (t instanceof ArrayType) {
      return new ANEWARRAY(cp.addArrayClass((ArrayType) t));
    } else {
      return new NEWARRAY(t.getType());
    }
  }
  ArrayType at;
  if (t instanceof ArrayType) {
    at = (ArrayType) t;
  } else {
    at = new ArrayType(t, dim);
  }
  return new MULTIANEWARRAY(cp.addArrayClass(at), dim);
}
origin: org.apache.bcel/bcel

/**
 * Ensures the specific preconditions of the said instruction.
 */
@Override
public void visitMULTIANEWARRAY(final MULTIANEWARRAY o) {
  final int dimensions = o.getDimensions();
  // Dimensions argument is okay: see Pass 3a.
  for (int i=0; i<dimensions; i++) {
    if (stack().peek(i) != Type.INT) {
      constraintViolated(o, "The '"+dimensions+"' upper stack types should be 'int' but aren't.");
    }
  }
  // The runtime constant pool item at that index must be a symbolic reference to a class,
  // array, or interface type. See Pass 3a.
}
origin: org.apache.bcel/bcel

@Override
public ObjectType getLoadClassType( final ConstantPoolGen cpg ) {
  Type t = getType(cpg);
  if (t instanceof ArrayType) {
    t = ((ArrayType) t).getBasicType();
  }
  return (t instanceof ObjectType) ? (ObjectType) t : null;
}
origin: org.apache.bcel/bcel

  break;
case Const.MULTIANEWARRAY:
  obj = new MULTIANEWARRAY();
  break;
case Const.IFNULL:
origin: bcel/bcel

public void visitAllocationInstruction(AllocationInstruction i) {
 Type type;
 if(i instanceof CPInstruction) {
  type = ((CPInstruction)i).getType(_cp);
 } else {
  type = ((NEWARRAY)i).getType();
 }
 short opcode = ((Instruction)i).getOpcode();
 int   dim    = 1;
 switch(opcode) {
 case Constants.NEW:
  _out.println("il.append(_factory.createNew(\"" +
     ((ObjectType)type).getClassName() + "\"));");
  break;
 case Constants.MULTIANEWARRAY:
  dim = ((MULTIANEWARRAY)i).getDimensions();
 case Constants.ANEWARRAY:
 case Constants.NEWARRAY:
  _out.println("il.append(_factory.createNewArray(" +
     BCELifier.printType(type) + ", (short) " + dim + "));");
  break;
 default:
  throw new RuntimeException("Oops: " + opcode);
 }
}
origin: bcel/bcel

public ObjectType getLoadClassType(ConstantPoolGen cpg) {
 Type t = getType(cpg);
 
 if (t instanceof ArrayType){
  t = ((ArrayType) t).getBasicType();
 }
 
 return (t instanceof ObjectType)? (ObjectType) t : null;
}
origin: rohanpadhye/jqf

  break;
case Const.MULTIANEWARRAY:
  ins = new MULTIANEWARRAY(generateClassRef(r), r.nextShort((short) 1 , Short.MAX_VALUE));
  break;
case Const.IFNULL:
origin: org.apache.bcel/bcel

@Override
public void visitAllocationInstruction( final AllocationInstruction i ) {
  Type type;
  if (i instanceof CPInstruction) {
    type = ((CPInstruction) i).getType(_cp);
  } else {
    type = ((NEWARRAY) i).getType();
  }
  final short opcode = ((Instruction) i).getOpcode();
  int dim = 1;
  switch (opcode) {
    case Const.NEW:
      _out.println("il.append(_factory.createNew(\"" + ((ObjectType) type).getClassName()
          + "\"));");
      break;
    case Const.MULTIANEWARRAY:
      dim = ((MULTIANEWARRAY) i).getDimensions();
      //$FALL-THROUGH$
    case Const.ANEWARRAY:
    case Const.NEWARRAY:
      if (type instanceof ArrayType) {
        type = ((ArrayType) type).getBasicType();
      }
      _out.println("il.append(_factory.createNewArray(" + BCELifier.printType(type)
          + ", (short) " + dim + "));");
      break;
    default:
      throw new RuntimeException("Oops: " + opcode);
  }
}
origin: com.google.code.findbugs/findbugs

@Override
public void visitMULTIANEWARRAY(MULTIANEWARRAY obj) {
  consumeStack(obj);
  Type elementType = obj.getType(getCPG());
  pushValue(elementType);
  // We now have an exact type for this value.
  setTopOfStackIsExact();
}
org.apache.bcel.genericMULTIANEWARRAY

Javadoc

MULTIANEWARRAY - Create new mutidimensional array of references
Stack: ..., count1, [count2, ...] -> ..., arrayref

Most used methods

  • getType
  • <init>
  • getDimensions
  • getIndex

Popular in Java

  • Reading from database using SQL prepared statement
  • setRequestProperty (URLConnection)
  • getSystemService (Context)
  • getContentResolver (Context)
  • MessageDigest (java.security)
    Uses a one-way hash function to turn an arbitrary number of bytes into a fixed-length byte sequence.
  • MessageFormat (java.text)
    Produces concatenated messages in language-neutral way. New code should probably use java.util.Forma
  • JLabel (javax.swing)
  • Response (javax.ws.rs.core)
    Defines the contract between a returned instance and the runtime when an application needs to provid
  • XPath (javax.xml.xpath)
    XPath provides access to the XPath evaluation environment and expressions. Evaluation of XPath Expr
  • LogFactory (org.apache.commons.logging)
    Factory for creating Log instances, with discovery and configuration features similar to that employ
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now