本文整理汇总了Java中org.apache.bcel.generic.TargetLostException类的典型用法代码示例。如果您正苦于以下问题:Java TargetLostException类的具体用法?Java TargetLostException怎么用?Java TargetLostException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TargetLostException类属于org.apache.bcel.generic包,在下文中一共展示了TargetLostException类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: deleteIns
import org.apache.bcel.generic.TargetLostException; //导入依赖的package包/类
static private void deleteIns(InstructionList il, InstructionHandle ih,
InstructionHandle new_target) {
// System.out.println("deleteIns: instructionList = " + il);
// System.out.println(" handle = " + ih);
try {
il.delete(ih);
} catch (TargetLostException e) {
InstructionHandle[] targets = e.getTargets();
for (int i = 0; i < targets.length; i++) {
InstructionTargeter[] targeters = targets[i].getTargeters();
for (int j = 0; j < targeters.length; j++) {
targeters[j].updateTarget(targets[i], new_target);
}
}
}
}
开发者ID:pieterhijma,项目名称:cashmere,代码行数:18,代码来源:Cashmerec.java
示例2: change1
import org.apache.bcel.generic.TargetLostException; //导入依赖的package包/类
private boolean change1(MethodGen mg)
{
InstructionList il = mg.getInstructionList();
InstructionFinder f = new InstructionFinder(il);
String pat = "[LDC_W|LDC] INVOKEVIRTUAL IFNE ICONST_1 GOTO ICONST_0";
boolean changed = false;
for(Iterator j = f.search(pat, new IsLdcClass()); j.hasNext(); )
{
InstructionHandle[] match = (InstructionHandle[]) j.next();
// replace
// LDC_W <class>
// INVOKEVIRTUAL Class.desiredAssertionStatus
// IFNE
// ICONST_1
// goto
// ICONST_0
// with
// ICONST_1
changed = true;
match[0].setInstruction(InstructionConstants.ICONST_1);
try
{
il.delete(match[1], match[5]);
// System.out.println(il);
}
catch (TargetLostException e)
{
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
}
}
return changed;
}
开发者ID:BowlerHatLLC,项目名称:feathers-sdk,代码行数:36,代码来源:Downgrader.java
示例3: change2
import org.apache.bcel.generic.TargetLostException; //导入依赖的package包/类
private boolean change2(MethodGen mg)
{
InstructionList il = mg.getInstructionList();
InstructionFinder f = new InstructionFinder(il);
String pat = "ALOAD_0 ALOAD_1 PUTFIELD ALOAD_0 INVOKESPECIAL";
boolean changed = false;
for(Iterator j = f.search(pat, new IsInnerConstructor()); j.hasNext(); )
{
InstructionHandle[] match = (InstructionHandle[]) j.next();
// replace
// ALOAD_0 [0]
// ALOAD_1 [1]
// PUTFIELD [2]
// ALOAD_0 [3]
// INVOKESPECIAL [4]
// with
// ALOAD_0 [0]
// INVOKESPECIAL [4]
// ALOAD_0 [3]
// ALOAD_1 [1]
// PUTFIELD [2]
changed = true;
try
{
InstructionList il2 = new InstructionList();
il2.append(match[3].getInstruction());
il2.append(match[4].getInstruction());
il.delete(match[3], match[4]);
il.insert(match[0], il2);
}
catch (TargetLostException e)
{
System.err.println("ERROR IN "+mg);
e.printStackTrace();
}
}
return changed;
}
开发者ID:BowlerHatLLC,项目名称:feathers-sdk,代码行数:42,代码来源:Downgrader.java
注:本文中的org.apache.bcel.generic.TargetLostException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论