public static @Nonnull XField getExactXField(@SlashedClassName String className, Field f) { FieldDescriptor fd = DescriptorFactory.instance().getFieldDescriptor(className, f); return getExactXField(fd); }
/** * 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; }
/** * Get an XField object exactly matching given class, name, and signature. * May return an unresolved object (if the class can't be found, or does not * directly declare named field). * * @param className * name of class containing the field * @param name * name of field * @param signature * field signature * @param isStatic * field access flags * @return XField exactly matching class name, field name, and field * signature */ public static XField getExactXField(@SlashedClassName String className, String name, String signature, boolean isStatic) { FieldDescriptor fieldDesc = DescriptorFactory.instance().getFieldDescriptor(ClassName.toSlashedClassName(className), name, signature, isStatic); return getExactXField(fieldDesc); }
/** * Convert to a value known because it was returned from a method in a * method property database. * * @param methodInvoked * TODO */ public IsNullValue markInformationAsComingFromReturnValueOfMethod(XMethod methodInvoked) { FieldDescriptor fieldDescriptor = methodInvoked.getAccessMethodForField(); if (fieldDescriptor != null) { XField f = XFactory.getExactXField(fieldDescriptor); return markInformationAsComingFromFieldValue(f); } int flag = RETURN_VAL; if ("readLine".equals(methodInvoked.getName()) && "()Ljava/lang/String;".equals(methodInvoked.getSignature())) { flag = READLINE_VAL; } if (getBaseKind() == NO_KABOOM_NN) { return new IsNullValue(kind | flag, locationOfKaBoom); } return instanceByFlagsList[(getFlags() | flag) >> FLAG_SHIFT][getBaseKind()]; }
XField xf = XFactory.getExactXField(classContext.getClassDescriptor().getClassName(), f); FieldStats stats = statMap.get(xf); if (stats == null) {
xfield = XFactory.getExactXField(instanceClassName, xfield.getName(), xfield.getSignature(), xfield.isStatic());
public static @Nonnull XField getExactXField(@SlashedClassName String className, Field f) { FieldDescriptor fd = DescriptorFactory.instance().getFieldDescriptor(className, f); return getExactXField(fd); }
/** * 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; }
/** * Get an XField object exactly matching given class, name, and signature. * May return an unresolved object (if the class can't be found, or does not * directly declare named field). * * @param className * name of class containing the field * @param name * name of field * @param signature * field signature * @param isStatic * field access flags * @return XField exactly matching class name, field name, and field * signature */ public static XField getExactXField(@SlashedClassName String className, String name, String signature, boolean isStatic) { FieldDescriptor fieldDesc = DescriptorFactory.instance().getFieldDescriptor(ClassName.toSlashedClassName(className), name, signature, isStatic); return getExactXField(fieldDesc); }
/** * Convert to a value known because it was returned from a method in a * method property database. * * @param methodInvoked * TODO */ public IsNullValue markInformationAsComingFromReturnValueOfMethod(XMethod methodInvoked) { FieldDescriptor fieldDescriptor = methodInvoked.getAccessMethodForField(); if (fieldDescriptor != null) { XField f = XFactory.getExactXField(fieldDescriptor); return markInformationAsComingFromFieldValue(f); } int flag = RETURN_VAL; if ("readLine".equals(methodInvoked.getName()) && "()Ljava/lang/String;".equals(methodInvoked.getSignature())) { flag = READLINE_VAL; } if (getBaseKind() == NO_KABOOM_NN) { return new IsNullValue(kind | flag, locationOfKaBoom); } return instanceByFlagsList[(getFlags() | flag) >> FLAG_SHIFT][getBaseKind()]; }
XField xf = XFactory.getExactXField(classContext.getClassDescriptor().getClassName(), f); FieldStats stats = statMap.get(xf); if (stats == null) {
xfield = XFactory.getExactXField(instanceClassName, xfield.getName(), xfield.getSignature(), xfield.isStatic());