@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(); }
@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; }
public ObjectType getLoadClassType(ConstantPoolGen cpg) { Type t = getType(cpg); if (t instanceof ArrayType){ t = ((ArrayType) t).getBasicType(); } return (t instanceof ObjectType)? (ObjectType) t : null; }
@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(); }
/** 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. */
/** 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. */
/** 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]"); } }
/** 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]"); } }