public Item(String signature, FieldAnnotation f, int fieldLoadedFromRegister) { this.signature = signature; if (f != null) { source = XFactory.createXField(f); } this.fieldLoadedFromRegister = fieldLoadedFromRegister; }
RememberedBug(BugInstance bug, FieldAnnotation maskingField, FieldAnnotation maskedField) { this.bug = bug; this.maskingField = XFactory.createXField(maskingField); this.maskedField = XFactory.createXField(maskedField); } }
public XField toXField() { return XFactory.createXField(className, fieldName, fieldSig, isStatic); }
@Override public void visit(ConstantValue obj) { // ConstantValue is an attribute of a field, so the instance variables // set during visitation of the Field are still valid here XField f = XFactory.createXField(this); data.constantFields.add(f); data.writtenFields.add(f); }
public Item(String signature, FieldAnnotation f) { this.signature = signature; setSpecialKindFromSignature(); if (f != null) { source = XFactory.createXField(f); } fieldLoadedFromRegister = -1; }
protected void addFieldAnnotation(String cName, String mName, String mSig, boolean isStatic, AnnotationEnum annotation) { // if (!Subtypes.DO_NOT_USE) { // subtypes.addNamedClass(cName); // } if (addClassOnly) { return; } XField m = XFactory.createXField(cName, mName, mSig, isStatic); addDirectAnnotation(m, annotation); }
public static XField createXField(JavaClass javaClass, Field field) { return createXField(javaClass.getClassName(), field); }
public UnreadFields(BugReporter bugReporter) { this.bugReporter = bugReporter; this.bugAccumulator = new BugAccumulator(bugReporter); AnalysisContext context = AnalysisContext.currentAnalysisContext(); data.reflectiveFields.add( XFactory.createXField("java.lang.System", "in", "Ljava/io/InputStream;", true)); data.reflectiveFields.add( XFactory.createXField("java.lang.System", "out", "Ljava/io/PrintStream;", true)); data.reflectiveFields.add( XFactory.createXField("java.lang.System", "err", "Ljava/io/PrintStream;", true)); data = context.getUnreadFieldsData(); context.setUnreadFields(this); }
@Override public void visitAnnotation(String annotationClass, Map<String, ElementValue> map, boolean runtimeVisible) { if (!visitingField()) { return; } if (isInjectionAttribute(annotationClass)) { data.containerFields.add(XFactory.createXField(this)); } if (!annotationClass.startsWith("edu.umd.cs.findbugs") && !annotationClass.startsWith("javax.lang")) { data.unknownAnnotation.add(XFactory.createXField(this), annotationClass); } }
@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)); }
/** * Create an XField object from the field currently being visited by the * given PreorderVisitor. * * @param visitor * the PreorderVisitor * @return the XField representing the method currently being visited */ public static XField createXField(PreorderVisitor visitor) { JavaClass javaClass = visitor.getThisClass(); Field field = visitor.getField(); XField f = createXField(javaClass, field); return f; }
@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); } } }
@Override public void visit(Field obj) { super.visit(obj); XField f = XFactory.createXField(this); data.allMyFields.add(f); String signature = obj.getSignature(); if (!"serialVersionUID".equals(getFieldName())) { data.myFields.add(f); if ("_jspx_dependants".equals(obj.getName())) { data.containerFields.add(f); } } if (isSeleniumWebElement(signature)) { data.containerFields.add(f); } }
/** * Create an XField object * * @param className * @param fieldName * @param fieldSignature * @param isStatic * @return the created XField */ public static XField createXFieldUsingSlashedClassName(@SlashedClassName String className, String fieldName, String fieldSignature, boolean isStatic) { FieldDescriptor fieldDesc = DescriptorFactory.instance().getFieldDescriptor(className, fieldName, fieldSignature, isStatic); return createXField(fieldDesc); }
public static XField createXField(FieldInstruction fieldInstruction, ConstantPoolGen cpg) { String className = fieldInstruction.getClassName(cpg); String fieldName = fieldInstruction.getName(cpg); String fieldSig = fieldInstruction.getSignature(cpg); int opcode = fieldInstruction.getOpcode(); return createXField(className, fieldName, fieldSig, opcode == Const.GETSTATIC || opcode == Const.PUTSTATIC); }
public static XField createXField(FieldAnnotation f) { return createXField(f.getClassName(), f.getFieldName(), f.getFieldSignature(), f.isStatic()); }
/** * Create an XField object * * @param className * @param fieldName * @param fieldSignature * @param isStatic * @return the created XField */ public static XField createXField(@DottedClassName String className, String fieldName, String fieldSignature, boolean isStatic) { FieldDescriptor fieldDesc = DescriptorFactory.instance().getFieldDescriptor(ClassName.toSlashedClassName(className), fieldName, fieldSignature, isStatic); return createXField(fieldDesc); }
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); } }
@Nonnull public BugInstance lowerPriorityIfDeprecated() { MethodAnnotation m = getPrimaryMethod(); if (m != null && XFactory.createXMethod(m).isDeprecated()) { lowerPriority(); } FieldAnnotation f = getPrimaryField(); if (f != null && XFactory.createXField(f).isDeprecated()) { lowerPriority(); } return this; }
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); } }