本文整理汇总了Java中edu.umd.cs.findbugs.ba.XFactory.createXField方法的典型用法代码示例。如果您正苦于以下问题:Java XFactory.createXField方法的具体用法?Java XFactory.createXField怎么用?Java XFactory.createXField使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类edu.umd.cs.findbugs.ba.XFactory
的用法示例。
在下文中一共展示了XFactory.createXField方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkNonNullPutField
import edu.umd.cs.findbugs.ba.XFactory; //导入方法依赖的package包/类
/**
* If this is a putfield or putstatic instruction, check to see if the field
* is @NonNull, and treat it as dereferences.
*
* @param location
* the Location of the instruction
* @param vnaFrame
* the ValueNumberFrame at the Location of the instruction
* @param fact
* the dataflow value to modify
* @throws DataflowAnalysisException
*/
private void checkNonNullPutField(Location location, ValueNumberFrame vnaFrame, UnconditionalValueDerefSet fact)
throws DataflowAnalysisException {
INullnessAnnotationDatabase database = AnalysisContext.currentAnalysisContext().getNullnessAnnotationDatabase();
FieldInstruction fieldIns = (FieldInstruction) location.getHandle().getInstruction();
XField field = XFactory.createXField(fieldIns, methodGen.getConstantPool());
char firstChar = field.getSignature().charAt(0);
if (firstChar != 'L' && firstChar != '[')
return;
NullnessAnnotation resolvedAnnotation = database.getResolvedAnnotation(field, true);
if (resolvedAnnotation == NullnessAnnotation.NONNULL) {
IsNullValueFrame invFrame = invDataflow.getFactAtLocation(location);
if (!invFrame.isValid())
return;
IsNullValue value = invFrame.getTopValue();
if (reportDereference(value)) {
ValueNumber vn = vnaFrame.getTopValue();
fact.addDeref(vn, location);
}
}
}
示例2: modelFieldStore
import edu.umd.cs.findbugs.ba.XFactory; //导入方法依赖的package包/类
private void modelFieldStore(Location location) throws DataflowAnalysisException {
// Model field stores
XField writtenField = XFactory.createXField((FieldInstruction) location.getHandle().getInstruction(), cpg);
TypeQualifierAnnotation tqa = TypeQualifierApplications.getEffectiveTypeQualifierAnnotation(writtenField,
typeQualifierValue);
When when = (tqa != null) ? tqa.when : When.UNKNOWN;
// The ValueNumberFrame *before* the FieldInstruction should
// have the ValueNumber of the stored value on the top of the stack.
ValueNumberFrame vnaFrameAtStore = vnaDataflow.getFactAtLocation(location);
if (vnaFrameAtStore.isValid()) {
ValueNumber vn = vnaFrameAtStore.getTopValue();
SourceSinkInfo sink = new SourceSinkInfo(SourceSinkType.FIELD_STORE, location, vn, when);
registerSourceSink(sink);
}
}
示例3: addFieldAnnotation
import edu.umd.cs.findbugs.ba.XFactory; //导入方法依赖的package包/类
public void addFieldAnnotation(String cName, String mName, String mSig, boolean isStatic, NullnessAnnotation annotation) {
if (DEBUG) {
System.out.println("addFieldAnnotation: annotate " + cName + "." + mName + " with " + annotation);
}
XField xfield = XFactory.createXField(cName, mName, mSig, isStatic);
if (!(xfield instanceof FieldInfo)) {
if (DEBUG) {
System.out.println(" Field not found! " + cName + "." + mName + ":" + mSig + " " + isStatic + " " + annotation);
}
return;
}
// Get JSR-305 nullness annotation type
ClassDescriptor nullnessAnnotationType = getNullnessAnnotationClassDescriptor(annotation);
// Create an AnnotationValue
AnnotationValue annotationValue = new AnnotationValue(nullnessAnnotationType);
// Destructively add the annotation to the FieldInfo object
((FieldInfo) xfield).addAnnotation(annotationValue);
}
示例4: visitAnnotation
import edu.umd.cs.findbugs.ba.XFactory; //导入方法依赖的package包/类
@Override
public void visitAnnotation(String annotationClass, Map<String, ElementValue> map, boolean runtimeVisible) {
if (annotationClass.startsWith(NET_JCIP_ANNOTATIONS)) {
annotationClass = annotationClass.substring(NET_JCIP_ANNOTATIONS.length());
} else if (annotationClass.startsWith(JSR305_CONCURRENT_ANNOTATIONS)) {
annotationClass = annotationClass.substring(JSR305_CONCURRENT_ANNOTATIONS.length());
} else {
return;
}
JCIPAnnotationDatabase annotationDatabase = AnalysisContext.currentAnalysisContext()
.getJCIPAnnotationDatabase();
ElementValue value = map.get("value");
ClassMember member;
if (visitingField()) {
member = XFactory.createXField(this);
} else if (visitingMethod()) {
member = XFactory.createXMethod(this);
} else {
annotationDatabase.addEntryForClass(getDottedClassName(), annotationClass, value);
return;
}
annotationDatabase.addEntryForClassMember(member, annotationClass, value);
}
示例5: visit
import edu.umd.cs.findbugs.ba.XFactory; //导入方法依赖的package包/类
@Override
public void visit(Field obj) {
super.visit(obj);
XField f = XFactory.createXField(this);
data.allMyFields.add(f);
String signature = obj.getSignature();
if (!getFieldName().equals("serialVersionUID")) {
data.myFields.add(f);
if (obj.getName().equals("_jspx_dependants"))
data.containerFields.add(f);
}
if (isSeleniumWebElement(signature))
data.containerFields.add(f);
}
示例6: visit
import edu.umd.cs.findbugs.ba.XFactory; //导入方法依赖的package包/类
@Override
public void visit(Field obj) {
super.visit(obj);
XField f = XFactory.createXField(this);
if (checkForInitialization(f) && !f.isSynthetic()) {
if (f.isStatic())
nonnullStaticFields.add(f);
else
nonnullFields.add(f);
}
}
示例7: visitGETSTATIC
import edu.umd.cs.findbugs.ba.XFactory; //导入方法依赖的package包/类
@Override
public void visitGETSTATIC(GETSTATIC obj) {
Type type = obj.getType(getCPG());
XField xf = XFactory.createXField(obj, cpg);
if (xf.isFinal()) {
FieldSummary fieldSummary = AnalysisContext.currentAnalysisContext().getFieldSummary();
Item summary = fieldSummary.getSummary(xf);
if (summary.isNull()) {
pushValue(TypeFrame.getNullType());
return;
}
String slashedClassName = ClassName.fromFieldSignature(type.getSignature());
if (slashedClassName != null) {
String dottedClassName = ClassName.toDottedClassName(slashedClassName);
if (DEFAULT_SUSPICIOUS_SET.contains(dottedClassName)) {
type = new FinalConstant(dottedClassName, xf);
consumeStack(obj);
pushValue(type);
return;
}
}
}
if (type.getSignature().equals(STRING_SIGNATURE)) {
handleLoad(obj);
} else
super.visitGETSTATIC(obj);
}
示例8: registerFieldLoadSource
import edu.umd.cs.findbugs.ba.XFactory; //导入方法依赖的package包/类
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);
}
}
开发者ID:OpenNTF,项目名称:FindBug-for-Domino-Designer,代码行数:11,代码来源:ForwardTypeQualifierDataflowAnalysis.java
示例9: Item
import edu.umd.cs.findbugs.ba.XFactory; //导入方法依赖的package包/类
public Item(String signature, FieldAnnotation f) {
this.signature = DescriptorFactory.canonicalizeString(signature);
setSpecialKindFromSignature();
if (f != null)
source = XFactory.createXField(f);
fieldLoadedFromRegister = -1;
}
示例10: writeKey
import edu.umd.cs.findbugs.ba.XFactory; //导入方法依赖的package包/类
@Override
protected void writeKey(Writer writer, FieldDescriptor key) throws IOException {
writer.write(key.getClassDescriptor().getDottedClassName());
writer.write(",");
writer.write(key.getName());
writer.write(",");
writer.write(key.getSignature());
writer.write(",");
XField xField = XFactory.createXField(key);
int flags = xField.getAccessFlags() & 0xf;
writer.write(String.valueOf(flags));
}
示例11: visitGETFIELD
import edu.umd.cs.findbugs.ba.XFactory; //导入方法依赖的package包/类
@Override
public void visitGETFIELD(GETFIELD obj) {
if (getNumWordsProduced(obj) != 1) {
super.visitGETFIELD(obj);
return;
}
if (checkForKnownValue(obj)) {
return;
}
XField field = XFactory.createXField(obj, cpg);
NullnessAnnotation annotation = AnalysisContext.currentAnalysisContext().getNullnessAnnotationDatabase()
.getResolvedAnnotation(field, false);
if (annotation == NullnessAnnotation.NONNULL) {
modelNormalInstruction(obj, getNumWordsConsumed(obj), 0);
produce(IsNullValue.nonNullValue());
} else if (annotation == NullnessAnnotation.CHECK_FOR_NULL) {
modelNormalInstruction(obj, getNumWordsConsumed(obj), 0);
produce(IsNullValue.nullOnSimplePathValue().markInformationAsComingFromFieldValue(field));
} else {
super.visitGETFIELD(obj);
}
}
示例12: visitGETFIELD
import edu.umd.cs.findbugs.ba.XFactory; //导入方法依赖的package包/类
@Override
public void visitGETFIELD(GETFIELD obj) {
Type type = obj.getType(getCPG());
if (type.getSignature().equals(STRING_SIGNATURE)) {
handleLoad(obj);
} else {
XField xf = XFactory.createXField(obj, cpg);
if (xf.isFinal()) {
FieldSummary fieldSummary = AnalysisContext.currentAnalysisContext().getFieldSummary();
Item summary = fieldSummary.getSummary(xf);
if (summary.isNull()) {
consumeStack(obj);
pushValue(TypeFrame.getNullType());
return;
}
String slashedClassName = ClassName.fromFieldSignature(type.getSignature());
if (slashedClassName != null) {
String dottedClassName = ClassName.toDottedClassName(slashedClassName);
if (DEFAULT_SUSPICIOUS_SET.contains(dottedClassName)) {
type = new FinalConstant(dottedClassName, xf);
consumeStack(obj);
pushValue(type);
return;
}
}
}
super.visitGETFIELD(obj);
}
}
示例13: RememberedBug
import edu.umd.cs.findbugs.ba.XFactory; //导入方法依赖的package包/类
RememberedBug(BugInstance bug, FieldAnnotation maskingField, FieldAnnotation maskedField) {
this.bug = bug;
this.maskingField = XFactory.createXField(maskingField);
this.maskedField = XFactory.createXField(maskedField);
}
示例14: toXField
import edu.umd.cs.findbugs.ba.XFactory; //导入方法依赖的package包/类
public XField toXField() {
return XFactory.createXField(className, fieldName, fieldSig, isStatic);
}