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

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


                // Sanity check
                InstructionContext lastJSR = null;
                int skip_jsr = 0;
                for (int ss = oldchain.size() - 1; ss >= 0; ss--) {
                    if (skip_jsr < 0) {
                        throw new AssertionViolatedException("More RET than JSR in execution chain?!");
                    }
                    // System.err.println("+"+oldchain.get(ss));
                    if (oldchain.get(ss).getInstruction()
                            .getInstruction() instanceof JsrInstruction)
                    {
                        if (skip_jsr == 0) {
                            lastJSR = oldchain.get(ss);
                            break;
                        } else {
                            skip_jsr--;
                        }
                    }
                    if (oldchain.get(ss).getInstruction()
                            .getInstruction() instanceof RET)
                    {
                        skip_jsr++;
                    }
                }
                if (lastJSR == null) {
                    throw new AssertionViolatedException("RET without a JSR before in ExecutionChain?! EC: '"
                            + oldchain + "'.");
                }
                JsrInstruction jsr = (JsrInstruction) lastJSR.getInstruction()
                        .getInstruction();
                if (theSuccessor != cfg.contextOf(jsr.physicalSuccessor())) {
                    throw new AssertionViolatedException("RET '"
                            + u.getInstruction()
                            + "' info inconsistent: jump back to '"
                            + theSuccessor + "' or '"
                            + cfg.contextOf(jsr.physicalSuccessor()) + "'?");
                }
View Full Code Here


            StringWriter sw = new StringWriter();
            PrintWriter pw = new PrintWriter(sw);
            re.printStackTrace(pw);

            throw new AssertionViolatedException("Some RuntimeException occured while verify()ing class '"
                    + jc.getClassName()
                    + "', method '"
                    + methods[method_no]
                    + "'. Original RuntimeException's stack trace:\n---\n"
                    + sw
View Full Code Here

                // Sanity check
                InstructionContext lastJSR = null;
                int skip_jsr = 0;
                for (int ss = oldchain.size() - 1; ss >= 0; ss--) {
                    if (skip_jsr < 0) {
                        throw new AssertionViolatedException("More RET than JSR in execution chain?!");
                    }
                    // System.err.println("+"+oldchain.get(ss));
                    if (((InstructionContext) oldchain.get(ss)).getInstruction()
                            .getInstruction() instanceof JsrInstruction)
                    {
                        if (skip_jsr == 0) {
                            lastJSR = (InstructionContext) oldchain.get(ss);
                            break;
                        } else {
                            skip_jsr--;
                        }
                    }
                    if (((InstructionContext) oldchain.get(ss)).getInstruction()
                            .getInstruction() instanceof RET)
                    {
                        skip_jsr++;
                    }
                }
                if (lastJSR == null) {
                    throw new AssertionViolatedException("RET without a JSR before in ExecutionChain?! EC: '"
                            + oldchain + "'.");
                }
                JsrInstruction jsr = (JsrInstruction) lastJSR.getInstruction()
                        .getInstruction();
                if (theSuccessor != cfg.contextOf(jsr.physicalSuccessor())) {
                    throw new AssertionViolatedException("RET '"
                            + u.getInstruction()
                            + "' info inconsistent: jump back to '"
                            + theSuccessor + "' or '"
                            + cfg.contextOf(jsr.physicalSuccessor()) + "'?");
                }
View Full Code Here

            StringWriter sw = new StringWriter();
            PrintWriter pw = new PrintWriter(sw);
            re.printStackTrace(pw);

            throw new AssertionViolatedException("Some RuntimeException occured while verify()ing class '"
                    + jc.getClassName()
                    + "', method '"
                    + methods[method_no]
                    + "'. Original RuntimeException's stack trace:\n---\n"
                    + sw
View Full Code Here

          method_number = mn;
          break;
        }
      }
      if (method_number < 0){ // Mmmmh. Can we be sure BCEL does not sometimes instantiate new objects?
        throw new AssertionViolatedException("Could not find a known BCEL Method object in the corresponding BCEL JavaClass object.");
      }
      localVariablesInfos[method_number] = new LocalVariablesInfo(obj.getMaxLocals());

      int num_of_lvt_attribs = 0;
      // Now iterate through the attributes the Code attribute has.
View Full Code Here

    // The run-time check below is needed because we don't want to omit inheritance
    // of "EmptyVisitor" and provide a thousand empty methods.
    // However, in terms of performance this would be a better idea.
    // If some new "Node" is defined in BCEL (such as some concrete "Attribute"), we
    // want to know that this class has also to be adapted.
    if (tostring == null) throw new AssertionViolatedException("Please adapt '"+getClass()+"' to deal with objects of class '"+n.getClass()+"'.");
    return tostring;
  }
View Full Code Here

   * You should not add own information. Leave that to JustIce.
   */
  public LocalVariablesInfo getLocalVariablesInfo(int method_nr){
    if (this.verify() != VerificationResult.VR_OK) return null; // It's cached, don't worry.
    if (method_nr < 0 || method_nr >= localVariablesInfos.length){
      throw new AssertionViolatedException("Method number out of range.");
    }
    return localVariablesInfos[method_nr];
  }
View Full Code Here

      }
      try{
        indexValid(o, o.getIndex()+1);
      }
      catch(StaticCodeInstructionOperandConstraintException e){
        throw new AssertionViolatedException("OOPS: Does not BCEL handle that? LDC2_W operand has a problem.");
      }
    }
View Full Code Here

          f = fields[i];
          break;
        }
      }
      if (f == null){
        throw new AssertionViolatedException("Field not found?!?");
      }

      if (f.isFinal()){
        if (!(myOwner.getClassName().equals(o.getClassType(cpg).getClassName()))){
          constraintViolated(o, "Referenced field '"+f+"' is final and must therefore be declared in the current class '"+myOwner.getClassName()+"' which is not the case: it is declared in '"+o.getClassType(cpg).getClassName()+"'.");
View Full Code Here

          f = fields[i];
          break;
        }
      }
      if (f == null){
        throw new AssertionViolatedException("Field not found?!?");
      }

      if (! (f.isStatic())){
        constraintViolated(o, "Referenced field '"+f+"' is not static which it should be.");
      }
View Full Code Here

TOP

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

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.