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


Java Options.java_version_1_5方法代码示例

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


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

示例1: getMinJavaVersion

import soot.options.Options; //导入方法依赖的package包/类
@Override
protected int getMinJavaVersion(SootMethod method) {
	final BafBody body = getBafBody(method);		
	int minVersion = Options.java_version_1_1;

	for (Unit u : body.getUnits()) {
		if (u instanceof DynamicInvokeInst) {
			return Options.java_version_1_7;
		}
		if (u instanceof PushInst) {
			if (((PushInst) u).getConstant() instanceof ClassConstant) {
				minVersion = Options.java_version_1_5;
			}
		}
	}

	return minVersion;
}
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:19,代码来源:BafASMBackend.java

示例2: AbstractASMBackend

import soot.options.Options; //导入方法依赖的package包/类
/**
 * Creates a new ASM backend
 * @param sc The SootClass that is to be converted into bytecode
 * @param javaVersion A particular Java version enforced by the user, may be 0 for automatic detection, must not be lower than necessary for all features used
 */
public AbstractASMBackend(SootClass sc, int javaVersion) {
	this.sc = sc;
	
	int minVersion = getMinJavaVersion(sc);		

	if (javaVersion == 0)
		javaVersion = Options.java_version_default;
	
	if(javaVersion != Options.java_version_default && javaVersion < minVersion){
		throw new IllegalArgumentException("Enforced Java version " + translateJavaVersion(javaVersion) + " too low to support required features (" + translateJavaVersion(minVersion) + " required)");
	}
	
	javaVersion = Math.max(javaVersion, minVersion);

	switch (javaVersion) {
	case Options.java_version_1_1:
		this.javaVersion = Opcodes.V1_1;
		break;
	case Options.java_version_1_2:
		this.javaVersion = Opcodes.V1_2;
		break;
	case Options.java_version_1_3:
		this.javaVersion = Opcodes.V1_3;
		break;
	case Options.java_version_1_4:
		this.javaVersion = Opcodes.V1_4;
		break;
	case Options.java_version_1_5:
		this.javaVersion = Opcodes.V1_5;
		break;
	case Options.java_version_1_6:
		this.javaVersion = Opcodes.V1_6;
		break;
	case Options.java_version_1_7:
		this.javaVersion = Opcodes.V1_7;
		break;
	case Options.java_version_1_8:
		this.javaVersion = Opcodes.V1_8;
		break;
	}
}
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:47,代码来源:AbstractASMBackend.java

示例3: getMinJavaVersion

import soot.options.Options; //导入方法依赖的package包/类
/**
 * Determines the minimum Java version required for the bytecode of the given SootClass
 * @param sc The SootClass the minimum Java version is to be determined for
 * @return The minimum Java version required for the given SootClass
 */
private int getMinJavaVersion(SootClass sc) {
	int minVersion = Options.java_version_1_1;
	
	if(sc.hasTag("SignatureTag")){
		if(((SignatureTag)sc.getTag("SignatureTag")).getSignature().contains("<")){
			minVersion=Options.java_version_1_5;
		}
	}
	if(sc.hasTag("VisibilityAnnotationTag")){
		minVersion = Options.java_version_1_5;
	}
	if(Modifier.isAnnotation(sc.getModifiers())){
		// Class is defining an annotation
		minVersion = Options.java_version_1_5;
	}
	
	for(SootField sf : sc.getFields()){
		if(minVersion >= Options.java_version_1_5){
			break;
		}
		if(sf.hasTag("SignatureTag")){
			if(((SignatureTag)sf.getTag("SignatureTag")).getSignature().contains("<")){
				minVersion=Options.java_version_1_5;
			}
		}
		if(sf.hasTag("VisibilityAnnotationTag")){
			minVersion = Options.java_version_1_5;
		}
	}
	
	for(SootMethod sm : sc.getMethods()){
		if(minVersion >= Options.java_version_1_8){
			break;
		}
		if(sm.hasTag("SignatureTag")){
			if(((SignatureTag)sm.getTag("SignatureTag")).getSignature().contains("<")){
				minVersion = Math.max(minVersion, Options.java_version_1_5);
			}
		}
		if(sm.hasTag("VisibilityAnnotationTag") || sm.hasTag("VisibilityParameterAnnotationTag")){
			minVersion = Math.max(minVersion, Options.java_version_1_5);
		}
		if(sm.hasActiveBody()){
			minVersion = Math.max(minVersion, getMinJavaVersion(sm));
		}
	}
	return minVersion;
}
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:54,代码来源:AbstractASMBackend.java


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