本文整理汇总了Java中org.apache.bcel.generic.MethodGen.isStatic方法的典型用法代码示例。如果您正苦于以下问题:Java MethodGen.isStatic方法的具体用法?Java MethodGen.isStatic怎么用?Java MethodGen.isStatic使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.bcel.generic.MethodGen
的用法示例。
在下文中一共展示了MethodGen.isStatic方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ValueNumberAnalysis
import org.apache.bcel.generic.MethodGen; //导入方法依赖的package包/类
public ValueNumberAnalysis(MethodGen methodGen, DepthFirstSearch dfs,
LoadedFieldSet loadedFieldSet,
RepositoryLookupFailureCallback lookupFailureCallback) {
super(dfs);
this.methodGen = methodGen;
this.factory = new ValueNumberFactory();
this.cache = new ValueNumberCache();
this.visitor = new ValueNumberFrameModelingVisitor(methodGen, factory, cache,
loadedFieldSet,
lookupFailureCallback);
int numLocals = methodGen.getMaxLocals();
this.entryLocalValueList = new ValueNumber[numLocals];
for (int i = 0; i < numLocals; ++i)
this.entryLocalValueList[i] = factory.createFreshValue();
this.exceptionHandlerValueNumberMap = new IdentityHashMap<BasicBlock, ValueNumber>();
// For non-static methods, keep track of which value represents the
// "this" reference
if (!methodGen.isStatic())
this.thisValue = entryLocalValueList[0];
this.factAtLocationMap = new HashMap<Location, ValueNumberFrame>();
this.factAfterLocationMap = new HashMap<Location, ValueNumberFrame>();
}
示例2: LockAnalysis
import org.apache.bcel.generic.MethodGen; //导入方法依赖的package包/类
public LockAnalysis(MethodGen methodGen, ValueNumberDataflow vnaDataflow, DepthFirstSearch dfs) {
super(dfs);
this.methodGen = methodGen;
this.vnaDataflow = vnaDataflow;
this.vna = vnaDataflow.getAnalysis();
this.isSynchronized = methodGen.isSynchronized();
this.isStatic = methodGen.isStatic();
}
示例3: ValueNumberAnalysis
import org.apache.bcel.generic.MethodGen; //导入方法依赖的package包/类
public ValueNumberAnalysis(MethodGen methodGen, DepthFirstSearch dfs, LoadedFieldSet loadedFieldSet,
RepositoryLookupFailureCallback lookupFailureCallback) {
super(dfs);
this.methodGen = methodGen;
this.factory = new ValueNumberFactory();
ValueNumberCache cache = new ValueNumberCache();
this.visitor = new ValueNumberFrameModelingVisitor(methodGen, factory, cache, loadedFieldSet, lookupFailureCallback);
int numLocals = methodGen.getMaxLocals();
this.entryLocalValueList = new ValueNumber[numLocals];
for (int i = 0; i < numLocals; ++i)
this.entryLocalValueList[i] = factory.createFreshValue();
this.exceptionHandlerValueNumberMap = new IdentityHashMap<BasicBlock, ValueNumber>();
// For non-static methods, keep track of which value represents the
// "this" reference
if (!methodGen.isStatic())
this.thisValue = entryLocalValueList[0];
this.factAtLocationMap = new HashMap<Location, ValueNumberFrame>();
this.factAfterLocationMap = new HashMap<Location, ValueNumberFrame>();
if (DEBUG)
System.out.println("VNA Analysis " + methodGen.getClassName() + "." + methodGen.getName() + " : "
+ methodGen.getSignature());
}
示例4: LockAnalysis
import org.apache.bcel.generic.MethodGen; //导入方法依赖的package包/类
public LockAnalysis(MethodGen methodGen, ValueNumberDataflow vnaDataflow, DepthFirstSearch dfs) {
super(dfs);
this.methodGen = methodGen;
this.vnaDataflow = vnaDataflow;
this.vna = vnaDataflow.getAnalysis();
this.isSynchronized = methodGen.isSynchronized();
this.isStatic = methodGen.isStatic();
if (DEBUG)
System.out.println("Analyzing Locks in " + methodGen.getClassName() + "." + methodGen.getName());
}
示例5: rewriteAbort
import org.apache.bcel.generic.MethodGen; //导入方法依赖的package包/类
void rewriteAbort(MethodGen m, InstructionList il, InstructionHandle i,
int maxLocals) {
// in a clone, we have to abort two lists: the outstanding spawns of
// the parent, and the outstanding spawns of the clone.
Instruction fa = getCashmere(ins_f);
Instruction ab = ins_f.createInvoke("ibis.cashmere.impl.Cashmere", "abort",
Type.VOID, new Type[] { irType, irType }, Constants.INVOKEVIRTUAL);
if (mtab.isClone(m)) {
int parentPos = 3;
if (!m.isStatic()) { // we have an additional 'this' param
parentPos++;
}
i.getPrev().getPrev().setInstruction(fa);
// push outstanding spawns
i.getPrev().setInstruction(new ALOAD(maxLocals - 3));
// push parent invocationrecord
i.setInstruction(new ALOAD(parentPos));
i = i.getNext();
} else if (mtab.containsInlet(m)) {
i.getPrev().getPrev().setInstruction(fa);
// push outstanding spawns
i.getPrev().setInstruction(new ALOAD(maxLocals - 3));
i.setInstruction(new ACONST_NULL());
i = i.getNext();
} else {
i.getPrev().setInstruction(fa);
// push outstanding spawns
i.setInstruction(new ALOAD(maxLocals - 3));
i = i.getNext();
il.insert(i, new ACONST_NULL());
}
// and call Cashmere.abort
il.insert(i, ab);
// all jobs were killed, set outstandingSpawns to null
il.insert(i, new ACONST_NULL()); // push null
il.insert(i, new ASTORE(maxLocals - 3)); // write
}
示例6: counterAdaptClass
import org.apache.bcel.generic.MethodGen; //导入方法依赖的package包/类
byte[] counterAdaptClass(final InputStream is, final String name)
throws Exception
{
JavaClass jc = new ClassParser(is, name + ".class").parse();
ClassGen cg = new ClassGen(jc);
ConstantPoolGen cp = cg.getConstantPool();
if (!cg.isInterface()) {
FieldGen fg = new FieldGen(ACC_PUBLIC,
Type.getType("I"),
"_counter",
cp);
cg.addField(fg.getField());
}
Method[] ms = cg.getMethods();
for (int j = 0; j < ms.length; ++j) {
MethodGen mg = new MethodGen(ms[j], cg.getClassName(), cp);
if (!mg.getName().equals("<init>") && !mg.isStatic()
&& !mg.isAbstract() && !mg.isNative())
{
if (mg.getInstructionList() != null) {
InstructionList il = new InstructionList();
il.append(new ALOAD(0));
il.append(new ALOAD(0));
il.append(new GETFIELD(cp.addFieldref(name, "_counter", "I")));
il.append(new ICONST(1));
il.append(new IADD());
il.append(new PUTFIELD(cp.addFieldref(name, "_counter", "I")));
mg.getInstructionList().insert(il);
mg.setMaxStack(Math.max(mg.getMaxStack(), 2));
boolean lv = ms[j].getLocalVariableTable() == null;
boolean ln = ms[j].getLineNumberTable() == null;
if (lv) {
mg.removeLocalVariables();
}
if (ln) {
mg.removeLineNumbers();
}
cg.replaceMethod(ms[j], mg.getMethod());
}
}
}
return cg.getJavaClass().getBytes();
}
示例7: addMethod
import org.apache.bcel.generic.MethodGen; //导入方法依赖的package包/类
/**
* Add a method annotation. If this is the first method annotation added, it
* becomes the primary method annotation. If the method has source line
* information, then a SourceLineAnnotation is added to the method.
*
* @param methodGen
* the MethodGen object for the method
* @param sourceFile
* source file method is defined in
* @return this object
*/
@Nonnull
public BugInstance addMethod(MethodGen methodGen, String sourceFile) {
String className = methodGen.getClassName();
MethodAnnotation methodAnnotation = new MethodAnnotation(className, methodGen.getName(), methodGen.getSignature(),
methodGen.isStatic());
addMethod(methodAnnotation);
addSourceLinesForMethod(methodAnnotation, SourceLineAnnotation.fromVisitedMethod(methodGen, sourceFile));
return this;
}