本文整理汇总了Java中com.sun.org.apache.bcel.internal.generic.ICONST类的典型用法代码示例。如果您正苦于以下问题:Java ICONST类的具体用法?Java ICONST怎么用?Java ICONST使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ICONST类属于com.sun.org.apache.bcel.internal.generic包,在下文中一共展示了ICONST类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: initialize
import com.sun.org.apache.bcel.internal.generic.ICONST; //导入依赖的package包/类
/**
* This method is part of a little trick that is needed to use local
* variables inside nested for-each loops. See the initializeVariables()
* method in the ForEach class for an explanation
*/
public void initialize(ClassGenerator classGen, MethodGenerator methodGen) {
final ConstantPoolGen cpg = classGen.getConstantPool();
final InstructionList il = methodGen.getInstructionList();
// This is only done for local variables that are actually used
if (isLocal() && !_refs.isEmpty()) {
// Create a variable slot if none is allocated
if (_local == null) {
_local = methodGen.addLocalVariable2(getEscapedName(),
_type.toJCType(),
null);
}
// Push the default value on the JVM's stack
if ((_type instanceof IntType) ||
(_type instanceof NodeType) ||
(_type instanceof BooleanType))
il.append(new ICONST(0)); // 0 for node-id, integer and boolean
else if (_type instanceof RealType)
il.append(new DCONST(0)); // 0.0 for floating point numbers
else
il.append(new ACONST_NULL()); // and 'null' for anything else
// Mark the store as the start of the live range of the variable
_local.setStart(il.append(_type.STORE(_local.getIndex())));
}
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:33,代码来源:Variable.java
注:本文中的com.sun.org.apache.bcel.internal.generic.ICONST类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论