Package cn.wensiqun.asmsupport.exception

Examples of cn.wensiqun.asmsupport.exception.ASMSupportException


  @Override
  public MethodInvoker invokeSuperConstructor(Parameterized... arguments) {
      AClass owner = getMethodOwner();
      if(ModifierUtils.isEnum(getMethodOwner().getModifiers())){
        throw new ASMSupportException("Cannot invoke super constructor from enum type " + owner);
      }
        invokeVerify(owner);

        return OperatorFactory.newOperator(SuperConstructorInvoker.class,
            new Class<?>[]{ProgramBlock.class, AClass.class, Parameterized[].class},
View Full Code Here


    @Override
  protected void verifyArgument() {
      AClass ftrCls = factor.getParamterizedType();
        if(!(ftrCls.equals(AClass.BOOLEAN_ACLASS) && !ftrCls.equals(AClass.BOOLEAN_WRAP_ACLASS))){
            throw new ASMSupportException("the factor type must be boolean or Boolean for logical operator!");
        }
  }
View Full Code Here

    @Override
    public void execute() {
        if(byOtherUsed){
            super.execute();
        }else{
            throw new ASMSupportException("the logical operator " + operator + " " +
                    factor.getParamterizedType() + " has not been used by other operator.");
        }
    }
View Full Code Here

    AClass ftrCls1 = factor1.getParamterizedType();
        AClass ftrCls2 = factor2.getParamterizedType();
       
        if(!((ftrCls1.equals(AClass.BOOLEAN_ACLASS) || ftrCls1.equals(AClass.BOOLEAN_WRAP_ACLASS)) &&
           (ftrCls2.equals(AClass.BOOLEAN_ACLASS) || ftrCls2.equals(AClass.BOOLEAN_WRAP_ACLASS)))){
            throw new ASMSupportException("the factor type must be boolean or Boolean for logical operator!");
        }
  }
View Full Code Here

     * @return
     */
    public Catch catchException(Catch ca){
     
        if(this.finallyBlock != null){
            throw new ASMSupportException("cannot declare catch after finally block");
        }
       
        if(entityTry.checkCatchBlockException(ca.exception)){
            throw new ASMSupportException("the exception type " + ca.exception + " has been catch by previously catch block");
        }

        entityTry.addCatchedException(ca.getException());
        /*entityTry.getCatchedExceptions().add(ca.getException());
      entityTry.removeException(ca.getException());*/
 
View Full Code Here

        return ca;
    }
   
    public Finally finallyThan(Finally fly){
        if(this.nextCatch != null){
            throw new ASMSupportException("cannot declare finally block before catch");
        }
        setFinallyBlock(fly);
        fly.setPrevious(this);

        subBlockPrepare(fly, getOwnerBlock());
View Full Code Here

                    argclses[i] = ((ProductClass) ttns[i].type).getReallyClass();
                }catch(ClassCastException cce){
                    try {
                        argclses[i] = ClassUtils.forName(((ArrayClass) ttns[i].type).getDescription());
                    } catch (ClassNotFoundException e) {
                      throw new ASMSupportException("Class not found exception : " + ((ArrayClass) ttns[i].type).getDescription() ,e);
                    }
                }
            }
           
            AClass[] pcs;
View Full Code Here

     */
    protected MethodEntity determineMostSpecificMethodEntity(MethodEntityTypeTreeNodeCombine[] mettnc){
        if(mettnc.length > 0){
            int mostIndex = mostSpecificIndex(mettnc);
            if(mostIndex == -1){
                throw new ASMSupportException("Ambiguous ...............");
            }else{
                return mettnc[mostIndex].entity;
            }
        }else{
            return null;
View Full Code Here

   
    protected abstract MethodEntity foundMethodWithNoArguments();
   
    protected MethodEntity foundMethodWithNoArguments(Class<?> cls){
        if(cls.isPrimitive()){
            throw new ASMSupportException("cannot invoke method in prmitive");
        }
       
        Class<?> actually = cls;
        MethodEntity me;
       
        for(; actually != null ;){
            try {
              AClass methodReturnType = null;
              int methodMidifiers;
              AClass[] exceptionTypes;
             
              if(name.equals(ASConstant.INIT)){
                    Constructor<?> constructor = actually.getDeclaredConstructor();
                    methodMidifiers = constructor.getModifiers();
                    exceptionTypes = convertToAClass(constructor.getExceptionTypes());
              }else{
                    Method method = actually.getDeclaredMethod(name);
                    methodReturnType = AClassFactory.getProductClass(method.getReturnType());
                    methodMidifiers = method.getModifiers();
                    exceptionTypes = convertToAClass(method.getExceptionTypes());
              }
             
                AClass invoked =  AClassFactory.getProductClass(cls);
                AClass actuallyInvoked = AClassFactory.getProductClass(actually);
               
                if(!AClassUtils.visible(invoker, invoked, actuallyInvoked, methodMidifiers)){
                    throw new ASMSupportException("cannot invoke method by the modifiers " + Modifier.toString(methodMidifiers));
                }
               
                me = new MethodEntity(name,invoked, actuallyInvoked,
                        null, null, methodReturnType, exceptionTypes, methodMidifiers);
               
View Full Code Here

   
    private void checkMember(MemberVariable member){
        AClass cls = member.getParamterizedType();
        if(!cls.isArray() &&
           !cls.isChildOrEqual(AClassFactory.getProductClass(Iterable.class))){
            throw new ASMSupportException("The object must be an array or an object that implements the new Iterable interface.");
        }
    }
View Full Code Here

TOP

Related Classes of cn.wensiqun.asmsupport.exception.ASMSupportException

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.