当前位置: 首页>>代码示例>>Java>>正文


Java VerificationResult.VERIFIED_OK属性代码示例

本文整理汇总了Java中org.apache.bcel.verifier.VerificationResult.VERIFIED_OK属性的典型用法代码示例。如果您正苦于以下问题:Java VerificationResult.VERIFIED_OK属性的具体用法?Java VerificationResult.VERIFIED_OK怎么用?Java VerificationResult.VERIFIED_OK使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.apache.bcel.verifier.VerificationResult的用法示例。


在下文中一共展示了VerificationResult.VERIFIED_OK属性的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: visitFieldInstruction

/**
* Ensures the general preconditions of a FieldInstruction instance.
*/
public void visitFieldInstruction(FieldInstruction o){
	// visitLoadClass(o) has been called before: Every FieldOrMethod
	// implements LoadClass.
	// visitCPInstruction(o) has been called before.
// A FieldInstruction may be: GETFIELD, GETSTATIC, PUTFIELD, PUTSTATIC 
	Constant c = cpg.getConstant(o.getIndex());
	if (!(c instanceof ConstantFieldref)){
		constraintViolated(o, "Index '"+o.getIndex()+"' should refer to a CONSTANT_Fieldref_info structure, but refers to '"+c+"'.");
	}
	// the o.getClassType(cpg) type has passed pass 2; see visitLoadClass(o).
	Type t = o.getType(cpg);
	if (t instanceof ObjectType){
		String name = ((ObjectType)t).getClassName();
		Verifier v = VerifierFactory.getVerifier( name );
		VerificationResult vr = v.doPass2();
		if (vr.getStatus() != VerificationResult.VERIFIED_OK){
			constraintViolated((Instruction) o, "Class '"+name+"' is referenced, but cannot be loaded and resolved: '"+vr+"'.");
		}
	}
}
 
开发者ID:Hu6,项目名称:VestaClient,代码行数:23,代码来源:InstConstraintVisitor.java

示例2: visitFieldInstruction

/**
 * Ensures the general preconditions of a FieldInstruction instance.
 */
public void visitFieldInstruction(FieldInstruction o) {
    // visitLoadClass(o) has been called before: Every FieldOrMethod
    // implements LoadClass.
    // visitCPInstruction(o) has been called before.
    // A FieldInstruction may be: GETFIELD, GETSTATIC, PUTFIELD, PUTSTATIC
    Constant c = cpg.getConstant(o.getIndex());
    if (!(c instanceof ConstantFieldref)) {
        constraintViolated(o, "Index '" + o.getIndex() + "' should refer to a CONSTANT_Fieldref_info structure, but refers to '" + c + "'.");
    }
    // the o.getClassType(cpg) type has passed pass 2; see visitLoadClass(o).
    Type t = o.getType(cpg);
    if (t instanceof ObjectType) {
        String name = ((ObjectType) t).getClassName();
        Verifier v = VerifierFactory.getVerifier(name);
        VerificationResult vr = v.doPass2();
        if (vr.getStatus() != VerificationResult.VERIFIED_OK) {
            constraintViolated(o, "Class '" + name + "' is referenced, but cannot be loaded and resolved: '" + vr + "'.");
        }
    }
}
 
开发者ID:miuirussia,项目名称:KJBE,代码行数:23,代码来源:InstConstraintVisitor.java

示例3: visitLoadClass

/**
 * Assures the generic preconditions of a LoadClass instance.
 * The referenced class is loaded and pass2-verified.
 */
public void visitLoadClass(LoadClass o){
	ObjectType t = o.getLoadClassType(cpg);
	if (t != null){// null means "no class is loaded"
		Verifier v = VerifierFactory.getVerifier(t.getClassName());
		VerificationResult vr = v.doPass1();
		if (vr.getStatus() != VerificationResult.VERIFIED_OK){
			constraintViolated((Instruction) o, "Class '"+o.getLoadClassType(cpg).getClassName()+"' is referenced, but cannot be loaded: '"+vr+"'.");
		}
	}
}
 
开发者ID:Hu6,项目名称:VestaClient,代码行数:14,代码来源:Pass3aVerifier.java

示例4: visitLoadClass

/**
 * Assures the generic preconditions of a LoadClass instance.
 * The referenced class is loaded and pass2-verified.
 */
public void visitLoadClass(LoadClass o){
	ObjectType t = o.getLoadClassType(cpg);
	if (t != null){// null means "no class is loaded"
		Verifier v = VerifierFactory.getVerifier(t.getClassName());
		VerificationResult vr = v.doPass2();
		if (vr.getStatus() != VerificationResult.VERIFIED_OK){
			constraintViolated((Instruction) o, "Class '"+o.getLoadClassType(cpg).getClassName()+"' is referenced, but cannot be loaded and resolved: '"+vr+"'.");
		}
	}
}
 
开发者ID:Hu6,项目名称:VestaClient,代码行数:14,代码来源:InstConstraintVisitor.java

示例5: visitLoadClass

/**
 * Assures the generic preconditions of a LoadClass instance.
 * The referenced class is loaded and pass2-verified.
 */
public void visitLoadClass(LoadClass o) {
    ObjectType t = o.getLoadClassType(cpg);
    if (t != null) {// null means "no class is loaded"
        Verifier v = VerifierFactory.getVerifier(t.getClassName());
        VerificationResult vr = v.doPass1();
        if (vr.getStatus() != VerificationResult.VERIFIED_OK) {
            constraintViolated((Instruction) o, "Class '" + o.getLoadClassType(cpg).getClassName() + "' is referenced, but cannot be loaded: '" + vr + "'.");
        }
    }
}
 
开发者ID:miuirussia,项目名称:KJBE,代码行数:14,代码来源:Pass3aVerifier.java

示例6: visitLoadClass

/**
 * Assures the generic preconditions of a LoadClass instance.
 * The referenced class is loaded and pass2-verified.
 */
public void visitLoadClass(LoadClass o) {
    ObjectType t = o.getLoadClassType(cpg);
    if (t != null) {// null means "no class is loaded"
        Verifier v = VerifierFactory.getVerifier(t.getClassName());
        VerificationResult vr = v.doPass2();
        if (vr.getStatus() != VerificationResult.VERIFIED_OK) {
            constraintViolated((Instruction) o, "Class '" + o.getLoadClassType(cpg).getClassName() + "' is referenced, but cannot be loaded and resolved: '" + vr + "'.");
        }
    }
}
 
开发者ID:miuirussia,项目名称:KJBE,代码行数:14,代码来源:InstConstraintVisitor.java

示例7: visitINVOKESTATIC

/**
 * Ensures the specific preconditions of the said instruction.
 */
public void visitINVOKESTATIC(INVOKESTATIC o){
    try {
	// Method is not native, otherwise pass 3 would not happen.
	
	Type t = o.getType(cpg);
	if (t instanceof ObjectType){
		String name = ((ObjectType)t).getClassName();
		Verifier v = VerifierFactory.getVerifier( name );
		VerificationResult vr = v.doPass2();
		if (vr.getStatus() != VerificationResult.VERIFIED_OK){
			constraintViolated((Instruction) o, "Class '"+name+"' is referenced, but cannot be loaded and resolved: '"+vr+"'.");
		}
	}

	Type[] argtypes = o.getArgumentTypes(cpg);
	int nargs = argtypes.length;
	
	for (int i=nargs-1; i>=0; i--){
		Type fromStack = stack().peek( (nargs-1) - i );	// 0 to nargs-1
		Type fromDesc = argtypes[i];
		if (fromDesc == Type.BOOLEAN ||
				fromDesc == Type.BYTE ||
				fromDesc == Type.CHAR ||
				fromDesc == Type.SHORT){
			fromDesc = Type.INT;
		}
		if (! fromStack.equals(fromDesc)){
			if (fromStack instanceof ReferenceType && fromDesc instanceof ReferenceType){
				ReferenceType rFromStack = (ReferenceType) fromStack;
				ReferenceType rFromDesc = (ReferenceType) fromDesc;
				// TODO: This check can possibly only be done using Staerk-et-al's "set of object types"
				// instead of a "wider cast object type" created during verification.
				if ( ! rFromStack.isAssignmentCompatibleWith(rFromDesc) ){
					constraintViolated(o, "Expecting a '"+fromDesc+"' but found a '"+fromStack+"' on the stack (which is not assignment compatible).");
				}
                   referenceTypeIsInitialized(o, rFromStack);
			}
			else{
				constraintViolated(o, "Expecting a '"+fromDesc+"' but found a '"+fromStack+"' on the stack.");
			}
		}
	}
    } catch (ClassNotFoundException e) {
	// FIXME: maybe not the best way to handle this
	throw new AssertionViolatedException("Missing class: " + e.toString());
    }
}
 
开发者ID:Hu6,项目名称:VestaClient,代码行数:50,代码来源:InstConstraintVisitor.java

示例8: visitINVOKEVIRTUAL

/**
 * Ensures the specific preconditions of the said instruction.
 */
public void visitINVOKEVIRTUAL(INVOKEVIRTUAL o){
    try {
	// the o.getClassType(cpg) type has passed pass 2; see visitLoadClass(o).

	Type t = o.getType(cpg);
	if (t instanceof ObjectType){
		String name = ((ObjectType)t).getClassName();
		Verifier v = VerifierFactory.getVerifier( name );
		VerificationResult vr = v.doPass2();
		if (vr.getStatus() != VerificationResult.VERIFIED_OK){
			constraintViolated((Instruction) o, "Class '"+name+"' is referenced, but cannot be loaded and resolved: '"+vr+"'.");
		}
	}


	Type[] argtypes = o.getArgumentTypes(cpg);
	int nargs = argtypes.length;
	
	for (int i=nargs-1; i>=0; i--){
		Type fromStack = stack().peek( (nargs-1) - i );	// 0 to nargs-1
		Type fromDesc = argtypes[i];
		if (fromDesc == Type.BOOLEAN ||
				fromDesc == Type.BYTE ||
				fromDesc == Type.CHAR ||
				fromDesc == Type.SHORT){
			fromDesc = Type.INT;
		}
		if (! fromStack.equals(fromDesc)){
			if (fromStack instanceof ReferenceType && fromDesc instanceof ReferenceType){
				ReferenceType rFromStack = (ReferenceType) fromStack;
				ReferenceType rFromDesc = (ReferenceType) fromDesc;
				// TODO: This can possibly only be checked when using Staerk-et-al's "set of object types" instead
				// of a single "wider cast object type" created during verification.
				if ( ! rFromStack.isAssignmentCompatibleWith(rFromDesc) ){
					constraintViolated(o, "Expecting a '"+fromDesc+"' but found a '"+fromStack+"' on the stack (which is not assignment compatible).");
				}
                   referenceTypeIsInitialized(o, rFromStack);
			}
			else{
				constraintViolated(o, "Expecting a '"+fromDesc+"' but found a '"+fromStack+"' on the stack.");
			}
		}
	}
	
	Type objref = stack().peek(nargs);
	if (objref == Type.NULL){
		return;
	}
	if (! (objref instanceof ReferenceType) ){
		constraintViolated(o, "Expecting a reference type as 'objectref' on the stack, not a '"+objref+"'.");
	}
	referenceTypeIsInitialized(o, (ReferenceType) objref);
	if (!(objref instanceof ObjectType)){
		if (!(objref instanceof ArrayType)){
			constraintViolated(o, "Expecting an ObjectType as 'objectref' on the stack, not a '"+objref+"'."); // could be a ReturnaddressType
		}
		else{
			objref = GENERIC_ARRAY;
		}
	}
	
	String objref_classname = ((ObjectType) objref).getClassName();

	String theClass = o.getClassName(cpg);

	if ( ! Repository.instanceOf(objref_classname, theClass) ){
		constraintViolated(o, "The 'objref' item '"+objref+"' does not implement '"+theClass+"' as expected.");
	}	
    } catch (ClassNotFoundException e) {
	// FIXME: maybe not the best way to handle this
	throw new AssertionViolatedException("Missing class: " + e.toString());
    }
}
 
开发者ID:Hu6,项目名称:VestaClient,代码行数:76,代码来源:InstConstraintVisitor.java

示例9: visitINVOKESTATIC

/**
 * Ensures the specific preconditions of the said instruction.
 */
public void visitINVOKESTATIC(INVOKESTATIC o) {
    // Method is not native, otherwise pass 3 would not happen.

    Type t = o.getType(cpg);
    if (t instanceof ObjectType) {
        String name = ((ObjectType) t).getClassName();
        Verifier v = VerifierFactory.getVerifier(name);
        VerificationResult vr = v.doPass2();
        if (vr.getStatus() != VerificationResult.VERIFIED_OK) {
            constraintViolated(o, "Class '" + name + "' is referenced, but cannot be loaded and resolved: '" + vr + "'.");
        }
    }

    Type[] argtypes = o.getArgumentTypes(cpg);
    int nargs = argtypes.length;

    for (int i = nargs - 1; i >= 0; i--) {
        Type fromStack = stack().peek((nargs - 1) - i);    // 0 to nargs-1
        Type fromDesc = argtypes[i];
        if (fromDesc == Type.BOOLEAN ||
                fromDesc == Type.BYTE ||
                fromDesc == Type.CHAR ||
                fromDesc == Type.SHORT) {
            fromDesc = Type.INT;
        }
        if (!fromStack.equals(fromDesc)) {
            if (fromStack instanceof ReferenceType && fromDesc instanceof ReferenceType) {
                ReferenceType rFromStack = (ReferenceType) fromStack;
                ReferenceType rFromDesc = (ReferenceType) fromDesc;
                // TODO: This check can possibly only be done using Staerk-et-al's "set of object types"
                // instead of a "wider cast object type" created during verification.
                if (!rFromStack.isAssignmentCompatibleWith(rFromDesc)) {
                    constraintViolated(o, "Expecting a '" + fromDesc + "' but found a '" + fromStack + "' on the stack (which is not assignment compatible).");
                }
            } else {
                constraintViolated(o, "Expecting a '" + fromDesc + "' but found a '" + fromStack + "' on the stack.");
            }
        }
    }
}
 
开发者ID:miuirussia,项目名称:KJBE,代码行数:43,代码来源:InstConstraintVisitor.java

示例10: visitINVOKEVIRTUAL

/**
 * Ensures the specific preconditions of the said instruction.
 */
public void visitINVOKEVIRTUAL(INVOKEVIRTUAL o) {
    // the o.getClassType(cpg) type has passed pass 2; see visitLoadClass(o).

    Type t = o.getType(cpg);
    if (t instanceof ObjectType) {
        String name = ((ObjectType) t).getClassName();
        Verifier v = VerifierFactory.getVerifier(name);
        VerificationResult vr = v.doPass2();
        if (vr.getStatus() != VerificationResult.VERIFIED_OK) {
            constraintViolated(o, "Class '" + name + "' is referenced, but cannot be loaded and resolved: '" + vr + "'.");
        }
    }


    Type[] argtypes = o.getArgumentTypes(cpg);
    int nargs = argtypes.length;

    for (int i = nargs - 1; i >= 0; i--) {
        Type fromStack = stack().peek((nargs - 1) - i);    // 0 to nargs-1
        Type fromDesc = argtypes[i];
        if (fromDesc == Type.BOOLEAN ||
                fromDesc == Type.BYTE ||
                fromDesc == Type.CHAR ||
                fromDesc == Type.SHORT) {
            fromDesc = Type.INT;
        }
        if (!fromStack.equals(fromDesc)) {
            if (fromStack instanceof ReferenceType && fromDesc instanceof ReferenceType) {
                ReferenceType rFromStack = (ReferenceType) fromStack;
                ReferenceType rFromDesc = (ReferenceType) fromDesc;
                // TODO: This can possibly only be checked when using Staerk-et-al's "set of object types" instead
                // of a single "wider cast object type" created during verification.
                if (!rFromStack.isAssignmentCompatibleWith(rFromDesc)) {
                    constraintViolated(o, "Expecting a '" + fromDesc + "' but found a '" + fromStack + "' on the stack (which is not assignment compatible).");
                }
            } else {
                constraintViolated(o, "Expecting a '" + fromDesc + "' but found a '" + fromStack + "' on the stack.");
            }
        }
    }

    Type objref = stack().peek(nargs);
    if (objref == Type.NULL) {
        return;
    }
    if (!(objref instanceof ReferenceType)) {
        constraintViolated(o, "Expecting a reference type as 'objectref' on the stack, not a '" + objref + "'.");
    }
    referenceTypeIsInitialized(o, (ReferenceType) objref);
    if (!(objref instanceof ObjectType)) {
        if (!(objref instanceof ArrayType)) {
            constraintViolated(o, "Expecting an ObjectType as 'objectref' on the stack, not a '" + objref + "'."); // could be a ReturnaddressType
        } else {
            objref = GENERIC_ARRAY;
        }
    }

    String objref_classname = ((ObjectType) objref).getClassName();

    String theClass = o.getClassName(cpg);

    if (!Repository.instanceOf(objref_classname, theClass)) {
        constraintViolated(o, "The 'objref' item '" + objref + "' does not implement '" + theClass + "' as expected.");
    }
}
 
开发者ID:miuirussia,项目名称:KJBE,代码行数:68,代码来源:InstConstraintVisitor.java


注:本文中的org.apache.bcel.verifier.VerificationResult.VERIFIED_OK属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。