mirror of
https://github.com/revanced/multidexlib2.git
synced 2025-04-30 06:34:31 +02:00
Fix inspections
This commit is contained in:
parent
58fa3f477f
commit
a1438645c5
6
.idea/inspectionProfiles/Project_Default.xml
generated
Normal file
6
.idea/inspectionProfiles/Project_Default.xml
generated
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<component name="InspectionProjectProfileManager">
|
||||||
|
<profile version="1.0">
|
||||||
|
<option name="myName" value="Project Default" />
|
||||||
|
<inspection_tool class="GroovyAssignabilityCheck" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||||
|
</profile>
|
||||||
|
</component>
|
20
.idea/misc.xml
generated
20
.idea/misc.xml
generated
@ -1,5 +1,25 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
|
<component name="EntryPointsManager">
|
||||||
|
<entry_points version="2.0">
|
||||||
|
<entry_point TYPE="field" FQNAME="lanchon.multidexlib2.DexIO DEFAULT_MAX_DEX_POOL_SIZE" />
|
||||||
|
<entry_point TYPE="field" FQNAME="lanchon.multidexlib2.BasicDexFileNamer DEFAULT_BASE_NAME" />
|
||||||
|
</entry_points>
|
||||||
|
<pattern value="lanchon.multidexlib2.MultiDexIO" method="readDexFile" />
|
||||||
|
<pattern value="lanchon.multidexlib2.MultiDexIO" method="writeDexFile" />
|
||||||
|
<pattern value="lanchon.multidexlib2.MultiDexIO" method="MultiDexIO" />
|
||||||
|
<pattern value="lanchon.multidexlib2.RawDexIO" method="readRawDexFile" />
|
||||||
|
<pattern value="lanchon.multidexlib2.RawDexIO" method="writeRawDexFile" />
|
||||||
|
<pattern value="lanchon.multidexlib2.RawDexIO" method="RawDexIO" />
|
||||||
|
<pattern value="lanchon.multidexlib2.DexIO" method="DexIO" />
|
||||||
|
<pattern value="lanchon.multidexlib2.OpcodeUtils" method="getDexVersionFromOpcodes" />
|
||||||
|
<pattern value="lanchon.multidexlib2.OpcodeUtils" method="getOpcodesFromDexVersion" />
|
||||||
|
<pattern value="lanchon.multidexlib2.OpcodeUtils" method="OpcodeUtils" />
|
||||||
|
<pattern value="lanchon.multidexlib2.BasicDexFileNamer" method="BasicDexFileNamer" />
|
||||||
|
<pattern value="lanchon.multidexlib2.DexFileNameComparator" method="getNamer" />
|
||||||
|
<pattern value="lanchon.multidexlib2.DexFileNameIterator" method="getMaxCount" />
|
||||||
|
<pattern value="lanchon.multidexlib2.DexFileNameIterator" method="getNamer" />
|
||||||
|
</component>
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||||
</component>
|
</component>
|
||||||
|
@ -24,7 +24,7 @@ ext.mainArtifact = 'multidexlib2'
|
|||||||
ext.artifactName = mainArtifact
|
ext.artifactName = mainArtifact
|
||||||
|
|
||||||
sourceCompatibility = '1.7'
|
sourceCompatibility = '1.7'
|
||||||
def jdk = findProperty('JDK7_HOME') ?: '/usr/lib/jvm/java-7-openjdk-amd64'
|
def jdk = findProperty('JDK7_HOME') as String ?: '/usr/lib/jvm/java-7-openjdk-amd64'
|
||||||
def jdk_rt = new File(jdk, 'jre/lib/rt.jar')
|
def jdk_rt = new File(jdk, 'jre/lib/rt.jar')
|
||||||
if (jdk_rt.exists()) compileJava.options.bootstrapClasspath = files(jdk_rt)
|
if (jdk_rt.exists()) compileJava.options.bootstrapClasspath = files(jdk_rt)
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ public class DexFileNameComparator implements Comparator<String> {
|
|||||||
boolean rv = (ri >= 0);
|
boolean rv = (ri >= 0);
|
||||||
if (lv != rv) return lv ? -1 : 1;
|
if (lv != rv) return lv ? -1 : 1;
|
||||||
if (!lv) return l.compareTo(r);
|
if (!lv) return l.compareTo(r);
|
||||||
return li < ri ? -1 : (li > ri ? 1 : 0);
|
return Integer.compare(li, ri);
|
||||||
}
|
}
|
||||||
|
|
||||||
public DexFileNamer getNamer() {
|
public DexFileNamer getNamer() {
|
||||||
|
@ -74,6 +74,7 @@ public class DexIO {
|
|||||||
minimalMainDex = false;
|
minimalMainDex = false;
|
||||||
}
|
}
|
||||||
Object lock = new Object();
|
Object lock = new Object();
|
||||||
|
//noinspection SynchronizationOnLocalVariableOrMethodParameter
|
||||||
synchronized (lock) { // avoid multiple synchronizations in single-threaded mode
|
synchronized (lock) { // avoid multiple synchronizations in single-threaded mode
|
||||||
writeMultiDexDirectoryCommon(directory, nameIterator, Iterators.peekingIterator(classes.iterator()),
|
writeMultiDexDirectoryCommon(directory, nameIterator, Iterators.peekingIterator(classes.iterator()),
|
||||||
minMainDexClassCount, minimalMainDex, dexFile.getOpcodes(), maxDexPoolSize, logger, lock);
|
minMainDexClassCount, minimalMainDex, dexFile.getOpcodes(), maxDexPoolSize, logger, lock);
|
||||||
@ -94,6 +95,7 @@ public class DexIO {
|
|||||||
final BatchedIterator<ClassDef> batchedIterator =
|
final BatchedIterator<ClassDef> batchedIterator =
|
||||||
new BatchedIterator<>(classIterator, lock, PER_THREAD_BATCH_SIZE);
|
new BatchedIterator<>(classIterator, lock, PER_THREAD_BATCH_SIZE);
|
||||||
if (i != 0 && !batchedIterator.hasNext()) break;
|
if (i != 0 && !batchedIterator.hasNext()) break;
|
||||||
|
//noinspection Convert2Lambda
|
||||||
callables.add(new Callable<Void>() {
|
callables.add(new Callable<Void>() {
|
||||||
@Override
|
@Override
|
||||||
public Void call() throws IOException {
|
public Void call() throws IOException {
|
||||||
@ -148,11 +150,14 @@ public class DexIO {
|
|||||||
fileClassCount++;
|
fileClassCount++;
|
||||||
}
|
}
|
||||||
File file;
|
File file;
|
||||||
|
//noinspection SynchronizationOnLocalVariableOrMethodParameter
|
||||||
synchronized (lock) {
|
synchronized (lock) {
|
||||||
String name = nameIterator.next();
|
String name = nameIterator.next();
|
||||||
file = new File(directory, name);
|
file = new File(directory, name);
|
||||||
if (logger != null) logger.log(directory, name, fileClassCount);
|
if (logger != null) logger.log(directory, name, fileClassCount);
|
||||||
if (classIterator instanceof BatchedIterator) ((BatchedIterator) classIterator).preloadBatch();
|
if (classIterator instanceof BatchedIterator) {
|
||||||
|
((BatchedIterator<?>) classIterator).preloadBatch();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
dexPool.writeTo(new FileDataStore(file));
|
dexPool.writeTo(new FileDataStore(file));
|
||||||
minMainDexClassCount = 0;
|
minMainDexClassCount = 0;
|
||||||
|
@ -30,6 +30,7 @@ public class MultiDexContainerBackedDexFile<T extends DexFile> implements DexFil
|
|||||||
List<String> entryNames = container.getDexEntryNames();
|
List<String> entryNames = container.getDexEntryNames();
|
||||||
if (entryNames.size() == 1) {
|
if (entryNames.size() == 1) {
|
||||||
String entryName = entryNames.get(0);
|
String entryName = entryNames.get(0);
|
||||||
|
//noinspection ConstantConditions
|
||||||
T entryDex = container.getEntry(entryName).getDexFile();
|
T entryDex = container.getEntry(entryName).getDexFile();
|
||||||
classes = Collections.unmodifiableSet(entryDex.getClasses());
|
classes = Collections.unmodifiableSet(entryDex.getClasses());
|
||||||
opcodes = entryDex.getOpcodes();
|
opcodes = entryDex.getOpcodes();
|
||||||
@ -37,6 +38,7 @@ public class MultiDexContainerBackedDexFile<T extends DexFile> implements DexFil
|
|||||||
LinkedHashSet<ClassDef> accumulatedClasses = new LinkedHashSet<>();
|
LinkedHashSet<ClassDef> accumulatedClasses = new LinkedHashSet<>();
|
||||||
Opcodes resolvedOpcodes = null;
|
Opcodes resolvedOpcodes = null;
|
||||||
for (String entryName : entryNames) {
|
for (String entryName : entryNames) {
|
||||||
|
//noinspection ConstantConditions
|
||||||
T entryDex = container.getEntry(entryName).getDexFile();
|
T entryDex = container.getEntry(entryName).getDexFile();
|
||||||
for (ClassDef entryClass : entryDex.getClasses()) {
|
for (ClassDef entryClass : entryDex.getClasses()) {
|
||||||
if (!accumulatedClasses.add(entryClass)) throw new DuplicateTypeException(entryClass.getType());
|
if (!accumulatedClasses.add(entryClass)) throw new DuplicateTypeException(entryClass.getType());
|
||||||
|
@ -48,6 +48,7 @@ public class MultiDexIO {
|
|||||||
MultiDexContainer<DexBackedDexFile> container = readMultiDexContainer(file, namer, opcodes);
|
MultiDexContainer<DexBackedDexFile> container = readMultiDexContainer(file, namer, opcodes);
|
||||||
if (logger != null) {
|
if (logger != null) {
|
||||||
for (String name : container.getDexEntryNames()) {
|
for (String name : container.getDexEntryNames()) {
|
||||||
|
//noinspection ConstantConditions
|
||||||
logger.log(file, name, container.getEntry(name).getDexFile().getClasses().size());
|
logger.log(file, name, container.getEntry(name).getDexFile().getClasses().size());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,6 +43,7 @@ public class RawDexIO {
|
|||||||
return readRawDexFile(inputStream, file.length(), opcodes);
|
return readRawDexFile(inputStream, file.length(), opcodes);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
//noinspection UnstableApiUsage
|
||||||
byte[] buf = Files.toByteArray(file);
|
byte[] buf = Files.toByteArray(file);
|
||||||
return readRawDexFile(buf, 0, opcodes);
|
return readRawDexFile(buf, 0, opcodes);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user