private void handleLoad(FieldInstruction obj) { consumeStack(obj); Type type = obj.getType(getCPG()); if (!STRING_SIGNATURE.equals(type.getSignature())) { throw new IllegalArgumentException("type is not String: " + type); } try { String className = obj.getClassName(getCPG()); String fieldName = obj.getName(getCPG()); Field field = Hierarchy.findField(className, fieldName); if (field != null) { // If the field is final, we'll assume that the String value // is static. if (field.isFinal()) { pushValue(staticStringTypeInstance); } else { pushValue(type); } return; } } catch (ClassNotFoundException ex) { lookupFailureCallback.reportMissingClass(ex); } pushValue(type); } }
Type fieldType = fins.getType(cpg); if (!(fieldType instanceof ReferenceType)) { continue;
/** @return size of field (1 or 2) */ protected int getFieldSize(ConstantPoolGen cpg) { return getType(cpg).getSize(); }
private void handleLoad(FieldInstruction obj) { consumeStack(obj); Type type = obj.getType(getCPG()); if (!STRING_SIGNATURE.equals(type.getSignature())) { throw new IllegalArgumentException("type is not String: " + type); } try { String className = obj.getClassName(getCPG()); String fieldName = obj.getName(getCPG()); Field field = Hierarchy.findField(className, fieldName); if (field != null) { // If the field is final, we'll assume that the String value // is static. if (field.isFinal() && field.isFinal()) { pushValue(staticStringTypeInstance); } else { pushValue(type); } return; } } catch (ClassNotFoundException ex) { lookupFailureCallback.reportMissingClass(ex); } pushValue(type); } }
/** * 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+"'."); } } }
/** * Ensures the general preconditions of a FieldInstruction instance. */ @Override public void visitFieldInstruction(final 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 final 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). final Type t = o.getType(cpg); if (t instanceof ObjectType) { final String name = ((ObjectType)t).getClassName(); final Verifier v = VerifierFactory.getVerifier( name ); final VerificationResult vr = v.doPass2(); if (vr.getStatus() != VerificationResult.VERIFIED_OK) { constraintViolated(o, "Class '"+name+"' is referenced, but cannot be loaded and resolved: '"+vr+"'."); } } }
if (field.getName().equals(field_name)) { final Type f_type = Type.getType(field.getSignature()); final Type o_type = o.getType(cpg); if (field.getName().equals(field_name)) { final Type f_type = Type.getType(field.getSignature()); final Type o_type = o.getType(cpg); if (f_type.equals(o_type)) { f = field; o.getType(cpg);
Type o_type = o.getType(cpg);
Type fieldType = fins.getType(cpg); if (!(fieldType instanceof ReferenceType)) { continue;