Package org.jboss.byteman.rule.exception

Examples of org.jboss.byteman.rule.exception.TypeException


    public Type typeCheckAssign(Type expected) throws TypeException {
        typeCheckAny();

        if (Type.dereference(expected).isDefined() && !type.isAssignableFrom(expected)) {
            throw new TypeException("StaticExpression.typeCheck : invalid value type " + expected.getName() + " for static field assignment " + getPos());
        }
        return type;
    }
View Full Code Here


        // look for a class whose name matches some initial segment of pathList
        TypeGroup typeGroup = getTypeGroup();
        ownerType = Type.dereference(typeGroup.create(ownerTypeName));
        if (ownerType.isUndefined()) {
            throw new TypeException("StaticExpression.typeCheck : invalid path " + ownerTypeName + " to static field " + fieldName + getPos());
        }

        Class clazz = ownerType.getTargetClass();
        try {
            field  = lookupField(clazz);
        } catch (NoSuchFieldException e) {
                // oops
            throw new TypeException("StaticExpression.typeCheck : invalid field name " + fieldName + getPos());
        }

        if ((field.getModifiers() & Modifier.STATIC)== 0) {
            // oops
            throw new TypeException("StaticExpression.typeCheck : field is not static " + fieldName + getPos());
        }

        clazz = field.getType();
        type = typeGroup.ensureType(clazz);
    }
View Full Code Here

     */

    public void bindAssign() throws TypeException
    {
        if (name.equals("$0") || name.equals("$this")){
            throw new TypeException("invalid assignment to final variable " + name + getPos());
        }
        if (name.equals("$^")){
            // TODO -- see if it is possible to allow update to the throwable variable
            throw new TypeException("invalid assignment to throwable variable " + name + getPos());
        }
        if (name.equals("$#")){
            throw new TypeException("invalid assignment to param count variable " + name + getPos());
        }
        if (name.equals("$*")){
            throw new TypeException("invalid assignment to param array variable " + name + getPos());
        }
        if (name.equals("$@")){
            throw new TypeException("invalid assignment to invoke param array variable " + name + getPos());
        }
        bind(true);
    }
View Full Code Here

    public Type typeCheck(Type expected) throws TypeException {

       typeCheckAny();

        if (Type.dereference(expected).isDefined() && !expected.isAssignableFrom(type)) {
            throw new TypeException("DollarExpression.typeCheck : invalid expected type " + expected.getName() + " for bound parameter " + name + getPos());           
        }
        return type;
    }
View Full Code Here

    public Type typeCheckAssign(Type expected) throws TypeException {

        typeCheckAny();

        if (Type.dereference(expected).isDefined() && !type.isAssignableFrom(expected)) {
            throw new TypeException("DollarExpression.typeCheck : invalid value type " + expected.getName() + " for assignment to bound parameter " + name + getPos());
        }
        return type;
    }
View Full Code Here

        // we have a putative reference to a class of the form
        // foo.bar.baz.Mumble.class
        TypeGroup typeGroup = getTypeGroup();
        ownerType = typeGroup.create(getPath(pathList.length));
        if (ownerType == null || ownerType.getTargetClass() == null) {
            throw new TypeException("FieldExpression.typeCheck : invalid class literal " + getPath(pathList.length) + ".class" + getPos());
        }
        type = typeGroup.ensureType(Class.class);

        return type;
    }
View Full Code Here

        // if the type of operand1 is float or double we will convert it to long and
        // generate a long result so correct the promotion here
        if (type.isFloating()) {
            type = type.J;
        } else if (type1 == type.C || type2 == type.C) {
            throw new TypeException("ShiftExpression.typeCheck : invalid operand type java.lang.character " + getPos());
        }
        if (Type.dereference(expected).isDefined() && !expected.isAssignableFrom(type)) {
            throw new TypeException("ShiftExpression.typeCheck : invalid expected result type " + expected.getName() + getPos());
        }

        return type;
    }
View Full Code Here

    public void fail(String failMessage, String triggerMethodName, String triggerMethodDescriptor)
    {
        String key = getRuleKey(triggerMethodName, triggerMethodDescriptor);
        Rule rule = ruleMap.get(key);
        String message = failMessage + " for method " + triggerMethodName + TypeHelper.internalizeDescriptor(triggerMethodDescriptor);
        TypeException te = new TypeException(message);
        ruleScript.recordTransform(loader, triggerClassName, triggerMethodName, triggerMethodDescriptor, rule, te);

        purgeRules();
        throw new TransformFailure();
    }
View Full Code Here

            type = Type.dereference(indirectStatic.typeCheck(expected));
        } else {
            typeCheckAny();

            if (Type.dereference(expected).isDefined() && !expected.isAssignableFrom(type)) {
                throw new TypeException("FieldExpresssion.typeCheck : invalid expected type " + expected.getName() + getPos());
            }
        }
        return type;
    }
View Full Code Here

        } else {
            typeCheckAny();

            // we cannot accept an array length access in this position
            if (isArrayLength) {
                throw new TypeException("FieldExpresssion.typeCheck : invalid attempt to update array length " + owner + getPos());
            }

            if (Type.dereference(expected).isDefined() && !type.isAssignableFrom(expected)) {
                throw new TypeException("FieldExpresssion.typeCheck : invalid value type " + expected.getName() + "for assignment" + getPos());
            }
        }
        return type;
    }
View Full Code Here

TOP

Related Classes of org.jboss.byteman.rule.exception.TypeException

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.