本文整理了Java中org.apache.bcel.classfile.Method.isStatic()
方法的一些代码示例,展示了Method.isStatic()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Method.isStatic()
方法的具体详情如下:
包路径:org.apache.bcel.classfile.Method
类名称:Method
方法名:isStatic
暂无
代码示例来源:origin: spotbugs/spotbugs
@Override
public void visit(Method obj) {
methodIsStatic = obj.isStatic();
state = 0;
sawGetClass = -100;
}
代码示例来源:origin: spotbugs/spotbugs
@Override
public void visit(Method obj) {
super.visit(obj);
numParms = getNumberMethodArguments();
if (!obj.isStatic()) {
numParms++;
}
// System.out.println(obj);
// System.out.println(numParms);
staticMethod = obj.isStatic();
}
代码示例来源:origin: spotbugs/spotbugs
@Override
public boolean choose(JavaClassAndMethod javaClassAndMethod) {
return javaClassAndMethod.getMethod().isStatic();
}
代码示例来源:origin: spotbugs/spotbugs
@Override
public boolean choose(JavaClassAndMethod javaClassAndMethod) {
return !javaClassAndMethod.getMethod().isStatic();
}
代码示例来源:origin: spotbugs/spotbugs
@Override
public void initMethod(Method method) {
isEqualsObject = "equals".equals(getMethodName()) && "(Ljava/lang/Object;)Z".equals(getMethodSig()) && !method.isStatic();
sawInstanceofCheck = false;
reportedBadCastInEquals = false;
}
代码示例来源:origin: spotbugs/spotbugs
public static boolean isMainMethod(Method method) {
return method.isStatic() && "main".equals(method.getName()) && "([Ljava/lang/String;)V".equals(method.getSignature());
}
代码示例来源:origin: spotbugs/spotbugs
/** is there a JUnit3TestSuite */
private boolean hasSuite(Method[] methods) {
for (Method m : methods) {
if (m.getName().equals("suite") && m.isPublic() && m.isStatic()
// && m.getReturnType().equals(junit.framework.Test.class)
// && m.getArgumentTypes().length == 0
&& m.getSignature().equals("()Ljunit/framework/Test;")) {
return true;
}
}
return false;
}
代码示例来源:origin: spotbugs/spotbugs
@Override
public void visit(Code obj) {
Method m = getMethod();
if (m.isStatic() || alreadyReported) {
return;
}
state = SEEN_NOTHING;
super.visit(obj);
}
代码示例来源:origin: spotbugs/spotbugs
@Override
public void visit(Code obj) {
if (getMethod().isStatic()) {
return;
}
initializedFields = new HashSet<>();
nullCheckedFields = new HashSet<>();
super.visit(obj);
accumulator.reportAccumulatedBugs();
}
代码示例来源:origin: spotbugs/spotbugs
/**
* Build map of value numbers to param indices. The first parameter has
* index 0, the second has index 1, etc.
*
* @param method
* the method analyzed by the ValueNumberAnalysis
* @return the value number to parameter index map
*/
public Map<ValueNumber, Integer> getValueNumberToParamMap(Method method) {
return getValueNumberToParamMap(method.getSignature(), method.isStatic());
}
代码示例来源:origin: spotbugs/spotbugs
public static Method findImplementation(JavaClass clazz, String name, String signature) {
Method[] m = clazz.getMethods();
for (Method aM : m) {
if (aM.getName().equals(name) && aM.getSignature().equals(signature) && !aM.isPrivate() && !aM.isStatic()) {
return aM;
}
}
return null;
}
}
代码示例来源:origin: spotbugs/spotbugs
private Set<ValueNumber> getParameterValueNumbers(ClassContext classContext, Method method, CFG cfg)
throws DataflowAnalysisException, CFGBuilderException {
ValueNumberDataflow vnaDataflow = classContext.getValueNumberDataflow(method);
ValueNumberFrame vnaFrameAtEntry = vnaDataflow.getStartFact(cfg.getEntry());
Set<ValueNumber> paramValueNumberSet = new HashSet<>();
int firstParam = method.isStatic() ? 0 : 1;
for (int i = firstParam; i < vnaFrameAtEntry.getNumLocals(); ++i) {
paramValueNumberSet.add(vnaFrameAtEntry.getValue(i));
}
return paramValueNumberSet;
}
代码示例来源:origin: spotbugs/spotbugs
/**
* @param obj
* the method to parse
* @return a descriptor for the method
*/
protected MethodDescriptor parseMethod(Method obj) {
return new MethodDescriptor(slashedClassName, obj.getName(), obj.getSignature(), obj.isStatic());
}
代码示例来源:origin: spotbugs/spotbugs
@Override
public void visit(Method obj) {
if (getMethodName().equals("suite") && !obj.isStatic()) {
bugReporter.reportBug(new BugInstance(this, "IJU_SUITE_NOT_STATIC", NORMAL_PRIORITY).addClassAndMethod(this));
}
if (getMethodName().equals("suite") && obj.getSignature().startsWith("()") && obj.isStatic()) {
if ((!obj.getSignature().equals("()Ljunit/framework/Test;") && !obj.getSignature().equals(
"()Ljunit/framework/TestSuite;"))
|| !obj.isPublic()) {
bugReporter.reportBug(new BugInstance(this, "IJU_BAD_SUITE_METHOD", NORMAL_PRIORITY).addClassAndMethod(this));
}
}
}
代码示例来源:origin: spotbugs/spotbugs
public static @CheckForNull
XMethod definedIn(JavaClass clazz, XMethod m) {
for (Method m2 : clazz.getMethods()) {
if (m.getName().equals(m2.getName()) && m.getSignature().equals(m2.getSignature()) && m.isStatic() == m2.isStatic()) {
return XFactory.createXMethod(clazz, m2);
}
}
return null;
}
代码示例来源:origin: spotbugs/spotbugs
private boolean classDefinesMethod(JavaClass c, XMethod m) {
for (Method definedMethod : c.getMethods()) {
if (definedMethod.getName().equals(m.getName()) && definedMethod.getSignature().equals(m.getSignature())
&& definedMethod.isStatic() == m.isStatic()) {
return true;
}
}
return false;
}
代码示例来源:origin: spotbugs/spotbugs
/**
* Construct a MethodDescriptor from JavaClass and method.
*
* @param jclass
* a JavaClass
* @param method
* a Method belonging to the JavaClass
* @return a MethodDescriptor identifying the method
*/
public static MethodDescriptor getMethodDescriptor(JavaClass jclass, Method method) {
return DescriptorFactory.instance().getMethodDescriptor(jclass.getClassName().replace('.', '/'), method.getName(),
method.getSignature(), method.isStatic());
}
代码示例来源:origin: spotbugs/spotbugs
@Override
public void visit(Code code) {
boolean interesting = !getMethod().isStatic() && !getThisClass().isFinal();
if (interesting) {
// initialize any variables we want to initialize for the method
pendingBug = null;
super.visit(code); // make callbacks to sawOpcode for all opcodes
assert (pendingBug == null);
}
}
代码示例来源:origin: spotbugs/spotbugs
/**
* Get the MethodDescriptor that (hopefully) uniqely names this method.
*
* @return the MethodDescriptor uniquely naming this method
*/
public MethodDescriptor toMethodDescriptor() {
return DescriptorFactory.instance().getMethodDescriptor(getSlashedClassName(), method.getName(), method.getSignature(),
method.isStatic());
}
代码示例来源:origin: spotbugs/spotbugs
public MethodDescriptor getMethodDescriptor(JavaClass jClass, Method method) {
return getMethodDescriptor(ClassName.toSlashedClassName(jClass.getClassName()), method.getName(), method.getSignature(),
method.isStatic());
}
内容来源于网络,如有侵权,请联系作者删除!