/** * Create an XField object from a BCEL Field. * * @param className * the name of the Java class containing the field * @param field * the Field within the JavaClass * @return the created XField */ public static XField createXField(String className, Field field) { String fieldName = field.getName(); String fieldSig = field.getSignature(); XField xfield = getExactXField(className, fieldName, fieldSig, field.isStatic()); assert xfield.isResolved() : "Could not exactly resolve " + xfield; return xfield; }
private void registerFieldLoadSource(Location location) throws DataflowAnalysisException { XField loadedField = XFactory.createXField((FieldInstruction) location.getHandle().getInstruction(), cpg); if (loadedField.isResolved()) { TypeQualifierAnnotation tqa = TypeQualifierApplications.getEffectiveTypeQualifierAnnotation(loadedField, typeQualifierValue); When when = (tqa != null) ? tqa.when : When.UNKNOWN; registerTopOfStackSource(SourceSinkType.FIELD_LOAD, location, when, false, null); } }
/** * Look up the field referenced by given FieldInstruction, returning it as * an {@link XField XField} object. * * @param fins * the FieldInstruction * @param cpg * the ConstantPoolGen used by the class containing the * instruction * @return an XField object representing the field, or null if no such field * could be found */ public static @CheckForNull XField findXField(FieldInstruction fins, @Nonnull ConstantPoolGen cpg) { String className = fins.getClassName(cpg); String fieldName = fins.getFieldName(cpg); String fieldSig = fins.getSignature(cpg); boolean isStatic = (fins.getOpcode() == Const.GETSTATIC || fins.getOpcode() == Const.PUTSTATIC); XField xfield = findXField(className, fieldName, fieldSig, isStatic); short opcode = fins.getOpcode(); if (xfield != null && xfield.isResolved() && xfield.isStatic() == (opcode == Const.GETSTATIC || opcode == Const.PUTSTATIC)) { return xfield; } else { return null; } }
if (f.isResolved() && !data.fieldsOfNativeClasses.contains(f) && (fieldSignature.charAt(0) == 'L' || fieldSignature.charAt(0) == '[')) { int priority = LOW_PRIORITY; if (f.isResolved() && !data.fieldsOfNativeClasses.contains(f)) { int priority = NORMAL_PRIORITY; if (!(fieldSignature.charAt(0) == 'L' || fieldSignature.charAt(0) == '[')) { System.out.println(" : " + data.abstractClasses.contains(f.getClassName())); System.out.println(" : " + data.hasNonAbstractSubClass.contains(f.getClassName())); System.out.println(" : " + f.isResolved()); if (!f.isResolved()) { continue; + "\t" + f.isStatic()); if (!f.isResolved()) { continue; } else if (f.isResolved()) { if (data.constantFields.contains(f)) { if (!f.isStatic()) {
XField xfield = Hierarchy.findXField(field.getClassName(), field.getFieldName(), field.getFieldSig(), field.isStatic()); if (!xfield.isResolved()) { return;
private void registerFieldLoadSource(Location location) throws DataflowAnalysisException { XField loadedField = XFactory.createXField((FieldInstruction) location.getHandle().getInstruction(), cpg); if (loadedField.isResolved()) { TypeQualifierAnnotation tqa = TypeQualifierApplications.getEffectiveTypeQualifierAnnotation(loadedField, typeQualifierValue); When when = (tqa != null) ? tqa.when : When.UNKNOWN; registerTopOfStackSource(SourceSinkType.FIELD_LOAD, location, when, false, null); } }
/** * Create an XField object from a BCEL Field. * * @param className * the name of the Java class containing the field * @param field * the Field within the JavaClass * @return the created XField */ public static XField createXField(String className, Field field) { String fieldName = field.getName(); String fieldSig = field.getSignature(); XField xfield = getExactXField(className, fieldName, fieldSig, field.isStatic()); assert xfield.isResolved() : "Could not exactly resolve " + xfield; return xfield; }
/** * Look up the field referenced by given FieldInstruction, returning it as * an {@link XField XField} object. * * @param fins * the FieldInstruction * @param cpg * the ConstantPoolGen used by the class containing the * instruction * @return an XField object representing the field, or null if no such field * could be found */ public static @CheckForNull XField findXField(FieldInstruction fins, @Nonnull ConstantPoolGen cpg) { String className = fins.getClassName(cpg); String fieldName = fins.getFieldName(cpg); String fieldSig = fins.getSignature(cpg); boolean isStatic = (fins.getOpcode() == Constants.GETSTATIC || fins.getOpcode() == Constants.PUTSTATIC); XField xfield = findXField(className, fieldName, fieldSig, isStatic); short opcode = fins.getOpcode(); if (xfield != null && xfield.isResolved() && xfield.isStatic() == (opcode == Constants.GETSTATIC || opcode == Constants.PUTSTATIC)) { return xfield; } else { return null; } }
if (f.isResolved() && !data.fieldsOfNativeClasses.contains(f) && (fieldSignature.charAt(0) == 'L' || fieldSignature.charAt(0) == '[')) { int priority = LOW_PRIORITY; if (f.isResolved() && !data.fieldsOfNativeClasses.contains(f)) { int priority = NORMAL_PRIORITY; if (!(fieldSignature.charAt(0) == 'L' || fieldSignature.charAt(0) == '[')) { System.out.println(" : " + data.abstractClasses.contains(f.getClassName())); System.out.println(" : " + data.hasNonAbstractSubClass.contains(f.getClassName())); System.out.println(" : " + f.isResolved()); if (!f.isResolved()) { continue; + "\t" + f.isStatic()); if (!f.isResolved()) { continue; } else if (f.isResolved()) { if (data.constantFields.contains(f)) { if (!f.isStatic()) {
XField xfield = Hierarchy.findXField(field.getClassName(), field.getFieldName(), field.getFieldSig(), field.isStatic()); if (!xfield.isResolved()) { return;