gpt4 book ai didi

edu.umd.cs.findbugs.ba.XField.isFinal()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-19 15:16:40 27 4
gpt4 key购买 nike

本文整理了Java中edu.umd.cs.findbugs.ba.XField.isFinal()方法的一些代码示例,展示了XField.isFinal()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XField.isFinal()方法的具体详情如下:
包路径:edu.umd.cs.findbugs.ba.XField
类名称:XField
方法名:isFinal

XField.isFinal介绍

暂无

代码示例

代码示例来源:origin: spotbugs/spotbugs

public void killAllLoadsExceptFor(@CheckForNull ValueNumber v) {
  if (!REDUNDANT_LOAD_ELIMINATION) {
    return;
  }
  AvailableLoad myLoad = getLoad(v);
  HashSet<AvailableLoad> killMe = new HashSet<>();
  for (AvailableLoad availableLoad : getAvailableLoadMap().keySet()) {
    if (!availableLoad.getField().isFinal() && !availableLoad.equals(myLoad)) {
      if (RLE_DEBUG) {
        System.out.println("KILLING load of " + availableLoad + " in " + this);
      }
      killMe.add(availableLoad);
    }
  }
  killAvailableLoads(killMe);
}

代码示例来源:origin: spotbugs/spotbugs

@Override
public void visit(Field obj) {
  XField xField = getXField();
  if(!xField.isStatic() && (xField.isPrivate() || xField.isFinal()) && xField.isReferenceType()) {
    allowedFields.add(xField.getFieldDescriptor());
  }
}

代码示例来源:origin: spotbugs/spotbugs

/**
 * Kill all loads. This conservatively handles method calls where we don't
 * really know what fields might be assigned.
 */
public void killAllLoadsOf(@CheckForNull ValueNumber v) {
  if (!REDUNDANT_LOAD_ELIMINATION) {
    return;
  }
  FieldSummary fieldSummary = AnalysisContext.currentAnalysisContext().getFieldSummary();
  HashSet<AvailableLoad> killMe = new HashSet<>();
  for (AvailableLoad availableLoad : getAvailableLoadMap().keySet()) {
    if (availableLoad.getReference() != v) {
      continue;
    }
    XField field = availableLoad.getField();
    if (!field.isFinal() && (!USE_WRITTEN_OUTSIDE_OF_CONSTRUCTOR || fieldSummary.isWrittenOutsideOfConstructor(field))) {
      if (RLE_DEBUG) {
        System.out.println("Killing load of " + availableLoad + " in " + this);
      }
      killMe.add(availableLoad);
    }
  }
  killAvailableLoads(killMe);
}

代码示例来源:origin: spotbugs/spotbugs

public boolean checkForInitialization(XField f) {
  if (!f.isReferenceType() || f.isFinal()) {
    return false;
  }
  NullnessAnnotation annotation = AnalysisContext.currentAnalysisContext().getNullnessAnnotationDatabase()
      .getResolvedAnnotation(f, false);
  boolean isNonnull = annotation == NullnessAnnotation.NONNULL;
  return isNonnull;
}

代码示例来源:origin: spotbugs/spotbugs

public void killAllLoads(boolean primitiveOnly) {
  if (!REDUNDANT_LOAD_ELIMINATION) {
    return;
  }
  FieldSummary fieldSummary = AnalysisContext.currentAnalysisContext().getFieldSummary();
  HashSet<AvailableLoad> killMe = new HashSet<>();
  for (AvailableLoad availableLoad : getAvailableLoadMap().keySet()) {
    XField field = availableLoad.getField();
    if ((!primitiveOnly || !field.isReferenceType()) && (field.isVolatile() || !field.isFinal()
        && (!USE_WRITTEN_OUTSIDE_OF_CONSTRUCTOR || fieldSummary.isWrittenOutsideOfConstructor(field)))) {
      if (RLE_DEBUG) {
        System.out.println("KILLING load of " + availableLoad + " in " + this);
      }
      killMe.add(availableLoad);
    }
  }
  killAvailableLoads(killMe);
}

代码示例来源:origin: spotbugs/spotbugs

public boolean isWrittenOutsideOfConstructor(XField field) {
  if (field.isFinal()) {
    return false;
  }
  if (writtenOutsideOfConstructor.contains(field)) {
    return true;
  }
  if (!AnalysisContext.currentAnalysisContext().unreadFieldsAvailable()) {
    return true;
  }
  UnreadFieldsData unreadFields = AnalysisContext.currentAnalysisContext().getUnreadFieldsData();
  if (unreadFields.isReflexive(field)) {
    return true;
  }
  return false;
}

代码示例来源:origin: spotbugs/spotbugs

boolean isFinal = f.isFinal();
String className = f.getClassName();
String fieldSig = f.getSignature();

代码示例来源:origin: spotbugs/spotbugs

XField f = getXFieldOperand();
if (f != null) {
  if (f.isFinal() || !f.isProtected() && !f.isPublic()) {
    if (emptyArrayOnTOS) {
      emptyArray.add(f);
if (emptyArray.contains(f) && !nonEmptyArray.contains(f) && f.isFinal()) {
  emptyArrayOnTOS = true;

代码示例来源:origin: spotbugs/spotbugs

for (XField f : xClass.getXFields()) {
  if (!f.isStatic()) {
    if (!f.isFinal() && !f.isSynthetic()) {
      hasMutableField = true;
      if (unreadFields.isWrittenOutsideOfInitialization(f)) {

代码示例来源:origin: spotbugs/spotbugs

private boolean interesting(XField f) {
  if (!f.isPublic() && !f.isProtected()) {
    return false;
  }
  if (!f.isStatic() || f.isSynthetic() || f.isVolatile()) {
    return false;
  }
  if (!f.isFinal()) {
    return true;
  }
  boolean isArray = f.getSignature().charAt(0) == '[';
  if (!(isArray || isCollection(f.getSignature()))) {
    return false;
  }
  return true;
}

代码示例来源:origin: spotbugs/spotbugs

@Override
public void visit(Code obj) {
  sawInitializeSuper = false;
  super.visit(obj);
  fieldSummary.setFieldsWritten(getXMethod(), touched);
  if (Const.CONSTRUCTOR_NAME.equals(getMethodName()) && sawInitializeSuper) {
    XClass thisClass = getXClass();
    for (XField f : thisClass.getXFields()) {
      if (!f.isStatic() && !f.isFinal() && !touched.contains(f)) {
        OpcodeStack.Item item;
        char firstChar = f.getSignature().charAt(0);
        if (firstChar == 'L' || firstChar == '[') {
          item = OpcodeStack.Item.nullItem(f.getSignature());
        } else if (firstChar == 'I') {
          item = new OpcodeStack.Item("I", (Integer) 0);
        } else if (firstChar == 'J') {
          item = new OpcodeStack.Item("J", 0L);
        } else {
          item = new OpcodeStack.Item(f.getSignature());
        }
        fieldSummary.mergeSummary(f, item);
      }
    }
  }
  touched.clear();
}

代码示例来源:origin: spotbugs/spotbugs

if (xField.isFinal() && mutableCollectionJustCreated) {
  mutableCollection.add(xField);

代码示例来源:origin: spotbugs/spotbugs

bugPattern = "RC_REF_COMPARISON_BAD_PRACTICE_BOOLEAN";
  priority = Priorities.NORMAL_PRIORITY;
} else if (xf != null && xf.isStatic() && xf.isFinal()) {
  bugPattern = "RC_REF_COMPARISON_BAD_PRACTICE";
  if (xf.isPublic() || !methodGen.isPublic()) {

代码示例来源:origin: spotbugs/spotbugs

@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 (STRING_SIGNATURE.equals(type.getSignature())) {
    handleLoad(obj);
  } else {
    super.visitGETSTATIC(obj);
  }
}

代码示例来源:origin: spotbugs/spotbugs

if (field.isFinal()) {
  Item summary = AnalysisContext.currentAnalysisContext().getFieldSummary().getSummary(field);
  if (summary.isNull()) {

代码示例来源:origin: spotbugs/spotbugs

@Override
public void visitGETFIELD(GETFIELD obj) {
  Type type = obj.getType(getCPG());
  if (STRING_SIGNATURE.equals(type.getSignature())) {
    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);
  }
}

代码示例来源:origin: spotbugs/spotbugs

if (f.isFinal()) {
  priority = HIGH_PRIORITY;
} else if (unreadFields.isWrittenDuringInitialization(f) || unreadFields.isWrittenOutsideOfInitialization(f)) {

代码示例来源:origin: spotbugs/spotbugs

@Override
public void visitClassContext(ClassContext classContext) {
  if(!classContext.getJavaClass().isEnum() || !classContext.getJavaClass().isPublic()) {
    return;
  }
  boolean hasInterestingField = false;
  for(XField field : classContext.getXClass().getXFields()) {
    if(!field.isStatic() && !field.isFinal() && !field.isSynthetic()) {
      if(field.isPublic()) {
        reporter.reportBug(new BugInstance("ME_MUTABLE_ENUM_FIELD", NORMAL_PRIORITY).addClass(classContext.getJavaClass())
            .addField(field));
      } else {
        hasInterestingField = true;
      }
    }
  }
  if(hasInterestingField) {
    super.visitClassContext(classContext);
  }
}

代码示例来源:origin: spotbugs/spotbugs

Item summary = fieldSummary.getSummary(xfield);
if (summary != null) {
  if (xfield.isFinal() && summary.isNull()) {
    return TypeFrame.getNullType();

代码示例来源:origin: spotbugs/spotbugs

int matches = 0;
for (XField f2 : x.getXFields()) {
  if (!f.equals(f2) && !f2.isStatic() && !f2.isFinal() && !f2.isSynthetic()
      && f2.getSignature().equals(f.getSignature())) {

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com