当前位置: 首页>>代码示例>>Java>>正文


Java Constants.GETSTATIC属性代码示例

本文整理汇总了Java中org.apache.bcel.Constants.GETSTATIC属性的典型用法代码示例。如果您正苦于以下问题:Java Constants.GETSTATIC属性的具体用法?Java Constants.GETSTATIC怎么用?Java Constants.GETSTATIC使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.apache.bcel.Constants的用法示例。


在下文中一共展示了Constants.GETSTATIC属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createStream

public Stream createStream(Location location, ObjectType type, ConstantPoolGen cpg,
                           RepositoryLookupFailureCallback lookupFailureCallback) {

	Instruction ins = location.getHandle().getInstruction();
	if (ins.getOpcode() != Constants.GETSTATIC)
		return null;

	GETSTATIC getstatic = (GETSTATIC) ins;
	if (!className.equals(getstatic.getClassName(cpg))
	        || !fieldName.equals(getstatic.getName(cpg))
	        || !fieldSig.equals(getstatic.getSignature(cpg)))
		return null;

	return new Stream(location, type.getClassName(), streamBaseClass)
	        .setIgnoreImplicitExceptions(true)
	        .setIsOpenOnCreation(true);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:17,代码来源:StaticFieldLoadStreamFactory.java

示例2: findXField

/**
 * Look up the field referenced by given FieldInstruction,
 * returning it as an {@link XField XField} object.
 *
 * @param fins the FieldInstruction
 * @param cpg  the ConstantPoolGen used by the class containing the instruction
 * @return an XField object representing the field, or null
 *         if no such field could be found
 */
public static XField findXField(FieldInstruction fins, ConstantPoolGen cpg)
        throws ClassNotFoundException {

	String className = fins.getClassName(cpg);
	String fieldName = fins.getFieldName(cpg);
	String fieldSig = fins.getSignature(cpg);

	XField xfield = findXField(className, fieldName, fieldSig);
	short opcode = fins.getOpcode();
	if (xfield != null &&
	        xfield.isStatic() == (opcode == Constants.GETSTATIC || opcode == Constants.PUTSTATIC))
		return xfield;
	else
		return null;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:24,代码来源:Hierarchy.java

示例3: isPEI

/**
 * Return whether or not the given instruction can throw exceptions.
 *
 * @param handle the instruction
 * @return true if the instruction can throw an exception, false otherwise
 */
private boolean isPEI(InstructionHandle handle) {
	Instruction ins = handle.getInstruction();
	short opcode = ins.getOpcode();

	if (!(ins instanceof ExceptionThrower))
		return false;

	// Return instructions can throw exceptions only if the method is synchronized
	if (ins instanceof ReturnInstruction && !methodGen.isSynchronized())
		return false;

	// We're really not interested in exceptions that could hypothetically be
	// thrown by static field accesses.
	if (NO_STATIC_FIELD_EXCEPTIONS &&
	        (opcode == Constants.GETSTATIC || opcode == Constants.PUTSTATIC))
		return false;

	// Exceptions from LDC instructions seem a bit far fetched as well.
	if (NO_LOAD_CONSTANT_EXCEPTIONS &&
	        (opcode == Constants.LDC || opcode == Constants.LDC_W || opcode == Constants.LDC2_W))
		return false;

	return true;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:30,代码来源:BetterCFGBuilder2.java

示例4: isGetterMethod

/**
 * Determine whether or not the the given method is
 * a getter method.  I.e., if it just returns the
 * value of an instance field.
 *
 * @param classContext the ClassContext for the class containing the method
 * @param method       the method
 */
public static boolean isGetterMethod(ClassContext classContext, Method method) {
	MethodGen methodGen = classContext.getMethodGen(method);
	InstructionList il = methodGen.getInstructionList();
	// System.out.println("Checking getter method: " + method.getName());
	if (il.getLength() > 60)
		return false;

	int count = 0;
	Iterator it = il.iterator();
	while (it.hasNext()) {
		InstructionHandle ih = (InstructionHandle) it.next();
		switch (ih.getInstruction().getOpcode()) {
		case Constants.GETFIELD:
			count++;
			if (count > 1) return false;
			break;
		case Constants.PUTFIELD:
		case Constants.BALOAD:
		case Constants.CALOAD:
		case Constants.DALOAD:
		case Constants.FALOAD:
		case Constants.IALOAD:
		case Constants.LALOAD:
		case Constants.SALOAD:
		case Constants.AALOAD:
		case Constants.BASTORE:
		case Constants.CASTORE:
		case Constants.DASTORE:
		case Constants.FASTORE:
		case Constants.IASTORE:
		case Constants.LASTORE:
		case Constants.SASTORE:
		case Constants.AASTORE:
		case Constants.PUTSTATIC:
			return false;
		case Constants.INVOKESTATIC:
		case Constants.INVOKEVIRTUAL:
		case Constants.INVOKEINTERFACE:
		case Constants.INVOKESPECIAL:
		case Constants.GETSTATIC:
			// no-op

		}
	}
	// System.out.println("Found getter method: " + method.getName());
	return true;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:55,代码来源:FindInconsistentSync2.java

示例5: handleInstruction

public void handleInstruction(int opcode, int index) {
	switch (opcode) {
	case Constants.GETFIELD:
	case Constants.PUTFIELD:
		setField(getIndex(instructionList, index), false, opcode == Constants.GETFIELD);
		break;
	case Constants.GETSTATIC:
	case Constants.PUTSTATIC:
		setField(getIndex(instructionList, index), true, opcode == Constants.GETSTATIC);
		break;
	}
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:12,代码来源:InnerClassAccessMap.java


注:本文中的org.apache.bcel.Constants.GETSTATIC属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。