mirror of
https://github.com/revanced/multidexlib2.git
synced 2025-04-29 22:24:28 +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"?>
|
||||
<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">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
|
@ -24,7 +24,7 @@ ext.mainArtifact = 'multidexlib2'
|
||||
ext.artifactName = mainArtifact
|
||||
|
||||
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')
|
||||
if (jdk_rt.exists()) compileJava.options.bootstrapClasspath = files(jdk_rt)
|
||||
|
||||
|
@ -28,7 +28,7 @@ public class DexFileNameComparator implements Comparator<String> {
|
||||
boolean rv = (ri >= 0);
|
||||
if (lv != rv) return lv ? -1 : 1;
|
||||
if (!lv) return l.compareTo(r);
|
||||
return li < ri ? -1 : (li > ri ? 1 : 0);
|
||||
return Integer.compare(li, ri);
|
||||
}
|
||||
|
||||
public DexFileNamer getNamer() {
|
||||
|
@ -74,6 +74,7 @@ public class DexIO {
|
||||
minimalMainDex = false;
|
||||
}
|
||||
Object lock = new Object();
|
||||
//noinspection SynchronizationOnLocalVariableOrMethodParameter
|
||||
synchronized (lock) { // avoid multiple synchronizations in single-threaded mode
|
||||
writeMultiDexDirectoryCommon(directory, nameIterator, Iterators.peekingIterator(classes.iterator()),
|
||||
minMainDexClassCount, minimalMainDex, dexFile.getOpcodes(), maxDexPoolSize, logger, lock);
|
||||
@ -94,6 +95,7 @@ public class DexIO {
|
||||
final BatchedIterator<ClassDef> batchedIterator =
|
||||
new BatchedIterator<>(classIterator, lock, PER_THREAD_BATCH_SIZE);
|
||||
if (i != 0 && !batchedIterator.hasNext()) break;
|
||||
//noinspection Convert2Lambda
|
||||
callables.add(new Callable<Void>() {
|
||||
@Override
|
||||
public Void call() throws IOException {
|
||||
@ -148,11 +150,14 @@ public class DexIO {
|
||||
fileClassCount++;
|
||||
}
|
||||
File file;
|
||||
//noinspection SynchronizationOnLocalVariableOrMethodParameter
|
||||
synchronized (lock) {
|
||||
String name = nameIterator.next();
|
||||
file = new File(directory, name);
|
||||
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));
|
||||
minMainDexClassCount = 0;
|
||||
|
@ -30,6 +30,7 @@ public class MultiDexContainerBackedDexFile<T extends DexFile> implements DexFil
|
||||
List<String> entryNames = container.getDexEntryNames();
|
||||
if (entryNames.size() == 1) {
|
||||
String entryName = entryNames.get(0);
|
||||
//noinspection ConstantConditions
|
||||
T entryDex = container.getEntry(entryName).getDexFile();
|
||||
classes = Collections.unmodifiableSet(entryDex.getClasses());
|
||||
opcodes = entryDex.getOpcodes();
|
||||
@ -37,6 +38,7 @@ public class MultiDexContainerBackedDexFile<T extends DexFile> implements DexFil
|
||||
LinkedHashSet<ClassDef> accumulatedClasses = new LinkedHashSet<>();
|
||||
Opcodes resolvedOpcodes = null;
|
||||
for (String entryName : entryNames) {
|
||||
//noinspection ConstantConditions
|
||||
T entryDex = container.getEntry(entryName).getDexFile();
|
||||
for (ClassDef entryClass : entryDex.getClasses()) {
|
||||
if (!accumulatedClasses.add(entryClass)) throw new DuplicateTypeException(entryClass.getType());
|
||||
|
@ -48,6 +48,7 @@ public class MultiDexIO {
|
||||
MultiDexContainer<DexBackedDexFile> container = readMultiDexContainer(file, namer, opcodes);
|
||||
if (logger != null) {
|
||||
for (String name : container.getDexEntryNames()) {
|
||||
//noinspection ConstantConditions
|
||||
logger.log(file, name, container.getEntry(name).getDexFile().getClasses().size());
|
||||
}
|
||||
}
|
||||
|
@ -43,6 +43,7 @@ public class RawDexIO {
|
||||
return readRawDexFile(inputStream, file.length(), opcodes);
|
||||
}
|
||||
*/
|
||||
//noinspection UnstableApiUsage
|
||||
byte[] buf = Files.toByteArray(file);
|
||||
return readRawDexFile(buf, 0, opcodes);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user