本文整理汇总了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+"'.");
}
}
}
示例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 + "'.");
}
}
}
示例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+"'.");
}
}
}
示例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+"'.");
}
}
}
示例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 + "'.");
}
}
}
示例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 + "'.");
}
}
}
示例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());
}
}
示例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());
}
}
示例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.");
}
}
}
}
示例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.");
}
}