mirror of
https://github.com/revanced/smali.git
synced 2025-06-13 04:27:38 +02:00
Use final and a private constructor for non-instantiable classes
This commit is contained in:
@ -33,7 +33,7 @@ package org.jf.dexlib2;
|
||||
|
||||
import org.jf.util.ExceptionWithContext;
|
||||
|
||||
public abstract class AnnotationVisibility {
|
||||
public final class AnnotationVisibility {
|
||||
public static final int BUILD = 0;
|
||||
public static final int RUNTIME = 1;
|
||||
public static final int SYSTEM = 2;
|
||||
@ -46,4 +46,6 @@ public abstract class AnnotationVisibility {
|
||||
}
|
||||
return NAMES[visibility];
|
||||
}
|
||||
|
||||
private AnnotationVisibility() {}
|
||||
}
|
||||
|
@ -31,7 +31,7 @@
|
||||
|
||||
package org.jf.dexlib2;
|
||||
|
||||
public abstract class DebugItemType {
|
||||
public final class DebugItemType {
|
||||
// The debug items that directly correspond with one of the dexlib2.iface.debug interfaces
|
||||
public static final int START_LOCAL = 0x03;
|
||||
public static final int END_LOCAL = 0x05;
|
||||
@ -46,4 +46,6 @@ public abstract class DebugItemType {
|
||||
public static final int ADVANCE_PC = 0x01;
|
||||
public static final int ADVANCE_LINE = 0x02;
|
||||
public static final int START_LOCAL_EXTENDED = 0x04;
|
||||
|
||||
private DebugItemType() {}
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ import java.io.IOException;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipFile;
|
||||
|
||||
public abstract class DexFileFactory {
|
||||
public final class DexFileFactory {
|
||||
@Nonnull
|
||||
public static DexFile loadDexFile(String path) throws IOException {
|
||||
return loadDexFile(new File(path));
|
||||
@ -97,4 +97,6 @@ public abstract class DexFileFactory {
|
||||
DexBuffer dexBuf = new DexBuffer(dexBytes);
|
||||
return new DexBackedDexFile(dexBuf);
|
||||
}
|
||||
|
||||
private DexFileFactory() {}
|
||||
}
|
||||
|
@ -31,10 +31,12 @@
|
||||
|
||||
package org.jf.dexlib2;
|
||||
|
||||
public abstract class ReferenceType {
|
||||
public final class ReferenceType {
|
||||
public static final int STRING = 0;
|
||||
public static final int TYPE = 1;
|
||||
public static final int FIELD = 2;
|
||||
public static final int METHOD = 3;
|
||||
public static final int NONE = 4;
|
||||
|
||||
private ReferenceType() {}
|
||||
}
|
@ -31,7 +31,7 @@
|
||||
|
||||
package org.jf.dexlib2;
|
||||
|
||||
public abstract class ValueType {
|
||||
public final class ValueType {
|
||||
public static final int BYTE = 0x00;
|
||||
public static final int SHORT = 0x02;
|
||||
public static final int CHAR = 0x03;
|
||||
@ -48,4 +48,6 @@ public abstract class ValueType {
|
||||
public static final int ANNOTATION = 0x1d;
|
||||
public static final int NULL = 0x1e;
|
||||
public static final int BOOLEAN = 0x1f;
|
||||
|
||||
private ValueType() {}
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ package org.jf.dexlib2.util;
|
||||
import org.jf.dexlib2.ValueType;
|
||||
import org.jf.dexlib2.iface.value.*;
|
||||
|
||||
public class EncodedValueUtils {
|
||||
public final class EncodedValueUtils {
|
||||
public static boolean isDefaultValue(EncodedValue encodedValue) {
|
||||
switch (encodedValue.getValueType()) {
|
||||
case ValueType.BOOLEAN:
|
||||
@ -59,4 +59,5 @@ public class EncodedValueUtils {
|
||||
return false;
|
||||
}
|
||||
|
||||
private EncodedValueUtils() {}
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ import org.jf.dexlib2.iface.ClassDef;
|
||||
import org.jf.dexlib2.iface.Method;
|
||||
import org.jf.dexlib2.iface.MethodParameter;
|
||||
|
||||
public class MethodUtil {
|
||||
public final class MethodUtil {
|
||||
public static String buildFullMethodString(ClassDef classDef, Method method) {
|
||||
//TODO: consider using a cached thread-local StringBuilder
|
||||
StringBuilder sb = new StringBuilder();
|
||||
@ -58,4 +58,6 @@ public class MethodUtil {
|
||||
public static boolean isDirect(Method method) {
|
||||
return (method.getAccessFlags() | directMask) != 0;
|
||||
}
|
||||
|
||||
private MethodUtil() {}
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ import org.jf.dexlib2.iface.reference.TypeReference;
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
|
||||
public abstract class ReferenceUtil {
|
||||
public final class ReferenceUtil {
|
||||
public static String getMethodDescriptor(MethodReference methodReference) {
|
||||
// TODO: try using a thread local StringBuilder
|
||||
StringBuilder sb = new StringBuilder();
|
||||
@ -93,4 +93,6 @@ public abstract class ReferenceUtil {
|
||||
writer.write(':');
|
||||
writer.write(fieldReference.getType());
|
||||
}
|
||||
|
||||
private ReferenceUtil() {}
|
||||
}
|
||||
|
@ -31,11 +31,11 @@
|
||||
|
||||
package org.jf.dexlib2.util;
|
||||
|
||||
import org.jf.dexlib2.iface.value.EncodedValue;
|
||||
|
||||
public class TypeUtils {
|
||||
public final class TypeUtils {
|
||||
public static boolean isWideType(String type) {
|
||||
char c = type.charAt(0);
|
||||
return c == 'J' || c == 'D';
|
||||
}
|
||||
|
||||
private TypeUtils() {}
|
||||
}
|
||||
|
Reference in New Issue
Block a user