lanchon.multidexlib2.OpcodeUtils Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of multidexlib2 Show documentation
Show all versions of multidexlib2 Show documentation
Multi-dex extensions for dexlib2.
The newest version!
/*
* multidexlib2 - Copyright 2015-2022 Rodrigo Balerdi
* (GNU General Public License version 3 or later)
*
* multidexlib2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
* by the Free Software Foundation, either version 3 of the License,
* or (at your option) any later version.
*/
package lanchon.multidexlib2;
import com.android.tools.smali.dexlib2.Opcodes;
import com.android.tools.smali.dexlib2.VersionMap;
public class OpcodeUtils {
private OpcodeUtils() {
}
public static Opcodes getOpcodesFromDexVersion(int dexVersion) {
return Opcodes.forDexVersion(dexVersion);
}
public static int getDexVersionFromOpcodes(Opcodes opcodes) {
if (opcodes.api == VersionMap.NO_VERSION) throw undefinedApiLevel();
return VersionMap.mapApiToDexVersion(opcodes.api);
}
public static Opcodes getNewestOpcodes(Opcodes o1, Opcodes o2, boolean nullable) {
if (nullable) {
if (o1 == null) return o2;
if (o2 == null) return o1;
}
if (o1.api == VersionMap.NO_VERSION || o2.api == VersionMap.NO_VERSION) throw undefinedApiLevel();
return o1.api >= o2.api ? o1 : o2;
}
private static IllegalArgumentException undefinedApiLevel() {
return new IllegalArgumentException("Opcodes instance has undefined api level");
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy