Package org.aspectj.apache.bcel.verifier.exc

Examples of org.aspectj.apache.bcel.verifier.exc.ClassConstraintException


      carrier.visit();
    }

    private void checkIndex(Node referrer, int index, Class shouldbe){
      if ((index < 0) || (index >= cplen)){
        throw new ClassConstraintException("Invalid index '"+index+"' used by '"+tostring(referrer)+"'.");
      }
      Constant c = cp.getConstant(index);
      if (! shouldbe.isInstance(c)){
        /* String isnot = shouldbe.toString().substring(shouldbe.toString().lastIndexOf(".")+1); //Cut all before last "." */
        throw new ClassCastException("Illegal constant '"+tostring(c)+"' at index '"+index+"'. '"+tostring(referrer)+"' expects a '"+shouldbe+"'.");
View Full Code Here


          addMessage("Attribute '"+tostring(atts[i])+"' as an attribute of the ClassFile structure '"+tostring(obj)+"' is unknown and will therefore be ignored.");
        }

        if (atts[i] instanceof SourceFile){
          if (foundSourceFile == false) foundSourceFile = true;
          else throw new ClassConstraintException("A ClassFile structure (like '"+tostring(obj)+"') may have no more than one SourceFile attribute."); //vmspec2 4.7.7
        }

        if (atts[i] instanceof InnerClasses){
          if (foundInnerClasses == false) foundInnerClasses = true;
          else{
            if (hasInnerClass){
              throw new ClassConstraintException("A Classfile structure (like '"+tostring(obj)+"') must have exactly one InnerClasses attribute if at least one Inner Class is referenced (which is the case). More than one InnerClasses attribute was found.");
            }
          }
          if (!hasInnerClass){
            addMessage("No referenced Inner Class found, but InnerClasses attribute '"+tostring(atts[i])+"' found. Strongly suggest removal of that attribute.");
          }
View Full Code Here

    /////////////////////////////
    // CONSTANTS (vmspec2 4.4) //
    /////////////////////////////
    public void visitConstantClass(ConstantClass obj){
      if (obj.getTag() != Constants.CONSTANT_Class){
        throw new ClassConstraintException("Wrong constant tag in '"+tostring(obj)+"'.");
      }
      checkIndex(obj, obj.getNameIndex(), CONST_Utf8);

    }
View Full Code Here

      checkIndex(obj, obj.getNameIndex(), CONST_Utf8);

    }
    public void visitConstantFieldref(ConstantFieldref obj){
      if (obj.getTag() != Constants.CONSTANT_Fieldref){
        throw new ClassConstraintException("Wrong constant tag in '"+tostring(obj)+"'.");
      }
      checkIndex(obj, obj.getClassIndex(), CONST_Class);
      checkIndex(obj, obj.getNameAndTypeIndex(), CONST_NameAndType);
    }
View Full Code Here

      checkIndex(obj, obj.getClassIndex(), CONST_Class);
      checkIndex(obj, obj.getNameAndTypeIndex(), CONST_NameAndType);
    }
    public void visitConstantMethodref(ConstantMethodref obj){
      if (obj.getTag() != Constants.CONSTANT_Methodref){
        throw new ClassConstraintException("Wrong constant tag in '"+tostring(obj)+"'.");
      }
      checkIndex(obj, obj.getClassIndex(), CONST_Class);
      checkIndex(obj, obj.getNameAndTypeIndex(), CONST_NameAndType);
    }
View Full Code Here

      checkIndex(obj, obj.getClassIndex(), CONST_Class);
      checkIndex(obj, obj.getNameAndTypeIndex(), CONST_NameAndType);
    }
    public void visitConstantInterfaceMethodref(ConstantInterfaceMethodref obj){
      if (obj.getTag() != Constants.CONSTANT_InterfaceMethodref){
        throw new ClassConstraintException("Wrong constant tag in '"+tostring(obj)+"'.");
      }
      checkIndex(obj, obj.getClassIndex(), CONST_Class);
      checkIndex(obj, obj.getNameAndTypeIndex(), CONST_NameAndType);
    }
View Full Code Here

      checkIndex(obj, obj.getClassIndex(), CONST_Class);
      checkIndex(obj, obj.getNameAndTypeIndex(), CONST_NameAndType);
    }
    public void visitConstantString(ConstantString obj){
      if (obj.getTag() != Constants.CONSTANT_String){
        throw new ClassConstraintException("Wrong constant tag in '"+tostring(obj)+"'.");
      }
      checkIndex(obj, obj.getStringIndex(), CONST_Utf8);
    }
View Full Code Here

      }
      checkIndex(obj, obj.getStringIndex(), CONST_Utf8);
    }
    public void visitConstantInteger(ConstantInteger obj){
      if (obj.getTag() != Constants.CONSTANT_Integer){
        throw new ClassConstraintException("Wrong constant tag in '"+tostring(obj)+"'.");
      }
      // no indices to check
    }
View Full Code Here

      }
      // no indices to check
    }
    public void visitConstantFloat(ConstantFloat obj){
      if (obj.getTag() != Constants.CONSTANT_Float){
        throw new ClassConstraintException("Wrong constant tag in '"+tostring(obj)+"'.");
      }
      //no indices to check
    }
View Full Code Here

      }
      //no indices to check
    }
    public void visitConstantLong(ConstantLong obj){
      if (obj.getTag() != Constants.CONSTANT_Long){
        throw new ClassConstraintException("Wrong constant tag in '"+tostring(obj)+"'.");
      }
      //no indices to check
    }
View Full Code Here

TOP

Related Classes of org.aspectj.apache.bcel.verifier.exc.ClassConstraintException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.