Java Code Examples for soot.options.Options#java_version_1_1()
The following examples show how to use
soot.options.Options#java_version_1_1() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BafASMBackend.java From JAADAS with GNU General Public License v3.0 | 6 votes |
@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; }
Example 2
Source File: AbstractASMBackend.java From JAADAS with GNU General Public License v3.0 | 4 votes |
/** * 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; } }
Example 3
Source File: AbstractASMBackend.java From JAADAS with GNU General Public License v3.0 | 4 votes |
/** * 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; }