本文整理汇总了Java中edu.umd.cs.findbugs.ba.XMethod.isPrivate方法的典型用法代码示例。如果您正苦于以下问题:Java XMethod.isPrivate方法的具体用法?Java XMethod.isPrivate怎么用?Java XMethod.isPrivate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类edu.umd.cs.findbugs.ba.XMethod
的用法示例。
在下文中一共展示了XMethod.isPrivate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addPropertiesForMethodContainingWarning
import edu.umd.cs.findbugs.ba.XMethod; //导入方法依赖的package包/类
/**
* @param propertySet
* @param xMethod
*/
private void addPropertiesForMethodContainingWarning(WarningPropertySet<WarningProperty> propertySet) {
XMethod xMethod = XFactory.createXMethod(classContext.getJavaClass(), method);
boolean uncallable = !AnalysisContext.currentXFactory().isCalledDirectlyOrIndirectly(xMethod) && xMethod.isPrivate();
if (uncallable)
propertySet.addProperty(GeneralWarningProperty.IN_UNCALLABLE_METHOD);
}
示例2: sawOpcode
import edu.umd.cs.findbugs.ba.XMethod; //导入方法依赖的package包/类
@Override
public void sawOpcode(int seen) {
if (getMethodName().equals("<init>") && seen == INVOKEVIRTUAL) {
XMethod m = getXMethodOperand();
if (m != null && !m.isPrivate() && !m.isFinal()) {
int args = PreorderVisitor.getNumberArguments(m.getSignature());
OpcodeStack.Item item = stack.getStackItem(args);
if (item.getRegisterNumber() == 0) {
try {
Set<XMethod> targets = Hierarchy2.resolveVirtualMethodCallTargets(m, false, false);
Subtypes2 subtypes2 = AnalysisContext.currentAnalysisContext().getSubtypes2();
for (XMethod called : targets) {
if (!called.isAbstract() && !called.equals(m)
&& subtypes2.isSubtype(called.getClassDescriptor(), getClassDescriptor()))
fieldSummary.setCalledFromSuperConstructor(new ProgramPoint(this), called);
}
} catch (ClassNotFoundException e) {
AnalysisContext.reportMissingClass(e);
}
}
}
}
if (seen == INVOKESPECIAL && getMethodName().equals("<init>") && getNameConstantOperand().equals("<init>")) {
String classOperand = getClassConstantOperand();
OpcodeStack.Item invokedOn = stack.getItemMethodInvokedOn(this);
if (invokedOn.getRegisterNumber() == 0 && !classOperand.equals(getClassName())) {
sawInitializeSuper = true;
XMethod invoked = getXMethodOperand();
if (invoked != null)
fieldSummary.sawSuperCall(getXMethod(), invoked);
}
}
if (seen == PUTFIELD || seen == PUTSTATIC) {
XField fieldOperand = getXFieldOperand();
if (fieldOperand == null)
return;
touched.add(fieldOperand);
if (!fieldOperand.getClassDescriptor().getClassName().equals(getClassName()))
fieldSummary.addWrittenOutsideOfConstructor(fieldOperand);
else if (seen == PUTFIELD) {
OpcodeStack.Item addr = stack.getStackItem(1);
{
if (addr.getRegisterNumber() != 0 || !getMethodName().equals("<init>"))
fieldSummary.addWrittenOutsideOfConstructor(fieldOperand);
}
} else if (seen == PUTSTATIC && !getMethodName().equals("<clinit>"))
fieldSummary.addWrittenOutsideOfConstructor(fieldOperand);
OpcodeStack.Item top = stack.getStackItem(0);
fieldSummary.mergeSummary(fieldOperand, top);
}
}