Enable most remaining error prone checks
Bug: b/296992810
Bug: b/297175621
Change-Id: I0ecc004f4c6dee8dd7f94db1a111da11ef728747
diff --git a/build.gradle b/build.gradle
index 58bb94a..6c28944 100644
--- a/build.gradle
+++ b/build.gradle
@@ -623,7 +623,7 @@
!org.gradle.internal.jvm.Jvm.current().javaVersion.java8) {
compileJava {
- // Enable error prone for D8/R8 main sources
+ // Enable error prone for D8/R8 main sources.
options.errorprone.enabled = true
// Make all warnings errors. Warnings that we have chosen not to fix (or suppress) are
@@ -635,52 +635,12 @@
options.compilerArgs << "1000"
// Non-default / Experimental checks - explicitly enforced.
- options.errorprone.check('ReferenceEquality', CheckSeverity.ERROR)
options.errorprone.check('RemoveUnusedImports', CheckSeverity.ERROR)
options.errorprone.check('InconsistentOverloads', CheckSeverity.ERROR)
options.errorprone.check('MissingDefault', CheckSeverity.ERROR)
options.errorprone.check('MultipleTopLevelClasses', CheckSeverity.ERROR)
options.errorprone.check('NarrowingCompoundAssignment', CheckSeverity.ERROR)
- // TODO(b/270510095): These should likely be fixed/suppressed and become hard failures.
- options.errorprone.check('UnusedVariable', CheckSeverity.OFF)
- options.errorprone.check('EqualsUnsafeCast', CheckSeverity.OFF)
- options.errorprone.check('TypeParameterUnusedInFormals', CheckSeverity.OFF)
- options.errorprone.check('ImmutableEnumChecker', CheckSeverity.OFF)
- options.errorprone.check('BadImport', CheckSeverity.OFF)
- options.errorprone.check('ComplexBooleanConstant', CheckSeverity.OFF)
- options.errorprone.check('StreamToIterable', CheckSeverity.OFF)
- options.errorprone.check('HidingField', CheckSeverity.OFF)
- options.errorprone.check('StreamResourceLeak', CheckSeverity.OFF)
- options.errorprone.check('CatchAndPrintStackTrace', CheckSeverity.OFF)
- options.errorprone.check('NonCanonicalType', CheckSeverity.OFF)
- options.errorprone.check('UnusedNestedClass', CheckSeverity.OFF)
- options.errorprone.check('AmbiguousMethodReference', CheckSeverity.OFF)
- options.errorprone.check('InvalidParam', CheckSeverity.OFF)
- options.errorprone.check('CharacterGetNumericValue', CheckSeverity.OFF)
- options.errorprone.check('ModifyCollectionInEnhancedForLoop', CheckSeverity.OFF)
- options.errorprone.check('EmptyCatch', CheckSeverity.OFF)
- options.errorprone.check('ArgumentSelectionDefectChecker', CheckSeverity.OFF)
- options.errorprone.check('ImmutableAnnotationChecker', CheckSeverity.OFF)
- options.errorprone.check('ObjectToString', CheckSeverity.OFF)
- options.errorprone.check('DoNotClaimAnnotations', CheckSeverity.OFF)
- options.errorprone.check('AnnotateFormatMethod', CheckSeverity.OFF)
-
- // TODO(b/270537614): Remove finalize uses.
- options.errorprone.check('Finalize', CheckSeverity.OFF)
-
- // The following warnings could/should be active but are hit by R8 now so silence them.
- options.errorprone.check('EqualsGetClass', CheckSeverity.OFF)
- options.errorprone.check('MixedMutabilityReturnType', CheckSeverity.OFF)
- options.errorprone.check('UnnecessaryParentheses', CheckSeverity.OFF)
- options.errorprone.check('DoNotCallSuggester', CheckSeverity.OFF)
- options.errorprone.check('InlineMeSuggester', CheckSeverity.OFF)
- options.errorprone.check('MutablePublicArray', CheckSeverity.OFF)
- options.errorprone.check('DefaultCharset', CheckSeverity.OFF)
- options.errorprone.check('InconsistentCapitalization', CheckSeverity.OFF)
- options.errorprone.check('InlineFormatString', CheckSeverity.OFF)
- options.errorprone.check('MissingImplementsComparable', CheckSeverity.OFF)
-
// Warnings that cause unwanted edits (e.g., inability to write informative asserts).
options.errorprone.check('AlreadyChecked', CheckSeverity.OFF)
diff --git a/d8_r8/main/build.gradle.kts b/d8_r8/main/build.gradle.kts
index e37f0e4..e75c8e6 100644
--- a/d8_r8/main/build.gradle.kts
+++ b/d8_r8/main/build.gradle.kts
@@ -178,51 +178,12 @@
options.compilerArgs.add("1000")
// Non-default / Experimental checks - explicitly enforced.
- options.errorprone.error("ReferenceEquality")
options.errorprone.error("RemoveUnusedImports")
options.errorprone.error("InconsistentOverloads")
options.errorprone.error("MissingDefault")
options.errorprone.error("MultipleTopLevelClasses")
options.errorprone.error("NarrowingCompoundAssignment")
- // TODO(b/270510095): These should likely be fixed/suppressed and become hard failures.
- options.errorprone.disable("UnusedVariable")
- options.errorprone.disable("EqualsUnsafeCast")
- options.errorprone.disable("TypeParameterUnusedInFormals")
- options.errorprone.disable("ImmutableEnumChecker")
- options.errorprone.disable("BadImport")
- options.errorprone.disable("ComplexBooleanConstant")
- options.errorprone.disable("HidingField")
- options.errorprone.disable("StreamResourceLeak")
- options.errorprone.disable("CatchAndPrintStackTrace")
- options.errorprone.disable("NonCanonicalType")
- options.errorprone.disable("UnusedNestedClass")
- options.errorprone.disable("AmbiguousMethodReference")
- options.errorprone.disable("InvalidParam")
- options.errorprone.disable("CharacterGetNumericValue")
- options.errorprone.disable("ModifyCollectionInEnhancedForLoop")
- options.errorprone.disable("EmptyCatch")
- options.errorprone.disable("ArgumentSelectionDefectChecker")
- options.errorprone.disable("ImmutableAnnotationChecker")
- options.errorprone.disable("ObjectToString")
- options.errorprone.disable("DoNotClaimAnnotations")
- options.errorprone.disable("AnnotateFormatMethod")
-
- // TODO(b/270537614): Remove finalize uses.
- options.errorprone.disable("Finalize")
-
- // The following warnings could/should be active but are hit by R8 now so silence them.
- options.errorprone.disable("EqualsGetClass")
- options.errorprone.disable("MixedMutabilityReturnType")
- options.errorprone.disable("UnnecessaryParentheses")
- options.errorprone.disable("DoNotCallSuggester")
- options.errorprone.disable("InlineMeSuggester")
- options.errorprone.disable("MutablePublicArray")
- options.errorprone.disable("DefaultCharset")
- options.errorprone.disable("InconsistentCapitalization")
- options.errorprone.disable("InlineFormatString")
- options.errorprone.disable("MissingImplementsComparable")
-
// Warnings that cause unwanted edits (e.g., inability to write informative asserts).
options.errorprone.disable("AlreadyChecked")
diff --git a/src/keepanno/java/com/android/tools/r8/keepanno/asm/KeepEdgeReader.java b/src/keepanno/java/com/android/tools/r8/keepanno/asm/KeepEdgeReader.java
index ad6caa7..5f7f156 100644
--- a/src/keepanno/java/com/android/tools/r8/keepanno/asm/KeepEdgeReader.java
+++ b/src/keepanno/java/com/android/tools/r8/keepanno/asm/KeepEdgeReader.java
@@ -1899,6 +1899,7 @@
private static class MethodAccessVisitor extends MemberAccessVisitor {
+ @SuppressWarnings("HidingField")
KeepMethodAccessPattern.Builder builder;
public MethodAccessVisitor(
@@ -1945,6 +1946,7 @@
private static class FieldAccessVisitor extends MemberAccessVisitor {
+ @SuppressWarnings("HidingField")
KeepFieldAccessPattern.Builder builder;
public FieldAccessVisitor(
diff --git a/src/keepanno/java/com/android/tools/r8/keepanno/ast/AnnotationConstants.java b/src/keepanno/java/com/android/tools/r8/keepanno/ast/AnnotationConstants.java
index a8c7383..f6c6a74 100644
--- a/src/keepanno/java/com/android/tools/r8/keepanno/ast/AnnotationConstants.java
+++ b/src/keepanno/java/com/android/tools/r8/keepanno/ast/AnnotationConstants.java
@@ -97,7 +97,10 @@
public static final class CheckOptimizedOut {
public static final Class<com.android.tools.r8.keepanno.annotations.CheckOptimizedOut> CLASS =
com.android.tools.r8.keepanno.annotations.CheckOptimizedOut.class;
+
+ @SuppressWarnings("MutablePublicArray")
public static final String DESCRIPTOR = getDescriptor(CLASS);
+
public static final String description = "description";
}
@@ -134,6 +137,8 @@
public static final String methodNameDefaultValue = "";
public static final String methodReturnTypeDefaultValue = "";
+
+ @SuppressWarnings("MutablePublicArray")
public static final String[] methodParametersDefaultValue = new String[] {""};
public static final String fieldNameDefaultValue = "";
diff --git a/src/keepanno/java/com/android/tools/r8/keepanno/ast/KeepClassReference.java b/src/keepanno/java/com/android/tools/r8/keepanno/ast/KeepClassReference.java
index 250152a..4f0f3f3 100644
--- a/src/keepanno/java/com/android/tools/r8/keepanno/ast/KeepClassReference.java
+++ b/src/keepanno/java/com/android/tools/r8/keepanno/ast/KeepClassReference.java
@@ -62,6 +62,7 @@
}
@Override
+ @SuppressWarnings("EqualsGetClass")
public boolean equals(Object o) {
if (this == o) {
return true;
@@ -103,6 +104,7 @@
}
@Override
+ @SuppressWarnings("EqualsGetClass")
public boolean equals(Object o) {
if (this == o) {
return true;
diff --git a/src/keepanno/java/com/android/tools/r8/keepanno/ast/KeepEdgeMetaInfo.java b/src/keepanno/java/com/android/tools/r8/keepanno/ast/KeepEdgeMetaInfo.java
index 662ad4c..75094be 100644
--- a/src/keepanno/java/com/android/tools/r8/keepanno/ast/KeepEdgeMetaInfo.java
+++ b/src/keepanno/java/com/android/tools/r8/keepanno/ast/KeepEdgeMetaInfo.java
@@ -115,6 +115,7 @@
}
@Override
+ @SuppressWarnings("EqualsGetClass")
public boolean equals(Object o) {
if (this == o) {
return true;
@@ -153,6 +154,7 @@
}
@Override
+ @SuppressWarnings("EqualsGetClass")
public boolean equals(Object o) {
if (this == o) {
return true;
@@ -189,6 +191,7 @@
}
@Override
+ @SuppressWarnings("EqualsGetClass")
public boolean equals(Object o) {
if (this == o) {
return true;
@@ -223,6 +226,7 @@
}
@Override
+ @SuppressWarnings("EqualsGetClass")
public boolean equals(Object o) {
if (this == o) {
return true;
diff --git a/src/keepanno/java/com/android/tools/r8/keepanno/ast/KeepExtendsPattern.java b/src/keepanno/java/com/android/tools/r8/keepanno/ast/KeepExtendsPattern.java
index ea30422..c6b3db3 100644
--- a/src/keepanno/java/com/android/tools/r8/keepanno/ast/KeepExtendsPattern.java
+++ b/src/keepanno/java/com/android/tools/r8/keepanno/ast/KeepExtendsPattern.java
@@ -53,6 +53,7 @@
}
@Override
+ @SuppressWarnings("EqualsGetClass")
public boolean equals(Object o) {
if (this == o) {
return true;
diff --git a/src/keepanno/java/com/android/tools/r8/keepanno/ast/KeepFieldNamePattern.java b/src/keepanno/java/com/android/tools/r8/keepanno/ast/KeepFieldNamePattern.java
index 3067966..0945764 100644
--- a/src/keepanno/java/com/android/tools/r8/keepanno/ast/KeepFieldNamePattern.java
+++ b/src/keepanno/java/com/android/tools/r8/keepanno/ast/KeepFieldNamePattern.java
@@ -73,6 +73,7 @@
}
@Override
+ @SuppressWarnings("EqualsGetClass")
public boolean equals(Object o) {
if (this == o) {
return true;
diff --git a/src/keepanno/java/com/android/tools/r8/keepanno/ast/KeepFieldTypePattern.java b/src/keepanno/java/com/android/tools/r8/keepanno/ast/KeepFieldTypePattern.java
index 3965699..478a938 100644
--- a/src/keepanno/java/com/android/tools/r8/keepanno/ast/KeepFieldTypePattern.java
+++ b/src/keepanno/java/com/android/tools/r8/keepanno/ast/KeepFieldTypePattern.java
@@ -42,6 +42,7 @@
}
@Override
+ @SuppressWarnings("EqualsGetClass")
public boolean equals(Object o) {
if (this == o) {
return true;
diff --git a/src/keepanno/java/com/android/tools/r8/keepanno/ast/KeepItemPattern.java b/src/keepanno/java/com/android/tools/r8/keepanno/ast/KeepItemPattern.java
index 06541d8..d81dde9 100644
--- a/src/keepanno/java/com/android/tools/r8/keepanno/ast/KeepItemPattern.java
+++ b/src/keepanno/java/com/android/tools/r8/keepanno/ast/KeepItemPattern.java
@@ -157,6 +157,7 @@
}
@Override
+ @SuppressWarnings("EqualsGetClass")
public boolean equals(Object obj) {
if (this == obj) {
return true;
diff --git a/src/keepanno/java/com/android/tools/r8/keepanno/ast/KeepItemReference.java b/src/keepanno/java/com/android/tools/r8/keepanno/ast/KeepItemReference.java
index 660ef07..21bb63c 100644
--- a/src/keepanno/java/com/android/tools/r8/keepanno/ast/KeepItemReference.java
+++ b/src/keepanno/java/com/android/tools/r8/keepanno/ast/KeepItemReference.java
@@ -52,6 +52,7 @@
}
@Override
+ @SuppressWarnings("EqualsGetClass")
public boolean equals(Object o) {
if (this == o) {
return true;
@@ -93,6 +94,7 @@
}
@Override
+ @SuppressWarnings("EqualsGetClass")
public boolean equals(Object o) {
if (this == o) {
return true;
diff --git a/src/keepanno/java/com/android/tools/r8/keepanno/ast/KeepMemberPattern.java b/src/keepanno/java/com/android/tools/r8/keepanno/ast/KeepMemberPattern.java
index 941a325..05c54e5 100644
--- a/src/keepanno/java/com/android/tools/r8/keepanno/ast/KeepMemberPattern.java
+++ b/src/keepanno/java/com/android/tools/r8/keepanno/ast/KeepMemberPattern.java
@@ -46,6 +46,7 @@
}
@Override
+ @SuppressWarnings("EqualsGetClass")
public boolean equals(Object o) {
if (this == o) {
return true;
diff --git a/src/keepanno/java/com/android/tools/r8/keepanno/ast/KeepMethodNamePattern.java b/src/keepanno/java/com/android/tools/r8/keepanno/ast/KeepMethodNamePattern.java
index 8203d56..18a399a 100644
--- a/src/keepanno/java/com/android/tools/r8/keepanno/ast/KeepMethodNamePattern.java
+++ b/src/keepanno/java/com/android/tools/r8/keepanno/ast/KeepMethodNamePattern.java
@@ -78,6 +78,7 @@
}
@Override
+ @SuppressWarnings("EqualsGetClass")
public boolean equals(Object o) {
if (this == o) {
return true;
diff --git a/src/keepanno/java/com/android/tools/r8/keepanno/ast/KeepMethodParametersPattern.java b/src/keepanno/java/com/android/tools/r8/keepanno/ast/KeepMethodParametersPattern.java
index 73f8669..c67fd9a 100644
--- a/src/keepanno/java/com/android/tools/r8/keepanno/ast/KeepMethodParametersPattern.java
+++ b/src/keepanno/java/com/android/tools/r8/keepanno/ast/KeepMethodParametersPattern.java
@@ -71,6 +71,7 @@
}
@Override
+ @SuppressWarnings("EqualsGetClass")
public boolean equals(Object o) {
if (this == o) {
return true;
diff --git a/src/keepanno/java/com/android/tools/r8/keepanno/ast/KeepMethodReturnTypePattern.java b/src/keepanno/java/com/android/tools/r8/keepanno/ast/KeepMethodReturnTypePattern.java
index 807b1bc..bd8d66f 100644
--- a/src/keepanno/java/com/android/tools/r8/keepanno/ast/KeepMethodReturnTypePattern.java
+++ b/src/keepanno/java/com/android/tools/r8/keepanno/ast/KeepMethodReturnTypePattern.java
@@ -79,6 +79,7 @@
}
@Override
+ @SuppressWarnings("EqualsGetClass")
public boolean equals(Object o) {
if (this == o) {
return true;
diff --git a/src/keepanno/java/com/android/tools/r8/keepanno/ast/KeepPackagePattern.java b/src/keepanno/java/com/android/tools/r8/keepanno/ast/KeepPackagePattern.java
index 6042930..69fc5b4 100644
--- a/src/keepanno/java/com/android/tools/r8/keepanno/ast/KeepPackagePattern.java
+++ b/src/keepanno/java/com/android/tools/r8/keepanno/ast/KeepPackagePattern.java
@@ -148,6 +148,7 @@
}
@Override
+ @SuppressWarnings("EqualsGetClass")
public boolean equals(Object o) {
if (this == o) {
return true;
diff --git a/src/keepanno/java/com/android/tools/r8/keepanno/ast/KeepPreconditions.java b/src/keepanno/java/com/android/tools/r8/keepanno/ast/KeepPreconditions.java
index dfba9f6..246b20c 100644
--- a/src/keepanno/java/com/android/tools/r8/keepanno/ast/KeepPreconditions.java
+++ b/src/keepanno/java/com/android/tools/r8/keepanno/ast/KeepPreconditions.java
@@ -94,6 +94,7 @@
}
@Override
+ @SuppressWarnings("EqualsGetClass")
public boolean equals(Object o) {
if (this == o) {
return true;
diff --git a/src/keepanno/java/com/android/tools/r8/keepanno/ast/KeepTarget.java b/src/keepanno/java/com/android/tools/r8/keepanno/ast/KeepTarget.java
index 30af390..4d450a2 100644
--- a/src/keepanno/java/com/android/tools/r8/keepanno/ast/KeepTarget.java
+++ b/src/keepanno/java/com/android/tools/r8/keepanno/ast/KeepTarget.java
@@ -59,6 +59,7 @@
}
@Override
+ @SuppressWarnings("EqualsGetClass")
public boolean equals(Object o) {
if (this == o) {
return true;
diff --git a/src/keepanno/java/com/android/tools/r8/keepanno/ast/KeepTypePattern.java b/src/keepanno/java/com/android/tools/r8/keepanno/ast/KeepTypePattern.java
index 872ad07..dd56be4 100644
--- a/src/keepanno/java/com/android/tools/r8/keepanno/ast/KeepTypePattern.java
+++ b/src/keepanno/java/com/android/tools/r8/keepanno/ast/KeepTypePattern.java
@@ -36,6 +36,7 @@
}
@Override
+ @SuppressWarnings("EqualsGetClass")
public boolean equals(Object o) {
if (this == o) {
return true;
diff --git a/src/keepanno/java/com/android/tools/r8/keepanno/ast/KeepUnqualfiedClassNamePattern.java b/src/keepanno/java/com/android/tools/r8/keepanno/ast/KeepUnqualfiedClassNamePattern.java
index f1fbd28..4139f57 100644
--- a/src/keepanno/java/com/android/tools/r8/keepanno/ast/KeepUnqualfiedClassNamePattern.java
+++ b/src/keepanno/java/com/android/tools/r8/keepanno/ast/KeepUnqualfiedClassNamePattern.java
@@ -104,6 +104,7 @@
}
@Override
+ @SuppressWarnings("EqualsGetClass")
public boolean equals(Object o) {
if (this == o) {
return true;
diff --git a/src/keepanno/java/com/android/tools/r8/keepanno/keeprules/KeepRuleExtractor.java b/src/keepanno/java/com/android/tools/r8/keepanno/keeprules/KeepRuleExtractor.java
index aaafed3..3dffb77 100644
--- a/src/keepanno/java/com/android/tools/r8/keepanno/keeprules/KeepRuleExtractor.java
+++ b/src/keepanno/java/com/android/tools/r8/keepanno/keeprules/KeepRuleExtractor.java
@@ -179,6 +179,7 @@
}
}
+ @SuppressWarnings("UnnecessaryParentheses")
private static List<PgRule> doSplit(KeepEdge edge) {
List<PgRule> rules = new ArrayList<>();
diff --git a/src/keepanno/java/com/android/tools/r8/keepanno/processor/KeepEdgeProcessor.java b/src/keepanno/java/com/android/tools/r8/keepanno/processor/KeepEdgeProcessor.java
index 72b36ed..1b8d1a6 100644
--- a/src/keepanno/java/com/android/tools/r8/keepanno/processor/KeepEdgeProcessor.java
+++ b/src/keepanno/java/com/android/tools/r8/keepanno/processor/KeepEdgeProcessor.java
@@ -61,11 +61,12 @@
}
@Override
+ @SuppressWarnings("DoNotClaimAnnotations")
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
Map<String, List<KeepEdge>> collectedEdges = new HashMap<>();
for (TypeElement annotation : annotations) {
for (Element element : roundEnv.getElementsAnnotatedWith(annotation)) {
- KeepEdge edge = processKeepEdge(element, roundEnv);
+ KeepEdge edge = processKeepEdge(element);
if (edge != null) {
TypeElement enclosingType = getEnclosingTypeElement(element);
String enclosingTypeName = enclosingType.getQualifiedName().toString();
@@ -106,7 +107,8 @@
return classWriter.toByteArray();
}
- private KeepEdge processKeepEdge(Element element, RoundEnvironment roundEnv) {
+ @SuppressWarnings("BadImport")
+ private KeepEdge processKeepEdge(Element element) {
AnnotationMirror mirror = getAnnotationMirror(element, AnnotationConstants.Edge.CLASS);
if (mirror == null) {
return null;
@@ -117,6 +119,7 @@
return edgeBuilder.build();
}
+ @SuppressWarnings("BadImport")
private void processPreconditions(Builder edgeBuilder, AnnotationMirror mirror) {
AnnotationValue preconditions = getAnnotationValue(mirror, Edge.preconditions);
if (preconditions == null) {
@@ -133,6 +136,7 @@
edgeBuilder.setPreconditions(preconditionsBuilder.build());
}
+ @SuppressWarnings("BadImport")
private void processConsequences(Builder edgeBuilder, AnnotationMirror mirror) {
AnnotationValue consequences = getAnnotationValue(mirror, Edge.consequences);
if (consequences == null) {
diff --git a/src/main/java/com/android/tools/r8/AssertionsConfiguration.java b/src/main/java/com/android/tools/r8/AssertionsConfiguration.java
index ae04fde..07513c9 100644
--- a/src/main/java/com/android/tools/r8/AssertionsConfiguration.java
+++ b/src/main/java/com/android/tools/r8/AssertionsConfiguration.java
@@ -175,6 +175,7 @@
}
/** Build and return the {@link AssertionsConfiguration}. */
+ @SuppressWarnings("InlineMeSuggester")
public AssertionsConfiguration build() {
if (transformation == null && assertionHandler == null) {
reporter.error(
@@ -222,6 +223,7 @@
* @deprecated As of version 3.3, replaced by {@link #compileTimeEnableAllAssertions(Builder)}
*/
@Deprecated
+ @SuppressWarnings("InlineMeSuggester")
public static AssertionsConfiguration enableAllAssertions(
AssertionsConfiguration.Builder builder) {
return compileTimeEnableAllAssertions(builder);
diff --git a/src/main/java/com/android/tools/r8/BaseCompilerCommand.java b/src/main/java/com/android/tools/r8/BaseCompilerCommand.java
index d96e654..650ff31 100644
--- a/src/main/java/com/android/tools/r8/BaseCompilerCommand.java
+++ b/src/main/java/com/android/tools/r8/BaseCompilerCommand.java
@@ -642,6 +642,7 @@
}
@Deprecated
+ @SuppressWarnings("InlineMeSuggester")
public B addSpecialLibraryConfiguration(String configuration) {
return addDesugaredLibraryConfiguration(configuration);
}
diff --git a/src/main/java/com/android/tools/r8/DataEntryResource.java b/src/main/java/com/android/tools/r8/DataEntryResource.java
index e20e5b2..855b7a1 100644
--- a/src/main/java/com/android/tools/r8/DataEntryResource.java
+++ b/src/main/java/com/android/tools/r8/DataEntryResource.java
@@ -22,10 +22,12 @@
/** Get the bytes of the data entry resource. */
InputStream getByteStream() throws ResourceException;
+ @SuppressWarnings("DefaultCharset")
static DataEntryResource fromBytes(byte[] bytes, String name, Origin origin) {
return new ByteDataEntryResource(bytes, name, origin);
}
+ @SuppressWarnings("DefaultCharset")
static DataEntryResource fromString(String name, Origin origin, String... lines) {
StringBuilder sb = new StringBuilder();
for (String line : lines) {
diff --git a/src/main/java/com/android/tools/r8/FeatureSplit.java b/src/main/java/com/android/tools/r8/FeatureSplit.java
index 43e553c..08f54e6 100644
--- a/src/main/java/com/android/tools/r8/FeatureSplit.java
+++ b/src/main/java/com/android/tools/r8/FeatureSplit.java
@@ -89,6 +89,8 @@
public static class Builder {
private ProgramConsumer programConsumer;
private final List<ProgramResourceProvider> programResourceProviders = new ArrayList<>();
+
+ @SuppressWarnings("UnusedVariable")
private final DiagnosticsHandler handler;
private Builder(DiagnosticsHandler handler) {
diff --git a/src/main/java/com/android/tools/r8/JdkClassFileProvider.java b/src/main/java/com/android/tools/r8/JdkClassFileProvider.java
index 9fcbd00..bd40b44 100644
--- a/src/main/java/com/android/tools/r8/JdkClassFileProvider.java
+++ b/src/main/java/com/android/tools/r8/JdkClassFileProvider.java
@@ -118,6 +118,7 @@
collectDescriptors(jrtFs);
}
+ @SuppressWarnings("StreamResourceLeak")
private void collectDescriptors(FileSystem jrtFs) throws IOException {
this.jrtFs = jrtFs;
Files.walk(jrtFs.getPath("/modules"))
@@ -159,6 +160,7 @@
}
@Override
+ @SuppressWarnings("Finalize")
protected void finalize() throws Throwable {
close();
super.finalize();
diff --git a/src/main/java/com/android/tools/r8/ParseFlagInfoImpl.java b/src/main/java/com/android/tools/r8/ParseFlagInfoImpl.java
index 91da498..2ecb303 100644
--- a/src/main/java/com/android/tools/r8/ParseFlagInfoImpl.java
+++ b/src/main/java/com/android/tools/r8/ParseFlagInfoImpl.java
@@ -202,6 +202,7 @@
return builder.toString();
}
+ @SuppressWarnings("UnusedVariable")
public static ParseFlagInfoImpl flag(String flag, List<String> args, List<String> help) {
return new ParseFlagInfoImpl(flag, fmt(flag, args), Collections.emptyList(), help);
}
@@ -213,7 +214,9 @@
// Note that the raw flag may be non-representable as in the case of the family of flags for
// assertions.
+ @SuppressWarnings("UnusedVariable")
private final String rawFlag;
+
private final String flagWithArgs;
private final List<String> alternatives;
private final List<String> flagHelp;
diff --git a/src/main/java/com/android/tools/r8/PrintClassList.java b/src/main/java/com/android/tools/r8/PrintClassList.java
index c23636c..5d7956c 100644
--- a/src/main/java/com/android/tools/r8/PrintClassList.java
+++ b/src/main/java/com/android/tools/r8/PrintClassList.java
@@ -29,6 +29,7 @@
public class PrintClassList {
+ @SuppressWarnings("BadImport")
public static void main(String[] args) throws IOException {
List<String> dexFiles = Arrays.asList(args);
Builder builder = AndroidApp.builder();
diff --git a/src/main/java/com/android/tools/r8/R8.java b/src/main/java/com/android/tools/r8/R8.java
index df434f9..d8a8834 100644
--- a/src/main/java/com/android/tools/r8/R8.java
+++ b/src/main/java/com/android/tools/r8/R8.java
@@ -244,6 +244,7 @@
return appView.appInfo().app().asDirect();
}
+ @SuppressWarnings("DefaultCharset")
private void run(AndroidApp inputApp, ExecutorService executorService) throws IOException {
assert options.programConsumer != null;
if (options.quiet) {
@@ -969,7 +970,7 @@
return true;
}
- @SuppressWarnings("ReferenceEquality")
+ @SuppressWarnings({"ComplexBooleanConstant", "ReferenceEquality"})
private static boolean verifyOriginalMethodInPosition(
Code code, DexMethod originalMethod, ProgramMethod context) {
code.forEachPosition(
diff --git a/src/main/java/com/android/tools/r8/cf/CfVerifierTool.java b/src/main/java/com/android/tools/r8/cf/CfVerifierTool.java
index 5b1d74f..408cded 100644
--- a/src/main/java/com/android/tools/r8/cf/CfVerifierTool.java
+++ b/src/main/java/com/android/tools/r8/cf/CfVerifierTool.java
@@ -20,6 +20,7 @@
/** Tool to verify various aspects of class file inputs. */
public class CfVerifierTool {
+ @SuppressWarnings("BadImport")
public static void main(String[] args) throws IOException {
Builder builder = AndroidApp.builder();
for (String arg : args) {
diff --git a/src/main/java/com/android/tools/r8/cf/code/CfFrame.java b/src/main/java/com/android/tools/r8/cf/code/CfFrame.java
index ed3970c..6813ed1 100644
--- a/src/main/java/com/android/tools/r8/cf/code/CfFrame.java
+++ b/src/main/java/com/android/tools/r8/cf/code/CfFrame.java
@@ -154,6 +154,7 @@
}
@Override
+ @SuppressWarnings("EqualsGetClass")
public boolean equals(Object obj) {
if (this == obj) {
return true;
diff --git a/src/main/java/com/android/tools/r8/cf/code/CfFrameVerifier.java b/src/main/java/com/android/tools/r8/cf/code/CfFrameVerifier.java
index 110e7ca..f16d699 100644
--- a/src/main/java/com/android/tools/r8/cf/code/CfFrameVerifier.java
+++ b/src/main/java/com/android/tools/r8/cf/code/CfFrameVerifier.java
@@ -306,6 +306,7 @@
: CfFrameState.error("No destination frame");
}
+ @SuppressWarnings("UnusedVariable")
private TraversalContinuation<CfCodeDiagnostics, CfFrameState> computeInitialState() {
DexItemFactory dexItemFactory = appView.dexItemFactory();
CfFrameState state = new ConcreteCfFrameState();
diff --git a/src/main/java/com/android/tools/r8/cf/code/frame/InitializedNonNullReferenceFrameTypeWithInterfaces.java b/src/main/java/com/android/tools/r8/cf/code/frame/InitializedNonNullReferenceFrameTypeWithInterfaces.java
index 25e8a13..c92d003 100644
--- a/src/main/java/com/android/tools/r8/cf/code/frame/InitializedNonNullReferenceFrameTypeWithInterfaces.java
+++ b/src/main/java/com/android/tools/r8/cf/code/frame/InitializedNonNullReferenceFrameTypeWithInterfaces.java
@@ -81,6 +81,7 @@
}
@Override
+ @SuppressWarnings("EqualsGetClass")
public boolean equals(Object obj) {
if (this == obj) {
return true;
diff --git a/src/main/java/com/android/tools/r8/cf/code/frame/InitializedNonNullReferenceFrameTypeWithoutInterfaces.java b/src/main/java/com/android/tools/r8/cf/code/frame/InitializedNonNullReferenceFrameTypeWithoutInterfaces.java
index 6dde359..a7475f8 100644
--- a/src/main/java/com/android/tools/r8/cf/code/frame/InitializedNonNullReferenceFrameTypeWithoutInterfaces.java
+++ b/src/main/java/com/android/tools/r8/cf/code/frame/InitializedNonNullReferenceFrameTypeWithoutInterfaces.java
@@ -94,7 +94,7 @@
}
@Override
- @SuppressWarnings("ReferenceEquality")
+ @SuppressWarnings({"EqualsGetClass", "ReferenceEquality"})
public boolean equals(Object obj) {
if (this == obj) {
return true;
diff --git a/src/main/java/com/android/tools/r8/cf/code/frame/UninitializedNew.java b/src/main/java/com/android/tools/r8/cf/code/frame/UninitializedNew.java
index d41a82d..eadec8a 100644
--- a/src/main/java/com/android/tools/r8/cf/code/frame/UninitializedNew.java
+++ b/src/main/java/com/android/tools/r8/cf/code/frame/UninitializedNew.java
@@ -61,7 +61,7 @@
}
@Override
- @SuppressWarnings("ReferenceEquality")
+ @SuppressWarnings({"EqualsGetClass", "ReferenceEquality"})
public boolean equals(Object o) {
if (this == o) {
return true;
diff --git a/src/main/java/com/android/tools/r8/compatproguard/CompatProguard.java b/src/main/java/com/android/tools/r8/compatproguard/CompatProguard.java
index 701d275..e49137e 100644
--- a/src/main/java/com/android/tools/r8/compatproguard/CompatProguard.java
+++ b/src/main/java/com/android/tools/r8/compatproguard/CompatProguard.java
@@ -85,6 +85,7 @@
}
public static CompatProguardOptions parse(String[] args) {
+ @SuppressWarnings("UnusedVariable")
DiagnosticsHandler handler = new DiagnosticsHandler() {};
String output = null;
CompilationMode mode = null;
@@ -99,10 +100,6 @@
String depsFileOutput = null;
// Flags to disable experimental features.
boolean disableVerticalClassMerging = false;
- // These flags are currently ignored.
- boolean minimalMainDex = false;
- boolean coreLibrary = false;
- boolean noLocals = false;
ImmutableList.Builder<String> builder = ImmutableList.builder();
if (args.length > 0) {
@@ -144,12 +141,10 @@
depsFileOutput = args[++i];
} else if (arg.equals("--no-vertical-class-merging")) {
disableVerticalClassMerging = true;
- } else if (arg.equals("--minimal-main-dex")) {
- minimalMainDex = true;
- } else if (arg.equals("--core-library")) {
- coreLibrary = true;
- } else if (arg.equals("--no-locals")) {
- noLocals = true;
+ } else if (arg.equals("--core-library")
+ || arg.equals("--minimal-main-dex")
+ || arg.equals("--no-locals")) {
+ // Ignore.
} else if (arg.equals("-outjars")) {
throw new CompilationError(
"Proguard argument -outjar is not supported. Use R8 compatible --output flag");
diff --git a/src/main/java/com/android/tools/r8/dex/ApplicationWriter.java b/src/main/java/com/android/tools/r8/dex/ApplicationWriter.java
index f6491b7..bd41479 100644
--- a/src/main/java/com/android/tools/r8/dex/ApplicationWriter.java
+++ b/src/main/java/com/android/tools/r8/dex/ApplicationWriter.java
@@ -633,6 +633,7 @@
byteBufferProvider.releaseByteBuffer(result.buffer.asByteBuffer());
}
+ @SuppressWarnings("DefaultCharset")
public static void supplyAdditionalConsumers(AppView<?> appView) {
InternalOptions options = appView.options();
Reporter reporter = options.reporter;
diff --git a/src/main/java/com/android/tools/r8/dex/ClassesChecksum.java b/src/main/java/com/android/tools/r8/dex/ClassesChecksum.java
index 3624975..3ce1c35 100644
--- a/src/main/java/com/android/tools/r8/dex/ClassesChecksum.java
+++ b/src/main/java/com/android/tools/r8/dex/ClassesChecksum.java
@@ -53,6 +53,7 @@
return "" + PREFIX_CHAR0 + PREFIX_CHAR1 + PREFIX_CHAR2 + sortedJson;
}
+ @SuppressWarnings("EmptyCatch")
// Try to parse the string as a marker and append its content if successful.
public void tryParseAndAppend(DexString dexString) {
if (dexString.size > 2
diff --git a/src/main/java/com/android/tools/r8/dex/Constants.java b/src/main/java/com/android/tools/r8/dex/Constants.java
index 9de8120..2b30ef2 100644
--- a/src/main/java/com/android/tools/r8/dex/Constants.java
+++ b/src/main/java/com/android/tools/r8/dex/Constants.java
@@ -7,10 +7,14 @@
public class Constants {
+ @SuppressWarnings("MutablePublicArray")
public static final byte[] DEX_FILE_MAGIC_PREFIX = {'d', 'e', 'x', '\n'};
+
public static final byte DEX_FILE_MAGIC_SUFFIX = '\0';
+ @SuppressWarnings("MutablePublicArray")
public static final byte[] VDEX_FILE_MAGIC_PREFIX = {'v', 'd', 'e', 'x'};
+
public static final int VDEX_FILE_VERSION_LENGTH = 4;
/** Supported vdex file versions */
diff --git a/src/main/java/com/android/tools/r8/dex/VDexParser.java b/src/main/java/com/android/tools/r8/dex/VDexParser.java
index c75667a..0bf814fc 100644
--- a/src/main/java/com/android/tools/r8/dex/VDexParser.java
+++ b/src/main/java/com/android/tools/r8/dex/VDexParser.java
@@ -33,6 +33,7 @@
return dexFiles;
}
+ @SuppressWarnings("UnusedVariable")
private void parseDexFiles() {
vDexReader.position(VDEX_NUMBER_OF_DEX_FILES_OFFSET);
int numberOfDexFiles = vDexReader.getUint();
diff --git a/src/main/java/com/android/tools/r8/dex/code/DexFormat11n.java b/src/main/java/com/android/tools/r8/dex/code/DexFormat11n.java
index d18c307..5796308 100644
--- a/src/main/java/com/android/tools/r8/dex/code/DexFormat11n.java
+++ b/src/main/java/com/android/tools/r8/dex/code/DexFormat11n.java
@@ -24,6 +24,7 @@
spec.withInt(i -> i.A).withInt(i -> i.B);
}
+ @SuppressWarnings("UnnecessaryParentheses")
// #+B | vA | op
/*package*/ DexFormat11n(int high, BytecodeStream stream) {
super(stream);
diff --git a/src/main/java/com/android/tools/r8/dump/DumpOptions.java b/src/main/java/com/android/tools/r8/dump/DumpOptions.java
index ae0ecd8..0bca3bd 100644
--- a/src/main/java/com/android/tools/r8/dump/DumpOptions.java
+++ b/src/main/java/com/android/tools/r8/dump/DumpOptions.java
@@ -88,7 +88,7 @@
Backend backend,
Tool tool,
CompilationMode compilationMode,
- int minAPI,
+ int minApi,
DesugaredLibrarySpecification desugaredLibrarySpecification,
boolean optimizeMultidexForLinearAlloc,
int threadCount,
@@ -111,7 +111,7 @@
this.backend = backend;
this.tool = tool;
this.compilationMode = compilationMode;
- this.minApi = minAPI;
+ this.minApi = minApi;
this.desugaredLibrarySpecification = desugaredLibrarySpecification;
this.optimizeMultidexForLinearAlloc = optimizeMultidexForLinearAlloc;
this.threadCount = threadCount;
@@ -387,8 +387,8 @@
return this;
}
- public Builder setMinApi(int minAPI) {
- this.minApi = minAPI;
+ public Builder setMinApi(int minApi) {
+ this.minApi = minApi;
return this;
}
diff --git a/src/main/java/com/android/tools/r8/errors/CheckDiscardDiagnostic.java b/src/main/java/com/android/tools/r8/errors/CheckDiscardDiagnostic.java
index 9e64b69..82ab8f4 100644
--- a/src/main/java/com/android/tools/r8/errors/CheckDiscardDiagnostic.java
+++ b/src/main/java/com/android/tools/r8/errors/CheckDiscardDiagnostic.java
@@ -23,6 +23,7 @@
public static class Builder {
private ImmutableList.Builder<String> messagesBuilder = ImmutableList.builder();
+ @SuppressWarnings("DefaultCharset")
public Builder addFailedItems(
List<ProgramDefinition> failed,
GraphReporter graphReporter,
diff --git a/src/main/java/com/android/tools/r8/graph/AppInfoWithClassHierarchy.java b/src/main/java/com/android/tools/r8/graph/AppInfoWithClassHierarchy.java
index 2ef7860..fcfb3cf 100644
--- a/src/main/java/com/android/tools/r8/graph/AppInfoWithClassHierarchy.java
+++ b/src/main/java/com/android/tools/r8/graph/AppInfoWithClassHierarchy.java
@@ -376,7 +376,7 @@
}
/** Collect all interfaces that this type directly or indirectly implements. */
- @SuppressWarnings("ReferenceEquality")
+ @SuppressWarnings({"BadImport", "ReferenceEquality"})
public InterfaceCollection implementedInterfaces(DexType type) {
assert type.isClassType();
DexClass clazz = definitionFor(type);
diff --git a/src/main/java/com/android/tools/r8/graph/AssemblyWriter.java b/src/main/java/com/android/tools/r8/graph/AssemblyWriter.java
index cd2ab6a..a3da4f7 100644
--- a/src/main/java/com/android/tools/r8/graph/AssemblyWriter.java
+++ b/src/main/java/com/android/tools/r8/graph/AssemblyWriter.java
@@ -20,7 +20,6 @@
import com.android.tools.r8.utils.RetracerForCodePrinting;
import com.android.tools.r8.utils.StringUtils;
import com.android.tools.r8.utils.StringUtils.BraceType;
-import com.android.tools.r8.utils.Timing;
import java.io.BufferedReader;
import java.io.PrintStream;
import java.io.StringReader;
@@ -35,7 +34,6 @@
private final boolean writeCode;
private final AppInfo appInfo;
private final Kotlin kotlin;
- private final Timing timing = new Timing("AssemblyWriter");
private final CompilationContext compilationContext;
private final RetracerForCodePrinting retracer;
diff --git a/src/main/java/com/android/tools/r8/graph/ClasspathOrLibraryContext.java b/src/main/java/com/android/tools/r8/graph/ClasspathOrLibraryContext.java
index b498837..fb6fcb6 100644
--- a/src/main/java/com/android/tools/r8/graph/ClasspathOrLibraryContext.java
+++ b/src/main/java/com/android/tools/r8/graph/ClasspathOrLibraryContext.java
@@ -11,6 +11,8 @@
public class ClasspathOrLibraryContext implements ProgramDerivedContext {
private final Definition context;
+
+ @SuppressWarnings("UnusedVariable")
private final ProgramDerivedContext programDerivedContext;
private ClasspathOrLibraryContext(
diff --git a/src/main/java/com/android/tools/r8/graph/DexClass.java b/src/main/java/com/android/tools/r8/graph/DexClass.java
index ed23497..263335f 100644
--- a/src/main/java/com/android/tools/r8/graph/DexClass.java
+++ b/src/main/java/com/android/tools/r8/graph/DexClass.java
@@ -52,7 +52,9 @@
public final Origin origin;
public final DexType type;
public final ClassAccessFlags accessFlags;
+
public DexType superType;
+
public DexTypeList interfaces;
public DexString sourceFile;
@@ -821,10 +823,10 @@
BiPredicate<? super DexType, ? super DexClass> predicate,
BiConsumer<? super DexType, ? super DexClass> consumer) {
forEachImmediateSupertype(
- supertype -> {
- DexClass superclass = definitions.definitionFor(supertype);
- if (predicate.test(supertype, superclass)) {
- consumer.accept(supertype, superclass);
+ superType -> {
+ DexClass superclass = definitions.definitionFor(superType);
+ if (predicate.test(superType, superclass)) {
+ consumer.accept(superType, superclass);
}
});
}
diff --git a/src/main/java/com/android/tools/r8/graph/DexCode.java b/src/main/java/com/android/tools/r8/graph/DexCode.java
index 7b2d440..f3fd961 100644
--- a/src/main/java/com/android/tools/r8/graph/DexCode.java
+++ b/src/main/java/com/android/tools/r8/graph/DexCode.java
@@ -544,6 +544,7 @@
}
@Override
+ @SuppressWarnings("UnusedVariable")
public IRCode buildInliningIR(
ProgramMethod context,
ProgramMethod method,
@@ -567,15 +568,15 @@
@Override
public void registerCodeReferences(ProgramMethod method, UseRegistry registry) {
- internalRegisterCodeReferences(method, registry);
+ internalRegisterCodeReferences(registry);
}
@Override
public void registerCodeReferencesForDesugaring(ClasspathMethod method, UseRegistry registry) {
- internalRegisterCodeReferences(method, registry);
+ internalRegisterCodeReferences(registry);
}
- private void internalRegisterCodeReferences(DexClassAndMethod method, UseRegistry registry) {
+ private void internalRegisterCodeReferences(UseRegistry<?> registry) {
assert registry.getTraversalContinuation().shouldContinue();
for (DexInstruction insn : instructions) {
insn.registerUse(registry);
diff --git a/src/main/java/com/android/tools/r8/graph/DexEncodedArray.java b/src/main/java/com/android/tools/r8/graph/DexEncodedArray.java
index 663a2e5..6d3d6db 100644
--- a/src/main/java/com/android/tools/r8/graph/DexEncodedArray.java
+++ b/src/main/java/com/android/tools/r8/graph/DexEncodedArray.java
@@ -32,6 +32,7 @@
}
@Override
+ @SuppressWarnings("UnnecessaryParentheses")
public boolean equals(Object o) {
if (o == this) {
return true;
diff --git a/src/main/java/com/android/tools/r8/graph/DexEncodedMember.java b/src/main/java/com/android/tools/r8/graph/DexEncodedMember.java
index 806b7a7..2a85b22 100644
--- a/src/main/java/com/android/tools/r8/graph/DexEncodedMember.java
+++ b/src/main/java/com/android/tools/r8/graph/DexEncodedMember.java
@@ -112,6 +112,7 @@
}
@Override
+ @SuppressWarnings("EqualsGetClass")
public final boolean equals(Object other) {
if (other == this) {
return true;
diff --git a/src/main/java/com/android/tools/r8/graph/DexProgramClass.java b/src/main/java/com/android/tools/r8/graph/DexProgramClass.java
index 39f6136..029fd1e 100644
--- a/src/main/java/com/android/tools/r8/graph/DexProgramClass.java
+++ b/src/main/java/com/android/tools/r8/graph/DexProgramClass.java
@@ -871,6 +871,7 @@
};
}
+ @SuppressWarnings("DoNotCallSuggester")
public static long invalidChecksumRequest(DexProgramClass clazz) {
throw new CompilationError(
clazz + " has no checksum information while checksum encoding is requested", clazz.origin);
diff --git a/src/main/java/com/android/tools/r8/graph/DexReference.java b/src/main/java/com/android/tools/r8/graph/DexReference.java
index c8e374d..4f633d3 100644
--- a/src/main/java/com/android/tools/r8/graph/DexReference.java
+++ b/src/main/java/com/android/tools/r8/graph/DexReference.java
@@ -30,6 +30,7 @@
BiConsumer<DexMethod, T> methodConsumer,
T arg);
+ @SuppressWarnings("MissingImplementsComparable")
public static <R extends DexReference, T> T applyPair(
R one,
R other,
@@ -48,6 +49,7 @@
public abstract void collectIndexedItems(AppView<?> appView, IndexedItemCollection indexedItems);
+ @SuppressWarnings("MissingImplementsComparable")
public abstract int compareTo(DexReference other);
public abstract DexType getContextType();
diff --git a/src/main/java/com/android/tools/r8/graph/GenericSignatureCorrectnessHelper.java b/src/main/java/com/android/tools/r8/graph/GenericSignatureCorrectnessHelper.java
index c3033f4..50532ea 100644
--- a/src/main/java/com/android/tools/r8/graph/GenericSignatureCorrectnessHelper.java
+++ b/src/main/java/com/android/tools/r8/graph/GenericSignatureCorrectnessHelper.java
@@ -24,7 +24,6 @@
import com.android.tools.r8.shaking.KeepClassInfo;
import com.android.tools.r8.shaking.KeepFieldInfo;
import com.android.tools.r8.shaking.KeepMethodInfo;
-import com.android.tools.r8.utils.InternalOptions;
import com.android.tools.r8.utils.ListUtils;
import java.util.Collection;
import java.util.List;
@@ -67,6 +66,7 @@
return isInvalid() ? this : other;
}
+ @SuppressWarnings("UnusedVariable")
public String getDescription() {
switch (this) {
case INVALID_APPLICATION_COUNT:
@@ -86,7 +86,6 @@
private final AppView<?> appView;
private final Mode mode;
- private final InternalOptions options;
private final GenericSignatureContextBuilder contextBuilder;
private GenericSignatureCorrectnessHelper(
@@ -94,7 +93,6 @@
this.appView = appView;
this.contextBuilder = contextBuilder;
this.mode = mode;
- this.options = appView.options();
}
public static GenericSignatureCorrectnessHelper createForInitialCheck(
diff --git a/src/main/java/com/android/tools/r8/graph/JarClassFileReader.java b/src/main/java/com/android/tools/r8/graph/JarClassFileReader.java
index fc6359f..05c265a 100644
--- a/src/main/java/com/android/tools/r8/graph/JarClassFileReader.java
+++ b/src/main/java/com/android/tools/r8/graph/JarClassFileReader.java
@@ -1159,8 +1159,6 @@
private static class CreateRecordComponentVisitor extends RecordComponentVisitor {
private final CreateDexClassVisitor<?> parent;
- private final String name;
- private final String descriptor;
private final DexField field;
private final FieldTypeSignature componentSignature;
@@ -1169,8 +1167,6 @@
super(ASM_VERSION);
this.field = parent.application.getField(parent.type, name, descriptor);
this.parent = parent;
- this.name = name;
- this.descriptor = descriptor;
this.componentSignature =
parent.application.options.parseSignatureAttribute()
? GenericSignature.parseFieldTypeSignature(
diff --git a/src/main/java/com/android/tools/r8/graph/LazyCfCode.java b/src/main/java/com/android/tools/r8/graph/LazyCfCode.java
index b3b5680..5676a96 100644
--- a/src/main/java/com/android/tools/r8/graph/LazyCfCode.java
+++ b/src/main/java/com/android/tools/r8/graph/LazyCfCode.java
@@ -311,17 +311,15 @@
}
protected BiFunction<String, String, LazyCfCode> createCodeLocator(ReparseContext context) {
- return new DefaultCodeLocator(context, application);
+ return new DefaultCodeLocator(context);
}
private static class DefaultCodeLocator implements BiFunction<String, String, LazyCfCode> {
private final ReparseContext context;
- private final JarApplicationReader application;
private int methodIndex = 0;
- private DefaultCodeLocator(ReparseContext context, JarApplicationReader application) {
+ private DefaultCodeLocator(ReparseContext context) {
this.context = context;
- this.application = application;
}
@Override
diff --git a/src/main/java/com/android/tools/r8/graph/classmerging/MergedClasses.java b/src/main/java/com/android/tools/r8/graph/classmerging/MergedClasses.java
index ae77e17..9aa77c9 100644
--- a/src/main/java/com/android/tools/r8/graph/classmerging/MergedClasses.java
+++ b/src/main/java/com/android/tools/r8/graph/classmerging/MergedClasses.java
@@ -5,7 +5,6 @@
package com.android.tools.r8.graph.classmerging;
import com.android.tools.r8.graph.AppView;
-import com.android.tools.r8.graph.DexProgramClass;
import com.android.tools.r8.graph.DexType;
import com.android.tools.r8.shaking.AppInfoWithLiveness;
import java.util.Set;
@@ -20,24 +19,4 @@
boolean isMergeTarget(DexType type);
boolean verifyAllSourcesPruned(AppView<AppInfoWithLiveness> appView);
-
- /**
- * Determine if the class has been merged by the merged classes object. If the merged classes is
- * null then return false.
- */
- static boolean hasBeenMergedIntoDifferentType(
- MergedClasses mergedClasses, DexProgramClass clazz) {
- return hasBeenMergedIntoDifferentType(mergedClasses, clazz.getType());
- }
-
- /**
- * Determine if the class has been merged by the merged classes object. If the merged classes is
- * null then return false.
- */
- static boolean hasBeenMergedIntoDifferentType(MergedClasses mergedClasses, DexType type) {
- if (mergedClasses != null) {
- return mergedClasses.hasBeenMergedIntoDifferentType(type);
- }
- return false;
- }
}
diff --git a/src/main/java/com/android/tools/r8/graph/fixup/TreeFixerBase.java b/src/main/java/com/android/tools/r8/graph/fixup/TreeFixerBase.java
index 6464048..908749c 100644
--- a/src/main/java/com/android/tools/r8/graph/fixup/TreeFixerBase.java
+++ b/src/main/java/com/android/tools/r8/graph/fixup/TreeFixerBase.java
@@ -39,7 +39,6 @@
private final DexItemFactory dexItemFactory;
private final Map<DexType, DexProgramClass> programClassCache = new IdentityHashMap<>();
- private final Map<DexType, DexProgramClass> synthesizedFromClasses = new IdentityHashMap<>();
private final Map<DexProto, DexProto> protoFixupCache = new IdentityHashMap<>();
public TreeFixerBase(AppView<?> appView) {
diff --git a/src/main/java/com/android/tools/r8/graph/lens/FieldLookupResult.java b/src/main/java/com/android/tools/r8/graph/lens/FieldLookupResult.java
index b031af1..9c4e83b 100644
--- a/src/main/java/com/android/tools/r8/graph/lens/FieldLookupResult.java
+++ b/src/main/java/com/android/tools/r8/graph/lens/FieldLookupResult.java
@@ -48,6 +48,7 @@
return writeCastType;
}
+ @SuppressWarnings("UnusedVariable")
public DexType getRewrittenWriteCastType(Function<DexType, DexType> fn) {
return hasWriteCastType() ? fn.apply(writeCastType) : null;
}
@@ -56,6 +57,8 @@
private DexType readCastType;
private DexType writeCastType;
+
+ @SuppressWarnings("UnusedVariable")
private GraphLens lens;
private Builder(GraphLens lens) {
diff --git a/src/main/java/com/android/tools/r8/graph/lens/MethodLookupResult.java b/src/main/java/com/android/tools/r8/graph/lens/MethodLookupResult.java
index a69267e..d0c3ded 100644
--- a/src/main/java/com/android/tools/r8/graph/lens/MethodLookupResult.java
+++ b/src/main/java/com/android/tools/r8/graph/lens/MethodLookupResult.java
@@ -38,13 +38,16 @@
return type;
}
+ @SuppressWarnings("UnusedVariable")
public RewrittenPrototypeDescription getPrototypeChanges() {
return prototypeChanges;
}
public static class Builder extends MemberLookupResult.Builder<DexMethod, Builder> {
+ @SuppressWarnings("UnusedVariable")
private final GraphLens lens;
+
private RewrittenPrototypeDescription prototypeChanges = RewrittenPrototypeDescription.none();
private InvokeType type;
diff --git a/src/main/java/com/android/tools/r8/graph/lens/NonIdentityGraphLens.java b/src/main/java/com/android/tools/r8/graph/lens/NonIdentityGraphLens.java
index 2c78950..33f5aeb 100644
--- a/src/main/java/com/android/tools/r8/graph/lens/NonIdentityGraphLens.java
+++ b/src/main/java/com/android/tools/r8/graph/lens/NonIdentityGraphLens.java
@@ -43,13 +43,11 @@
previousLens = newPreviousLens;
}
- @SuppressWarnings("unchecked")
- public final <T extends com.android.tools.r8.graph.lens.NonIdentityGraphLens> T find(
- Predicate<com.android.tools.r8.graph.lens.NonIdentityGraphLens> predicate) {
+ @SuppressWarnings({"TypeParameterUnusedInFormals", "unchecked"})
+ public final <T extends NonIdentityGraphLens> T find(Predicate<NonIdentityGraphLens> predicate) {
GraphLens current = this;
while (current.isNonIdentityLens()) {
- com.android.tools.r8.graph.lens.NonIdentityGraphLens nonIdentityGraphLens =
- current.asNonIdentityLens();
+ NonIdentityGraphLens nonIdentityGraphLens = current.asNonIdentityLens();
if (predicate.test(nonIdentityGraphLens)) {
return (T) nonIdentityGraphLens;
}
@@ -58,16 +56,17 @@
return null;
}
- @SuppressWarnings("unchecked")
- public final <T extends com.android.tools.r8.graph.lens.NonIdentityGraphLens> T findPrevious(
- Predicate<com.android.tools.r8.graph.lens.NonIdentityGraphLens> predicate) {
+ @SuppressWarnings({"TypeParameterUnusedInFormals", "unchecked"})
+ public final <T extends NonIdentityGraphLens> T findPrevious(
+ Predicate<NonIdentityGraphLens> predicate) {
GraphLens previous = getPrevious();
return previous.isNonIdentityLens() ? previous.asNonIdentityLens().find(predicate) : null;
}
- public final <T extends com.android.tools.r8.graph.lens.NonIdentityGraphLens> T findPreviousUntil(
- Predicate<com.android.tools.r8.graph.lens.NonIdentityGraphLens> predicate,
- Predicate<com.android.tools.r8.graph.lens.NonIdentityGraphLens> stoppingCriterion) {
+ @SuppressWarnings({"TypeParameterUnusedInFormals", "unchecked"})
+ public final <T extends NonIdentityGraphLens> T findPreviousUntil(
+ Predicate<NonIdentityGraphLens> predicate,
+ Predicate<NonIdentityGraphLens> stoppingCriterion) {
T found = findPrevious(predicate.or(stoppingCriterion));
return (found == null || stoppingCriterion.test(found)) ? null : found;
}
@@ -201,7 +200,7 @@
}
@Override
- public final com.android.tools.r8.graph.lens.NonIdentityGraphLens asNonIdentityLens() {
+ public final NonIdentityGraphLens asNonIdentityLens() {
return this;
}
}
diff --git a/src/main/java/com/android/tools/r8/graph/proto/ArgumentInfoCollection.java b/src/main/java/com/android/tools/r8/graph/proto/ArgumentInfoCollection.java
index 544940a..85ee2db 100644
--- a/src/main/java/com/android/tools/r8/graph/proto/ArgumentInfoCollection.java
+++ b/src/main/java/com/android/tools/r8/graph/proto/ArgumentInfoCollection.java
@@ -207,6 +207,7 @@
}
@Override
+ @SuppressWarnings("EqualsGetClass")
public boolean equals(Object obj) {
if (this == obj) {
return true;
diff --git a/src/main/java/com/android/tools/r8/graph/proto/RemovedArgumentInfo.java b/src/main/java/com/android/tools/r8/graph/proto/RemovedArgumentInfo.java
index 18bbc7f..839756a 100644
--- a/src/main/java/com/android/tools/r8/graph/proto/RemovedArgumentInfo.java
+++ b/src/main/java/com/android/tools/r8/graph/proto/RemovedArgumentInfo.java
@@ -98,7 +98,7 @@
}
@Override
- @SuppressWarnings("ReferenceEquality")
+ @SuppressWarnings({"EqualsGetClass", "ReferenceEquality"})
public boolean equals(Object obj) {
if (obj == null || getClass() != obj.getClass()) {
return false;
diff --git a/src/main/java/com/android/tools/r8/graph/proto/RemovedReceiverInfo.java b/src/main/java/com/android/tools/r8/graph/proto/RemovedReceiverInfo.java
index b6d2d93..7a1391c 100644
--- a/src/main/java/com/android/tools/r8/graph/proto/RemovedReceiverInfo.java
+++ b/src/main/java/com/android/tools/r8/graph/proto/RemovedReceiverInfo.java
@@ -36,7 +36,7 @@
}
@Override
- @SuppressWarnings("ReferenceEquality")
+ @SuppressWarnings({"EqualsGetClass", "ReferenceEquality"})
public boolean equals(Object obj) {
if (obj == null || getClass() != obj.getClass()) {
return false;
diff --git a/src/main/java/com/android/tools/r8/graph/proto/RewrittenPrototypeDescription.java b/src/main/java/com/android/tools/r8/graph/proto/RewrittenPrototypeDescription.java
index e7cff1a..cde2daf 100644
--- a/src/main/java/com/android/tools/r8/graph/proto/RewrittenPrototypeDescription.java
+++ b/src/main/java/com/android/tools/r8/graph/proto/RewrittenPrototypeDescription.java
@@ -271,6 +271,7 @@
}
@Override
+ @SuppressWarnings("EqualsGetClass")
public boolean equals(Object obj) {
if (obj == null || getClass() != obj.getClass()) {
return false;
diff --git a/src/main/java/com/android/tools/r8/graph/proto/RewrittenTypeInfo.java b/src/main/java/com/android/tools/r8/graph/proto/RewrittenTypeInfo.java
index 6f06fab..8537d1d 100644
--- a/src/main/java/com/android/tools/r8/graph/proto/RewrittenTypeInfo.java
+++ b/src/main/java/com/android/tools/r8/graph/proto/RewrittenTypeInfo.java
@@ -109,7 +109,7 @@
}
@Override
- @SuppressWarnings("ReferenceEquality")
+ @SuppressWarnings({"EqualsGetClass", "ReferenceEquality"})
public boolean equals(Object obj) {
if (obj == null || getClass() != obj.getClass()) {
return false;
diff --git a/src/main/java/com/android/tools/r8/horizontalclassmerging/ClassInstanceFieldsMerger.java b/src/main/java/com/android/tools/r8/horizontalclassmerging/ClassInstanceFieldsMerger.java
index fb0b12f..8edf836 100644
--- a/src/main/java/com/android/tools/r8/horizontalclassmerging/ClassInstanceFieldsMerger.java
+++ b/src/main/java/com/android/tools/r8/horizontalclassmerging/ClassInstanceFieldsMerger.java
@@ -138,6 +138,8 @@
private final AppView<? extends AppInfoWithClassHierarchy> appView;
private final MergeGroup group;
+
+ @SuppressWarnings("BadImport")
private final Builder lensBuilder;
private DexEncodedField classIdField;
diff --git a/src/main/java/com/android/tools/r8/horizontalclassmerging/ClassMerger.java b/src/main/java/com/android/tools/r8/horizontalclassmerging/ClassMerger.java
index ac9ec55..507396f 100644
--- a/src/main/java/com/android/tools/r8/horizontalclassmerging/ClassMerger.java
+++ b/src/main/java/com/android/tools/r8/horizontalclassmerging/ClassMerger.java
@@ -381,6 +381,7 @@
this.mode = mode;
}
+ @SuppressWarnings("MixedMutabilityReturnType")
private List<VirtualMethodMerger> createVirtualMethodMergers() {
if (!appView.hasClassHierarchy()) {
assert getVirtualMethodMergerBuilders().isEmpty();
diff --git a/src/main/java/com/android/tools/r8/horizontalclassmerging/ClassStaticFieldsMerger.java b/src/main/java/com/android/tools/r8/horizontalclassmerging/ClassStaticFieldsMerger.java
index 5fcbc0d..81ec45e 100644
--- a/src/main/java/com/android/tools/r8/horizontalclassmerging/ClassStaticFieldsMerger.java
+++ b/src/main/java/com/android/tools/r8/horizontalclassmerging/ClassStaticFieldsMerger.java
@@ -18,6 +18,8 @@
private final AppView<?> appView;
private final DexItemFactory dexItemFactory;
private final MergeGroup group;
+
+ @SuppressWarnings("BadImport")
private final Builder lensBuilder;
private final Map<DexField, DexEncodedField> targetFields = new LinkedHashMap<>();
diff --git a/src/main/java/com/android/tools/r8/horizontalclassmerging/InstanceInitializerDescription.java b/src/main/java/com/android/tools/r8/horizontalclassmerging/InstanceInitializerDescription.java
index 407cbce..b2421bb 100644
--- a/src/main/java/com/android/tools/r8/horizontalclassmerging/InstanceInitializerDescription.java
+++ b/src/main/java/com/android/tools/r8/horizontalclassmerging/InstanceInitializerDescription.java
@@ -61,6 +61,7 @@
return new Builder(appView.dexItemFactory(), instanceInitializer);
}
+ @SuppressWarnings("InvalidParam")
public static Builder builder(
AppView<? extends AppInfoWithClassHierarchy> appView, ProgramMethod instanceInitializer) {
return new Builder(appView.dexItemFactory(), instanceInitializer);
@@ -69,7 +70,6 @@
/**
* Transform this description into actual CF code.
*
- * @param newMethodReference the reference of the method that is being synthesized
* @param originalMethodReference the original reference of the representative method
* @param syntheticMethodReference the original, synthetic reference of the new method reference
* ($r8$init$synthetic)
@@ -92,7 +92,7 @@
}
@Override
- @SuppressWarnings("ReferenceEquality")
+ @SuppressWarnings({"EqualsGetClass", "ReferenceEquality"})
public boolean equals(Object obj) {
if (obj == null || getClass() != obj.getClass()) {
return false;
diff --git a/src/main/java/com/android/tools/r8/horizontalclassmerging/InstanceInitializerMergerCollection.java b/src/main/java/com/android/tools/r8/horizontalclassmerging/InstanceInitializerMergerCollection.java
index 4ce1f2f..50a0f23 100644
--- a/src/main/java/com/android/tools/r8/horizontalclassmerging/InstanceInitializerMergerCollection.java
+++ b/src/main/java/com/android/tools/r8/horizontalclassmerging/InstanceInitializerMergerCollection.java
@@ -37,6 +37,7 @@
this.equivalentInstanceInitializerMergers = equivalentInstanceInitializerMergers;
}
+ @SuppressWarnings("BadImport")
public static InstanceInitializerMergerCollection create(
AppView<?> appView,
Reference2IntMap<DexType> classIdentifiers,
diff --git a/src/main/java/com/android/tools/r8/horizontalclassmerging/policies/LimitClassGroups.java b/src/main/java/com/android/tools/r8/horizontalclassmerging/policies/LimitClassGroups.java
index 15070c2..d271464 100644
--- a/src/main/java/com/android/tools/r8/horizontalclassmerging/policies/LimitClassGroups.java
+++ b/src/main/java/com/android/tools/r8/horizontalclassmerging/policies/LimitClassGroups.java
@@ -25,8 +25,8 @@
}
// TODO(b/270398965): Replace LinkedList.
- @SuppressWarnings("JdkObsolete")
@Override
+ @SuppressWarnings({"JdkObsolete", "MixedMutabilityReturnType"})
public Collection<MergeGroup> apply(MergeGroup group) {
if (group.size() <= maxGroupSize || group.isInterfaceGroup()) {
return Collections.singletonList(group);
diff --git a/src/main/java/com/android/tools/r8/horizontalclassmerging/policies/NoDeadLocks.java b/src/main/java/com/android/tools/r8/horizontalclassmerging/policies/NoDeadLocks.java
index f120117..d47b3fb 100644
--- a/src/main/java/com/android/tools/r8/horizontalclassmerging/policies/NoDeadLocks.java
+++ b/src/main/java/com/android/tools/r8/horizontalclassmerging/policies/NoDeadLocks.java
@@ -26,8 +26,8 @@
}
// TODO(b/270398965): Replace LinkedList.
- @SuppressWarnings("JdkObsolete")
@Override
+ @SuppressWarnings({"JdkObsolete", "MixedMutabilityReturnType"})
public Collection<MergeGroup> apply(MergeGroup group) {
// Gather all synchronized classes.
Collection<MergeGroup> synchronizedGroups = new LinkedList<>();
diff --git a/src/main/java/com/android/tools/r8/horizontalclassmerging/policies/NoDefaultInterfaceMethodCollisions.java b/src/main/java/com/android/tools/r8/horizontalclassmerging/policies/NoDefaultInterfaceMethodCollisions.java
index 3b37e83..e8494a3 100644
--- a/src/main/java/com/android/tools/r8/horizontalclassmerging/policies/NoDefaultInterfaceMethodCollisions.java
+++ b/src/main/java/com/android/tools/r8/horizontalclassmerging/policies/NoDefaultInterfaceMethodCollisions.java
@@ -179,6 +179,7 @@
}
/** Returns the set of program classes that must be considered during preprocessing. */
+ @SuppressWarnings("UnusedVariable")
private Collection<DexProgramClass> computeClassesOfInterest(SubtypingInfo subtypingInfo) {
// TODO(b/173990042): Limit result to the set of classes that are in the same as one of
// the interfaces that is subject to merging.
diff --git a/src/main/java/com/android/tools/r8/horizontalclassmerging/policies/NoInstanceInitializerMerging.java b/src/main/java/com/android/tools/r8/horizontalclassmerging/policies/NoInstanceInitializerMerging.java
index bf5d475..aef65d3 100644
--- a/src/main/java/com/android/tools/r8/horizontalclassmerging/policies/NoInstanceInitializerMerging.java
+++ b/src/main/java/com/android/tools/r8/horizontalclassmerging/policies/NoInstanceInitializerMerging.java
@@ -71,6 +71,7 @@
}
@Override
+ @SuppressWarnings("MixedMutabilityReturnType")
public Map<DexProgramClass, Set<DexMethod>> preprocess(
Collection<MergeGroup> groups, ExecutorService executorService) {
if (!appView.options().canHaveNonReboundConstructorInvoke()) {
@@ -116,6 +117,7 @@
}
@Override
+ @SuppressWarnings("MixedMutabilityReturnType")
public Collection<MergeGroup> apply(
MergeGroup group, Map<DexProgramClass, Set<DexMethod>> absentInstanceInitializers) {
assert !group.hasTarget();
diff --git a/src/main/java/com/android/tools/r8/horizontalclassmerging/policies/OnlyDirectlyConnectedOrUnrelatedInterfaces.java b/src/main/java/com/android/tools/r8/horizontalclassmerging/policies/OnlyDirectlyConnectedOrUnrelatedInterfaces.java
index a64402a..9812a26 100644
--- a/src/main/java/com/android/tools/r8/horizontalclassmerging/policies/OnlyDirectlyConnectedOrUnrelatedInterfaces.java
+++ b/src/main/java/com/android/tools/r8/horizontalclassmerging/policies/OnlyDirectlyConnectedOrUnrelatedInterfaces.java
@@ -71,8 +71,8 @@
}
// TODO(b/270398965): Replace LinkedList.
- @SuppressWarnings("JdkObsolete")
@Override
+ @SuppressWarnings({"JdkObsolete", "MixedMutabilityReturnType"})
public Collection<MergeGroup> apply(MergeGroup group, SubtypingInfo subtypingInfo) {
if (!group.isInterfaceGroup()) {
return ImmutableList.of(group);
diff --git a/src/main/java/com/android/tools/r8/horizontalclassmerging/policies/PreserveMethodCharacteristics.java b/src/main/java/com/android/tools/r8/horizontalclassmerging/policies/PreserveMethodCharacteristics.java
index 60a279f..63e334b 100644
--- a/src/main/java/com/android/tools/r8/horizontalclassmerging/policies/PreserveMethodCharacteristics.java
+++ b/src/main/java/com/android/tools/r8/horizontalclassmerging/policies/PreserveMethodCharacteristics.java
@@ -74,7 +74,7 @@
}
@Override
- @SuppressWarnings("ReferenceEquality")
+ @SuppressWarnings({"EqualsGetClass", "ReferenceEquality"})
public boolean equals(Object obj) {
if (obj == null) {
return false;
diff --git a/src/main/java/com/android/tools/r8/horizontalclassmerging/policies/SameInstanceFields.java b/src/main/java/com/android/tools/r8/horizontalclassmerging/policies/SameInstanceFields.java
index 9c5d8b2..da0951e 100644
--- a/src/main/java/com/android/tools/r8/horizontalclassmerging/policies/SameInstanceFields.java
+++ b/src/main/java/com/android/tools/r8/horizontalclassmerging/policies/SameInstanceFields.java
@@ -82,7 +82,7 @@
}
@Override
- @SuppressWarnings("ReferenceEquality")
+ @SuppressWarnings({"EqualsGetClass", "ReferenceEquality"})
public boolean equals(Object obj) {
if (obj == null || getClass() != obj.getClass()) {
return false;
diff --git a/src/main/java/com/android/tools/r8/horizontalclassmerging/policies/deadlock/SingleCallerInformation.java b/src/main/java/com/android/tools/r8/horizontalclassmerging/policies/deadlock/SingleCallerInformation.java
index deda00e..8696342 100644
--- a/src/main/java/com/android/tools/r8/horizontalclassmerging/policies/deadlock/SingleCallerInformation.java
+++ b/src/main/java/com/android/tools/r8/horizontalclassmerging/policies/deadlock/SingleCallerInformation.java
@@ -93,11 +93,13 @@
private class InvokeExtractor extends UseRegistry<ProgramMethod> {
- private final AppView<? extends AppInfoWithClassHierarchy> appView;
+ private final AppView<? extends AppInfoWithClassHierarchy> appViewWithClassHierachy;
- InvokeExtractor(AppView<? extends AppInfoWithClassHierarchy> appView, ProgramMethod context) {
- super(appView, context);
- this.appView = appView;
+ InvokeExtractor(
+ AppView<? extends AppInfoWithClassHierarchy> appViewWithClassHierachy,
+ ProgramMethod context) {
+ super(appViewWithClassHierachy, context);
+ this.appViewWithClassHierachy = appViewWithClassHierachy;
}
@SuppressWarnings("ReferenceEquality")
@@ -120,7 +122,7 @@
}
private void triggerClassInitializerIfNotAlreadyTriggeredInContext(DexType type) {
- DexProgramClass clazz = type.asProgramClass(appView);
+ DexProgramClass clazz = type.asProgramClass(appViewWithClassHierachy);
if (clazz != null) {
triggerClassInitializerIfNotAlreadyTriggeredInContext(clazz);
}
@@ -133,11 +135,11 @@
}
private boolean isClassAlreadyInitializedInCurrentContext(DexProgramClass clazz) {
- return appView.appInfo().isSubtype(getContext().getHolder(), clazz);
+ return appViewWithClassHierachy.appInfo().isSubtype(getContext().getHolder(), clazz);
}
private void triggerClassInitializer(DexType type) {
- DexProgramClass clazz = type.asProgramClass(appView);
+ DexProgramClass clazz = type.asProgramClass(appViewWithClassHierachy);
if (clazz != null) {
triggerClassInitializer(clazz);
}
@@ -180,7 +182,7 @@
@Override
public void registerInitClass(DexType type) {
- DexType rewrittenType = appView.graphLens().lookupType(type);
+ DexType rewrittenType = appViewWithClassHierachy.graphLens().lookupType(type);
triggerClassInitializerIfNotAlreadyTriggeredInContext(rewrittenType);
}
@@ -197,8 +199,12 @@
@Override
public void registerInvokeDirect(DexMethod method) {
DexMethod rewrittenMethod =
- appView.graphLens().lookupInvokeDirect(method, getContext()).getReference();
- DexProgramClass holder = rewrittenMethod.getHolderType().asProgramClass(appView);
+ appViewWithClassHierachy
+ .graphLens()
+ .lookupInvokeDirect(method, getContext())
+ .getReference();
+ DexProgramClass holder =
+ rewrittenMethod.getHolderType().asProgramClass(appViewWithClassHierachy);
ProgramMethod target = rewrittenMethod.lookupOnProgramClass(holder);
if (target != null) {
recordDispatchTarget(target);
@@ -214,9 +220,12 @@
@Override
public void registerInvokeStatic(DexMethod method) {
DexMethod rewrittenMethod =
- appView.graphLens().lookupInvokeDirect(method, getContext()).getReference();
+ appViewWithClassHierachy
+ .graphLens()
+ .lookupInvokeDirect(method, getContext())
+ .getReference();
ProgramMethod target =
- appView
+ appViewWithClassHierachy
.appInfo()
.unsafeResolveMethodDueToDexFormatLegacy(rewrittenMethod)
.getResolvedProgramMethod();
@@ -240,19 +249,19 @@
@Override
public void registerNewInstance(DexType type) {
- DexType rewrittenType = appView.graphLens().lookupType(type);
+ DexType rewrittenType = appViewWithClassHierachy.graphLens().lookupType(type);
triggerClassInitializerIfNotAlreadyTriggeredInContext(rewrittenType);
}
@Override
public void registerStaticFieldRead(DexField field) {
- DexField rewrittenField = appView.graphLens().lookupField(field);
+ DexField rewrittenField = appViewWithClassHierachy.graphLens().lookupField(field);
triggerClassInitializerIfNotAlreadyTriggeredInContext(rewrittenField.getHolderType());
}
@Override
public void registerStaticFieldWrite(DexField field) {
- DexField rewrittenField = appView.graphLens().lookupField(field);
+ DexField rewrittenField = appViewWithClassHierachy.graphLens().lookupField(field);
triggerClassInitializerIfNotAlreadyTriggeredInContext(rewrittenField.getHolderType());
}
diff --git a/src/main/java/com/android/tools/r8/inspector/internal/InspectorImpl.java b/src/main/java/com/android/tools/r8/inspector/internal/InspectorImpl.java
index 72e322f..1c80859 100644
--- a/src/main/java/com/android/tools/r8/inspector/internal/InspectorImpl.java
+++ b/src/main/java/com/android/tools/r8/inspector/internal/InspectorImpl.java
@@ -15,6 +15,7 @@
public class InspectorImpl implements Inspector {
// This wrapping appears odd, but allows hooking in inspections on the impl type from tests.
+ @SuppressWarnings("MixedMutabilityReturnType")
public static List<Consumer<InspectorImpl>> wrapInspections(
Collection<Consumer<Inspector>> inspections) {
if (inspections == null || inspections.isEmpty()) {
diff --git a/src/main/java/com/android/tools/r8/ir/analysis/ValueMayDependOnEnvironmentAnalysis.java b/src/main/java/com/android/tools/r8/ir/analysis/ValueMayDependOnEnvironmentAnalysis.java
index 9d7a65b..abbb78c 100644
--- a/src/main/java/com/android/tools/r8/ir/analysis/ValueMayDependOnEnvironmentAnalysis.java
+++ b/src/main/java/com/android/tools/r8/ir/analysis/ValueMayDependOnEnvironmentAnalysis.java
@@ -156,10 +156,8 @@
return addConstantValueToValueGraph(value)
|| addArrayValueToValueGraph(
value, node, graph, consumedInstructions, mutableValues, worklist)
- || addInvokeVirtualValueToValueGraph(
- value, node, graph, consumedInstructions, mutableValues, worklist)
- || addLogicalBinopValueToValueGraph(
- value, node, graph, consumedInstructions, mutableValues, worklist)
+ || addInvokeVirtualValueToValueGraph(value)
+ || addLogicalBinopValueToValueGraph(value, node, graph, worklist)
|| addNewInstanceValueToValueGraph(
value, node, graph, consumedInstructions, mutableValues, worklist);
}
@@ -185,6 +183,7 @@
return false;
}
+ @SuppressWarnings("UnusedVariable")
private boolean addArrayValueToValueGraph(
Value value,
Node node,
@@ -252,13 +251,7 @@
}
@SuppressWarnings("ReferenceEquality")
- private boolean addInvokeVirtualValueToValueGraph(
- Value value,
- Node node,
- ValueGraph graph,
- Set<Instruction> consumedInstructions,
- Set<Value> mutableValues,
- WorkList<Value> worklist) {
+ private boolean addInvokeVirtualValueToValueGraph(Value value) {
if (!value.isDefinedByInstructionSatisfying(Instruction::isInvokeVirtual)) {
return false;
}
@@ -286,8 +279,6 @@
Value value,
Node node,
ValueGraph graph,
- Set<Instruction> consumedInstructions,
- Set<Value> mutableValues,
WorkList<Value> worklist) {
if (!value.isDefinedByInstructionSatisfying(Instruction::isLogicalBinop)) {
return false;
diff --git a/src/main/java/com/android/tools/r8/ir/analysis/equivalence/BasicBlockBehavioralSubsumption.java b/src/main/java/com/android/tools/r8/ir/analysis/equivalence/BasicBlockBehavioralSubsumption.java
index 76c3362..c37be79 100644
--- a/src/main/java/com/android/tools/r8/ir/analysis/equivalence/BasicBlockBehavioralSubsumption.java
+++ b/src/main/java/com/android/tools/r8/ir/analysis/equivalence/BasicBlockBehavioralSubsumption.java
@@ -36,12 +36,10 @@
public class BasicBlockBehavioralSubsumption {
private final AppView<?> appView;
- private final IRCode code;
private final ProgramMethod context;
public BasicBlockBehavioralSubsumption(AppView<?> appView, IRCode code) {
this.appView = appView;
- this.code = code;
this.context = code.context();
}
diff --git a/src/main/java/com/android/tools/r8/ir/analysis/escape/EscapeAnalysis.java b/src/main/java/com/android/tools/r8/ir/analysis/escape/EscapeAnalysis.java
index a8e98f0..fc21b02 100644
--- a/src/main/java/com/android/tools/r8/ir/analysis/escape/EscapeAnalysis.java
+++ b/src/main/java/com/android/tools/r8/ir/analysis/escape/EscapeAnalysis.java
@@ -215,6 +215,7 @@
return trackedValues.contains(value);
}
+ @SuppressWarnings("UnusedVariable")
private static Value getPropagatedSubject(Value src, Instruction instr) {
if (instr.isArrayPut()) {
return instr.asArrayPut().array();
diff --git a/src/main/java/com/android/tools/r8/ir/analysis/fieldaccess/FieldReadForWriteAnalysis.java b/src/main/java/com/android/tools/r8/ir/analysis/fieldaccess/FieldReadForWriteAnalysis.java
index 2155676..76607c5 100644
--- a/src/main/java/com/android/tools/r8/ir/analysis/fieldaccess/FieldReadForWriteAnalysis.java
+++ b/src/main/java/com/android/tools/r8/ir/analysis/fieldaccess/FieldReadForWriteAnalysis.java
@@ -25,6 +25,7 @@
this.appView = appView;
}
+ @SuppressWarnings("BadImport")
public void recordFieldAccess(
FieldInstruction instruction,
ProgramField field,
diff --git a/src/main/java/com/android/tools/r8/ir/analysis/fieldvalueanalysis/ConcreteMutableFieldSet.java b/src/main/java/com/android/tools/r8/ir/analysis/fieldvalueanalysis/ConcreteMutableFieldSet.java
index 41ffebf..901c082 100644
--- a/src/main/java/com/android/tools/r8/ir/analysis/fieldvalueanalysis/ConcreteMutableFieldSet.java
+++ b/src/main/java/com/android/tools/r8/ir/analysis/fieldvalueanalysis/ConcreteMutableFieldSet.java
@@ -130,6 +130,7 @@
}
@Override
+ @SuppressWarnings("EqualsGetClass")
public boolean equals(Object other) {
if (other == null) {
return false;
diff --git a/src/main/java/com/android/tools/r8/ir/analysis/proto/ProtoEnqueuerUseRegistry.java b/src/main/java/com/android/tools/r8/ir/analysis/proto/ProtoEnqueuerUseRegistry.java
index ebfc1f4..c565fcf 100644
--- a/src/main/java/com/android/tools/r8/ir/analysis/proto/ProtoEnqueuerUseRegistry.java
+++ b/src/main/java/com/android/tools/r8/ir/analysis/proto/ProtoEnqueuerUseRegistry.java
@@ -91,7 +91,8 @@
if (field == references.getDefaultInstanceField(getContextHolder())) {
return true;
}
- DexProgramClass holder = asProgramClassOrNull(appView.definitionFor(field.getHolderType()));
+ DexProgramClass holder =
+ asProgramClassOrNull(appViewWithClassHierarchy.definitionFor(field.getHolderType()));
return holder != null
&& holder.getInterfaces().contains(references.enumVerifierType)
&& field == references.getEnumVerifierInstanceField(holder);
diff --git a/src/main/java/com/android/tools/r8/ir/analysis/proto/ProtoInliningReasonStrategy.java b/src/main/java/com/android/tools/r8/ir/analysis/proto/ProtoInliningReasonStrategy.java
index 95ed51a..a5fa7b7 100644
--- a/src/main/java/com/android/tools/r8/ir/analysis/proto/ProtoInliningReasonStrategy.java
+++ b/src/main/java/com/android/tools/r8/ir/analysis/proto/ProtoInliningReasonStrategy.java
@@ -17,19 +17,17 @@
import com.android.tools.r8.ir.optimize.inliner.InliningReasonStrategy;
/**
- * Equivalent to the {@link InliningReasonStrategy} in {@link #parent} except for invocations to
- * dynamicMethod().
+ * Equivalent to the {@link InliningReasonStrategy} in {@link #parent} except for invocations
+ * to @SuppressWarnings("UnusedVariable") dynamicMethod().
*/
public class ProtoInliningReasonStrategy implements InliningReasonStrategy {
private static final int METHOD_TO_INVOKE_ARGUMENT_POSITION_IN_DYNAMIC_METHOD = 1;
- private final AppView<?> appView;
private final InliningReasonStrategy parent;
private final ProtoReferences references;
public ProtoInliningReasonStrategy(AppView<?> appView, InliningReasonStrategy parent) {
- this.appView = appView;
this.parent = parent;
this.references = appView.protoShrinker().references;
}
diff --git a/src/main/java/com/android/tools/r8/ir/analysis/type/ClassTypeElement.java b/src/main/java/com/android/tools/r8/ir/analysis/type/ClassTypeElement.java
index ca9ebfd..e966ed6 100644
--- a/src/main/java/com/android/tools/r8/ir/analysis/type/ClassTypeElement.java
+++ b/src/main/java/com/android/tools/r8/ir/analysis/type/ClassTypeElement.java
@@ -194,7 +194,7 @@
}
@Override
- @SuppressWarnings("ReferenceEquality")
+ @SuppressWarnings({"BadImport", "ReferenceEquality"})
public TypeElement fixupClassTypeReferences(
AppView<? extends AppInfoWithClassHierarchy> ignore,
Function<DexType, DexType> mapping,
@@ -478,6 +478,7 @@
return objectType;
}
+ @SuppressWarnings("BadImport")
public static InterfaceCollection computeLeastUpperBoundOfInterfaces(
AppView<? extends AppInfoWithClassHierarchy> appView,
InterfaceCollection s1,
diff --git a/src/main/java/com/android/tools/r8/ir/analysis/type/DynamicTypeWithLowerBound.java b/src/main/java/com/android/tools/r8/ir/analysis/type/DynamicTypeWithLowerBound.java
index 1b1a557..19d4965 100644
--- a/src/main/java/com/android/tools/r8/ir/analysis/type/DynamicTypeWithLowerBound.java
+++ b/src/main/java/com/android/tools/r8/ir/analysis/type/DynamicTypeWithLowerBound.java
@@ -50,6 +50,7 @@
}
@Override
+ @SuppressWarnings("EqualsGetClass")
public boolean equals(Object other) {
if (other == null || getClass() != other.getClass()) {
return false;
diff --git a/src/main/java/com/android/tools/r8/ir/analysis/type/DynamicTypeWithUpperBound.java b/src/main/java/com/android/tools/r8/ir/analysis/type/DynamicTypeWithUpperBound.java
index 4ed918e..68777ec 100644
--- a/src/main/java/com/android/tools/r8/ir/analysis/type/DynamicTypeWithUpperBound.java
+++ b/src/main/java/com/android/tools/r8/ir/analysis/type/DynamicTypeWithUpperBound.java
@@ -253,6 +253,7 @@
}
@Override
+ @SuppressWarnings("EqualsGetClass")
public boolean equals(Object other) {
if (other == null || getClass() != other.getClass()) {
return false;
diff --git a/src/main/java/com/android/tools/r8/ir/analysis/type/ExactDynamicType.java b/src/main/java/com/android/tools/r8/ir/analysis/type/ExactDynamicType.java
index 0b92334..816388f 100644
--- a/src/main/java/com/android/tools/r8/ir/analysis/type/ExactDynamicType.java
+++ b/src/main/java/com/android/tools/r8/ir/analysis/type/ExactDynamicType.java
@@ -61,6 +61,7 @@
}
@Override
+ @SuppressWarnings("EqualsGetClass")
public boolean equals(Object other) {
if (other == null || getClass() != other.getClass()) {
return false;
diff --git a/src/main/java/com/android/tools/r8/ir/analysis/type/TypeUtils.java b/src/main/java/com/android/tools/r8/ir/analysis/type/TypeUtils.java
index aa30ed7..4471bf8 100644
--- a/src/main/java/com/android/tools/r8/ir/analysis/type/TypeUtils.java
+++ b/src/main/java/com/android/tools/r8/ir/analysis/type/TypeUtils.java
@@ -46,6 +46,7 @@
}
@Override
+ @SuppressWarnings("EqualsGetClass")
public boolean equals(Object obj) {
if (this == obj) {
return true;
diff --git a/src/main/java/com/android/tools/r8/ir/analysis/value/DefiniteBitsNumberValue.java b/src/main/java/com/android/tools/r8/ir/analysis/value/DefiniteBitsNumberValue.java
index ffe6292..83ea1a0 100644
--- a/src/main/java/com/android/tools/r8/ir/analysis/value/DefiniteBitsNumberValue.java
+++ b/src/main/java/com/android/tools/r8/ir/analysis/value/DefiniteBitsNumberValue.java
@@ -119,6 +119,7 @@
}
@Override
+ @SuppressWarnings("EqualsGetClass")
public boolean equals(Object o) {
if (this == o) {
return true;
diff --git a/src/main/java/com/android/tools/r8/ir/analysis/value/NullOrAbstractValue.java b/src/main/java/com/android/tools/r8/ir/analysis/value/NullOrAbstractValue.java
index 983708f..875943f 100644
--- a/src/main/java/com/android/tools/r8/ir/analysis/value/NullOrAbstractValue.java
+++ b/src/main/java/com/android/tools/r8/ir/analysis/value/NullOrAbstractValue.java
@@ -49,6 +49,7 @@
}
@Override
+ @SuppressWarnings("EqualsGetClass")
public boolean equals(Object o) {
if (o == null) {
return false;
diff --git a/src/main/java/com/android/tools/r8/ir/analysis/value/NumberFromIntervalValue.java b/src/main/java/com/android/tools/r8/ir/analysis/value/NumberFromIntervalValue.java
index 997a5ba..9581c42 100644
--- a/src/main/java/com/android/tools/r8/ir/analysis/value/NumberFromIntervalValue.java
+++ b/src/main/java/com/android/tools/r8/ir/analysis/value/NumberFromIntervalValue.java
@@ -92,6 +92,7 @@
}
@Override
+ @SuppressWarnings("EqualsGetClass")
public boolean equals(Object o) {
if (o == null || o.getClass() != getClass()) {
return false;
diff --git a/src/main/java/com/android/tools/r8/ir/analysis/value/NumberFromSetValue.java b/src/main/java/com/android/tools/r8/ir/analysis/value/NumberFromSetValue.java
index dcdcc7e..91b53e1 100644
--- a/src/main/java/com/android/tools/r8/ir/analysis/value/NumberFromSetValue.java
+++ b/src/main/java/com/android/tools/r8/ir/analysis/value/NumberFromSetValue.java
@@ -108,6 +108,7 @@
}
@Override
+ @SuppressWarnings("EqualsGetClass")
public boolean equals(Object o) {
if (o == null || o.getClass() != getClass()) {
return false;
diff --git a/src/main/java/com/android/tools/r8/ir/analysis/value/SingleDexItemBasedStringValue.java b/src/main/java/com/android/tools/r8/ir/analysis/value/SingleDexItemBasedStringValue.java
index da830b6..c5f258a 100644
--- a/src/main/java/com/android/tools/r8/ir/analysis/value/SingleDexItemBasedStringValue.java
+++ b/src/main/java/com/android/tools/r8/ir/analysis/value/SingleDexItemBasedStringValue.java
@@ -55,7 +55,7 @@
}
@Override
- @SuppressWarnings("ReferenceEquality")
+ @SuppressWarnings({"EqualsGetClass", "ReferenceEquality"})
public boolean equals(Object o) {
if (o == null || getClass() != o.getClass()) {
return false;
diff --git a/src/main/java/com/android/tools/r8/ir/analysis/value/SingleStatefulFieldValue.java b/src/main/java/com/android/tools/r8/ir/analysis/value/SingleStatefulFieldValue.java
index 3030116..7d06ddf 100644
--- a/src/main/java/com/android/tools/r8/ir/analysis/value/SingleStatefulFieldValue.java
+++ b/src/main/java/com/android/tools/r8/ir/analysis/value/SingleStatefulFieldValue.java
@@ -45,7 +45,7 @@
}
@Override
- @SuppressWarnings("ReferenceEquality")
+ @SuppressWarnings({"EqualsGetClass", "ReferenceEquality"})
public boolean equals(Object o) {
if (o == null || getClass() != o.getClass()) {
return false;
diff --git a/src/main/java/com/android/tools/r8/ir/analysis/value/SingleStatelessFieldValue.java b/src/main/java/com/android/tools/r8/ir/analysis/value/SingleStatelessFieldValue.java
index d64c67e..7b55767 100644
--- a/src/main/java/com/android/tools/r8/ir/analysis/value/SingleStatelessFieldValue.java
+++ b/src/main/java/com/android/tools/r8/ir/analysis/value/SingleStatelessFieldValue.java
@@ -30,7 +30,7 @@
}
@Override
- @SuppressWarnings("ReferenceEquality")
+ @SuppressWarnings({"EqualsGetClass", "ReferenceEquality"})
public boolean equals(Object o) {
if (o == null || getClass() != o.getClass()) {
return false;
diff --git a/src/main/java/com/android/tools/r8/ir/analysis/value/StatefulObjectValue.java b/src/main/java/com/android/tools/r8/ir/analysis/value/StatefulObjectValue.java
index 1d46931..25deb94 100644
--- a/src/main/java/com/android/tools/r8/ir/analysis/value/StatefulObjectValue.java
+++ b/src/main/java/com/android/tools/r8/ir/analysis/value/StatefulObjectValue.java
@@ -71,6 +71,7 @@
}
@Override
+ @SuppressWarnings("EqualsGetClass")
public boolean equals(Object o) {
if (o == this) {
return true;
diff --git a/src/main/java/com/android/tools/r8/ir/analysis/value/objectstate/EnumValuesObjectState.java b/src/main/java/com/android/tools/r8/ir/analysis/value/objectstate/EnumValuesObjectState.java
index 433e5f4..28652ca 100644
--- a/src/main/java/com/android/tools/r8/ir/analysis/value/objectstate/EnumValuesObjectState.java
+++ b/src/main/java/com/android/tools/r8/ir/analysis/value/objectstate/EnumValuesObjectState.java
@@ -106,6 +106,7 @@
}
@Override
+ @SuppressWarnings("EqualsGetClass")
public boolean equals(Object o) {
if (getClass() != o.getClass()) {
return false;
diff --git a/src/main/java/com/android/tools/r8/ir/analysis/value/objectstate/NonEmptyObjectState.java b/src/main/java/com/android/tools/r8/ir/analysis/value/objectstate/NonEmptyObjectState.java
index 2b6f00d..e5f5b5e 100644
--- a/src/main/java/com/android/tools/r8/ir/analysis/value/objectstate/NonEmptyObjectState.java
+++ b/src/main/java/com/android/tools/r8/ir/analysis/value/objectstate/NonEmptyObjectState.java
@@ -54,6 +54,7 @@
}
@Override
+ @SuppressWarnings("EqualsGetClass")
public boolean equals(Object o) {
if (o == null || getClass() != o.getClass()) {
return false;
diff --git a/src/main/java/com/android/tools/r8/ir/code/BasicBlock.java b/src/main/java/com/android/tools/r8/ir/code/BasicBlock.java
index 0dbf1fd..55c29af 100644
--- a/src/main/java/com/android/tools/r8/ir/code/BasicBlock.java
+++ b/src/main/java/com/android/tools/r8/ir/code/BasicBlock.java
@@ -334,6 +334,7 @@
return false;
}
+ @SuppressWarnings("MixedMutabilityReturnType")
public List<BasicBlock> getNormalSuccessors() {
if (!hasCatchHandlers()) {
return successors;
diff --git a/src/main/java/com/android/tools/r8/ir/code/IRCode.java b/src/main/java/com/android/tools/r8/ir/code/IRCode.java
index 5055a37..834c14c 100644
--- a/src/main/java/com/android/tools/r8/ir/code/IRCode.java
+++ b/src/main/java/com/android/tools/r8/ir/code/IRCode.java
@@ -95,6 +95,7 @@
}
@Override
+ @SuppressWarnings("EqualsUnsafeCast")
public boolean equals(Object o) {
LiveAtEntrySets other = (LiveAtEntrySets) o;
return liveValues.equals(other.liveValues) && liveLocalValues.equals(other.liveLocalValues);
@@ -109,6 +110,8 @@
// sorting.
private static class BlockMarker {
final BasicBlock block;
+
+ @SuppressWarnings("UnusedVariable")
BlockMarker(BasicBlock block) {
this.block = block;
}
@@ -127,7 +130,6 @@
public final NumberGenerator basicBlockNumberGenerator;
private int usedMarkingColors = 0;
- private boolean numbered = false;
private int nextInstructionNumber = 0;
private final IRMetadata metadata;
diff --git a/src/main/java/com/android/tools/r8/ir/code/Instruction.java b/src/main/java/com/android/tools/r8/ir/code/Instruction.java
index a778b37..b98f3a0 100644
--- a/src/main/java/com/android/tools/r8/ir/code/Instruction.java
+++ b/src/main/java/com/android/tools/r8/ir/code/Instruction.java
@@ -518,6 +518,7 @@
return true;
}
+ @SuppressWarnings("UnusedVariable")
public boolean identicalAfterRegisterAllocation(
Instruction other, RegisterAllocator allocator, MethodConversionOptions conversionOptions) {
if (other.getClass() != getClass()) {
diff --git a/src/main/java/com/android/tools/r8/ir/code/Invoke.java b/src/main/java/com/android/tools/r8/ir/code/Invoke.java
index 4cd8e15..a2bb674 100644
--- a/src/main/java/com/android/tools/r8/ir/code/Invoke.java
+++ b/src/main/java/com/android/tools/r8/ir/code/Invoke.java
@@ -26,11 +26,13 @@
static final int NO_SUCH_DEX_INSTRUCTION = -1;
+ @SuppressWarnings("InlineMeSuggester")
protected Invoke(Value result, List<Value> arguments) {
super(result, arguments);
}
@Deprecated
+ @SuppressWarnings("InlineMeSuggester")
public static Invoke create(
InvokeType type, DexItem target, DexProto proto, Value result, List<Value> arguments) {
return create(type, target, proto, result, arguments, false);
diff --git a/src/main/java/com/android/tools/r8/ir/code/InvokeCustom.java b/src/main/java/com/android/tools/r8/ir/code/InvokeCustom.java
index ae2c6f0..0ee142f 100644
--- a/src/main/java/com/android/tools/r8/ir/code/InvokeCustom.java
+++ b/src/main/java/com/android/tools/r8/ir/code/InvokeCustom.java
@@ -68,7 +68,7 @@
}
@Override
- @SuppressWarnings("ReferenceEquality")
+ @SuppressWarnings({"BadImport", "ReferenceEquality"})
public TypeElement evaluate(AppView<?> appView) {
TypeElement returnType = super.evaluate(appView);
if (!appView.appInfo().hasLiveness()) {
diff --git a/src/main/java/com/android/tools/r8/ir/code/NextUntilIterator.java b/src/main/java/com/android/tools/r8/ir/code/NextUntilIterator.java
index cd08f22..d87fed8 100644
--- a/src/main/java/com/android/tools/r8/ir/code/NextUntilIterator.java
+++ b/src/main/java/com/android/tools/r8/ir/code/NextUntilIterator.java
@@ -14,7 +14,7 @@
* @returns the item that matched the predicate or {@code null} if all items fail the predicate
* test
*/
- @SuppressWarnings("unchecked")
+ @SuppressWarnings({"TypeParameterUnusedInFormals", "unchecked"})
default <S extends T> S nextUntil(Predicate<T> predicate) {
while (hasNext()) {
T item = next();
diff --git a/src/main/java/com/android/tools/r8/ir/conversion/CfSourceCode.java b/src/main/java/com/android/tools/r8/ir/conversion/CfSourceCode.java
index f4f6a36..424108f 100644
--- a/src/main/java/com/android/tools/r8/ir/conversion/CfSourceCode.java
+++ b/src/main/java/com/android/tools/r8/ir/conversion/CfSourceCode.java
@@ -139,7 +139,9 @@
private static class LocalVariableList {
+ @SuppressWarnings("UnusedVariable")
public static final LocalVariableList EMPTY = new LocalVariableList(0, 0, emptyMap());
+
public final int startOffset;
public final int endOffset;
public final Int2ReferenceMap<DebugLocalInfo> locals;
diff --git a/src/main/java/com/android/tools/r8/ir/conversion/DexBuilder.java b/src/main/java/com/android/tools/r8/ir/conversion/DexBuilder.java
index 300998f..18fc132 100644
--- a/src/main/java/com/android/tools/r8/ir/conversion/DexBuilder.java
+++ b/src/main/java/com/android/tools/r8/ir/conversion/DexBuilder.java
@@ -664,6 +664,7 @@
add(branch, new IfInfo(branch));
}
+ @SuppressWarnings("UnnecessaryParentheses")
public void addMove(Move move) {
add(move, new MoveInfo(move));
}
@@ -680,6 +681,7 @@
|| (instruction.isGoto() && instruction.asGoto().getTarget() == nextBlock);
}
+ @SuppressWarnings("UnnecessaryParentheses")
private static boolean isNonMaterializingConstNumber(
com.android.tools.r8.ir.code.Instruction instruction) {
return instruction.isConstNumber()
diff --git a/src/main/java/com/android/tools/r8/ir/conversion/ExtraConstantIntParameter.java b/src/main/java/com/android/tools/r8/ir/conversion/ExtraConstantIntParameter.java
index 7803f4e..a725f36 100644
--- a/src/main/java/com/android/tools/r8/ir/conversion/ExtraConstantIntParameter.java
+++ b/src/main/java/com/android/tools/r8/ir/conversion/ExtraConstantIntParameter.java
@@ -36,6 +36,7 @@
}
@Override
+ @SuppressWarnings("EqualsGetClass")
public boolean equals(Object obj) {
if (obj == null || getClass() != obj.getClass()) {
return false;
diff --git a/src/main/java/com/android/tools/r8/ir/conversion/ExtraUnusedNullParameter.java b/src/main/java/com/android/tools/r8/ir/conversion/ExtraUnusedNullParameter.java
index cc8a8c7..41f3237 100644
--- a/src/main/java/com/android/tools/r8/ir/conversion/ExtraUnusedNullParameter.java
+++ b/src/main/java/com/android/tools/r8/ir/conversion/ExtraUnusedNullParameter.java
@@ -23,6 +23,7 @@
this.type = type;
}
+ @SuppressWarnings("MixedMutabilityReturnType")
public static List<ExtraUnusedNullParameter> computeExtraUnusedNullParameters(
DexMethod from, DexMethod to) {
int numberOfExtraNullParameters = to.getArity() - from.getArity();
@@ -57,6 +58,7 @@
}
@Override
+ @SuppressWarnings("EqualsGetClass")
public boolean equals(Object obj) {
return obj != null && getClass() == obj.getClass();
}
diff --git a/src/main/java/com/android/tools/r8/ir/conversion/IRBuilder.java b/src/main/java/com/android/tools/r8/ir/conversion/IRBuilder.java
index d1d7ab6..63a52e5 100644
--- a/src/main/java/com/android/tools/r8/ir/conversion/IRBuilder.java
+++ b/src/main/java/com/android/tools/r8/ir/conversion/IRBuilder.java
@@ -2726,6 +2726,7 @@
}
@Override
+ @SuppressWarnings("UnnecessaryParentheses")
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append(("blocks:\n"));
diff --git a/src/main/java/com/android/tools/r8/ir/conversion/IRToDexFinalizer.java b/src/main/java/com/android/tools/r8/ir/conversion/IRToDexFinalizer.java
index 535c9e7..87f9a4b 100644
--- a/src/main/java/com/android/tools/r8/ir/conversion/IRToDexFinalizer.java
+++ b/src/main/java/com/android/tools/r8/ir/conversion/IRToDexFinalizer.java
@@ -59,6 +59,7 @@
assert code.isConsistentSSA(appView);
}
+ @SuppressWarnings("UnusedVariable")
private RegisterAllocator performRegisterAllocation(
IRCode code, DexEncodedMethod method, Timing timing) {
// Always perform dead code elimination before register allocation. The register allocator
diff --git a/src/main/java/com/android/tools/r8/ir/conversion/PostMethodProcessor.java b/src/main/java/com/android/tools/r8/ir/conversion/PostMethodProcessor.java
index 03f8859..893db6c 100644
--- a/src/main/java/com/android/tools/r8/ir/conversion/PostMethodProcessor.java
+++ b/src/main/java/com/android/tools/r8/ir/conversion/PostMethodProcessor.java
@@ -165,6 +165,7 @@
}
}
+ @SuppressWarnings("UnusedVariable")
private Deque<ProgramMethodSet> createWaves(CallGraph callGraph) {
Deque<ProgramMethodSet> waves = new ArrayDeque<>();
int waveCount = 1;
diff --git a/src/main/java/com/android/tools/r8/ir/conversion/PrimaryD8L8IRConverter.java b/src/main/java/com/android/tools/r8/ir/conversion/PrimaryD8L8IRConverter.java
index c5c3e73..b840b0d 100644
--- a/src/main/java/com/android/tools/r8/ir/conversion/PrimaryD8L8IRConverter.java
+++ b/src/main/java/com/android/tools/r8/ir/conversion/PrimaryD8L8IRConverter.java
@@ -51,6 +51,7 @@
this.timing = timing;
}
+ @SuppressWarnings("BadImport")
public void convert(AppView<AppInfo> appView, ExecutorService executorService)
throws ExecutionException {
LambdaDeserializationMethodRemover.run(appView);
@@ -343,6 +344,7 @@
programAdditions.apply(executorService);
}
+ @SuppressWarnings("BadImport")
private void processCovariantReturnTypeAnnotations(
Builder<?> builder, ProfileCollectionAdditions profileCollectionAdditions) {
if (covariantReturnTypeAnnotationTransformer != null) {
@@ -370,6 +372,7 @@
methodProcessingContext));
}
+ @SuppressWarnings("UnusedVariable")
private Timing rewriteNonDesugaredCodeInternal(
ProgramMethod method,
CfInstructionDesugaringEventConsumer desugaringEventConsumer,
diff --git a/src/main/java/com/android/tools/r8/ir/conversion/PrimaryMethodProcessor.java b/src/main/java/com/android/tools/r8/ir/conversion/PrimaryMethodProcessor.java
index 45450f9..fb136e1 100644
--- a/src/main/java/com/android/tools/r8/ir/conversion/PrimaryMethodProcessor.java
+++ b/src/main/java/com/android/tools/r8/ir/conversion/PrimaryMethodProcessor.java
@@ -98,6 +98,7 @@
return callSiteInformation;
}
+ @SuppressWarnings("UnusedVariable")
private Deque<ProgramMethodSet> createWaves(AppView<?> appView, CallGraph callGraph) {
InternalOptions options = appView.options();
Deque<ProgramMethodSet> waves = new ArrayDeque<>();
diff --git a/src/main/java/com/android/tools/r8/ir/conversion/StringSwitchRemover.java b/src/main/java/com/android/tools/r8/ir/conversion/StringSwitchRemover.java
index dc2bcbd..38194cb 100644
--- a/src/main/java/com/android/tools/r8/ir/conversion/StringSwitchRemover.java
+++ b/src/main/java/com/android/tools/r8/ir/conversion/StringSwitchRemover.java
@@ -112,6 +112,7 @@
&& isClassNameValue(theSwitch.value(), appView.dexItemFactory());
}
+ @SuppressWarnings("UnusedVariable")
private boolean prepareForStringSwitchRemoval(IRCode code) {
boolean hasStringSwitch = false;
ListIterator<BasicBlock> blockIterator = code.listIterator();
diff --git a/src/main/java/com/android/tools/r8/ir/conversion/callgraph/CallGraph.java b/src/main/java/com/android/tools/r8/ir/conversion/callgraph/CallGraph.java
index 313f4d1..a5a151b 100644
--- a/src/main/java/com/android/tools/r8/ir/conversion/callgraph/CallGraph.java
+++ b/src/main/java/com/android/tools/r8/ir/conversion/callgraph/CallGraph.java
@@ -7,7 +7,6 @@
import com.android.tools.r8.graph.AppView;
import com.android.tools.r8.graph.DexMethod;
import com.android.tools.r8.ir.conversion.callgraph.CallSiteInformation.CallGraphBasedCallSiteInformation;
-import com.android.tools.r8.ir.conversion.callgraph.CycleEliminator.CycleEliminationResult;
import com.android.tools.r8.shaking.AppInfoWithLiveness;
import com.android.tools.r8.utils.InternalOptions;
import com.android.tools.r8.utils.collections.ProgramMethodSet;
@@ -28,7 +27,8 @@
* <p>Each node in the graph contain the methods called and the calling methods. For virtual and
* interface calls all potential calls from subtypes are recorded.
*
- * <p>Only methods in the program - not library methods - are represented.
+ * <p>Only methods in the program - not library methods - are
+ * represented. @SuppressWarnings("UnusedVariable")
*
* <p>The directional edges are represented as sets of nodes in each node (called methods and
* callees).
@@ -40,15 +40,8 @@
*/
public class CallGraph extends CallGraphBase<Node> {
- private final CycleEliminationResult cycleEliminationResult;
-
CallGraph(Map<DexMethod, Node> nodes) {
- this(nodes, null);
- }
-
- CallGraph(Map<DexMethod, Node> nodes, CycleEliminationResult cycleEliminationResult) {
super(nodes);
- this.cycleEliminationResult = cycleEliminationResult;
}
public static CallGraphBuilder builder(AppView<AppInfoWithLiveness> appView) {
diff --git a/src/main/java/com/android/tools/r8/ir/conversion/callgraph/IRProcessingCallGraphBuilderBase.java b/src/main/java/com/android/tools/r8/ir/conversion/callgraph/IRProcessingCallGraphBuilderBase.java
index a580f04..e58e0df 100644
--- a/src/main/java/com/android/tools/r8/ir/conversion/callgraph/IRProcessingCallGraphBuilderBase.java
+++ b/src/main/java/com/android/tools/r8/ir/conversion/callgraph/IRProcessingCallGraphBuilderBase.java
@@ -5,7 +5,6 @@
import com.android.tools.r8.graph.AppView;
import com.android.tools.r8.graph.ProgramMethod;
-import com.android.tools.r8.ir.conversion.callgraph.CycleEliminator.CycleEliminationResult;
import com.android.tools.r8.shaking.AppInfoWithLiveness;
import com.android.tools.r8.utils.Timing;
import com.google.common.collect.Sets;
@@ -34,14 +33,13 @@
// Sort the nodes for deterministic cycle elimination.
Set<Node> nodesWithDeterministicOrder = Sets.newTreeSet(nodes.values());
CycleEliminator cycleEliminator = new CycleEliminator();
- CycleEliminationResult cycleEliminationResult =
- cycleEliminator.breakCycles(nodesWithDeterministicOrder);
+ cycleEliminator.breakCycles(nodesWithDeterministicOrder);
timing.end();
timing.end();
assert cycleEliminator.breakCycles(nodesWithDeterministicOrder).numberOfRemovedCallEdges()
== 0; // The cycles should be gone.
- return new CallGraph(nodes, cycleEliminationResult);
+ return new CallGraph(nodes);
}
@Override
diff --git a/src/main/java/com/android/tools/r8/ir/conversion/callgraph/IRProcessingCallGraphUseRegistry.java b/src/main/java/com/android/tools/r8/ir/conversion/callgraph/IRProcessingCallGraphUseRegistry.java
index 00c9b70..be5c506 100644
--- a/src/main/java/com/android/tools/r8/ir/conversion/callgraph/IRProcessingCallGraphUseRegistry.java
+++ b/src/main/java/com/android/tools/r8/ir/conversion/callgraph/IRProcessingCallGraphUseRegistry.java
@@ -45,7 +45,7 @@
protected void addClassInitializerTarget(DexType type) {
assert type.isClassType();
- DexProgramClass clazz = asProgramClassOrNull(appView.definitionFor(type));
+ DexProgramClass clazz = asProgramClassOrNull(appViewWithLiveness.definitionFor(type));
if (clazz != null) {
addClassInitializerTarget(clazz);
}
@@ -60,13 +60,15 @@
}
private void processFieldRead(DexField reference) {
- DexField rewrittenReference = appView.graphLens().lookupField(reference, getCodeLens());
+ DexField rewrittenReference =
+ appViewWithLiveness.graphLens().lookupField(reference, getCodeLens());
if (!rewrittenReference.getHolderType().isClassType()) {
return;
}
- ProgramField field = appView.appInfo().resolveField(rewrittenReference).getSingleProgramField();
- if (field == null || appView.appInfo().isPinned(field)) {
+ ProgramField field =
+ appViewWithLiveness.appInfo().resolveField(rewrittenReference).getSingleProgramField();
+ if (field == null || appViewWithLiveness.appInfo().isPinned(field)) {
return;
}
@@ -84,13 +86,15 @@
}
private void processFieldWrite(DexField reference) {
- DexField rewrittenReference = appView.graphLens().lookupField(reference, getCodeLens());
+ DexField rewrittenReference =
+ appViewWithLiveness.graphLens().lookupField(reference, getCodeLens());
if (!rewrittenReference.getHolderType().isClassType()) {
return;
}
- ProgramField field = appView.appInfo().resolveField(rewrittenReference).getSingleProgramField();
- if (field == null || appView.appInfo().isPinned(field)) {
+ ProgramField field =
+ appViewWithLiveness.appInfo().resolveField(rewrittenReference).getSingleProgramField();
+ if (field == null || appViewWithLiveness.appInfo().isPinned(field)) {
return;
}
@@ -101,14 +105,14 @@
}
private void processInitClass(DexType type) {
- DexType rewrittenType = appView.graphLens().lookupType(type);
+ DexType rewrittenType = appViewWithLiveness.graphLens().lookupType(type);
if (rewrittenType.isIntType()) {
// Type was unboxed; init-class instruction will be removed by enum unboxer.
- assert appView.hasUnboxedEnums();
- assert appView.unboxedEnums().isUnboxedEnum(type);
+ assert appViewWithLiveness.hasUnboxedEnums();
+ assert appViewWithLiveness.unboxedEnums().isUnboxedEnum(type);
return;
}
- DexProgramClass clazz = asProgramClassOrNull(appView.definitionFor(rewrittenType));
+ DexProgramClass clazz = asProgramClassOrNull(appViewWithLiveness.definitionFor(rewrittenType));
if (clazz == null) {
assert false;
return;
diff --git a/src/main/java/com/android/tools/r8/ir/conversion/callgraph/InvokeExtractor.java b/src/main/java/com/android/tools/r8/ir/conversion/callgraph/InvokeExtractor.java
index 21e446b..1f0e197 100644
--- a/src/main/java/com/android/tools/r8/ir/conversion/callgraph/InvokeExtractor.java
+++ b/src/main/java/com/android/tools/r8/ir/conversion/callgraph/InvokeExtractor.java
@@ -25,20 +25,20 @@
public class InvokeExtractor<N extends NodeBase<N>> extends UseRegistry<ProgramMethod> {
- protected final AppView<AppInfoWithLiveness> appView;
+ protected final AppView<AppInfoWithLiveness> appViewWithLiveness;
protected final N currentMethod;
protected final Function<ProgramMethod, N> nodeFactory;
protected final Map<DexMethod, ProgramMethodSet> possibleProgramTargetsCache;
protected final Predicate<ProgramMethod> targetTester;
public InvokeExtractor(
- AppView<AppInfoWithLiveness> appView,
+ AppView<AppInfoWithLiveness> appViewWithLiveness,
N currentMethod,
Function<ProgramMethod, N> nodeFactory,
Map<DexMethod, ProgramMethodSet> possibleProgramTargetsCache,
Predicate<ProgramMethod> targetTester) {
- super(appView, currentMethod.getProgramMethod());
- this.appView = appView;
+ super(appViewWithLiveness, currentMethod.getProgramMethod());
+ this.appViewWithLiveness = appViewWithLiveness;
this.currentMethod = currentMethod;
this.nodeFactory = nodeFactory;
this.possibleProgramTargetsCache = possibleProgramTargetsCache;
@@ -57,7 +57,9 @@
// We don't care about calls to native methods.
return;
}
- if (!appView.getKeepInfo(callee).isOptimizationAllowed(appView.options())) {
+ if (!appViewWithLiveness
+ .getKeepInfo(callee)
+ .isOptimizationAllowed(appViewWithLiveness.options())) {
// Since the callee is kept and optimizations are disallowed, we cannot inline it into the
// caller, and we also cannot collect any optimization info for the method. Therefore, we
// drop the call edge to reduce the total number of call graph edges, which should lead to
@@ -70,7 +72,7 @@
private void processInvoke(InvokeType originalType, DexMethod originalMethod) {
ProgramMethod context = currentMethod.getProgramMethod();
MethodLookupResult result =
- appView
+ appViewWithLiveness
.graphLens()
.lookupMethod(originalMethod, context.getReference(), originalType, getCodeLens());
DexMethod method = result.getReference();
@@ -78,14 +80,17 @@
if (type == InvokeType.INTERFACE || type == InvokeType.VIRTUAL) {
// For virtual and interface calls add all potential targets that could be called.
MethodResolutionResult resolutionResult =
- appView.appInfo().resolveMethodLegacy(method, type == InvokeType.INTERFACE);
+ appViewWithLiveness.appInfo().resolveMethodLegacy(method, type == InvokeType.INTERFACE);
DexClassAndMethod target = resolutionResult.getResolutionPair();
if (target != null) {
processInvokeWithDynamicDispatch(type, target, context);
}
} else {
ProgramMethod singleTarget =
- appView.appInfo().lookupSingleProgramTarget(appView, type, method, context, appView);
+ appViewWithLiveness
+ .appInfo()
+ .lookupSingleProgramTarget(
+ appViewWithLiveness, type, method, context, appViewWithLiveness);
if (singleTarget != null) {
processSingleTarget(singleTarget, context);
}
@@ -103,7 +108,7 @@
InvokeType type, DexClassAndMethod encodedTarget, ProgramMethod context) {
DexMethod target = encodedTarget.getReference();
DexClass clazz = encodedTarget.getHolder();
- if (!appView.options().testing.addCallEdgesForLibraryInvokes) {
+ if (!appViewWithLiveness.options().testing.addCallEdgesForLibraryInvokes) {
if (clazz.isLibraryClass()) {
// Likely to have many possible targets.
return;
@@ -116,10 +121,11 @@
target,
method -> {
MethodResolutionResult resolution =
- appView.appInfo().resolveMethodLegacy(method, isInterface);
+ appViewWithLiveness.appInfo().resolveMethodLegacy(method, isInterface);
if (resolution.isVirtualTarget()) {
LookupResult lookupResult =
- resolution.lookupVirtualDispatchTargets(context.getHolder(), appView);
+ resolution.lookupVirtualDispatchTargets(
+ context.getHolder(), appViewWithLiveness);
if (lookupResult.isLookupResultSuccess()) {
ProgramMethodSet targets = ProgramMethodSet.create();
lookupResult
@@ -147,7 +153,7 @@
if (possibleProgramTargets != null) {
boolean likelySpuriousCallEdge =
possibleProgramTargets.size()
- >= appView.options().callGraphLikelySpuriousCallEdgeThreshold;
+ >= appViewWithLiveness.options().callGraphLikelySpuriousCallEdgeThreshold;
for (ProgramMethod possibleTarget : possibleProgramTargets) {
addCallEdge(possibleTarget, likelySpuriousCallEdge);
}
diff --git a/src/main/java/com/android/tools/r8/ir/conversion/passes/CodeRewriterPassCollection.java b/src/main/java/com/android/tools/r8/ir/conversion/passes/CodeRewriterPassCollection.java
index 2aa9e64..1610454 100644
--- a/src/main/java/com/android/tools/r8/ir/conversion/passes/CodeRewriterPassCollection.java
+++ b/src/main/java/com/android/tools/r8/ir/conversion/passes/CodeRewriterPassCollection.java
@@ -18,11 +18,9 @@
public class CodeRewriterPassCollection {
- private final AppView<?> appView;
private final List<CodeRewriterPass<?>> passes;
- public CodeRewriterPassCollection(AppView<?> appView, List<CodeRewriterPass<?>> passes) {
- this.appView = appView;
+ public CodeRewriterPassCollection(List<CodeRewriterPass<?>> passes) {
this.passes = passes;
}
@@ -43,7 +41,7 @@
passes.add(new RedundantConstNumberRemover(appView));
passes.add(new RedundantFieldLoadAndStoreElimination(appView));
passes.add(new BinopRewriter(appView));
- return new CodeRewriterPassCollection(appView, passes);
+ return new CodeRewriterPassCollection(passes);
}
public void run(
diff --git a/src/main/java/com/android/tools/r8/ir/conversion/passes/NaturalIntLoopRemover.java b/src/main/java/com/android/tools/r8/ir/conversion/passes/NaturalIntLoopRemover.java
index 5d078fe..f426278 100644
--- a/src/main/java/com/android/tools/r8/ir/conversion/passes/NaturalIntLoopRemover.java
+++ b/src/main/java/com/android/tools/r8/ir/conversion/passes/NaturalIntLoopRemover.java
@@ -66,6 +66,7 @@
&& code.getBlocks().size() >= 4;
}
+ @SuppressWarnings("UnnecessaryParentheses")
private boolean isComparisonBlock(BasicBlock comparisonBlockCandidate) {
if (!comparisonBlockCandidate.exit().isIf()
|| comparisonBlockCandidate.exit().asIf().isZeroTest()) {
diff --git a/src/main/java/com/android/tools/r8/ir/desugar/BackportedMethodRewriter.java b/src/main/java/com/android/tools/r8/ir/desugar/BackportedMethodRewriter.java
index 3c8315b..a6934c4 100644
--- a/src/main/java/com/android/tools/r8/ir/desugar/BackportedMethodRewriter.java
+++ b/src/main/java/com/android/tools/r8/ir/desugar/BackportedMethodRewriter.java
@@ -1842,16 +1842,15 @@
private static class MethodGenerator extends MethodProvider {
private final TemplateMethodFactory factory;
- private final String methodName;
MethodGenerator(DexMethod method, TemplateMethodFactory factory) {
this(method, factory, method.name.toString());
}
+ @SuppressWarnings("UnusedVariable")
MethodGenerator(DexMethod method, TemplateMethodFactory factory, String methodName) {
super(method);
this.factory = factory;
- this.methodName = methodName;
}
protected SyntheticKind getSyntheticKind(SyntheticNaming naming) {
diff --git a/src/main/java/com/android/tools/r8/ir/desugar/BufferCovariantReturnTypeRewriter.java b/src/main/java/com/android/tools/r8/ir/desugar/BufferCovariantReturnTypeRewriter.java
index b2d4efa..234c2fe 100644
--- a/src/main/java/com/android/tools/r8/ir/desugar/BufferCovariantReturnTypeRewriter.java
+++ b/src/main/java/com/android/tools/r8/ir/desugar/BufferCovariantReturnTypeRewriter.java
@@ -20,11 +20,9 @@
*/
public class BufferCovariantReturnTypeRewriter implements CfInstructionDesugaring {
- private final AppView<?> appView;
private final DexItemFactory factory;
public BufferCovariantReturnTypeRewriter(AppView<?> appView) {
- this.appView = appView;
this.factory = appView.dexItemFactory();
}
diff --git a/src/main/java/com/android/tools/r8/ir/desugar/CfInstructionDesugaringEventConsumer.java b/src/main/java/com/android/tools/r8/ir/desugar/CfInstructionDesugaringEventConsumer.java
index bf7ebd5..0c3d095 100644
--- a/src/main/java/com/android/tools/r8/ir/desugar/CfInstructionDesugaringEventConsumer.java
+++ b/src/main/java/com/android/tools/r8/ir/desugar/CfInstructionDesugaringEventConsumer.java
@@ -335,6 +335,7 @@
acceptUtilityMethod(method, context);
}
+ @SuppressWarnings("UnusedVariable")
private void acceptUtilityMethod(ProgramMethod method, ProgramMethod context) {
methodProcessor.scheduleDesugaredMethodForProcessing(method);
}
@@ -594,11 +595,13 @@
}
@Override
+ @SuppressWarnings("UnusedVariable")
public void acceptUtilityThrowRuntimeExceptionWithMessageMethod(
ProgramMethod method, ProgramMethod context) {
acceptUtilityMethod(method, context);
}
+ @SuppressWarnings("UnusedVariable")
private void acceptUtilityMethod(ProgramMethod method, ProgramMethod context) {
// Intentionally empty. The method will be hit by tracing if required.
}
diff --git a/src/main/java/com/android/tools/r8/ir/desugar/LambdaConstructorSourceCode.java b/src/main/java/com/android/tools/r8/ir/desugar/LambdaConstructorSourceCode.java
index d5673fd..d48b38a 100644
--- a/src/main/java/com/android/tools/r8/ir/desugar/LambdaConstructorSourceCode.java
+++ b/src/main/java/com/android/tools/r8/ir/desugar/LambdaConstructorSourceCode.java
@@ -21,7 +21,7 @@
final class LambdaConstructorSourceCode {
- @SuppressWarnings("ReferenceEquality")
+ @SuppressWarnings({"BadImport", "ReferenceEquality"})
public static CfCode build(LambdaClass lambda) {
int maxStack = 1;
ImmutableList<CfTryCatch> tryCatchRanges = ImmutableList.of();
diff --git a/src/main/java/com/android/tools/r8/ir/desugar/LambdaMainMethodSourceCode.java b/src/main/java/com/android/tools/r8/ir/desugar/LambdaMainMethodSourceCode.java
index e581cf6..f13a1ea 100644
--- a/src/main/java/com/android/tools/r8/ir/desugar/LambdaMainMethodSourceCode.java
+++ b/src/main/java/com/android/tools/r8/ir/desugar/LambdaMainMethodSourceCode.java
@@ -171,7 +171,7 @@
}
}
- @SuppressWarnings("ReferenceEquality")
+ @SuppressWarnings({"BadImport", "ReferenceEquality"})
public static CfCode build(
LambdaClass lambda, DexMethod mainMethod, DesugarInvoke desugarInvoke) {
DexItemFactory factory = lambda.appView.dexItemFactory();
@@ -335,6 +335,7 @@
// Adds necessary casts and transformations to adjust the value
// returned by impl-method to expected return type of the method.
+ @SuppressWarnings("BadImport")
private static int prepareReturnValue(
DexType erasedType,
DexType enforcedType,
@@ -355,6 +356,7 @@
// be converted to enforced parameter type (`enforcedType`), which,
// in its turn, may need to be adjusted to the parameter type of
// the impl-method (`expectedType`).
+ @SuppressWarnings("BadImport")
private static int prepareParameterValue(
DexType erasedType,
DexType enforcedType,
@@ -365,7 +367,7 @@
return adjustType(enforcedType, expectedType, false, instructions, factory);
}
- @SuppressWarnings("ReferenceEquality")
+ @SuppressWarnings({"BadImport", "ReferenceEquality"})
private static void enforceParameterType(
DexType paramType,
DexType enforcedType,
@@ -380,7 +382,7 @@
}
}
- @SuppressWarnings("ReferenceEquality")
+ @SuppressWarnings({"BadImport", "ReferenceEquality"})
private static int adjustType(
DexType fromType,
DexType toType,
@@ -402,7 +404,7 @@
ValueType.fromDexType(toType).requiredRegisters()));
}
- @SuppressWarnings("ReferenceEquality")
+ @SuppressWarnings({"BadImport", "ReferenceEquality"})
private static void internalAdjustType(
DexType fromType,
DexType toType,
@@ -480,7 +482,7 @@
+ fromType.toSourceString() + " to " + toType);
}
- @SuppressWarnings("ReferenceEquality")
+ @SuppressWarnings({"BadImport", "ReferenceEquality"})
private static void addPrimitiveWideningConversion(
DexType fromType, DexType toType, Builder<CfInstruction> instructions) {
assert fromType.isPrimitiveType() && toType.isPrimitiveType();
@@ -542,18 +544,16 @@
"converted to " + toType.toSourceString() + " via primitive widening conversion.");
}
+ @SuppressWarnings("BadImport")
private static void addPrimitiveUnboxing(
- DexType boxType,
- Builder<CfInstruction> instructions,
- DexItemFactory factory) {
+ DexType boxType, Builder<CfInstruction> instructions, DexItemFactory factory) {
DexMethod method = factory.getUnboxPrimitiveMethod(boxType);
instructions.add(new CfInvoke(Opcodes.INVOKEVIRTUAL, method, false));
}
+ @SuppressWarnings("BadImport")
private static void addPrimitiveBoxing(
- DexType boxType,
- Builder<CfInstruction> instructions,
- DexItemFactory factory) {
+ DexType boxType, Builder<CfInstruction> instructions, DexItemFactory factory) {
DexMethod method = factory.getBoxPrimitiveMethod(boxType);
instructions.add(new CfInvoke(Opcodes.INVOKESTATIC, method, false));
}
diff --git a/src/main/java/com/android/tools/r8/ir/desugar/NonEmptyCfInstructionDesugaringCollection.java b/src/main/java/com/android/tools/r8/ir/desugar/NonEmptyCfInstructionDesugaringCollection.java
index f40acbb..d16016a 100644
--- a/src/main/java/com/android/tools/r8/ir/desugar/NonEmptyCfInstructionDesugaringCollection.java
+++ b/src/main/java/com/android/tools/r8/ir/desugar/NonEmptyCfInstructionDesugaringCollection.java
@@ -61,12 +61,10 @@
private final InterfaceMethodRewriter interfaceMethodRewriter;
private final DesugaredLibraryAPIConverter desugaredLibraryAPIConverter;
private final DesugaredLibraryDisableDesugarer disableDesugarer;
- private final AndroidApiLevelCompute apiLevelCompute;
NonEmptyCfInstructionDesugaringCollection(
AppView<?> appView, AndroidApiLevelCompute apiLevelCompute) {
this.appView = appView;
- this.apiLevelCompute = apiLevelCompute;
AlwaysThrowingInstructionDesugaring alwaysThrowingInstructionDesugaring =
appView.enableWholeProgramOptimizations()
? new AlwaysThrowingInstructionDesugaring(appView.withClassHierarchy())
diff --git a/src/main/java/com/android/tools/r8/ir/desugar/UnrepresentableInDexInstructionRemover.java b/src/main/java/com/android/tools/r8/ir/desugar/UnrepresentableInDexInstructionRemover.java
index 51976fb..31c2f61 100644
--- a/src/main/java/com/android/tools/r8/ir/desugar/UnrepresentableInDexInstructionRemover.java
+++ b/src/main/java/com/android/tools/r8/ir/desugar/UnrepresentableInDexInstructionRemover.java
@@ -107,16 +107,19 @@
+ descriptor));
}
+ @SuppressWarnings("BadImport")
static void pop(DexType type, Builder<CfInstruction> builder) {
assert !type.isVoidType();
builder.add(new CfStackInstruction(type.isWideType() ? Opcode.Pop2 : Opcode.Pop));
}
+ @SuppressWarnings("BadImport")
static void pop(DexProto proto, Builder<CfInstruction> builder) {
// Pop arguments in reverse order from the stack.
proto.getParameters().forEachReverse(t -> pop(t, builder));
}
+ @SuppressWarnings("BadImport")
static Builder<CfInstruction> pushReturnValue(DexType type, Builder<CfInstruction> builder) {
if (!type.isVoidType()) {
builder.add(createDefaultValueForType(type));
@@ -135,6 +138,8 @@
}
private static class InvokeDynamicMatcher extends InstructionMatcher {
+
+ @SuppressWarnings("BadImport")
static void addIfNeeded(AppView<?> appView, Builder<InstructionMatcher> builder) {
InternalOptions options = appView.options();
if (!options.canUseInvokeCustom()) {
@@ -152,6 +157,7 @@
}
@Override
+ @SuppressWarnings("BadImport")
DesugarDescription compute(CfInstruction instruction) {
CfInvokeDynamic invokeDynamic = instruction.asInvokeDynamic();
if (invokeDynamic == null) {
@@ -180,6 +186,8 @@
}
private static class InvokePolymorphicMatcher extends InstructionMatcher {
+
+ @SuppressWarnings("BadImport")
static void addIfNeeded(AppView<?> appView, Builder<InstructionMatcher> builder) {
InternalOptions options = appView.options();
if (!options.canUseInvokePolymorphicOnMethodHandle()) {
@@ -202,6 +210,7 @@
}
@Override
+ @SuppressWarnings("BadImport")
DesugarDescription compute(CfInstruction instruction) {
CfInvoke invoke = instruction.asInvoke();
if (invoke == null || !isPolymorphicInvoke(invoke)) {
@@ -232,6 +241,8 @@
}
private static class ConstMethodHandleMatcher extends InstructionMatcher {
+
+ @SuppressWarnings("BadImport")
static void addIfNeeded(AppView<?> appView, Builder<InstructionMatcher> builder) {
InternalOptions options = appView.options();
if (!options.canUseConstantMethodHandle()) {
@@ -249,6 +260,7 @@
}
@Override
+ @SuppressWarnings("BadImport")
DesugarDescription compute(CfInstruction instruction) {
if (!(instruction instanceof CfConstMethodHandle)) {
return null;
@@ -272,6 +284,8 @@
}
private static class ConstMethodTypeMatcher extends InstructionMatcher {
+
+ @SuppressWarnings("BadImport")
static void addIfNeeded(AppView<?> appView, Builder<InstructionMatcher> builder) {
InternalOptions options = appView.options();
if (!options.canUseConstantMethodType()) {
@@ -289,6 +303,7 @@
}
@Override
+ @SuppressWarnings("BadImport")
DesugarDescription compute(CfInstruction instruction) {
if (!(instruction instanceof CfConstMethodType)) {
return null;
@@ -312,6 +327,8 @@
}
private static class ConstDynamicMatcher extends InstructionMatcher {
+
+ @SuppressWarnings("BadImport")
static void addIfNeeded(AppView<?> appView, Builder<InstructionMatcher> builder) {
InternalOptions options = appView.options();
if (!options.canUseConstantDynamic()) {
@@ -329,6 +346,7 @@
}
@Override
+ @SuppressWarnings("BadImport")
DesugarDescription compute(CfInstruction instruction) {
final CfConstDynamic constDynamic = instruction.asConstDynamic();
if (constDynamic == null) {
@@ -354,6 +372,7 @@
private final List<InstructionMatcher> matchers;
+ @SuppressWarnings("BadImport")
public UnrepresentableInDexInstructionRemover(AppView<?> appView) {
Builder<InstructionMatcher> builder = ImmutableList.builder();
InvokeDynamicMatcher.addIfNeeded(appView, builder);
diff --git a/src/main/java/com/android/tools/r8/ir/desugar/backports/CollectionMethodGenerators.java b/src/main/java/com/android/tools/r8/ir/desugar/backports/CollectionMethodGenerators.java
index f6b6ac3..532fc1a 100644
--- a/src/main/java/com/android/tools/r8/ir/desugar/backports/CollectionMethodGenerators.java
+++ b/src/main/java/com/android/tools/r8/ir/desugar/backports/CollectionMethodGenerators.java
@@ -35,6 +35,7 @@
return generateFixedMethods(factory, method, formalCount, factory.setType);
}
+ @SuppressWarnings("BadImport")
private static CfCode generateFixedMethods(
DexItemFactory factory, DexMethod method, int formalCount, DexType returnType) {
Builder<CfInstruction> builder = ImmutableList.builder();
@@ -62,6 +63,7 @@
return new CfCode(method.holder, 4, formalCount, builder.build());
}
+ @SuppressWarnings("BadImport")
public static CfCode generateMapOf(DexItemFactory factory, DexMethod method, int formalCount) {
DexType mapEntryArray = factory.createArrayType(1, factory.mapEntryType);
DexType simpleEntry = factory.abstractMapSimpleEntryType;
diff --git a/src/main/java/com/android/tools/r8/ir/desugar/desugaredlibrary/apiconversion/DesugaredLibraryAPIConverter.java b/src/main/java/com/android/tools/r8/ir/desugar/desugaredlibrary/apiconversion/DesugaredLibraryAPIConverter.java
index afeb568..4c56b9b 100644
--- a/src/main/java/com/android/tools/r8/ir/desugar/desugaredlibrary/apiconversion/DesugaredLibraryAPIConverter.java
+++ b/src/main/java/com/android/tools/r8/ir/desugar/desugaredlibrary/apiconversion/DesugaredLibraryAPIConverter.java
@@ -31,6 +31,7 @@
import java.util.Set;
import org.objectweb.asm.Opcodes;
+@SuppressWarnings("UnusedVariable")
// I convert library calls with desugared parameters/return values so they can work normally.
// In the JSON of the desugared library, one can specify conversions between desugared and
// non-desugared types. If no conversion is specified, D8/R8 simply generate wrapper classes around
diff --git a/src/main/java/com/android/tools/r8/ir/desugar/desugaredlibrary/apiconversion/DesugaredLibraryWrapperSynthesizer.java b/src/main/java/com/android/tools/r8/ir/desugar/desugaredlibrary/apiconversion/DesugaredLibraryWrapperSynthesizer.java
index b19056a..35a84a8 100644
--- a/src/main/java/com/android/tools/r8/ir/desugar/desugaredlibrary/apiconversion/DesugaredLibraryWrapperSynthesizer.java
+++ b/src/main/java/com/android/tools/r8/ir/desugar/desugaredlibrary/apiconversion/DesugaredLibraryWrapperSynthesizer.java
@@ -677,6 +677,7 @@
return generatedMethods;
}
+ @SuppressWarnings("UnusedVariable")
private Collection<DexEncodedMethod> synthesizeHashCodeAndEquals(
DexProgramClass wrapper, DexEncodedField wrapperField) {
return ImmutableList.of(
@@ -765,6 +766,7 @@
clazz, methods, eventConsumer, processingContext));
}
+ @SuppressWarnings("UnusedVariable")
private DexClass getWrapperContext(DexClass context, WrapperKind kind) {
// A different context can be specified here, so that the wrapper is prefixed by a different
// class than the context.
diff --git a/src/main/java/com/android/tools/r8/ir/desugar/desugaredlibrary/lint/GenerateHtmlDoc.java b/src/main/java/com/android/tools/r8/ir/desugar/desugaredlibrary/lint/GenerateHtmlDoc.java
index 68cad32..5889b77 100644
--- a/src/main/java/com/android/tools/r8/ir/desugar/desugaredlibrary/lint/GenerateHtmlDoc.java
+++ b/src/main/java/com/android/tools/r8/ir/desugar/desugaredlibrary/lint/GenerateHtmlDoc.java
@@ -284,6 +284,7 @@
private static class HTMLBuilder extends StringBuilderWithIndent {
+ @SuppressWarnings("HidingField")
private String indent = "";
private void increaseIndent() {
diff --git a/src/main/java/com/android/tools/r8/ir/desugar/desugaredlibrary/specificationconversion/HumanToMachineWrapperConverter.java b/src/main/java/com/android/tools/r8/ir/desugar/desugaredlibrary/specificationconversion/HumanToMachineWrapperConverter.java
index feaccc2..b120dce 100644
--- a/src/main/java/com/android/tools/r8/ir/desugar/desugaredlibrary/specificationconversion/HumanToMachineWrapperConverter.java
+++ b/src/main/java/com/android/tools/r8/ir/desugar/desugaredlibrary/specificationconversion/HumanToMachineWrapperConverter.java
@@ -176,7 +176,7 @@
}
// TODO(b/270398965): Replace LinkedList.
- @SuppressWarnings({"JdkObsolete", "ReferenceEquality"})
+ @SuppressWarnings({"JdkObsolete", "ReferenceEquality", "UnnecessaryParentheses"})
private void fillDescriptors(
DexClass wrapperClass,
Set<DexMethod> excludedMethods,
diff --git a/src/main/java/com/android/tools/r8/ir/desugar/desugaredlibrary/specificationconversion/LegacyToHumanSpecificationConverter.java b/src/main/java/com/android/tools/r8/ir/desugar/desugaredlibrary/specificationconversion/LegacyToHumanSpecificationConverter.java
index 32994c4..5feb934 100644
--- a/src/main/java/com/android/tools/r8/ir/desugar/desugaredlibrary/specificationconversion/LegacyToHumanSpecificationConverter.java
+++ b/src/main/java/com/android/tools/r8/ir/desugar/desugaredlibrary/specificationconversion/LegacyToHumanSpecificationConverter.java
@@ -250,6 +250,7 @@
}
}
+ @SuppressWarnings("MixedMutabilityReturnType")
private void convertRetargetCoreLibMember(
HumanRewritingFlags.Builder builder,
DexApplication app,
@@ -279,7 +280,7 @@
});
}
- @SuppressWarnings("ReferenceEquality")
+ @SuppressWarnings({"MixedMutabilityReturnType", "ReferenceEquality"})
private List<DexClassAndMethod> findMethodsWithName(
DexString methodName,
DexClass clazz,
diff --git a/src/main/java/com/android/tools/r8/ir/desugar/icce/AlwaysThrowingInstructionDesugaring.java b/src/main/java/com/android/tools/r8/ir/desugar/icce/AlwaysThrowingInstructionDesugaring.java
index ccf096e..e7a534f 100644
--- a/src/main/java/com/android/tools/r8/ir/desugar/icce/AlwaysThrowingInstructionDesugaring.java
+++ b/src/main/java/com/android/tools/r8/ir/desugar/icce/AlwaysThrowingInstructionDesugaring.java
@@ -82,12 +82,12 @@
invoke,
localStackAllocator,
eventConsumer,
- context,
methodProcessingContext,
getMethodSynthesizerForThrowing(appView, invoke, resolutionResult, context)))
.build();
}
+ @SuppressWarnings("UnusedVariable")
public static DesugarDescription computeInvokeAsThrowNSMERewrite(
AppView<?> appView, CfInvoke invoke, ScanCallback scanCallback) {
DesugarDescription.Builder builder =
@@ -105,7 +105,6 @@
invoke,
localStackAllocator,
eventConsumer,
- context,
methodProcessingContext,
UtilityMethodsForCodeOptimizations
::synthesizeThrowNoSuchMethodErrorMethod));
@@ -118,7 +117,6 @@
CfInvoke invoke,
LocalStackAllocator localStackAllocator,
CfInstructionDesugaringEventConsumer eventConsumer,
- ProgramMethod context,
MethodProcessingContext methodProcessingContext,
MethodSynthesizerConsumer methodSynthesizerConsumer) {
if (methodSynthesizerConsumer == null) {
diff --git a/src/main/java/com/android/tools/r8/ir/desugar/itf/ClassProcessor.java b/src/main/java/com/android/tools/r8/ir/desugar/itf/ClassProcessor.java
index 2a423c2..74b0447 100644
--- a/src/main/java/com/android/tools/r8/ir/desugar/itf/ClassProcessor.java
+++ b/src/main/java/com/android/tools/r8/ir/desugar/itf/ClassProcessor.java
@@ -586,6 +586,7 @@
return MethodSignatures.create(defaultMethods);
}
+ @SuppressWarnings("UnusedVariable")
// Computes the set of signatures of that may need forwarding methods on classes that derive
// from a library class.
private SignaturesInfo computeLibraryClassInfo(DexLibraryClass clazz, SignaturesInfo signatures) {
@@ -792,6 +793,7 @@
return false;
}
+ @SuppressWarnings("BadImport")
private boolean overridesAbstractNonLibraryInterfaceMethod(
DexClass clazz, DexMethod dexMethod, EmulatedInterfaceInfo emulatedInterfaceInfo) {
List<Entry<DexClass, DexEncodedMethod>> abstractInterfaceMethods =
@@ -806,6 +808,7 @@
return false;
}
+ @SuppressWarnings("BadImport")
private void resolveForwardingMethods(
DexClass clazz,
ClassInfo superInfo,
@@ -823,6 +826,7 @@
// Looks up a method signature from the point of 'clazz', if it can dispatch to a default method
// the 'addForward' call-back is called with the target of the forward.
+ @SuppressWarnings("BadImport")
private void resolveForwardForSignature(
DexClass clazz,
ClassInfo superInfo,
diff --git a/src/main/java/com/android/tools/r8/ir/optimize/AssertionsRewriter.java b/src/main/java/com/android/tools/r8/ir/optimize/AssertionsRewriter.java
index 2db87df..1454841 100644
--- a/src/main/java/com/android/tools/r8/ir/optimize/AssertionsRewriter.java
+++ b/src/main/java/com/android/tools/r8/ir/optimize/AssertionsRewriter.java
@@ -579,6 +579,7 @@
: null;
}
+ @SuppressWarnings("UnusedVariable")
private Throw dominatedBlocksHasSingleThrow(BasicBlock block, List<BasicBlock> dominatedBlocks) {
Throw theThrow = null;
for (BasicBlock current : dominatedBlocks) {
diff --git a/src/main/java/com/android/tools/r8/ir/optimize/IdempotentFunctionCallCanonicalizer.java b/src/main/java/com/android/tools/r8/ir/optimize/IdempotentFunctionCallCanonicalizer.java
index c7b3cfd..efca497 100644
--- a/src/main/java/com/android/tools/r8/ir/optimize/IdempotentFunctionCallCanonicalizer.java
+++ b/src/main/java/com/android/tools/r8/ir/optimize/IdempotentFunctionCallCanonicalizer.java
@@ -32,20 +32,15 @@
*
* <p>For example,
*
- * v1 <- const4 0x0
- * ...
- * vx <- invoke-static { v1 } Ljava/lang/Boolean;->valueOf(Z)Ljava/lang/Boolean;
- * ...
- * vy <- invoke-static { v1 } Ljava/lang/Boolean;->valueOf(Z);Ljava/lang/Boolean;
- * ...
- * vz <- invoke-static { v1 } Ljava/lang/Boolean;->valueOf(Z);Ljava/lang/Boolean;
- * ...
+ * <p>v1 <- const4 0x0 ... vx <- invoke-static { v1 }
+ * Ljava/lang/Boolean;->valueOf(Z)Ljava/lang/Boolean; ... vy <- invoke-static { v1 }
+ * Ljava/lang/Boolean;->valueOf(Z);Ljava/lang/Boolean; ... vz <- invoke-static { v1 }
+ * Ljava/lang/Boolean;->valueOf(Z);Ljava/lang/Boolean; ...
*
- * ~>
+ * <p>~>
*
- * v1 <- const4 0x0
- * v2 <- invoke-static { v1 } Ljava/lang/Boolean;->valueOf(Z);Ljava/lang/Boolean;
- * // Update users of vx, vy, and vz.
+ * <p>v1 <- const4 0x0 @SuppressWarnings("UnusedVariable") v2 <- invoke-static { v1 }
+ * Ljava/lang/Boolean;->valueOf(Z);Ljava/lang/Boolean; // Update users of vx, vy, and vz.
*/
public class IdempotentFunctionCallCanonicalizer {
@@ -55,9 +50,6 @@
private final AppView<?> appView;
private final DexItemFactory factory;
- private int numberOfLibraryCallCanonicalization = 0;
- private int numberOfProgramCallCanonicalization = 0;
-
public IdempotentFunctionCallCanonicalizer(AppView<?> appView) {
this.appView = appView;
this.factory = appView.dexItemFactory();
diff --git a/src/main/java/com/android/tools/r8/ir/optimize/Inliner.java b/src/main/java/com/android/tools/r8/ir/optimize/Inliner.java
index f4f0970..1004186 100644
--- a/src/main/java/com/android/tools/r8/ir/optimize/Inliner.java
+++ b/src/main/java/com/android/tools/r8/ir/optimize/Inliner.java
@@ -206,7 +206,7 @@
SUBCLASS(16), // Inlineable into methods with holders from a subclass in a different package.
ALWAYS(32); // No restrictions for inlining this.
- int value;
+ final int value;
Constraint(int value) {
this.value = value;
diff --git a/src/main/java/com/android/tools/r8/ir/optimize/RedundantFieldLoadAndStoreElimination.java b/src/main/java/com/android/tools/r8/ir/optimize/RedundantFieldLoadAndStoreElimination.java
index a7d22be..e6ab075 100644
--- a/src/main/java/com/android/tools/r8/ir/optimize/RedundantFieldLoadAndStoreElimination.java
+++ b/src/main/java/com/android/tools/r8/ir/optimize/RedundantFieldLoadAndStoreElimination.java
@@ -154,6 +154,7 @@
}
@Override
+ @SuppressWarnings("EqualsGetClass")
public boolean equals(Object other) {
if (this == other) {
return true;
@@ -186,6 +187,7 @@
}
@Override
+ @SuppressWarnings("EqualsGetClass")
public boolean equals(Object other) {
if (this == other) {
return true;
diff --git a/src/main/java/com/android/tools/r8/ir/optimize/classinliner/analysis/InternalNonEmptyParameterUsage.java b/src/main/java/com/android/tools/r8/ir/optimize/classinliner/analysis/InternalNonEmptyParameterUsage.java
index 29274b2..98e568a 100644
--- a/src/main/java/com/android/tools/r8/ir/optimize/classinliner/analysis/InternalNonEmptyParameterUsage.java
+++ b/src/main/java/com/android/tools/r8/ir/optimize/classinliner/analysis/InternalNonEmptyParameterUsage.java
@@ -194,6 +194,7 @@
}
@Override
+ @SuppressWarnings("EqualsGetClass")
public boolean equals(Object obj) {
if (obj == this) {
return true;
diff --git a/src/main/java/com/android/tools/r8/ir/optimize/classinliner/analysis/NonEmptyParameterUsage.java b/src/main/java/com/android/tools/r8/ir/optimize/classinliner/analysis/NonEmptyParameterUsage.java
index 38056c8..2521558 100644
--- a/src/main/java/com/android/tools/r8/ir/optimize/classinliner/analysis/NonEmptyParameterUsage.java
+++ b/src/main/java/com/android/tools/r8/ir/optimize/classinliner/analysis/NonEmptyParameterUsage.java
@@ -117,6 +117,7 @@
}
@Override
+ @SuppressWarnings("EqualsGetClass")
public boolean equals(Object obj) {
if (obj == this) {
return true;
diff --git a/src/main/java/com/android/tools/r8/ir/optimize/classinliner/analysis/NonEmptyParameterUsagePerContext.java b/src/main/java/com/android/tools/r8/ir/optimize/classinliner/analysis/NonEmptyParameterUsagePerContext.java
index 715d88f..d4b244d 100644
--- a/src/main/java/com/android/tools/r8/ir/optimize/classinliner/analysis/NonEmptyParameterUsagePerContext.java
+++ b/src/main/java/com/android/tools/r8/ir/optimize/classinliner/analysis/NonEmptyParameterUsagePerContext.java
@@ -129,6 +129,7 @@
}
@Override
+ @SuppressWarnings("EqualsGetClass")
public boolean equals(Object obj) {
if (obj == null || obj.getClass() != getClass()) {
return false;
diff --git a/src/main/java/com/android/tools/r8/ir/optimize/classinliner/analysis/NonEmptyParameterUsages.java b/src/main/java/com/android/tools/r8/ir/optimize/classinliner/analysis/NonEmptyParameterUsages.java
index 50fa8a7..c4294f5 100644
--- a/src/main/java/com/android/tools/r8/ir/optimize/classinliner/analysis/NonEmptyParameterUsages.java
+++ b/src/main/java/com/android/tools/r8/ir/optimize/classinliner/analysis/NonEmptyParameterUsages.java
@@ -224,6 +224,7 @@
}
@Override
+ @SuppressWarnings("EqualsGetClass")
public boolean equals(Object other) {
if (other == null || getClass() != other.getClass()) {
return false;
diff --git a/src/main/java/com/android/tools/r8/ir/optimize/enums/EmptyEnumUnboxer.java b/src/main/java/com/android/tools/r8/ir/optimize/enums/EmptyEnumUnboxer.java
index 3e870d3..cc90f9b 100644
--- a/src/main/java/com/android/tools/r8/ir/optimize/enums/EmptyEnumUnboxer.java
+++ b/src/main/java/com/android/tools/r8/ir/optimize/enums/EmptyEnumUnboxer.java
@@ -66,11 +66,13 @@
}
@Override
+ @SuppressWarnings("BadImport")
public void rewriteWithLens() {
// Intentionally empty.
}
@Override
+ @SuppressWarnings("BadImport")
public void unboxEnums(
AppView<AppInfoWithLiveness> appView,
IRConverter converter,
diff --git a/src/main/java/com/android/tools/r8/ir/optimize/enums/EnumUnboxer.java b/src/main/java/com/android/tools/r8/ir/optimize/enums/EnumUnboxer.java
index 0910ca1..48ae3b2 100644
--- a/src/main/java/com/android/tools/r8/ir/optimize/enums/EnumUnboxer.java
+++ b/src/main/java/com/android/tools/r8/ir/optimize/enums/EnumUnboxer.java
@@ -28,6 +28,7 @@
return appView.options().enableEnumUnboxing ? new EnumUnboxerImpl(appView) : empty();
}
+ @SuppressWarnings("BadImport")
public static EmptyEnumUnboxer empty() {
return EmptyEnumUnboxer.get();
}
@@ -48,6 +49,7 @@
public abstract void rewriteWithLens();
+ @SuppressWarnings("BadImport")
public abstract void unboxEnums(
AppView<AppInfoWithLiveness> appView,
IRConverter converter,
diff --git a/src/main/java/com/android/tools/r8/ir/optimize/enums/EnumUnboxerImpl.java b/src/main/java/com/android/tools/r8/ir/optimize/enums/EnumUnboxerImpl.java
index 8ec6037..a2639bf 100644
--- a/src/main/java/com/android/tools/r8/ir/optimize/enums/EnumUnboxerImpl.java
+++ b/src/main/java/com/android/tools/r8/ir/optimize/enums/EnumUnboxerImpl.java
@@ -676,12 +676,14 @@
}
@Override
+ @SuppressWarnings("BadImport")
public void rewriteWithLens() {
methodsDependingOnLibraryModelisation =
methodsDependingOnLibraryModelisation.rewrittenWithLens(appView.graphLens());
}
@Override
+ @SuppressWarnings("BadImport")
public void unboxEnums(
AppView<AppInfoWithLiveness> appView,
IRConverter converter,
@@ -1165,6 +1167,7 @@
.mayHaveOtherSideEffectsThanInstanceFieldAssignments());
}
+ @SuppressWarnings("UnusedVariable")
private Reason instructionAllowEnumUnboxing(
Instruction instruction, IRCode code, DexProgramClass enumClass, Value enumValue) {
ProgramMethod context = code.context();
@@ -1207,6 +1210,7 @@
}
}
+ @SuppressWarnings("UnusedVariable")
private Reason analyzeAssumeUser(
Assume assume,
IRCode code,
@@ -1216,6 +1220,7 @@
return validateEnumUsages(code, assume.outValue(), enumClass);
}
+ @SuppressWarnings("UnusedVariable")
private Reason analyzeArrayGetUser(
ArrayGet arrayGet,
IRCode code,
@@ -1226,6 +1231,7 @@
return Reason.ELIGIBLE;
}
+ @SuppressWarnings("UnusedVariable")
private Reason analyzeArrayLengthUser(
ArrayLength arrayLength,
IRCode code,
@@ -1236,6 +1242,7 @@
return Reason.ELIGIBLE;
}
+ @SuppressWarnings("UnusedVariable")
private boolean isAssignableToArray(Value value, ClassTypeElement arrayBaseType) {
TypeElement valueType = value.getType();
if (valueType.isNullType()) {
@@ -1248,6 +1255,7 @@
valueBaseType.asClassType().getClassType(), arrayBaseType.getClassType());
}
+ @SuppressWarnings("UnusedVariable")
private Reason analyzeArrayPutUser(
ArrayPut arrayPut,
IRCode code,
@@ -1269,7 +1277,7 @@
return Reason.INVALID_ARRAY_PUT;
}
- @SuppressWarnings("ReferenceEquality")
+ @SuppressWarnings({"ReferenceEquality", "UnusedVariable"})
private Reason analyzeNewArrayFilledUser(
NewArrayFilled newArrayFilled,
IRCode code,
@@ -1298,6 +1306,7 @@
return Reason.ELIGIBLE;
}
+ @SuppressWarnings("UnusedVariable")
private Reason analyzeCheckCastUser(
CheckCast checkCast,
IRCode code,
@@ -1310,6 +1319,7 @@
return Reason.DOWN_CAST;
}
+ @SuppressWarnings("UnusedVariable")
// A field put is valid only if the field is not on an enum, and the field type and the valuePut
// have identical enum type.
private Reason analyzeFieldPutUser(
@@ -1343,7 +1353,7 @@
return Reason.ELIGIBLE;
}
- @SuppressWarnings("ReferenceEquality")
+ @SuppressWarnings({"ReferenceEquality", "UnusedVariable"})
// An If using enum as inValue is valid if it matches e == null
// or e == X with X of same enum type as e. Ex: if (e == MyEnum.A).
private Reason analyzeIfUser(
@@ -1365,7 +1375,7 @@
return Reason.INVALID_IF_TYPES;
}
- @SuppressWarnings("ReferenceEquality")
+ @SuppressWarnings({"ReferenceEquality", "UnusedVariable"})
private Reason analyzeInstanceGetUser(
InstanceGet instanceGet,
IRCode code,
@@ -1497,6 +1507,7 @@
return reason;
}
+ @SuppressWarnings("UnusedVariable")
private Reason comparableAsUnboxedValues(InvokeMethod invoke) {
assert invoke.inValues().size() == 2;
TypeElement type1 = invoke.getFirstArgument().getType();
@@ -1515,7 +1526,7 @@
return new UnboxedValueNonComparable(invoke.getInvokedMethod(), type1, type2);
}
- @SuppressWarnings("ReferenceEquality")
+ @SuppressWarnings({"ReferenceEquality", "UnusedVariable"})
private Reason analyzeLibraryInvoke(
InvokeMethod invoke,
IRCode code,
@@ -1646,7 +1657,7 @@
return new UnsupportedLibraryInvokeReason(singleTargetReference);
}
- @SuppressWarnings("ReferenceEquality")
+ @SuppressWarnings({"ReferenceEquality", "UnusedVariable"})
// Return is used for valueOf methods.
private Reason analyzeReturnUser(
Return theReturn,
diff --git a/src/main/java/com/android/tools/r8/ir/optimize/enums/EnumUnboxingTreeFixer.java b/src/main/java/com/android/tools/r8/ir/optimize/enums/EnumUnboxingTreeFixer.java
index 82f61ed..6ba6ad1 100644
--- a/src/main/java/com/android/tools/r8/ir/optimize/enums/EnumUnboxingTreeFixer.java
+++ b/src/main/java/com/android/tools/r8/ir/optimize/enums/EnumUnboxingTreeFixer.java
@@ -926,7 +926,7 @@
method.isNonPrivateVirtualMethod(), OptionalBool.FALSE));
}
- @SuppressWarnings("ReferenceEquality")
+ @SuppressWarnings({"BadImport", "ReferenceEquality"})
private DexEncodedField fixupEncodedField(DexEncodedField encodedField) {
DexField field = encodedField.getReference();
DexType newType = fixupType(field.type);
diff --git a/src/main/java/com/android/tools/r8/ir/optimize/info/field/InstanceFieldTypeInitializationInfo.java b/src/main/java/com/android/tools/r8/ir/optimize/info/field/InstanceFieldTypeInitializationInfo.java
index 3f70c66..b095afc 100644
--- a/src/main/java/com/android/tools/r8/ir/optimize/info/field/InstanceFieldTypeInitializationInfo.java
+++ b/src/main/java/com/android/tools/r8/ir/optimize/info/field/InstanceFieldTypeInitializationInfo.java
@@ -80,6 +80,7 @@
}
@Override
+ @SuppressWarnings("EqualsGetClass")
public boolean equals(Object other) {
if (this == other) {
return true;
diff --git a/src/main/java/com/android/tools/r8/ir/optimize/inliner/multicallerinliner/MultiCallerInlinerInvokeRegistry.java b/src/main/java/com/android/tools/r8/ir/optimize/inliner/multicallerinliner/MultiCallerInlinerInvokeRegistry.java
index 10d15ca..17413a4 100644
--- a/src/main/java/com/android/tools/r8/ir/optimize/inliner/multicallerinliner/MultiCallerInlinerInvokeRegistry.java
+++ b/src/main/java/com/android/tools/r8/ir/optimize/inliner/multicallerinliner/MultiCallerInlinerInvokeRegistry.java
@@ -30,7 +30,7 @@
@Override
public GraphLens getCodeLens() {
- return appView.graphLens();
+ return appViewWithLiveness.graphLens();
}
@Override
diff --git a/src/main/java/com/android/tools/r8/ir/optimize/library/ByteMethodOptimizer.java b/src/main/java/com/android/tools/r8/ir/optimize/library/ByteMethodOptimizer.java
index a1b2c39..b058da4 100644
--- a/src/main/java/com/android/tools/r8/ir/optimize/library/ByteMethodOptimizer.java
+++ b/src/main/java/com/android/tools/r8/ir/optimize/library/ByteMethodOptimizer.java
@@ -19,11 +19,9 @@
public class ByteMethodOptimizer extends StatelessLibraryMethodModelCollection {
- private final AppView<?> appView;
private final DexItemFactory dexItemFactory;
ByteMethodOptimizer(AppView<?> appView) {
- this.appView = appView;
this.dexItemFactory = appView.dexItemFactory();
}
diff --git a/src/main/java/com/android/tools/r8/ir/optimize/library/LibraryOptimizationInfoInitializer.java b/src/main/java/com/android/tools/r8/ir/optimize/library/LibraryOptimizationInfoInitializer.java
index 0c41415..1168e12 100644
--- a/src/main/java/com/android/tools/r8/ir/optimize/library/LibraryOptimizationInfoInitializer.java
+++ b/src/main/java/com/android/tools/r8/ir/optimize/library/LibraryOptimizationInfoInitializer.java
@@ -12,7 +12,6 @@
import com.android.tools.r8.graph.DexMethod;
import com.android.tools.r8.graph.DexType;
import com.android.tools.r8.ir.analysis.type.DynamicType;
-import com.android.tools.r8.ir.analysis.value.AbstractValueFactory;
import com.android.tools.r8.ir.optimize.info.LibraryOptimizationInfoInitializerFeedback;
import com.android.tools.r8.ir.optimize.info.field.EmptyInstanceFieldInitializationInfoCollection;
import com.android.tools.r8.ir.optimize.info.field.InstanceFieldInitializationInfoCollection;
@@ -25,7 +24,6 @@
public class LibraryOptimizationInfoInitializer {
- private final AbstractValueFactory abstractValueFactory;
private final AppView<?> appView;
private final DexItemFactory dexItemFactory;
@@ -34,7 +32,6 @@
private final Set<DexType> modeledLibraryTypes = Sets.newIdentityHashSet();
LibraryOptimizationInfoInitializer(AppView<?> appView) {
- this.abstractValueFactory = appView.abstractValueFactory();
this.appView = appView;
this.dexItemFactory = appView.dexItemFactory();
}
diff --git a/src/main/java/com/android/tools/r8/ir/optimize/membervaluepropagation/assume/AssumeInfo.java b/src/main/java/com/android/tools/r8/ir/optimize/membervaluepropagation/assume/AssumeInfo.java
index 342eefc..3f1db81 100644
--- a/src/main/java/com/android/tools/r8/ir/optimize/membervaluepropagation/assume/AssumeInfo.java
+++ b/src/main/java/com/android/tools/r8/ir/optimize/membervaluepropagation/assume/AssumeInfo.java
@@ -137,6 +137,7 @@
}
@Override
+ @SuppressWarnings("EqualsGetClass")
public boolean equals(Object other) {
if (this == other) {
return true;
diff --git a/src/main/java/com/android/tools/r8/ir/optimize/outliner/OutlinerImpl.java b/src/main/java/com/android/tools/r8/ir/optimize/outliner/OutlinerImpl.java
index 3e3dbdd..ee3fc44 100644
--- a/src/main/java/com/android/tools/r8/ir/optimize/outliner/OutlinerImpl.java
+++ b/src/main/java/com/android/tools/r8/ir/optimize/outliner/OutlinerImpl.java
@@ -204,6 +204,7 @@
return type.ordinal();
}
+ @SuppressWarnings("MissingImplementsComparable")
public int compareTo(OutlineInstruction other) {
return type.compareTo(other.type);
}
@@ -727,7 +728,7 @@
}
@Override
- @SuppressWarnings("ReferenceEquality")
+ @SuppressWarnings({"ReferenceEquality", "UnnecessaryParentheses"})
public String toString() {
// The printing of the code for an outline maps the value numbers to the arguments numbers.
int outRegisterNumber = argumentTypes.size();
@@ -770,6 +771,7 @@
}
}
+ @SuppressWarnings("UnusedVariable")
// Spot the outline opportunities in a basic block.
// This is the superclass for both collection candidates and actually replacing code.
// TODO(sgjesse): Collect more information in the candidate collection and reuse that for
diff --git a/src/main/java/com/android/tools/r8/ir/optimize/string/StringBuilderEscapeTransferFunction.java b/src/main/java/com/android/tools/r8/ir/optimize/string/StringBuilderEscapeTransferFunction.java
index e2d46af..9745e1d 100644
--- a/src/main/java/com/android/tools/r8/ir/optimize/string/StringBuilderEscapeTransferFunction.java
+++ b/src/main/java/com/android/tools/r8/ir/optimize/string/StringBuilderEscapeTransferFunction.java
@@ -50,6 +50,7 @@
}
@Override
+ @SuppressWarnings("UnnecessaryParentheses")
public TransferFunctionResult<StringBuilderEscapeState> apply(
Instruction instruction, StringBuilderEscapeState state) {
StringBuilderEscapeState.Builder builder = state.builder();
diff --git a/src/main/java/com/android/tools/r8/ir/regalloc/LinearScanRegisterAllocator.java b/src/main/java/com/android/tools/r8/ir/regalloc/LinearScanRegisterAllocator.java
index a13c810..9307108 100644
--- a/src/main/java/com/android/tools/r8/ir/regalloc/LinearScanRegisterAllocator.java
+++ b/src/main/java/com/android/tools/r8/ir/regalloc/LinearScanRegisterAllocator.java
@@ -1630,6 +1630,7 @@
return false;
}
+ @SuppressWarnings("BadImport")
private boolean allocateSingleInterval(LiveIntervals unhandledInterval, ArgumentReuseMode mode) {
int registerConstraint = unhandledInterval.getRegisterLimit();
assert registerConstraint <= Constants.U16BIT_MAX;
@@ -2056,6 +2057,7 @@
return candidate;
}
+ @SuppressWarnings("BadImport")
private void allocateBlockedRegister(LiveIntervals unhandledInterval) {
int registerConstraint = unhandledInterval.getRegisterLimit();
if (registerConstraint < Constants.U16BIT_MAX) {
diff --git a/src/main/java/com/android/tools/r8/ir/synthetic/FieldAccessorBuilder.java b/src/main/java/com/android/tools/r8/ir/synthetic/FieldAccessorBuilder.java
index f549990..cd0e15e 100644
--- a/src/main/java/com/android/tools/r8/ir/synthetic/FieldAccessorBuilder.java
+++ b/src/main/java/com/android/tools/r8/ir/synthetic/FieldAccessorBuilder.java
@@ -80,6 +80,7 @@
return this;
}
+ @SuppressWarnings("BadImport")
public CfCode build() {
assert validate();
int maxStack = 0;
diff --git a/src/main/java/com/android/tools/r8/ir/synthetic/ForwardMethodBuilder.java b/src/main/java/com/android/tools/r8/ir/synthetic/ForwardMethodBuilder.java
index af638fb..71172bb 100644
--- a/src/main/java/com/android/tools/r8/ir/synthetic/ForwardMethodBuilder.java
+++ b/src/main/java/com/android/tools/r8/ir/synthetic/ForwardMethodBuilder.java
@@ -151,7 +151,7 @@
return this;
}
- @SuppressWarnings("ReferenceEquality")
+ @SuppressWarnings({"BadImport", "ReferenceEquality"})
public CfCode build() {
assert validate();
int maxStack = 0;
@@ -216,7 +216,7 @@
localVariables);
}
- @SuppressWarnings("ReferenceEquality")
+ @SuppressWarnings({"BadImport", "ReferenceEquality"})
private void maybeInsertArgumentCast(
int argumentIndex, DexType sourceArgumentType, Builder<CfInstruction> instructions) {
if (appInfoForCastArguments == null) {
diff --git a/src/main/java/com/android/tools/r8/ir/synthetic/apiconverter/NullableConversionCfCodeProvider.java b/src/main/java/com/android/tools/r8/ir/synthetic/apiconverter/NullableConversionCfCodeProvider.java
index cb117c5..77dc578 100644
--- a/src/main/java/com/android/tools/r8/ir/synthetic/apiconverter/NullableConversionCfCodeProvider.java
+++ b/src/main/java/com/android/tools/r8/ir/synthetic/apiconverter/NullableConversionCfCodeProvider.java
@@ -80,6 +80,7 @@
}
@Override
+ @SuppressWarnings("UnusedVariable")
public CfCode generateCfCode() {
DexItemFactory factory = appView.dexItemFactory();
List<CfInstruction> instructions = new ArrayList<>();
diff --git a/src/main/java/com/android/tools/r8/jar/CfApplicationWriter.java b/src/main/java/com/android/tools/r8/jar/CfApplicationWriter.java
index c1db29c..5756529 100644
--- a/src/main/java/com/android/tools/r8/jar/CfApplicationWriter.java
+++ b/src/main/java/com/android/tools/r8/jar/CfApplicationWriter.java
@@ -408,6 +408,7 @@
return debugExtensions.asDexValueString().getValue().toString();
}
+ @SuppressWarnings("BadImport")
private ImmutableMap<DexString, DexValue> getAnnotationDefaults(DexAnnotationSet annotations) {
DexValue value =
getSystemAnnotationValue(annotations, application.dexItemFactory.annotationDefault);
@@ -687,6 +688,7 @@
return writer.toString();
}
+ @SuppressWarnings("DefaultCharset")
private static void verifyCf(byte[] result) {
ClassReader reader = new ClassReader(result);
PrintWriter pw = new PrintWriter(System.out);
diff --git a/src/main/java/com/android/tools/r8/kotlin/KotlinAnnotationArgumentInfo.java b/src/main/java/com/android/tools/r8/kotlin/KotlinAnnotationArgumentInfo.java
index 7d9fd7f..5d67400 100644
--- a/src/main/java/com/android/tools/r8/kotlin/KotlinAnnotationArgumentInfo.java
+++ b/src/main/java/com/android/tools/r8/kotlin/KotlinAnnotationArgumentInfo.java
@@ -29,6 +29,7 @@
abstract boolean rewrite(Consumer<KmAnnotationArgument> consumer, AppView<?> appView);
+ @SuppressWarnings("MixedMutabilityReturnType")
private static KotlinAnnotationArgumentInfo createArgument(
KmAnnotationArgument arg, DexItemFactory factory) {
if (arg instanceof KClassValue) {
@@ -44,6 +45,7 @@
}
}
+ @SuppressWarnings("MixedMutabilityReturnType")
static Map<String, KotlinAnnotationArgumentInfo> create(
Map<String, KmAnnotationArgument> arguments, DexItemFactory factory) {
if (arguments.isEmpty()) {
diff --git a/src/main/java/com/android/tools/r8/kotlin/KotlinClassInfo.java b/src/main/java/com/android/tools/r8/kotlin/KotlinClassInfo.java
index c18c564..bc61463 100644
--- a/src/main/java/com/android/tools/r8/kotlin/KotlinClassInfo.java
+++ b/src/main/java/com/android/tools/r8/kotlin/KotlinClassInfo.java
@@ -48,7 +48,9 @@
private final KotlinDeclarationContainerInfo declarationContainerInfo;
private final List<KotlinTypeParameterInfo> typeParameters;
private final List<KotlinTypeInfo> superTypes;
+
private final List<KotlinTypeReference> sealedSubClasses;
+
private final List<KotlinTypeReference> nestedClasses;
private final List<String> enumEntries;
private final KotlinVersionRequirementInfo versionRequirements;
@@ -223,9 +225,9 @@
}
private static List<KotlinTypeReference> getSealedSubClasses(
- List<String> sealedSubclasses, DexItemFactory factory) {
+ List<String> sealedSubClasses, DexItemFactory factory) {
ImmutableList.Builder<KotlinTypeReference> sealedTypes = ImmutableList.builder();
- for (String sealedSubClass : sealedSubclasses) {
+ for (String sealedSubClass : sealedSubClasses) {
String binaryName =
sealedSubClass.replace(
DescriptorUtils.JAVA_PACKAGE_SEPARATOR, DescriptorUtils.INNER_CLASS_SEPARATOR);
diff --git a/src/main/java/com/android/tools/r8/kotlin/KotlinMetadataAnnotationWrapper.java b/src/main/java/com/android/tools/r8/kotlin/KotlinMetadataAnnotationWrapper.java
index e6bba9a..6c01e1b 100644
--- a/src/main/java/com/android/tools/r8/kotlin/KotlinMetadataAnnotationWrapper.java
+++ b/src/main/java/com/android/tools/r8/kotlin/KotlinMetadataAnnotationWrapper.java
@@ -23,9 +23,16 @@
private static final int[] NULL_INT_ARRAY = new int[0];
private final int kind;
+
+ @SuppressWarnings("ImmutableAnnotationChecker")
private final int[] metadataVersion;
+
+ @SuppressWarnings("ImmutableAnnotationChecker")
private final String[] data1;
+
+ @SuppressWarnings("ImmutableAnnotationChecker")
private final String[] data2;
+
private final int extraInt;
private final String extraString;
private final String packageName;
@@ -127,6 +134,7 @@
}
@Override
+ @SuppressWarnings("ImmutableAnnotationChecker")
public boolean equals(Object obj) {
throw new Unreachable();
}
diff --git a/src/main/java/com/android/tools/r8/kotlin/KotlinMetadataRewriter.java b/src/main/java/com/android/tools/r8/kotlin/KotlinMetadataRewriter.java
index 5e707db..1c56876 100644
--- a/src/main/java/com/android/tools/r8/kotlin/KotlinMetadataRewriter.java
+++ b/src/main/java/com/android/tools/r8/kotlin/KotlinMetadataRewriter.java
@@ -32,6 +32,7 @@
public class KotlinMetadataRewriter {
+ @SuppressWarnings("UnusedVariable")
// Due to a bug with nested classes and the lookup of RequirementVersion, we bump all metadata
// versions to 1.4 if compiled with kotlin 1.3 (1.1.16). For more information, see b/161885097.
private static final int[] METADATA_VERSION_1_4 = new int[] {1, 4, 0};
@@ -39,7 +40,10 @@
private static final class WriteMetadataFieldInfo {
final boolean writeKind;
final boolean writeMetadataVersion;
+
+ @SuppressWarnings("UnusedVariable")
final boolean writeByteCodeVersion;
+
final boolean writeData1;
final boolean writeData2;
final boolean writeExtraString;
@@ -208,6 +212,7 @@
}
}
+ @SuppressWarnings("EmptyCatch")
private boolean verifyRewrittenMetadataIsEquivalent(
DexAnnotation original, DexAnnotation rewritten) {
try {
diff --git a/src/main/java/com/android/tools/r8/kotlin/KotlinMetadataWriter.java b/src/main/java/com/android/tools/r8/kotlin/KotlinMetadataWriter.java
index a266093..9276239 100644
--- a/src/main/java/com/android/tools/r8/kotlin/KotlinMetadataWriter.java
+++ b/src/main/java/com/android/tools/r8/kotlin/KotlinMetadataWriter.java
@@ -48,7 +48,7 @@
static final String INDENT = " ";
- @SuppressWarnings("ReferenceEquality")
+ @SuppressWarnings({"EmptyCatch", "ReferenceEquality"})
public static void writeKotlinMetadataAnnotation(
String prefix, DexAnnotation annotation, PrintStream ps, Kotlin kotlin) {
assert annotation.annotation.type == kotlin.factory.kotlinMetadataType;
diff --git a/src/main/java/com/android/tools/r8/lightir/LirBuilder.java b/src/main/java/com/android/tools/r8/lightir/LirBuilder.java
index 927e17f..d222f5f 100644
--- a/src/main/java/com/android/tools/r8/lightir/LirBuilder.java
+++ b/src/main/java/com/android/tools/r8/lightir/LirBuilder.java
@@ -368,6 +368,7 @@
return oldIndex != null ? oldIndex : nextIndex;
}
+ @SuppressWarnings("UnusedVariable")
private int constantIndexSize(LirConstant item) {
return 4;
}
diff --git a/src/main/java/com/android/tools/r8/naming/ClassNamingForNameMapper.java b/src/main/java/com/android/tools/r8/naming/ClassNamingForNameMapper.java
index 809fd77..60222b7 100644
--- a/src/main/java/com/android/tools/r8/naming/ClassNamingForNameMapper.java
+++ b/src/main/java/com/android/tools/r8/naming/ClassNamingForNameMapper.java
@@ -254,6 +254,7 @@
}
@Override
+ @SuppressWarnings("EqualsGetClass")
public boolean equals(Object o) {
if (this == o) {
return true;
@@ -272,6 +273,7 @@
return mappedRanges.hashCode();
}
+ @SuppressWarnings("MixedMutabilityReturnType")
public List<MappedRangesOfName> partitionOnMethodSignature() {
if (mappedRanges.size() <= 1) {
return Collections.singletonList(this);
diff --git a/src/main/java/com/android/tools/r8/naming/ComposingBuilder.java b/src/main/java/com/android/tools/r8/naming/ComposingBuilder.java
index 02afaab..d42f0e0 100644
--- a/src/main/java/com/android/tools/r8/naming/ComposingBuilder.java
+++ b/src/main/java/com/android/tools/r8/naming/ComposingBuilder.java
@@ -1052,6 +1052,7 @@
: committedPreviousClassBuilder;
}
+ @SuppressWarnings("MixedMutabilityReturnType")
private void registerMappingInformationFromMappedRanges(MappedRange mappedRange)
throws MappingComposeException {
for (MappingInformation mappingInformation : mappedRange.getAdditionalMappingInformation()) {
@@ -1080,6 +1081,7 @@
}
}
+ @SuppressWarnings("MixedMutabilityReturnType")
private List<MappedRange> composeMappedRangesForMethod(
ComposingClassBuilder existingClassBuilder,
List<MappedRange> existingRanges,
diff --git a/src/main/java/com/android/tools/r8/naming/DictionaryReader.java b/src/main/java/com/android/tools/r8/naming/DictionaryReader.java
index 50ff3a1..ecde9f8 100644
--- a/src/main/java/com/android/tools/r8/naming/DictionaryReader.java
+++ b/src/main/java/com/android/tools/r8/naming/DictionaryReader.java
@@ -79,6 +79,7 @@
}
}
+ @SuppressWarnings("BadImport")
public static ImmutableList<String> readAllNames(Path path, Reporter reporter) {
if (path != null) {
Set<String> seenNames = new HashSet<>();
diff --git a/src/main/java/com/android/tools/r8/naming/KotlinModuleSynthesizer.java b/src/main/java/com/android/tools/r8/naming/KotlinModuleSynthesizer.java
index de480da..fc52598 100644
--- a/src/main/java/com/android/tools/r8/naming/KotlinModuleSynthesizer.java
+++ b/src/main/java/com/android/tools/r8/naming/KotlinModuleSynthesizer.java
@@ -42,6 +42,7 @@
return file.getName().endsWith(".kotlin_module");
}
+ @SuppressWarnings("MixedMutabilityReturnType")
public List<DataEntryResource> synthesizeKotlinModuleFiles() {
Map<String, KotlinModuleInfoBuilder> kotlinModuleBuilders = new HashMap<>();
// We cannot obtain the module name for multi class file facades. But, we can for a multi class
diff --git a/src/main/java/com/android/tools/r8/naming/PositionRangeAllocator.java b/src/main/java/com/android/tools/r8/naming/PositionRangeAllocator.java
index 957e660..668b2cc 100644
--- a/src/main/java/com/android/tools/r8/naming/PositionRangeAllocator.java
+++ b/src/main/java/com/android/tools/r8/naming/PositionRangeAllocator.java
@@ -45,12 +45,13 @@
public static class NonCardinalPositionRangeAllocator extends PositionRangeAllocator {
- private final NonCardinalPositionRangeFixedDeltaCache[] cache =
- new NonCardinalPositionRangeFixedDeltaCache[MAX_DELTA + 1];
+ private final NonCardinalPositionRangeFixedDeltaCache[]
+ nonCardinalPositionRangeFixedDeltaCache =
+ new NonCardinalPositionRangeFixedDeltaCache[MAX_DELTA + 1];
private NonCardinalPositionRangeAllocator() {
for (int i = 0; i <= MAX_DELTA; i++) {
- cache[i] = new NonCardinalPositionRangeFixedDeltaCache(i);
+ nonCardinalPositionRangeFixedDeltaCache[i] = new NonCardinalPositionRangeFixedDeltaCache(i);
}
}
@@ -65,7 +66,7 @@
if (thisDelta > MAX_DELTA) {
return new Range(from, to);
}
- return cache[thisDelta].get(from);
+ return nonCardinalPositionRangeFixedDeltaCache[thisDelta].get(from);
}
}
}
diff --git a/src/main/java/com/android/tools/r8/naming/ProguardMapMinifier.java b/src/main/java/com/android/tools/r8/naming/ProguardMapMinifier.java
index 75322ca..f08df03 100644
--- a/src/main/java/com/android/tools/r8/naming/ProguardMapMinifier.java
+++ b/src/main/java/com/android/tools/r8/naming/ProguardMapMinifier.java
@@ -34,7 +34,6 @@
import com.android.tools.r8.naming.Minifier.MinifierMemberNamingStrategy;
import com.android.tools.r8.position.Position;
import com.android.tools.r8.shaking.AppInfoWithLiveness;
-import com.android.tools.r8.utils.Reporter;
import com.android.tools.r8.utils.Timing;
import com.google.common.collect.BiMap;
import com.google.common.collect.HashBiMap;
@@ -430,14 +429,12 @@
private final Map<DexReference, MemberNaming> mappedNames;
private final DexItemFactory factory;
- private final Reporter reporter;
public ApplyMappingMemberNamingStrategy(
AppView<AppInfoWithLiveness> appView, Map<DexReference, MemberNaming> mappedNames) {
super(appView);
this.mappedNames = mappedNames;
this.factory = appView.dexItemFactory();
- this.reporter = appView.options().reporter;
}
@Override
@@ -524,6 +521,7 @@
return true;
}
+ @SuppressWarnings("UnusedVariable")
void reportReservationError(DexReference source, DexString name) {
MemberNaming memberNaming = mappedNames.get(source);
assert source.isDexMethod() || source.isDexField();
diff --git a/src/main/java/com/android/tools/r8/naming/ProguardMapReader.java b/src/main/java/com/android/tools/r8/naming/ProguardMapReader.java
index 84b7242..8868840 100644
--- a/src/main/java/com/android/tools/r8/naming/ProguardMapReader.java
+++ b/src/main/java/com/android/tools/r8/naming/ProguardMapReader.java
@@ -825,6 +825,7 @@
return nonCardinalRangeCache.get(from, to);
}
+ @SuppressWarnings("CharacterGetNumericValue")
private int parseNumber() {
int result = 0;
if (!isSimpleDigit(peekChar(0))) {
diff --git a/src/main/java/com/android/tools/r8/naming/dexitembasedstring/ClassNameComputationInfo.java b/src/main/java/com/android/tools/r8/naming/dexitembasedstring/ClassNameComputationInfo.java
index 34a9076..000e8d3 100644
--- a/src/main/java/com/android/tools/r8/naming/dexitembasedstring/ClassNameComputationInfo.java
+++ b/src/main/java/com/android/tools/r8/naming/dexitembasedstring/ClassNameComputationInfo.java
@@ -204,6 +204,7 @@
}
@Override
+ @SuppressWarnings("EqualsGetClass")
public boolean equals(Object other) {
if (getClass() != other.getClass()) {
return false;
diff --git a/src/main/java/com/android/tools/r8/naming/dexitembasedstring/RecordFieldNamesComputationInfo.java b/src/main/java/com/android/tools/r8/naming/dexitembasedstring/RecordFieldNamesComputationInfo.java
index 9d93047..4fc282f 100644
--- a/src/main/java/com/android/tools/r8/naming/dexitembasedstring/RecordFieldNamesComputationInfo.java
+++ b/src/main/java/com/android/tools/r8/naming/dexitembasedstring/RecordFieldNamesComputationInfo.java
@@ -191,6 +191,7 @@
return new MissMatchingRecordFieldNamesComputationInfo(fieldNamesSplit, fields);
}
+ @SuppressWarnings("UnnecessaryParentheses")
private static boolean fieldsMatchNames(String[] fieldNames, DexField[] fields) {
for (int i = 0; i < fieldNames.length; i++) {
if (!(fields[i].name.toString().equals(fieldNames[i]))) {
diff --git a/src/main/java/com/android/tools/r8/optimize/argumentpropagation/ArgumentPropagatorCodeScanner.java b/src/main/java/com/android/tools/r8/optimize/argumentpropagation/ArgumentPropagatorCodeScanner.java
index 0d98394..3a6e882 100644
--- a/src/main/java/com/android/tools/r8/optimize/argumentpropagation/ArgumentPropagatorCodeScanner.java
+++ b/src/main/java/com/android/tools/r8/optimize/argumentpropagation/ArgumentPropagatorCodeScanner.java
@@ -275,6 +275,7 @@
return result;
}
+ @SuppressWarnings("UnusedVariable")
// TODO(b/190154391): Add a strategy that widens the dynamic receiver type to allow easily
// experimenting with the performance/size trade-off between precise/imprecise handling of
// dynamic dispatch.
@@ -294,8 +295,7 @@
ProgramMethod singleTarget = invoke.lookupSingleProgramTarget(appView, context);
DynamicTypeWithUpperBound bounds =
- computeBoundsForPolymorphicMethodState(
- invoke, resolvedMethod, singleTarget, context, dynamicReceiverType);
+ computeBoundsForPolymorphicMethodState(resolvedMethod, singleTarget, dynamicReceiverType);
MethodState existingMethodStateForBounds =
existingMethodState.isPolymorphic()
? existingMethodState.asPolymorphic().getMethodStateForBounds(bounds)
@@ -324,10 +324,8 @@
}
private DynamicTypeWithUpperBound computeBoundsForPolymorphicMethodState(
- InvokeMethodWithReceiver invoke,
ProgramMethod resolvedMethod,
ProgramMethod singleTarget,
- ProgramMethod context,
DynamicTypeWithUpperBound dynamicReceiverType) {
DynamicTypeWithUpperBound bounds =
singleTarget != null
@@ -375,6 +373,7 @@
: null);
}
+ @SuppressWarnings("UnusedVariable")
private ConcreteMonomorphicMethodStateOrUnknown computeMonomorphicMethodState(
InvokeMethod invoke,
ProgramMethod resolvedMethod,
@@ -394,7 +393,6 @@
assert dynamicReceiverType != null;
parameterStates.add(
computeParameterStateForReceiver(
- invoke.asInvokeMethodWithReceiver(),
resolvedMethod,
dynamicReceiverType,
existingMethodState,
@@ -424,7 +422,6 @@
// TODO(b/190154391): Consider validating the above hypothesis by using
// computeParameterStateForNonReceiver() for receivers.
private ParameterState computeParameterStateForReceiver(
- InvokeMethodWithReceiver invoke,
ProgramMethod resolvedMethod,
DynamicType dynamicReceiverType,
ConcreteMonomorphicMethodStateOrBottom existingMethodState,
@@ -448,6 +445,7 @@
: new ConcreteReceiverParameterState(dynamicReceiverType);
}
+ @SuppressWarnings("UnusedVariable")
private ParameterState computeParameterStateForNonReceiver(
InvokeMethod invoke,
int argumentIndex,
@@ -547,6 +545,7 @@
&& !isMonomorphicVirtualMethod(getRepresentative(invoke, resolvedMethod));
}
+ @SuppressWarnings("UnusedVariable")
private void scan(InvokeCustom invoke, ProgramMethod context) {
// If the bootstrap method is program declared it will be called. The call is with runtime
// provided arguments so ensure that the argument information is unknown.
diff --git a/src/main/java/com/android/tools/r8/optimize/argumentpropagation/ArgumentPropagatorMethodReprocessingEnqueuer.java b/src/main/java/com/android/tools/r8/optimize/argumentpropagation/ArgumentPropagatorMethodReprocessingEnqueuer.java
index 85c77a4..848e450 100644
--- a/src/main/java/com/android/tools/r8/optimize/argumentpropagation/ArgumentPropagatorMethodReprocessingEnqueuer.java
+++ b/src/main/java/com/android/tools/r8/optimize/argumentpropagation/ArgumentPropagatorMethodReprocessingEnqueuer.java
@@ -109,6 +109,7 @@
}
}
+ @SuppressWarnings("HidingField")
// TODO(b/190154391): This could invalidate the @NeverReprocessMethod testing annotations (non
// critical). If @NeverReprocessMethod is used, we would need to scan the application to mark
// methods as unoptimizable prior to removing parameters from the application.
@@ -145,15 +146,15 @@
static class AffectedMethodUseRegistry extends UseRegistryWithResult<Boolean, ProgramMethod> {
- private final AppView<AppInfoWithLiveness> appView;
+ private final AppView<AppInfoWithLiveness> appViewWithLiveness;
private final ArgumentPropagatorGraphLens graphLens;
AffectedMethodUseRegistry(
- AppView<AppInfoWithLiveness> appView,
+ AppView<AppInfoWithLiveness> appViewWithLiveness,
ProgramMethod context,
ArgumentPropagatorGraphLens graphLens) {
- super(appView, context, false);
- this.appView = appView;
+ super(appViewWithLiveness, context, false);
+ this.appViewWithLiveness = appViewWithLiveness;
this.graphLens = graphLens;
}
@@ -189,7 +190,10 @@
@SuppressWarnings("ReferenceEquality")
private void registerInvokeMethod(DexMethod method) {
SingleResolutionResult<?> resolutionResult =
- appView.appInfo().unsafeResolveMethodDueToDexFormatLegacy(method).asSingleResolution();
+ appViewWithLiveness
+ .appInfo()
+ .unsafeResolveMethodDueToDexFormatLegacy(method)
+ .asSingleResolution();
if (resolutionResult == null || !resolutionResult.getResolvedHolder().isProgramClass()) {
return;
}
@@ -225,7 +229,7 @@
@SuppressWarnings("ReferenceEquality")
private void registerFieldAccess(DexField field) {
- FieldResolutionResult resolutionResult = appView.appInfo().resolveField(field);
+ FieldResolutionResult resolutionResult = appViewWithLiveness.appInfo().resolveField(field);
if (resolutionResult.getSingleProgramField() == null) {
return;
}
diff --git a/src/main/java/com/android/tools/r8/optimize/argumentpropagation/ArgumentPropagatorProgramOptimizer.java b/src/main/java/com/android/tools/r8/optimize/argumentpropagation/ArgumentPropagatorProgramOptimizer.java
index c4d5fee..aa25c14 100644
--- a/src/main/java/com/android/tools/r8/optimize/argumentpropagation/ArgumentPropagatorProgramOptimizer.java
+++ b/src/main/java/com/android/tools/r8/optimize/argumentpropagation/ArgumentPropagatorProgramOptimizer.java
@@ -158,7 +158,7 @@
}
@Override
- @SuppressWarnings("ReferenceEquality")
+ @SuppressWarnings({"EqualsGetClass", "ReferenceEquality"})
public boolean equals(Object obj) {
if (obj == null || getClass() != obj.getClass()) {
return false;
@@ -187,6 +187,7 @@
ConcurrentNonProgramMethodsCollection.createVirtualMethodsCollection(appView);
}
+ @SuppressWarnings("BadImport")
public ArgumentPropagatorGraphLens run(
List<Set<DexProgramClass>> stronglyConnectedProgramComponents,
Consumer<DexProgramClass> affectedClassConsumer,
diff --git a/src/main/java/com/android/tools/r8/optimize/argumentpropagation/codescanner/MethodParameter.java b/src/main/java/com/android/tools/r8/optimize/argumentpropagation/codescanner/MethodParameter.java
index 21e3df1..d2ba546 100644
--- a/src/main/java/com/android/tools/r8/optimize/argumentpropagation/codescanner/MethodParameter.java
+++ b/src/main/java/com/android/tools/r8/optimize/argumentpropagation/codescanner/MethodParameter.java
@@ -26,7 +26,7 @@
}
@Override
- @SuppressWarnings("ReferenceEquality")
+ @SuppressWarnings({"EqualsGetClass", "ReferenceEquality"})
public boolean equals(Object obj) {
if (obj == null || getClass() != obj.getClass()) {
return false;
diff --git a/src/main/java/com/android/tools/r8/optimize/interfaces/analysis/ConcreteCfFrameState.java b/src/main/java/com/android/tools/r8/optimize/interfaces/analysis/ConcreteCfFrameState.java
index 81fcbfd..0d5dcbf 100644
--- a/src/main/java/com/android/tools/r8/optimize/interfaces/analysis/ConcreteCfFrameState.java
+++ b/src/main/java/com/android/tools/r8/optimize/interfaces/analysis/ConcreteCfFrameState.java
@@ -371,6 +371,7 @@
return error(message.toString());
}
+ @SuppressWarnings("BadImport")
public CfFrameState join(
AppView<? extends AppInfoWithClassHierarchy> appView,
ConcreteCfFrameState state,
@@ -385,6 +386,7 @@
return new ConcreteCfFrameState(frame.getMutableLocals(), frame.getMutableStack(), stackHeight);
}
+ @SuppressWarnings("BadImport")
private void joinLocals(
AppView<? extends AppInfoWithClassHierarchy> appView,
Int2ObjectSortedMap<FrameType> locals,
@@ -618,6 +620,7 @@
}
@Override
+ @SuppressWarnings("EqualsGetClass")
public boolean equals(Object o) {
if (this == o) {
return true;
diff --git a/src/main/java/com/android/tools/r8/optimize/interfaces/analysis/ErroneousCfFrameState.java b/src/main/java/com/android/tools/r8/optimize/interfaces/analysis/ErroneousCfFrameState.java
index eb4d25f..d287c15 100644
--- a/src/main/java/com/android/tools/r8/optimize/interfaces/analysis/ErroneousCfFrameState.java
+++ b/src/main/java/com/android/tools/r8/optimize/interfaces/analysis/ErroneousCfFrameState.java
@@ -272,6 +272,7 @@
}
@Override
+ @SuppressWarnings("EqualsGetClass")
public boolean equals(Object other) {
if (this == other) {
return true;
diff --git a/src/main/java/com/android/tools/r8/position/TextPosition.java b/src/main/java/com/android/tools/r8/position/TextPosition.java
index ebfd33a..730bd75 100644
--- a/src/main/java/com/android/tools/r8/position/TextPosition.java
+++ b/src/main/java/com/android/tools/r8/position/TextPosition.java
@@ -72,6 +72,7 @@
}
@Override
+ @SuppressWarnings("EqualsGetClass")
public boolean equals(Object o) {
if (o == this) {
return true;
diff --git a/src/main/java/com/android/tools/r8/position/TextRange.java b/src/main/java/com/android/tools/r8/position/TextRange.java
index 0e642d8..62c5c39 100644
--- a/src/main/java/com/android/tools/r8/position/TextRange.java
+++ b/src/main/java/com/android/tools/r8/position/TextRange.java
@@ -36,6 +36,7 @@
}
@Override
+ @SuppressWarnings("EqualsGetClass")
public boolean equals(Object o) {
if (o == this) {
return true;
diff --git a/src/main/java/com/android/tools/r8/profile/art/ArtProfileClassRule.java b/src/main/java/com/android/tools/r8/profile/art/ArtProfileClassRule.java
index b09934e..4b56d6c 100644
--- a/src/main/java/com/android/tools/r8/profile/art/ArtProfileClassRule.java
+++ b/src/main/java/com/android/tools/r8/profile/art/ArtProfileClassRule.java
@@ -69,7 +69,7 @@
}
@Override
- @SuppressWarnings("ReferenceEquality")
+ @SuppressWarnings({"EqualsGetClass", "ReferenceEquality"})
public boolean equals(Object o) {
if (this == o) {
return true;
diff --git a/src/main/java/com/android/tools/r8/profile/art/ArtProfileMethodRule.java b/src/main/java/com/android/tools/r8/profile/art/ArtProfileMethodRule.java
index f3032b2..c0b377f 100644
--- a/src/main/java/com/android/tools/r8/profile/art/ArtProfileMethodRule.java
+++ b/src/main/java/com/android/tools/r8/profile/art/ArtProfileMethodRule.java
@@ -74,6 +74,7 @@
}
@Override
+ @SuppressWarnings("EqualsGetClass")
public boolean equals(Object o) {
if (this == o) {
return true;
diff --git a/src/main/java/com/android/tools/r8/profile/art/ArtProfileMethodRuleInfoImpl.java b/src/main/java/com/android/tools/r8/profile/art/ArtProfileMethodRuleInfoImpl.java
index b86c569..ce823fc 100644
--- a/src/main/java/com/android/tools/r8/profile/art/ArtProfileMethodRuleInfoImpl.java
+++ b/src/main/java/com/android/tools/r8/profile/art/ArtProfileMethodRuleInfoImpl.java
@@ -63,6 +63,7 @@
}
@Override
+ @SuppressWarnings("EqualsGetClass")
public boolean equals(Object o) {
if (this == o) {
return true;
diff --git a/src/main/java/com/android/tools/r8/profile/art/ArtProfileProviderUtils.java b/src/main/java/com/android/tools/r8/profile/art/ArtProfileProviderUtils.java
index e09b79c..e7cfc7d 100644
--- a/src/main/java/com/android/tools/r8/profile/art/ArtProfileProviderUtils.java
+++ b/src/main/java/com/android/tools/r8/profile/art/ArtProfileProviderUtils.java
@@ -46,6 +46,7 @@
}
/** Serialize the given {@param artProfileProvider} to a string for writing it to a dump. */
+ @SuppressWarnings("DefaultCharset")
public static String serializeToString(ArtProfileProvider artProfileProvider) throws IOException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try (OutputStreamWriter outputStreamWriter =
@@ -106,6 +107,7 @@
}
@Override
+ @SuppressWarnings("DefaultCharset")
public ArtProfileBuilder addHumanReadableArtProfile(
TextInputStream textInputStream,
Consumer<HumanReadableArtProfileParserBuilder> parserBuilderConsumer) {
diff --git a/src/main/java/com/android/tools/r8/profile/art/rewriting/ArtProfileAdditions.java b/src/main/java/com/android/tools/r8/profile/art/rewriting/ArtProfileAdditions.java
index 2425ef4..5714c27 100644
--- a/src/main/java/com/android/tools/r8/profile/art/rewriting/ArtProfileAdditions.java
+++ b/src/main/java/com/android/tools/r8/profile/art/rewriting/ArtProfileAdditions.java
@@ -15,6 +15,7 @@
import com.android.tools.r8.profile.rewriting.ProfileAdditions;
import java.util.Comparator;
+@SuppressWarnings("BadImport")
public class ArtProfileAdditions
extends ProfileAdditions<
ArtProfileAdditions,
@@ -56,6 +57,7 @@
}
@Override
+ @SuppressWarnings("BadImport")
public ArtProfileAdditions self() {
return this;
}
diff --git a/src/main/java/com/android/tools/r8/profile/rewriting/ProfileRewritingCfInstructionDesugaringEventConsumer.java b/src/main/java/com/android/tools/r8/profile/rewriting/ProfileRewritingCfInstructionDesugaringEventConsumer.java
index 9b4ceb2..181723e 100644
--- a/src/main/java/com/android/tools/r8/profile/rewriting/ProfileRewritingCfInstructionDesugaringEventConsumer.java
+++ b/src/main/java/com/android/tools/r8/profile/rewriting/ProfileRewritingCfInstructionDesugaringEventConsumer.java
@@ -361,6 +361,7 @@
}
@Override
+ @SuppressWarnings("ArgumentSelectionDefectChecker")
public void acceptUtilityToStringIfNotNullMethod(ProgramMethod method, ProgramMethod context) {
additionsCollection.addMethodAndHolderIfContextIsInProfile(context, method);
parent.acceptUtilityToStringIfNotNullMethod(method, context);
diff --git a/src/main/java/com/android/tools/r8/profile/rewriting/ProfileRewritingCfPostProcessingDesugaringEventConsumer.java b/src/main/java/com/android/tools/r8/profile/rewriting/ProfileRewritingCfPostProcessingDesugaringEventConsumer.java
index 81115bb..944f860 100644
--- a/src/main/java/com/android/tools/r8/profile/rewriting/ProfileRewritingCfPostProcessingDesugaringEventConsumer.java
+++ b/src/main/java/com/android/tools/r8/profile/rewriting/ProfileRewritingCfPostProcessingDesugaringEventConsumer.java
@@ -67,6 +67,7 @@
}
@Override
+ @SuppressWarnings("ArgumentSelectionDefectChecker")
public void acceptCovariantRetargetMethod(ProgramMethod method, ProgramMethod context) {
additionsCollection.addMethodAndHolderIfContextIsInProfile(context, method);
parent.acceptCovariantRetargetMethod(method, context);
diff --git a/src/main/java/com/android/tools/r8/profile/startup/profile/StartupProfileClassRule.java b/src/main/java/com/android/tools/r8/profile/startup/profile/StartupProfileClassRule.java
index f879adb..42c3ad1 100644
--- a/src/main/java/com/android/tools/r8/profile/startup/profile/StartupProfileClassRule.java
+++ b/src/main/java/com/android/tools/r8/profile/startup/profile/StartupProfileClassRule.java
@@ -52,7 +52,7 @@
}
@Override
- @SuppressWarnings("ReferenceEquality")
+ @SuppressWarnings({"EqualsGetClass", "ReferenceEquality"})
public boolean equals(Object o) {
if (this == o) {
return true;
diff --git a/src/main/java/com/android/tools/r8/profile/startup/profile/StartupProfileMethodRule.java b/src/main/java/com/android/tools/r8/profile/startup/profile/StartupProfileMethodRule.java
index 5f8e2b5..c703e5d 100644
--- a/src/main/java/com/android/tools/r8/profile/startup/profile/StartupProfileMethodRule.java
+++ b/src/main/java/com/android/tools/r8/profile/startup/profile/StartupProfileMethodRule.java
@@ -52,7 +52,7 @@
}
@Override
- @SuppressWarnings("ReferenceEquality")
+ @SuppressWarnings({"EqualsGetClass", "ReferenceEquality"})
public boolean equals(Object o) {
if (this == o) {
return true;
diff --git a/src/main/java/com/android/tools/r8/repackaging/Repackaging.java b/src/main/java/com/android/tools/r8/repackaging/Repackaging.java
index b79ae30..1b9b6c3 100644
--- a/src/main/java/com/android/tools/r8/repackaging/Repackaging.java
+++ b/src/main/java/com/android/tools/r8/repackaging/Repackaging.java
@@ -164,8 +164,11 @@
private static class RepackagingTreeFixer extends TreeFixerBase {
private final BiMap<DexType, DexType> mappings;
+
+ @SuppressWarnings("BadImport")
private final Builder lensBuilder;
+ @SuppressWarnings("BadImport")
public RepackagingTreeFixer(
AppView<AppInfoWithLiveness> appView,
BiMap<DexType, DexType> mappings,
diff --git a/src/main/java/com/android/tools/r8/repackaging/RepackagingAnnotationTracer.java b/src/main/java/com/android/tools/r8/repackaging/RepackagingAnnotationTracer.java
index 3bf5519..0c43208 100644
--- a/src/main/java/com/android/tools/r8/repackaging/RepackagingAnnotationTracer.java
+++ b/src/main/java/com/android/tools/r8/repackaging/RepackagingAnnotationTracer.java
@@ -18,13 +18,11 @@
public class RepackagingAnnotationTracer {
- private final AppInfoWithClassHierarchy appInfo;
private final GraphLens graphLens;
private final RepackagingUseRegistry registry;
public RepackagingAnnotationTracer(
AppView<? extends AppInfoWithClassHierarchy> appView, RepackagingUseRegistry registry) {
- this.appInfo = appView.appInfo();
this.graphLens = appView.graphLens();
this.registry = registry;
}
diff --git a/src/main/java/com/android/tools/r8/retrace/RetraceCommand.java b/src/main/java/com/android/tools/r8/retrace/RetraceCommand.java
index 10db02a..c491aba 100644
--- a/src/main/java/com/android/tools/r8/retrace/RetraceCommand.java
+++ b/src/main/java/com/android/tools/r8/retrace/RetraceCommand.java
@@ -14,7 +14,8 @@
@Keep
public class RetraceCommand {
- private final StackTraceSupplier stacktraceSupplier;
+ private final StackTraceSupplier stackTraceSupplier;
+
private final Consumer<List<String>> retracedStackTraceConsumer;
// Not inheriting to allow for static builder methods.
private final RetraceOptions options;
@@ -23,11 +24,11 @@
StackTraceSupplier stackTraceSupplier,
Consumer<List<String>> retracedStackTraceConsumer,
RetraceOptions options) {
- this.stacktraceSupplier = stackTraceSupplier;
+ this.stackTraceSupplier = stackTraceSupplier;
this.retracedStackTraceConsumer = retracedStackTraceConsumer;
this.options = options;
- assert this.stacktraceSupplier != null || options.isVerifyMappingFileHash();
+ assert this.stackTraceSupplier != null || options.isVerifyMappingFileHash();
assert this.retracedStackTraceConsumer != null;
}
@@ -39,8 +40,14 @@
return System.getProperty("com.android.tools.r8.printmemory") != null;
}
+ @Deprecated
+ @SuppressWarnings("InlineMeSuggester")
public StackTraceSupplier getStacktraceSupplier() {
- return stacktraceSupplier;
+ return getStackTraceSupplier();
+ }
+
+ public StackTraceSupplier getStackTraceSupplier() {
+ return stackTraceSupplier;
}
public Consumer<List<String>> getRetracedStackTraceConsumer() {
diff --git a/src/main/java/com/android/tools/r8/retrace/internal/FieldDefinition.java b/src/main/java/com/android/tools/r8/retrace/internal/FieldDefinition.java
index bb2a83d..1bb98c8 100644
--- a/src/main/java/com/android/tools/r8/retrace/internal/FieldDefinition.java
+++ b/src/main/java/com/android/tools/r8/retrace/internal/FieldDefinition.java
@@ -55,6 +55,7 @@
}
@Override
+ @SuppressWarnings("EqualsGetClass")
public boolean equals(Object o) {
if (this == o) {
return true;
@@ -111,6 +112,7 @@
}
@Override
+ @SuppressWarnings("EqualsGetClass")
public boolean equals(Object o) {
if (this == o) {
return true;
diff --git a/src/main/java/com/android/tools/r8/retrace/internal/MappingPartitionMetadataInternal.java b/src/main/java/com/android/tools/r8/retrace/internal/MappingPartitionMetadataInternal.java
index b5438c6..b8717ec 100644
--- a/src/main/java/com/android/tools/r8/retrace/internal/MappingPartitionMetadataInternal.java
+++ b/src/main/java/com/android/tools/r8/retrace/internal/MappingPartitionMetadataInternal.java
@@ -46,6 +46,7 @@
return MetadataAdditionalInfo.create(null, null);
}
+ @SuppressWarnings("MutablePublicArray")
// Magic byte put into the metadata
byte[] MAGIC = new byte[] {(byte) 0xAA, (byte) 0xA8};
@@ -116,6 +117,7 @@
}
}
+ @SuppressWarnings("DefaultCharset")
public static ObfuscatedTypeNameAsKeyMetadata deserialize(CompatByteBuffer buffer) {
byte[] array = buffer.array();
MapVersion mapVersion = MapVersion.fromName(new String(array, 2, array.length - 2));
diff --git a/src/main/java/com/android/tools/r8/retrace/internal/MethodDefinition.java b/src/main/java/com/android/tools/r8/retrace/internal/MethodDefinition.java
index b1e23f5..b80e08c 100644
--- a/src/main/java/com/android/tools/r8/retrace/internal/MethodDefinition.java
+++ b/src/main/java/com/android/tools/r8/retrace/internal/MethodDefinition.java
@@ -56,6 +56,7 @@
}
@Override
+ @SuppressWarnings("EqualsGetClass")
public boolean equals(Object o) {
if (this == o) {
return true;
@@ -116,6 +117,7 @@
}
@Override
+ @SuppressWarnings("EqualsGetClass")
public boolean equals(Object o) {
if (this == o) {
return true;
diff --git a/src/main/java/com/android/tools/r8/retrace/internal/PartitionMappingSupplierBase.java b/src/main/java/com/android/tools/r8/retrace/internal/PartitionMappingSupplierBase.java
index 1d913e3..dce9988 100644
--- a/src/main/java/com/android/tools/r8/retrace/internal/PartitionMappingSupplierBase.java
+++ b/src/main/java/com/android/tools/r8/retrace/internal/PartitionMappingSupplierBase.java
@@ -39,7 +39,10 @@
private final RegisterMappingPartitionCallback registerCallback;
private final PrepareMappingPartitionsCallback prepareCallback;
+
+ @SuppressWarnings("UnusedVariable")
private final FinishedPartitionMappingCallback finishedCallback;
+
private final boolean allowExperimental;
private final byte[] metadata;
private final MapVersion fallbackMapVersion;
diff --git a/src/main/java/com/android/tools/r8/retrace/internal/ProguardMapReaderWithFiltering.java b/src/main/java/com/android/tools/r8/retrace/internal/ProguardMapReaderWithFiltering.java
index 282e28a..28276f3 100644
--- a/src/main/java/com/android/tools/r8/retrace/internal/ProguardMapReaderWithFiltering.java
+++ b/src/main/java/com/android/tools/r8/retrace/internal/ProguardMapReaderWithFiltering.java
@@ -20,6 +20,7 @@
public abstract class ProguardMapReaderWithFiltering implements LineReader {
+ @SuppressWarnings("DefaultCharset")
private static final byte[] SOURCE_FILE_BYTES = "sourceFile".getBytes();
public enum LineParserNode {
diff --git a/src/main/java/com/android/tools/r8/retrace/internal/RetraceFieldResultImpl.java b/src/main/java/com/android/tools/r8/retrace/internal/RetraceFieldResultImpl.java
index c7f09b8..5006eac 100644
--- a/src/main/java/com/android/tools/r8/retrace/internal/RetraceFieldResultImpl.java
+++ b/src/main/java/com/android/tools/r8/retrace/internal/RetraceFieldResultImpl.java
@@ -18,7 +18,9 @@
public class RetraceFieldResultImpl implements RetraceFieldResult {
+ @SuppressWarnings("UnusedVariable")
private final RetraceClassResultImpl classResult;
+
private final List<Pair<RetraceClassElementImpl, List<MemberNaming>>> memberNamings;
private final FieldDefinition fieldDefinition;
private final RetracerImpl retracer;
diff --git a/src/main/java/com/android/tools/r8/retrace/internal/RetraceFrameResultImpl.java b/src/main/java/com/android/tools/r8/retrace/internal/RetraceFrameResultImpl.java
index 2deef6f..8b1a45f 100644
--- a/src/main/java/com/android/tools/r8/retrace/internal/RetraceFrameResultImpl.java
+++ b/src/main/java/com/android/tools/r8/retrace/internal/RetraceFrameResultImpl.java
@@ -34,7 +34,9 @@
class RetraceFrameResultImpl implements RetraceFrameResult {
+ @SuppressWarnings("UnusedVariable")
private final RetraceClassResultImpl classResult;
+
private final MethodDefinition methodDefinition;
private final List<RetraceFrameResultData> mappedRanges;
private final RetracerImpl retracer;
@@ -347,6 +349,7 @@
}
@Override
+ @SuppressWarnings("ObjectToString")
public void forEachRewritten(Consumer<RetracedSingleFrame> consumer) {
RetraceStackTraceContextImpl contextImpl = retraceFrameResult.context;
RetraceStackTraceCurrentEvaluationInformation currentFrameInformation =
@@ -393,6 +396,7 @@
}
@Override
+ @SuppressWarnings("MixedMutabilityReturnType")
public List<RetracedMethodReferenceImpl> getOuterFrames() {
if (mappedRanges == null) {
return Collections.emptyList();
diff --git a/src/main/java/com/android/tools/r8/retrace/internal/RetraceThrownExceptionResultImpl.java b/src/main/java/com/android/tools/r8/retrace/internal/RetraceThrownExceptionResultImpl.java
index 3488823..502d6fd 100644
--- a/src/main/java/com/android/tools/r8/retrace/internal/RetraceThrownExceptionResultImpl.java
+++ b/src/main/java/com/android/tools/r8/retrace/internal/RetraceThrownExceptionResultImpl.java
@@ -16,7 +16,9 @@
public class RetraceThrownExceptionResultImpl implements RetraceThrownExceptionResult {
+ @SuppressWarnings("UnusedVariable")
private final RetraceStackTraceContextImpl context;
+
private final ClassReference obfuscatedReference;
private final ClassNamingForNameMapper mapper;
diff --git a/src/main/java/com/android/tools/r8/retrace/internal/RetraceTypeResultImpl.java b/src/main/java/com/android/tools/r8/retrace/internal/RetraceTypeResultImpl.java
index d1ee952..0ab58eb 100644
--- a/src/main/java/com/android/tools/r8/retrace/internal/RetraceTypeResultImpl.java
+++ b/src/main/java/com/android/tools/r8/retrace/internal/RetraceTypeResultImpl.java
@@ -19,8 +19,12 @@
public class RetraceTypeResultImpl implements RetraceTypeResult {
+ @SuppressWarnings("UnusedVariable")
private final TypeReference obfuscatedType;
+
private final List<RetracedTypeReference> retracedTypeReferences;
+
+ @SuppressWarnings("UnusedVariable")
private final Retracer retracer;
private RetraceTypeResultImpl(
diff --git a/src/main/java/com/android/tools/r8/retrace/internal/StackTraceRegularExpressionParser.java b/src/main/java/com/android/tools/r8/retrace/internal/StackTraceRegularExpressionParser.java
index cebdc23..64f42e6 100644
--- a/src/main/java/com/android/tools/r8/retrace/internal/StackTraceRegularExpressionParser.java
+++ b/src/main/java/com/android/tools/r8/retrace/internal/StackTraceRegularExpressionParser.java
@@ -73,6 +73,7 @@
return proxyBuilder.build();
}
+ @SuppressWarnings("UnnecessaryParentheses")
private int registerGroups(
String regularExpression,
StringBuilder refinedRegularExpression,
diff --git a/src/main/java/com/android/tools/r8/shaking/AnnotationRemover.java b/src/main/java/com/android/tools/r8/shaking/AnnotationRemover.java
index c41d870..6389e26 100644
--- a/src/main/java/com/android/tools/r8/shaking/AnnotationRemover.java
+++ b/src/main/java/com/android/tools/r8/shaking/AnnotationRemover.java
@@ -318,6 +318,7 @@
return annotationsToRetain.contains(annotation);
}
+ @SuppressWarnings("UnusedVariable")
private boolean shouldRetainAnnotationDefaultAnnotationOnAnnotationClass(
DexAnnotation annotation) {
// We currently always retain the @AnnotationDefault annotations for annotation classes. In full
diff --git a/src/main/java/com/android/tools/r8/shaking/CheckEnumUnboxedRule.java b/src/main/java/com/android/tools/r8/shaking/CheckEnumUnboxedRule.java
index da2fbbe..3de682d 100644
--- a/src/main/java/com/android/tools/r8/shaking/CheckEnumUnboxedRule.java
+++ b/src/main/java/com/android/tools/r8/shaking/CheckEnumUnboxedRule.java
@@ -12,6 +12,7 @@
public static final String RULE_NAME = "checkenumunboxed";
+ @SuppressWarnings("NonCanonicalType")
public static class Builder
extends ProguardConfigurationRule.Builder<CheckEnumUnboxedRule, Builder> {
diff --git a/src/main/java/com/android/tools/r8/shaking/ClassInlineRule.java b/src/main/java/com/android/tools/r8/shaking/ClassInlineRule.java
index ccda8e3..6639246 100644
--- a/src/main/java/com/android/tools/r8/shaking/ClassInlineRule.java
+++ b/src/main/java/com/android/tools/r8/shaking/ClassInlineRule.java
@@ -15,6 +15,7 @@
NEVER
}
+ @SuppressWarnings("NonCanonicalType")
public static class Builder extends ProguardConfigurationRule.Builder<ClassInlineRule, Builder> {
private Builder() {
diff --git a/src/main/java/com/android/tools/r8/shaking/ComputeApiLevelUseRegistry.java b/src/main/java/com/android/tools/r8/shaking/ComputeApiLevelUseRegistry.java
index 67e5054..bd53f9a 100644
--- a/src/main/java/com/android/tools/r8/shaking/ComputeApiLevelUseRegistry.java
+++ b/src/main/java/com/android/tools/r8/shaking/ComputeApiLevelUseRegistry.java
@@ -22,7 +22,6 @@
public class ComputeApiLevelUseRegistry extends UseRegistry<ProgramMethod> {
- protected final AppView<?> appView;
private final AppInfoWithClassHierarchy appInfoWithClassHierarchy;
private final AndroidApiLevelCompute apiLevelCompute;
private final boolean isEnabled;
@@ -31,7 +30,6 @@
public ComputeApiLevelUseRegistry(
AppView<?> appView, ProgramMethod context, AndroidApiLevelCompute apiLevelCompute) {
super(appView, context);
- this.appView = appView;
this.appInfoWithClassHierarchy = appView.appInfoForDesugaring();
this.apiLevelCompute = apiLevelCompute;
isEnabled = apiLevelCompute.isEnabled();
@@ -172,6 +170,7 @@
}
}
+ @SuppressWarnings("HidingField")
public ComputedApiLevel getMaxApiReferenceLevel() {
return maxApiReferenceLevel;
}
diff --git a/src/main/java/com/android/tools/r8/shaking/ConvertCheckNotNullRule.java b/src/main/java/com/android/tools/r8/shaking/ConvertCheckNotNullRule.java
index dd372e3..8dd9b27 100644
--- a/src/main/java/com/android/tools/r8/shaking/ConvertCheckNotNullRule.java
+++ b/src/main/java/com/android/tools/r8/shaking/ConvertCheckNotNullRule.java
@@ -12,6 +12,7 @@
public static final String RULE_NAME = "convertchecknotnull";
+ @SuppressWarnings("NonCanonicalType")
public static class Builder
extends ProguardConfigurationRule.Builder<ConvertCheckNotNullRule, Builder> {
diff --git a/src/main/java/com/android/tools/r8/shaking/DefaultEnqueuerUseRegistry.java b/src/main/java/com/android/tools/r8/shaking/DefaultEnqueuerUseRegistry.java
index f7ffc42..c07de40 100644
--- a/src/main/java/com/android/tools/r8/shaking/DefaultEnqueuerUseRegistry.java
+++ b/src/main/java/com/android/tools/r8/shaking/DefaultEnqueuerUseRegistry.java
@@ -23,16 +23,16 @@
public class DefaultEnqueuerUseRegistry extends ComputeApiLevelUseRegistry {
- protected final AppView<? extends AppInfoWithClassHierarchy> appView;
+ protected final AppView<? extends AppInfoWithClassHierarchy> appViewWithClassHierarchy;
protected final Enqueuer enqueuer;
public DefaultEnqueuerUseRegistry(
- AppView<? extends AppInfoWithClassHierarchy> appView,
+ AppView<? extends AppInfoWithClassHierarchy> appViewWithClassHierarchy,
ProgramMethod context,
Enqueuer enqueuer,
AndroidApiLevelCompute apiLevelCompute) {
- super(appView, context, apiLevelCompute);
- this.appView = appView;
+ super(appViewWithClassHierarchy, context, apiLevelCompute);
+ this.appViewWithClassHierarchy = appViewWithClassHierarchy;
this.enqueuer = enqueuer;
}
@@ -193,8 +193,8 @@
@Override
public void registerCallSite(DexCallSite callSite) {
super.registerCallSiteExceptBootstrapArgs(callSite);
- if (isInvokeDynamicOnRecord(callSite, appView, getContext())
- && appView.options().testing.enableRecordModeling) {
+ if (isInvokeDynamicOnRecord(callSite, appViewWithClassHierarchy, getContext())
+ && appViewWithClassHierarchy.options().testing.enableRecordModeling) {
registerRecordCallSiteBootstrapArgs(callSite);
} else {
super.registerCallSiteBootstrapArgs(callSite, 0, callSite.bootstrapArgs.size());
@@ -202,6 +202,7 @@
enqueuer.traceCallSite(callSite, getContext());
}
+ @SuppressWarnings("HidingField")
private void registerRecordCallSiteBootstrapArgs(DexCallSite callSite) {
// The Instance Get method handle in invokeDynamicOnRecord are considered:
// - a record use if not a constant value,
@@ -210,7 +211,7 @@
for (int i = 2; i < callSite.getBootstrapArgs().size(); i++) {
DexField field = callSite.getBootstrapArgs().get(i).asDexValueMethodHandle().value.asField();
DexEncodedField encodedField =
- appView.appInfo().resolveField(field, getContext()).getResolvedField();
+ appViewWithClassHierarchy.appInfo().resolveField(field, getContext()).getResolvedField();
// Member value propagation does not rewrite method handles, special handling for this
// method handle access is done after the final tree shaking.
if (!encodedField.getOptimizationInfo().isDead()) {
diff --git a/src/main/java/com/android/tools/r8/shaking/Enqueuer.java b/src/main/java/com/android/tools/r8/shaking/Enqueuer.java
index b6d4948..539d36c 100644
--- a/src/main/java/com/android/tools/r8/shaking/Enqueuer.java
+++ b/src/main/java/com/android/tools/r8/shaking/Enqueuer.java
@@ -66,7 +66,6 @@
import com.android.tools.r8.graph.FieldAccessInfoCollectionImpl;
import com.android.tools.r8.graph.FieldAccessInfoImpl;
import com.android.tools.r8.graph.FieldResolutionResult;
-import com.android.tools.r8.graph.FieldResolutionResult.FailedOrUnknownFieldResolutionResult;
import com.android.tools.r8.graph.GenericSignatureEnqueuerAnalysis;
import com.android.tools.r8.graph.InnerClassAttribute;
import com.android.tools.r8.graph.InvalidCode;
@@ -386,7 +385,7 @@
private final LiveFieldsSet liveFields;
/** A queue of items that need processing. Different items trigger different actions. */
- private EnqueuerWorklist workList;
+ private EnqueuerWorklist worklist;
private final ProguardCompatibilityActions.Builder proguardCompatibilityActionsBuilder;
@@ -493,7 +492,7 @@
this.mode = mode;
this.options = options;
this.useRegistryFactory = createUseRegistryFactory();
- this.workList = EnqueuerWorklist.createWorklist(this);
+ this.worklist = EnqueuerWorklist.createWorklist(this);
this.proguardCompatibilityActionsBuilder =
mode.isInitialTreeShaking() && options.forceProguardCompatibility
? ProguardCompatibilityActions.builder()
@@ -768,7 +767,7 @@
}
public EnqueuerWorklist getWorklist() {
- return workList;
+ return worklist;
}
private void addLiveNonProgramType(
@@ -949,11 +948,11 @@
DexProgramClass clazz, Set<ProguardKeepRuleBase> rules, DexDefinition precondition) {
KeepReasonWitness witness = graphReporter.reportKeepClass(precondition, rules, clazz);
if (clazz.isAnnotation()) {
- workList.enqueueMarkAnnotationInstantiatedAction(clazz, witness);
+ worklist.enqueueMarkAnnotationInstantiatedAction(clazz, witness);
} else if (clazz.isInterface()) {
- workList.enqueueMarkInterfaceInstantiatedAction(clazz, witness);
+ worklist.enqueueMarkInterfaceInstantiatedAction(clazz, witness);
} else {
- workList.enqueueMarkInstantiatedAction(clazz, null, InstantiationReason.KEEP_RULE, witness);
+ worklist.enqueueMarkInstantiatedAction(clazz, null, InstantiationReason.KEEP_RULE, witness);
if (clazz.hasDefaultInitializer()) {
ProgramMethod defaultInitializer = clazz.getProgramDefaultInitializer();
if (forceProguardCompatibility) {
@@ -964,7 +963,7 @@
}
}
if (!joiner.getRules().isEmpty()) {
- workList.enqueueMarkMethodKeptAction(
+ worklist.enqueueMarkMethodKeptAction(
defaultInitializer,
graphReporter.reportCompatKeepDefaultInitializer(defaultInitializer));
applyMinimumKeepInfoWhenLiveOrTargeted(
@@ -972,7 +971,7 @@
}
}
if (clazz.isExternalizable(appView)) {
- workList.enqueueMarkMethodLiveAction(defaultInitializer, defaultInitializer, witness);
+ worklist.enqueueMarkMethodLiveAction(defaultInitializer, defaultInitializer, witness);
applyMinimumKeepInfoWhenLiveOrTargeted(
defaultInitializer, KeepMethodInfo.newEmptyJoiner().disallowOptimization());
}
@@ -984,7 +983,7 @@
ProgramField field, KeepFieldInfo.Joiner minimumKeepInfo, EnqueuerEvent preconditionEvent) {
assert minimumKeepInfo.verifyShrinkingDisallowedWithRule(options);
DexDefinition precondition = preconditionEvent.getDefinition(appInfo());
- workList.enqueueMarkFieldKeptAction(
+ worklist.enqueueMarkFieldKeptAction(
field,
graphReporter.reportKeepField(
precondition,
@@ -999,7 +998,7 @@
EnqueuerEvent preconditionEvent) {
assert minimumKeepInfo.verifyShrinkingDisallowedWithRule(options);
DexDefinition precondition = preconditionEvent.getDefinition(appInfo());
- workList.enqueueMarkMethodKeptAction(
+ worklist.enqueueMarkMethodKeptAction(
method,
graphReporter.reportKeepMethod(
precondition, minimumKeepInfo.getRules(), method.getDefinition()));
@@ -1018,7 +1017,7 @@
clazz = superClass;
}
if (clazz.hasDefaultInitializer()) {
- workList.enqueueMarkMethodLiveAction(clazz.getProgramDefaultInitializer(), clazz, reason);
+ worklist.enqueueMarkMethodLiveAction(clazz.getProgramDefaultInitializer(), clazz, reason);
applyMinimumKeepInfoWhenLiveOrTargeted(
clazz.getProgramDefaultInitializer(),
KeepMethodInfo.newEmptyJoiner().disallowOptimization());
@@ -1415,7 +1414,7 @@
registerDeferredActionForDeadProtoBuilder(
invokedMethod.holder,
context,
- () -> workList.enqueueTraceInvokeDirectAction(invokedMethod, context));
+ () -> worklist.enqueueTraceInvokeDirectAction(invokedMethod, context));
if (skipTracing) {
addDeadProtoTypeCandidate(invokedMethod.holder);
return;
@@ -1508,6 +1507,7 @@
invokeAnalyses.forEach(analysis -> analysis.traceInvokeStatic(invokedMethod, context));
}
+ @SuppressWarnings("UnusedVariable")
void traceInvokeSuper(DexMethod invokedMethod, ProgramMethod context) {
// We have to revisit super invokes based on the context they are found in. The same
// method descriptor will hit different targets, depending on the context it is used in.
@@ -1516,7 +1516,7 @@
methodAccessInfoCollection::registerInvokeSuperInContext, invokedMethod, context)) {
return;
}
- workList.enqueueMarkReachableSuperAction(invokedMethod, context);
+ worklist.enqueueMarkReachableSuperAction(invokedMethod, context);
invokeAnalyses.forEach(analysis -> analysis.traceInvokeSuper(invokedMethod, context));
}
@@ -1551,7 +1551,7 @@
void traceNewInstance(DexType type, ProgramMethod context) {
boolean skipTracing =
registerDeferredActionForDeadProtoBuilder(
- type, context, () -> workList.enqueueTraceNewInstanceAction(type, context));
+ type, context, () -> worklist.enqueueTraceNewInstanceAction(type, context));
if (skipTracing) {
addDeadProtoTypeCandidate(type);
return;
@@ -1579,7 +1579,7 @@
if (clazz.isAnnotation() || clazz.isInterface()) {
markTypeAsLive(clazz, graphReporter.registerClass(clazz, keepReason));
} else {
- workList.enqueueMarkInstantiatedAction(clazz, context, instantiationReason, keepReason);
+ worklist.enqueueMarkInstantiatedAction(clazz, context, instantiationReason, keepReason);
}
}
}
@@ -1668,6 +1668,7 @@
}
@Override
+ @SuppressWarnings("EqualsGetClass")
public boolean equals(Object obj) {
if (this == obj) {
return true;
@@ -1704,7 +1705,7 @@
fieldAccessAnalyses.forEach(
analysis ->
analysis.traceInstanceFieldRead(
- fieldReference, singleResolutionResult, currentMethod, workList));
+ fieldReference, singleResolutionResult, currentMethod, worklist));
ProgramField field = singleResolutionResult.getProgramField();
if (field == null) {
@@ -1729,12 +1730,12 @@
markTypeAsLive(singleResolutionResult.getInitialResolutionHolder(), currentMethod);
}
- workList.enqueueMarkFieldAsReachableAction(
+ worklist.enqueueMarkFieldAsReachableAction(
field, currentMethod, KeepReason.fieldReferencedIn(currentMethod));
},
failedResolution -> {
// Must trace the types from the field reference even if it does not exist.
- traceFieldReference(fieldReference, failedResolution, currentMethod);
+ traceFieldReference(fieldReference, currentMethod);
noClassMerging.add(fieldReference.getHolderType());
});
}
@@ -1770,7 +1771,7 @@
fieldAccessAnalyses.forEach(
analysis ->
analysis.traceInstanceFieldWrite(
- fieldReference, singleResolutionResult, currentMethod, workList));
+ fieldReference, singleResolutionResult, currentMethod, worklist));
ProgramField field = singleResolutionResult.getProgramField();
if (field == null) {
@@ -1794,11 +1795,11 @@
}
KeepReason reason = KeepReason.fieldReferencedIn(currentMethod);
- workList.enqueueMarkFieldAsReachableAction(field, currentMethod, reason);
+ worklist.enqueueMarkFieldAsReachableAction(field, currentMethod, reason);
},
failedResolution -> {
// Must trace the types from the field reference even if it does not exist.
- traceFieldReference(fieldReference, failedResolution, currentMethod);
+ traceFieldReference(fieldReference, currentMethod);
noClassMerging.add(fieldReference.getHolderType());
});
}
@@ -1845,7 +1846,7 @@
fieldAccessAnalyses.forEach(
analysis ->
analysis.traceStaticFieldRead(
- fieldReference, singleResolutionResult, currentMethod, workList));
+ fieldReference, singleResolutionResult, currentMethod, worklist));
ProgramField field = singleResolutionResult.getProgramField();
if (field == null) {
@@ -1874,7 +1875,7 @@
},
failedResolution -> {
// Must trace the types from the field reference even if it does not exist.
- traceFieldReference(fieldReference, failedResolution, currentMethod);
+ traceFieldReference(fieldReference, currentMethod);
noClassMerging.add(fieldReference.getHolderType());
// Record field reference for generated extension registry shrinking.
appView.withGeneratedExtensionRegistryShrinker(
@@ -1926,7 +1927,7 @@
fieldAccessAnalyses.forEach(
analysis ->
analysis.traceStaticFieldWrite(
- fieldReference, singleResolutionResult, currentMethod, workList));
+ fieldReference, singleResolutionResult, currentMethod, worklist));
ProgramField field = singleResolutionResult.getProgramField();
if (field == null) {
@@ -1955,7 +1956,7 @@
},
failedResolution -> {
// Must trace the types from the field reference even if it does not exist.
- traceFieldReference(fieldReference, failedResolution, currentMethod);
+ traceFieldReference(fieldReference, currentMethod);
noClassMerging.add(fieldReference.getHolderType());
});
}
@@ -2186,7 +2187,7 @@
compatEnqueueHolderIfDependentNonStaticMember(
clazz, rootSet.getDependentKeepClassCompatRule(clazz.getType()));
- analyses.forEach(analysis -> analysis.processNewlyLiveClass(clazz, workList));
+ analyses.forEach(analysis -> analysis.processNewlyLiveClass(clazz, worklist));
}
@SuppressWarnings("ReferenceEquality")
@@ -2590,7 +2591,7 @@
// to a verification error. See also testInvokeSpecialToDefaultMethod.
if (resolvedMethod.getDefinition().isNonPrivateVirtualMethod()
&& virtualMethodsTargetedByInvokeDirect.add(resolvedMethod.getReference())) {
- workList.enqueueMarkMethodLiveAction(resolvedMethod, context, reason);
+ worklist.enqueueMarkMethodLiveAction(resolvedMethod, context, reason);
}
});
}
@@ -2764,7 +2765,7 @@
// could lead to nondeterminism.
analyses.forEach(
analysis ->
- analysis.processNewlyInstantiatedClass(clazz.asProgramClass(), context, workList));
+ analysis.processNewlyInstantiatedClass(clazz.asProgramClass(), context, worklist));
if (!markInstantiatedClass(clazz, context, instantiationReason, keepReason)) {
return;
@@ -3161,7 +3162,7 @@
}
// Notify analyses.
- analyses.forEach(analysis -> analysis.processNewlyLiveField(field, context, workList));
+ analyses.forEach(analysis -> analysis.processNewlyLiveField(field, context, worklist));
}
// Package protected due to entry point from worklist.
@@ -3187,9 +3188,10 @@
traceFieldDefinition(field);
- analyses.forEach(analysis -> analysis.notifyMarkFieldAsReachable(field, workList));
+ analyses.forEach(analysis -> analysis.notifyMarkFieldAsReachable(field, worklist));
}
+ @SuppressWarnings("UnusedVariable")
private void traceFieldDefinition(ProgramField field) {
markTypeAsLive(field.getHolder(), field);
markTypeAsLive(field.getType(), field);
@@ -3198,7 +3200,6 @@
private void traceFieldReference(
DexField field,
- FailedOrUnknownFieldResolutionResult resolutionResult,
ProgramMethod context) {
markTypeAsLive(field.getHolderType(), context);
markTypeAsLive(field.getType(), context);
@@ -3210,8 +3211,8 @@
&& method.getAccessFlags().isPrivate()) {
return;
}
- if (workList.enqueueMarkMethodLiveAction(method, method, reason)) {
- assert workList.enqueueAssertAction(
+ if (worklist.enqueueMarkMethodLiveAction(method, method, reason)) {
+ assert worklist.enqueueAssertAction(
() -> {
// Should have marked the holder type live.
assert method.getDefinition().isClassInitializer() || verifyMethodIsTargeted(method);
@@ -3219,7 +3220,7 @@
});
} else {
assert method.getDefinition().isClassInitializer() || verifyMethodIsTargeted(method);
- assert workList.enqueueAssertAction(() -> verifyTypeIsLive(method.getHolder()));
+ assert worklist.enqueueAssertAction(() -> verifyTypeIsLive(method.getHolder()));
}
}
@@ -3228,7 +3229,7 @@
assert !method.getDefinition().isAbstract()
|| reason.isDueToKeepRule()
|| reason.isDueToReflectiveUse();
- workList.enqueueMarkMethodLiveAction(method, method, reason);
+ worklist.enqueueMarkMethodLiveAction(method, method, reason);
}
public boolean isFieldReferenced(DexEncodedField field) {
@@ -3446,7 +3447,7 @@
target.accept(
method -> markVirtualDispatchMethodTargetAsLive(method, reason),
lambda -> markVirtualDispatchLambdaTargetAsLive(lambda, reason));
- analyses.forEach(analysis -> analysis.notifyMarkVirtualDispatchTargetAsLive(target, workList));
+ analyses.forEach(analysis -> analysis.notifyMarkVirtualDispatchTargetAsLive(target, worklist));
}
private void markVirtualDispatchMethodTargetAsLive(
@@ -3466,7 +3467,7 @@
LookupLambdaTarget target, Function<ProgramMethod, KeepReasonWitness> reason) {
ProgramMethod implementationMethod = target.getImplementationMethod().asProgramMethod();
if (implementationMethod != null) {
- workList.enqueueMarkMethodLiveAction(
+ worklist.enqueueMarkMethodLiveAction(
implementationMethod, implementationMethod, reason.apply(implementationMethod));
}
}
@@ -3546,7 +3547,7 @@
if (valuesMethod != null) {
// TODO(sgjesse): Does this have to be enqueued as a root item? Right now it is done as the
// marking for not renaming it is in the root set.
- workList.enqueueMarkMethodKeptAction(valuesMethod, reason);
+ worklist.enqueueMarkMethodKeptAction(valuesMethod, reason);
keepInfo.joinMethod(
valuesMethod,
joiner -> joiner.disallowMinification().disallowOptimization().disallowShrinking());
@@ -3581,7 +3582,7 @@
analyses.forEach(
analyses ->
analyses.notifyFailedMethodResolutionTarget(
- resolution.getResolvedMethod(), workList));
+ resolution.getResolvedMethod(), worklist));
return;
}
@@ -3983,7 +3984,7 @@
KeepReasonWitness fakeReason = enqueuer.graphReporter.fakeReportShouldNotBeUsed();
for (ProgramMethod desugaredMethod : desugaredMethods) {
- enqueuer.workList.enqueueTraceCodeAction(desugaredMethod);
+ enqueuer.worklist.enqueueTraceCodeAction(desugaredMethod);
}
liveMethodsWithKeepActions.forEach(
@@ -3991,7 +3992,7 @@
for (ProgramMethod liveMethod : liveMethods.values()) {
assert !enqueuer.targetedMethods.contains(liveMethod.getDefinition());
enqueuer.markMethodAsTargeted(liveMethod, fakeReason);
- enqueuer.workList.enqueueMarkMethodLiveAction(liveMethod, liveMethod, fakeReason);
+ enqueuer.worklist.enqueueMarkMethodLiveAction(liveMethod, liveMethod, fakeReason);
}
enqueuer.liveNonProgramTypes.addAll(syntheticClasspathClasses.values());
injectedInterfaces.forEach(
@@ -4462,8 +4463,8 @@
try {
while (true) {
long numberOfLiveItems = getNumberOfLiveItems();
- while (!workList.isEmpty()) {
- EnqueuerAction action = workList.poll();
+ while (!worklist.isEmpty()) {
+ EnqueuerAction action = worklist.poll();
action.run(this);
}
@@ -4492,7 +4493,7 @@
consequentSetBuilder);
addConsequentRootSet(ifRuleEvaluator.run());
assert getNumberOfLiveItems() == numberOfLiveItemsAfterProcessing;
- if (!workList.isEmpty()) {
+ if (!worklist.isEmpty()) {
continue;
}
}
@@ -4503,20 +4504,20 @@
pendingReflectiveUses.forEach(this::handleReflectiveBehavior);
pendingReflectiveUses.clear();
}
- if (!workList.isEmpty()) {
+ if (!worklist.isEmpty()) {
continue;
}
// Allow deferred tracing to enqueue worklist items.
- if (deferredTracing.enqueueWorklistActions(workList)) {
- assert !workList.isEmpty();
+ if (deferredTracing.enqueueWorklistActions(worklist)) {
+ assert !worklist.isEmpty();
continue;
}
// Notify each analysis that a fixpoint has been reached, and give each analysis an
// opportunity to add items to the worklist.
- analyses.forEach(analysis -> analysis.notifyFixpoint(this, workList, timing));
- if (!workList.isEmpty()) {
+ analyses.forEach(analysis -> analysis.notifyFixpoint(this, worklist, timing));
+ if (!worklist.isEmpty()) {
continue;
}
@@ -4537,7 +4538,7 @@
.merge(consequentRootSet.getDependentMinimumKeepInfo());
rootSet.delayedRootSetActionItems.clear();
- if (!workList.isEmpty()) {
+ if (!worklist.isEmpty()) {
continue;
}
@@ -4560,7 +4561,7 @@
SyntheticAdditions syntheticAdditions =
new SyntheticAdditions(appView.createProcessorContext());
- assert workList.isEmpty();
+ assert worklist.isEmpty();
CfPostProcessingDesugaringEventConsumer eventConsumer =
CfPostProcessingDesugaringEventConsumer.createForR8(
@@ -4595,10 +4596,10 @@
syntheticAdditions.enqueueWorkItems(this);
- workList = workList.nonPushable();
+ worklist = worklist.nonPushable();
- while (!workList.isEmpty()) {
- EnqueuerAction action = workList.poll();
+ while (!worklist.isEmpty()) {
+ EnqueuerAction action = worklist.poll();
action.run(this);
}
}
@@ -4678,7 +4679,7 @@
if (annotationRemoverBuilder != null) {
for (MatchedAnnotation matchedAnnotation : matchedAnnotations) {
annotationRemoverBuilder.retainAnnotation(matchedAnnotation.getAnnotation());
- workList.enqueueTraceAnnotationAction(
+ worklist.enqueueTraceAnnotationAction(
matchedAnnotation.getAnnotatedItem(),
matchedAnnotation.getAnnotation(),
matchedAnnotation.getAnnotatedKind());
@@ -4720,7 +4721,7 @@
if (field.getDefinition().isStatic()) {
markFieldAsLive(field, field, reason);
} else {
- workList.enqueueMarkFieldAsReachableAction(field, field, reason);
+ worklist.enqueueMarkFieldAsReachableAction(field, field, reason);
}
}
@@ -4812,7 +4813,7 @@
}
// Notify analyses.
- analyses.forEach(analysis -> analysis.processNewlyLiveMethod(method, context, this, workList));
+ analyses.forEach(analysis -> analysis.processNewlyLiveMethod(method, context, this, worklist));
}
private void markMethodAsTargeted(ProgramMethod method, KeepReason reason) {
@@ -4832,7 +4833,7 @@
markMethodAsLiveWithCompatRule(method);
}
}
- analyses.forEach(analysis -> analysis.notifyMarkMethodAsTargeted(method, workList));
+ analyses.forEach(analysis -> analysis.notifyMarkMethodAsTargeted(method, worklist));
}
void traceMethodDefinitionExcludingCode(ProgramMethod method) {
@@ -4867,7 +4868,7 @@
useRegistryFactory.create(appView, method, this, appView.apiLevelCompute());
method.registerCodeReferences(registry);
// Notify analyses.
- analyses.forEach(analysis -> analysis.processTracedCode(method, registry, workList));
+ analyses.forEach(analysis -> analysis.processTracedCode(method, registry, worklist));
}
private void markReferencedTypesAsLive(ProgramMethod method) {
@@ -4883,10 +4884,10 @@
}
private void markClassAsInstantiatedWithReason(DexProgramClass clazz, KeepReason reason) {
- workList.enqueueMarkInstantiatedAction(clazz, null, InstantiationReason.REFLECTION, reason);
+ worklist.enqueueMarkInstantiatedAction(clazz, null, InstantiationReason.REFLECTION, reason);
if (clazz.hasDefaultInitializer()) {
ProgramMethod defaultInitializer = clazz.getProgramDefaultInitializer();
- workList.enqueueMarkReachableDirectAction(
+ worklist.enqueueMarkReachableDirectAction(
defaultInitializer.getReference(), defaultInitializer, reason);
}
}
@@ -4905,10 +4906,10 @@
} else if (clazz.isInterface()) {
markInterfaceAsInstantiated(clazz, witness);
} else {
- workList.enqueueMarkInstantiatedAction(clazz, null, InstantiationReason.KEEP_RULE, witness);
+ worklist.enqueueMarkInstantiatedAction(clazz, null, InstantiationReason.KEEP_RULE, witness);
if (clazz.hasDefaultInitializer()) {
ProgramMethod defaultInitializer = clazz.getProgramDefaultInitializer();
- workList.enqueueMarkReachableDirectAction(
+ worklist.enqueueMarkReachableDirectAction(
defaultInitializer.getReference(),
defaultInitializer,
graphReporter.reportCompatKeepDefaultInitializer(defaultInitializer));
@@ -4938,7 +4939,7 @@
}
private void markMethodAsLiveWithCompatRule(ProgramMethod method) {
- workList.enqueueMarkMethodLiveAction(
+ worklist.enqueueMarkMethodLiveAction(
method, method, graphReporter.reportCompatKeepMethod(method));
}
@@ -5028,7 +5029,7 @@
!encodedField.isStatic()
&& dexItemFactory.atomicFieldUpdaterMethods.isFieldUpdater(invokedMethod);
if (keepClass) {
- workList.enqueueMarkInstantiatedAction(
+ worklist.enqueueMarkInstantiatedAction(
clazz, null, InstantiationReason.REFLECTION, KeepReason.reflectiveUseIn(method));
}
if (keepInfo.getFieldInfo(encodedField, clazz).isShrinkingAllowed(options)) {
@@ -5527,7 +5528,7 @@
}
} else {
// There is no dispatch on annotations, so only keep what is directly referenced.
- workList.enqueueMarkFieldAsReachableAction(field, context, reason);
+ worklist.enqueueMarkFieldAsReachableAction(field, context, reason);
}
return false;
}
@@ -5609,7 +5610,7 @@
}
@Override
- @SuppressWarnings("ReferenceEquality")
+ @SuppressWarnings({"EqualsGetClass", "ReferenceEquality"})
public boolean equals(Object o) {
if (o == null || getClass() != o.getClass()) {
return false;
diff --git a/src/main/java/com/android/tools/r8/shaking/EnqueuerWorklist.java b/src/main/java/com/android/tools/r8/shaking/EnqueuerWorklist.java
index d0ae107..45eee23 100644
--- a/src/main/java/com/android/tools/r8/shaking/EnqueuerWorklist.java
+++ b/src/main/java/com/android/tools/r8/shaking/EnqueuerWorklist.java
@@ -385,6 +385,7 @@
}
@Override
+ @SuppressWarnings("EqualsGetClass")
public boolean equals(Object obj) {
if (this == obj) {
return true;
@@ -415,6 +416,7 @@
}
@Override
+ @SuppressWarnings("EqualsGetClass")
public boolean equals(Object obj) {
if (this == obj) {
return true;
@@ -445,6 +447,7 @@
}
@Override
+ @SuppressWarnings("EqualsGetClass")
public boolean equals(Object obj) {
if (this == obj) {
return true;
@@ -475,6 +478,7 @@
}
@Override
+ @SuppressWarnings("EqualsGetClass")
public boolean equals(Object obj) {
if (this == obj) {
return true;
@@ -500,6 +504,7 @@
}
@Override
+ @SuppressWarnings("EqualsGetClass")
public boolean equals(Object obj) {
if (this == obj) {
return true;
diff --git a/src/main/java/com/android/tools/r8/shaking/GraphReporter.java b/src/main/java/com/android/tools/r8/shaking/GraphReporter.java
index 40b2940..1e63e51 100644
--- a/src/main/java/com/android/tools/r8/shaking/GraphReporter.java
+++ b/src/main/java/com/android/tools/r8/shaking/GraphReporter.java
@@ -478,6 +478,7 @@
});
}
+ @SuppressWarnings("BadImport")
MethodGraphNode getMethodGraphNode(DexMethod context) {
return methodNodes.computeIfAbsent(
context,
diff --git a/src/main/java/com/android/tools/r8/shaking/IfRuleEvaluator.java b/src/main/java/com/android/tools/r8/shaking/IfRuleEvaluator.java
index 06fee94..93268d1 100644
--- a/src/main/java/com/android/tools/r8/shaking/IfRuleEvaluator.java
+++ b/src/main/java/com/android/tools/r8/shaking/IfRuleEvaluator.java
@@ -326,6 +326,7 @@
return field.getOrComputeIsInlinableByJavaC(appView.dexItemFactory());
}
+ @SuppressWarnings("BadImport")
private void materializeIfRule(ProguardIfRule rule, Set<DexReference> preconditions) {
DexItemFactory dexItemFactory = appView.dexItemFactory();
ProguardIfRule materializedRule = rule.materialize(dexItemFactory, preconditions);
diff --git a/src/main/java/com/android/tools/r8/shaking/InlineRule.java b/src/main/java/com/android/tools/r8/shaking/InlineRule.java
index 505bdbe..cc813ad 100644
--- a/src/main/java/com/android/tools/r8/shaking/InlineRule.java
+++ b/src/main/java/com/android/tools/r8/shaking/InlineRule.java
@@ -17,6 +17,7 @@
NEVER_SINGLE_CALLER
}
+ @SuppressWarnings("NonCanonicalType")
public static class Builder extends ProguardConfigurationRule.Builder<InlineRule, Builder> {
private Builder() {
diff --git a/src/main/java/com/android/tools/r8/shaking/KeepConstantArgumentRule.java b/src/main/java/com/android/tools/r8/shaking/KeepConstantArgumentRule.java
index bc7d2ea..4a7a3ba 100644
--- a/src/main/java/com/android/tools/r8/shaking/KeepConstantArgumentRule.java
+++ b/src/main/java/com/android/tools/r8/shaking/KeepConstantArgumentRule.java
@@ -11,6 +11,7 @@
public static final String RULE_NAME = "keepconstantarguments";
+ @SuppressWarnings("NonCanonicalType")
public static class Builder
extends ProguardConfigurationRule.Builder<KeepConstantArgumentRule, Builder> {
diff --git a/src/main/java/com/android/tools/r8/shaking/KeepInfoCollection.java b/src/main/java/com/android/tools/r8/shaking/KeepInfoCollection.java
index fcabc9d..26d9e87 100644
--- a/src/main/java/com/android/tools/r8/shaking/KeepInfoCollection.java
+++ b/src/main/java/com/android/tools/r8/shaking/KeepInfoCollection.java
@@ -395,7 +395,7 @@
return newFieldInfo;
}
- @SuppressWarnings("ReferenceEquality")
+ @SuppressWarnings({"ReferenceEquality", "UnusedVariable"})
private Map<DexMethod, KeepMethodInfo> rewriteMethodInfo(
NonIdentityGraphLens lens, InternalOptions options, Timing timing) {
timing.begin("Rewrite method info");
diff --git a/src/main/java/com/android/tools/r8/shaking/KeepMemberInfo.java b/src/main/java/com/android/tools/r8/shaking/KeepMemberInfo.java
index e77c27e..4f4355b 100644
--- a/src/main/java/com/android/tools/r8/shaking/KeepMemberInfo.java
+++ b/src/main/java/com/android/tools/r8/shaking/KeepMemberInfo.java
@@ -7,6 +7,7 @@
import com.android.tools.r8.shaking.KeepInfo.Builder;
/** Immutable keep requirements for a member. */
+@SuppressWarnings("BadImport")
public abstract class KeepMemberInfo<B extends Builder<B, K>, K extends KeepInfo<B, K>>
extends KeepInfo<B, K> {
@@ -14,6 +15,7 @@
super(builder);
}
+ @SuppressWarnings("BadImport")
public boolean isKotlinMetadataRemovalAllowed(
DexProgramClass holder, GlobalKeepInfoConfiguration configuration) {
// Checking the holder for missing kotlin information relies on the holder being processed
diff --git a/src/main/java/com/android/tools/r8/shaking/KeepUnusedArgumentRule.java b/src/main/java/com/android/tools/r8/shaking/KeepUnusedArgumentRule.java
index 06bd39a..f0a113e 100644
--- a/src/main/java/com/android/tools/r8/shaking/KeepUnusedArgumentRule.java
+++ b/src/main/java/com/android/tools/r8/shaking/KeepUnusedArgumentRule.java
@@ -11,6 +11,7 @@
public static final String RULE_NAME = "keepunusedarguments";
+ @SuppressWarnings("NonCanonicalType")
public static class Builder
extends ProguardConfigurationRule.Builder<KeepUnusedArgumentRule, Builder> {
diff --git a/src/main/java/com/android/tools/r8/shaking/KeepUnusedReturnValueRule.java b/src/main/java/com/android/tools/r8/shaking/KeepUnusedReturnValueRule.java
index 0bd866d..5e34650 100644
--- a/src/main/java/com/android/tools/r8/shaking/KeepUnusedReturnValueRule.java
+++ b/src/main/java/com/android/tools/r8/shaking/KeepUnusedReturnValueRule.java
@@ -12,6 +12,7 @@
public static final String RULE_NAME = "keepunusedreturnvalue";
+ @SuppressWarnings("NonCanonicalType")
public static class Builder
extends ProguardConfigurationRule.Builder<KeepUnusedReturnValueRule, Builder> {
diff --git a/src/main/java/com/android/tools/r8/shaking/MaximumRemovedAndroidLogLevelRule.java b/src/main/java/com/android/tools/r8/shaking/MaximumRemovedAndroidLogLevelRule.java
index 0090b89..4645385 100644
--- a/src/main/java/com/android/tools/r8/shaking/MaximumRemovedAndroidLogLevelRule.java
+++ b/src/main/java/com/android/tools/r8/shaking/MaximumRemovedAndroidLogLevelRule.java
@@ -20,6 +20,7 @@
public static final int ERROR = 6;
public static final int ASSERT = 7;
+ @SuppressWarnings("NonCanonicalType")
public static class Builder
extends ProguardConfigurationRule.Builder<MaximumRemovedAndroidLogLevelRule, Builder> {
diff --git a/src/main/java/com/android/tools/r8/shaking/NoAccessModificationRule.java b/src/main/java/com/android/tools/r8/shaking/NoAccessModificationRule.java
index aeed6ea..6f22fb9 100644
--- a/src/main/java/com/android/tools/r8/shaking/NoAccessModificationRule.java
+++ b/src/main/java/com/android/tools/r8/shaking/NoAccessModificationRule.java
@@ -12,6 +12,7 @@
public static final String RULE_NAME = "noaccessmodification";
+ @SuppressWarnings("NonCanonicalType")
public static class Builder
extends ProguardConfigurationRule.Builder<NoAccessModificationRule, Builder> {
diff --git a/src/main/java/com/android/tools/r8/shaking/NoFieldTypeStrengtheningRule.java b/src/main/java/com/android/tools/r8/shaking/NoFieldTypeStrengtheningRule.java
index 80cf0db..35466fc 100644
--- a/src/main/java/com/android/tools/r8/shaking/NoFieldTypeStrengtheningRule.java
+++ b/src/main/java/com/android/tools/r8/shaking/NoFieldTypeStrengtheningRule.java
@@ -12,6 +12,7 @@
public static final String RULE_NAME = "nofieldtypestrengthening";
+ @SuppressWarnings("NonCanonicalType")
public static class Builder
extends ProguardConfigurationRule.Builder<NoFieldTypeStrengtheningRule, Builder> {
diff --git a/src/main/java/com/android/tools/r8/shaking/NoHorizontalClassMergingRule.java b/src/main/java/com/android/tools/r8/shaking/NoHorizontalClassMergingRule.java
index acaedac..f775baf 100644
--- a/src/main/java/com/android/tools/r8/shaking/NoHorizontalClassMergingRule.java
+++ b/src/main/java/com/android/tools/r8/shaking/NoHorizontalClassMergingRule.java
@@ -12,6 +12,7 @@
public static final String RULE_NAME = "nohorizontalclassmerging";
+ @SuppressWarnings("NonCanonicalType")
public static class Builder
extends ProguardConfigurationRule.Builder<NoHorizontalClassMergingRule, Builder> {
diff --git a/src/main/java/com/android/tools/r8/shaking/NoMethodStaticizingRule.java b/src/main/java/com/android/tools/r8/shaking/NoMethodStaticizingRule.java
index 54c514b..11467c4 100644
--- a/src/main/java/com/android/tools/r8/shaking/NoMethodStaticizingRule.java
+++ b/src/main/java/com/android/tools/r8/shaking/NoMethodStaticizingRule.java
@@ -12,6 +12,7 @@
public static final String RULE_NAME = "nomethodstaticizing";
+ @SuppressWarnings("NonCanonicalType")
public static class Builder
extends ProguardConfigurationRule.Builder<NoMethodStaticizingRule, Builder> {
diff --git a/src/main/java/com/android/tools/r8/shaking/NoParameterReorderingRule.java b/src/main/java/com/android/tools/r8/shaking/NoParameterReorderingRule.java
index 901b3bc..c49860c 100644
--- a/src/main/java/com/android/tools/r8/shaking/NoParameterReorderingRule.java
+++ b/src/main/java/com/android/tools/r8/shaking/NoParameterReorderingRule.java
@@ -12,6 +12,7 @@
public static final String RULE_NAME = "noparameterreordering";
+ @SuppressWarnings("NonCanonicalType")
public static class Builder
extends ProguardConfigurationRule.Builder<NoParameterReorderingRule, Builder> {
diff --git a/src/main/java/com/android/tools/r8/shaking/NoParameterTypeStrengtheningRule.java b/src/main/java/com/android/tools/r8/shaking/NoParameterTypeStrengtheningRule.java
index 172793c..9b71cdb 100644
--- a/src/main/java/com/android/tools/r8/shaking/NoParameterTypeStrengtheningRule.java
+++ b/src/main/java/com/android/tools/r8/shaking/NoParameterTypeStrengtheningRule.java
@@ -12,6 +12,7 @@
public static final String RULE_NAME = "noparametertypestrengthening";
+ @SuppressWarnings("NonCanonicalType")
public static class Builder
extends ProguardConfigurationRule.Builder<NoParameterTypeStrengtheningRule, Builder> {
diff --git a/src/main/java/com/android/tools/r8/shaking/NoRedundantFieldLoadEliminationRule.java b/src/main/java/com/android/tools/r8/shaking/NoRedundantFieldLoadEliminationRule.java
index 3921ff1..c674a85 100644
--- a/src/main/java/com/android/tools/r8/shaking/NoRedundantFieldLoadEliminationRule.java
+++ b/src/main/java/com/android/tools/r8/shaking/NoRedundantFieldLoadEliminationRule.java
@@ -12,6 +12,7 @@
public static final String RULE_NAME = "noredundantfieldloadelimination";
+ @SuppressWarnings("NonCanonicalType")
public static class Builder
extends ProguardConfigurationRule.Builder<NoRedundantFieldLoadEliminationRule, Builder> {
diff --git a/src/main/java/com/android/tools/r8/shaking/NoReturnTypeStrengtheningRule.java b/src/main/java/com/android/tools/r8/shaking/NoReturnTypeStrengtheningRule.java
index 11de402..e6529cf 100644
--- a/src/main/java/com/android/tools/r8/shaking/NoReturnTypeStrengtheningRule.java
+++ b/src/main/java/com/android/tools/r8/shaking/NoReturnTypeStrengtheningRule.java
@@ -12,6 +12,7 @@
public static final String RULE_NAME = "noreturntypestrengthening";
+ @SuppressWarnings("NonCanonicalType")
public static class Builder
extends ProguardConfigurationRule.Builder<NoReturnTypeStrengtheningRule, Builder> {
diff --git a/src/main/java/com/android/tools/r8/shaking/NoUnusedInterfaceRemovalRule.java b/src/main/java/com/android/tools/r8/shaking/NoUnusedInterfaceRemovalRule.java
index c14f3e8..f00dd7c 100644
--- a/src/main/java/com/android/tools/r8/shaking/NoUnusedInterfaceRemovalRule.java
+++ b/src/main/java/com/android/tools/r8/shaking/NoUnusedInterfaceRemovalRule.java
@@ -11,6 +11,7 @@
public static final String RULE_NAME = "nounusedinterfaceremoval";
+ @SuppressWarnings("NonCanonicalType")
public static class Builder
extends ProguardConfigurationRule.Builder<NoUnusedInterfaceRemovalRule, Builder> {
diff --git a/src/main/java/com/android/tools/r8/shaking/NoValuePropagationRule.java b/src/main/java/com/android/tools/r8/shaking/NoValuePropagationRule.java
index b1ac352..9215f36 100644
--- a/src/main/java/com/android/tools/r8/shaking/NoValuePropagationRule.java
+++ b/src/main/java/com/android/tools/r8/shaking/NoValuePropagationRule.java
@@ -11,6 +11,7 @@
public static final String RULE_NAME = "neverpropagatevalue";
+ @SuppressWarnings("NonCanonicalType")
public static class Builder
extends ProguardConfigurationRule.Builder<NoValuePropagationRule, Builder> {
diff --git a/src/main/java/com/android/tools/r8/shaking/NoVerticalClassMergingRule.java b/src/main/java/com/android/tools/r8/shaking/NoVerticalClassMergingRule.java
index edda33c..6521496 100644
--- a/src/main/java/com/android/tools/r8/shaking/NoVerticalClassMergingRule.java
+++ b/src/main/java/com/android/tools/r8/shaking/NoVerticalClassMergingRule.java
@@ -11,6 +11,7 @@
public static final String RULE_NAME = "noverticalclassmerging";
+ @SuppressWarnings("NonCanonicalType")
public static class Builder
extends ProguardConfigurationRule.Builder<NoVerticalClassMergingRule, Builder> {
diff --git a/src/main/java/com/android/tools/r8/shaking/ProguardAssumeMayHaveSideEffectsRule.java b/src/main/java/com/android/tools/r8/shaking/ProguardAssumeMayHaveSideEffectsRule.java
index 654bc3e..803ace4 100644
--- a/src/main/java/com/android/tools/r8/shaking/ProguardAssumeMayHaveSideEffectsRule.java
+++ b/src/main/java/com/android/tools/r8/shaking/ProguardAssumeMayHaveSideEffectsRule.java
@@ -9,6 +9,7 @@
public class ProguardAssumeMayHaveSideEffectsRule extends ProguardConfigurationRule {
+ @SuppressWarnings("NonCanonicalType")
public static class Builder
extends ProguardConfigurationRule.Builder<ProguardAssumeMayHaveSideEffectsRule, Builder> {
diff --git a/src/main/java/com/android/tools/r8/shaking/ProguardAssumeNoSideEffectRule.java b/src/main/java/com/android/tools/r8/shaking/ProguardAssumeNoSideEffectRule.java
index ed151aa..a224bed 100644
--- a/src/main/java/com/android/tools/r8/shaking/ProguardAssumeNoSideEffectRule.java
+++ b/src/main/java/com/android/tools/r8/shaking/ProguardAssumeNoSideEffectRule.java
@@ -9,6 +9,7 @@
public class ProguardAssumeNoSideEffectRule extends ProguardConfigurationRule {
+ @SuppressWarnings("NonCanonicalType")
public static class Builder
extends ProguardConfigurationRule.Builder<ProguardAssumeNoSideEffectRule, Builder> {
diff --git a/src/main/java/com/android/tools/r8/shaking/ProguardAssumeValuesRule.java b/src/main/java/com/android/tools/r8/shaking/ProguardAssumeValuesRule.java
index 97d901e..8685347 100644
--- a/src/main/java/com/android/tools/r8/shaking/ProguardAssumeValuesRule.java
+++ b/src/main/java/com/android/tools/r8/shaking/ProguardAssumeValuesRule.java
@@ -9,6 +9,7 @@
public class ProguardAssumeValuesRule extends ProguardConfigurationRule {
+ @SuppressWarnings("NonCanonicalType")
public static class Builder
extends ProguardConfigurationRule.Builder<ProguardAssumeValuesRule, Builder> {
diff --git a/src/main/java/com/android/tools/r8/shaking/ProguardCheckDiscardRule.java b/src/main/java/com/android/tools/r8/shaking/ProguardCheckDiscardRule.java
index 8ab748e..08d00c6 100644
--- a/src/main/java/com/android/tools/r8/shaking/ProguardCheckDiscardRule.java
+++ b/src/main/java/com/android/tools/r8/shaking/ProguardCheckDiscardRule.java
@@ -9,8 +9,9 @@
public class ProguardCheckDiscardRule extends ProguardConfigurationRule {
- public static class Builder extends
- ProguardConfigurationRule.Builder<ProguardCheckDiscardRule, Builder> {
+ @SuppressWarnings("NonCanonicalType")
+ public static class Builder
+ extends ProguardConfigurationRule.Builder<ProguardCheckDiscardRule, Builder> {
private Builder() {
super();
diff --git a/src/main/java/com/android/tools/r8/shaking/ProguardClassNameList.java b/src/main/java/com/android/tools/r8/shaking/ProguardClassNameList.java
index deacfd7..576588d 100644
--- a/src/main/java/com/android/tools/r8/shaking/ProguardClassNameList.java
+++ b/src/main/java/com/android/tools/r8/shaking/ProguardClassNameList.java
@@ -193,6 +193,7 @@
}
@Override
+ @SuppressWarnings("EqualsGetClass")
public boolean equals(Object o) {
if (this == o) {
return true;
@@ -268,6 +269,7 @@
}
@Override
+ @SuppressWarnings("EqualsGetClass")
public boolean equals(Object o) {
if (this == o) {
return true;
@@ -357,6 +359,7 @@
}
@Override
+ @SuppressWarnings("EqualsGetClass")
public boolean equals(Object o) {
if (this == o) {
return true;
diff --git a/src/main/java/com/android/tools/r8/shaking/ProguardConfiguration.java b/src/main/java/com/android/tools/r8/shaking/ProguardConfiguration.java
index e488088..d7e4ff2 100644
--- a/src/main/java/com/android/tools/r8/shaking/ProguardConfiguration.java
+++ b/src/main/java/com/android/tools/r8/shaking/ProguardConfiguration.java
@@ -25,7 +25,9 @@
private final List<String> parsedConfiguration = new ArrayList<>();
private final List<FilteredClassPath> injars = new ArrayList<>();
- private final List<FilteredClassPath> libraryjars = new ArrayList<>();
+
+ private final List<FilteredClassPath> libraryJars = new ArrayList<>();
+
private final Reporter reporter;
private PackageObfuscationMode packageObfuscationMode = PackageObfuscationMode.NONE;
private String packagePrefix = "";
@@ -91,7 +93,7 @@
}
public void addLibraryJars(List<FilteredClassPath> libraryJars) {
- this.libraryjars.addAll(libraryJars);
+ this.libraryJars.addAll(libraryJars);
}
public PackageObfuscationMode getPackageObfuscationMode() {
@@ -313,7 +315,7 @@
String.join(System.lineSeparator(), parsedConfiguration),
dexItemFactory,
injars,
- libraryjars,
+ libraryJars,
packageObfuscationMode,
packagePrefix,
allowAccessModification,
@@ -372,7 +374,7 @@
private final String parsedConfiguration;
private final DexItemFactory dexItemFactory;
private final ImmutableList<FilteredClassPath> injars;
- private final ImmutableList<FilteredClassPath> libraryjars;
+ private final ImmutableList<FilteredClassPath> libraryJars;
private final PackageObfuscationMode packageObfuscationMode;
private final String packagePrefix;
private final boolean allowAccessModification;
@@ -413,7 +415,7 @@
String parsedConfiguration,
DexItemFactory factory,
List<FilteredClassPath> injars,
- List<FilteredClassPath> libraryjars,
+ List<FilteredClassPath> libraryJars,
PackageObfuscationMode packageObfuscationMode,
String packagePrefix,
boolean allowAccessModification,
@@ -452,7 +454,7 @@
this.parsedConfiguration = parsedConfiguration;
this.dexItemFactory = factory;
this.injars = ImmutableList.copyOf(injars);
- this.libraryjars = ImmutableList.copyOf(libraryjars);
+ this.libraryJars = ImmutableList.copyOf(libraryJars);
this.packageObfuscationMode = packageObfuscationMode;
this.packagePrefix = packagePrefix;
this.allowAccessModification = allowAccessModification;
@@ -511,7 +513,7 @@
}
public List<FilteredClassPath> getLibraryjars() {
- return libraryjars;
+ return libraryJars;
}
public PackageObfuscationMode getPackageObfuscationMode() {
diff --git a/src/main/java/com/android/tools/r8/shaking/ProguardConfigurationParser.java b/src/main/java/com/android/tools/r8/shaking/ProguardConfigurationParser.java
index 9d98730..6ae7d4c 100644
--- a/src/main/java/com/android/tools/r8/shaking/ProguardConfigurationParser.java
+++ b/src/main/java/com/android/tools/r8/shaking/ProguardConfigurationParser.java
@@ -47,7 +47,9 @@
public class ProguardConfigurationParser {
+ @SuppressWarnings("BadImport")
private final Builder configurationBuilder;
+
private final DexItemFactory dexItemFactory;
private final ProguardConfigurationParserOptions options;
private final Reporter reporter;
@@ -679,6 +681,7 @@
throw unknownOption(unknownOption, optionStart, "");
}
+ @SuppressWarnings("UnnecessaryParentheses")
private RuntimeException unknownOption(
String unknownOption, TextPosition optionStart, String additionalMessage) {
throw reporter.fatalError((new StringDiagnostic(
@@ -835,8 +838,8 @@
}
}
- private ProguardKeepRule parseKeepRule(Position start)
- throws ProguardRuleParserException {
+ @SuppressWarnings("NonCanonicalType")
+ private ProguardKeepRule parseKeepRule(Position start) throws ProguardRuleParserException {
ProguardKeepRule.Builder keepRuleBuilder = ProguardKeepRule.builder()
.setOrigin(origin)
.setStart(start);
@@ -858,6 +861,7 @@
return keepRuleBuilder.build();
}
+ @SuppressWarnings("NonCanonicalType")
private <R extends ProguardConfigurationRule, B extends ProguardConfigurationRule.Builder<R, B>>
R parseRuleWithClassSpec(Position start, B builder) throws ProguardRuleParserException {
builder.setOrigin(origin).setStart(start);
diff --git a/src/main/java/com/android/tools/r8/shaking/ProguardIdentifierNameStringRule.java b/src/main/java/com/android/tools/r8/shaking/ProguardIdentifierNameStringRule.java
index 37c75a1..56f431d 100644
--- a/src/main/java/com/android/tools/r8/shaking/ProguardIdentifierNameStringRule.java
+++ b/src/main/java/com/android/tools/r8/shaking/ProguardIdentifierNameStringRule.java
@@ -9,6 +9,7 @@
public class ProguardIdentifierNameStringRule extends ProguardConfigurationRule {
+ @SuppressWarnings("NonCanonicalType")
public static class Builder
extends ProguardConfigurationRule.Builder<ProguardIdentifierNameStringRule, Builder> {
private Builder() {
diff --git a/src/main/java/com/android/tools/r8/shaking/ProguardKeepRuleBase.java b/src/main/java/com/android/tools/r8/shaking/ProguardKeepRuleBase.java
index b87e5a6..fb02899 100644
--- a/src/main/java/com/android/tools/r8/shaking/ProguardKeepRuleBase.java
+++ b/src/main/java/com/android/tools/r8/shaking/ProguardKeepRuleBase.java
@@ -10,6 +10,7 @@
public class ProguardKeepRuleBase extends ProguardConfigurationRule {
+ @SuppressWarnings("NonCanonicalType")
public static abstract class Builder<C extends ProguardKeepRuleBase, B extends Builder<C, B>>
extends ProguardConfigurationRule.Builder<C, B> {
diff --git a/src/main/java/com/android/tools/r8/shaking/ProguardPackageMatcher.java b/src/main/java/com/android/tools/r8/shaking/ProguardPackageMatcher.java
index f31087d..67608f2 100644
--- a/src/main/java/com/android/tools/r8/shaking/ProguardPackageMatcher.java
+++ b/src/main/java/com/android/tools/r8/shaking/ProguardPackageMatcher.java
@@ -15,6 +15,7 @@
return matchPackageNameImpl(pattern, 0, packageName, 0);
}
+ @SuppressWarnings("UnnecessaryParentheses")
private static boolean matchPackageNameImpl(
String pattern, int patternIndex, String name, int nameIndex) {
for (int i = patternIndex; i < pattern.length(); i++) {
diff --git a/src/main/java/com/android/tools/r8/shaking/ProguardWhyAreYouKeepingRule.java b/src/main/java/com/android/tools/r8/shaking/ProguardWhyAreYouKeepingRule.java
index 4083ff5..cffaab1 100644
--- a/src/main/java/com/android/tools/r8/shaking/ProguardWhyAreYouKeepingRule.java
+++ b/src/main/java/com/android/tools/r8/shaking/ProguardWhyAreYouKeepingRule.java
@@ -9,6 +9,7 @@
public class ProguardWhyAreYouKeepingRule extends ProguardConfigurationRule {
+ @SuppressWarnings("NonCanonicalType")
public static class Builder
extends ProguardConfigurationRule.Builder<ProguardWhyAreYouKeepingRule, Builder> {
diff --git a/src/main/java/com/android/tools/r8/shaking/ReprocessClassInitializerRule.java b/src/main/java/com/android/tools/r8/shaking/ReprocessClassInitializerRule.java
index cfcd1fc..031e147 100644
--- a/src/main/java/com/android/tools/r8/shaking/ReprocessClassInitializerRule.java
+++ b/src/main/java/com/android/tools/r8/shaking/ReprocessClassInitializerRule.java
@@ -15,6 +15,7 @@
NEVER
}
+ @SuppressWarnings("NonCanonicalType")
public static class Builder
extends ProguardConfigurationRule.Builder<ReprocessClassInitializerRule, Builder> {
diff --git a/src/main/java/com/android/tools/r8/shaking/ReprocessMethodRule.java b/src/main/java/com/android/tools/r8/shaking/ReprocessMethodRule.java
index 2c7d19a..1c20623 100644
--- a/src/main/java/com/android/tools/r8/shaking/ReprocessMethodRule.java
+++ b/src/main/java/com/android/tools/r8/shaking/ReprocessMethodRule.java
@@ -15,6 +15,7 @@
NEVER
}
+ @SuppressWarnings("NonCanonicalType")
public static class Builder
extends ProguardConfigurationRule.Builder<ReprocessMethodRule, Builder> {
diff --git a/src/main/java/com/android/tools/r8/shaking/RootSetUtils.java b/src/main/java/com/android/tools/r8/shaking/RootSetUtils.java
index 513b132..74c0ada 100644
--- a/src/main/java/com/android/tools/r8/shaking/RootSetUtils.java
+++ b/src/main/java/com/android/tools/r8/shaking/RootSetUtils.java
@@ -1519,6 +1519,7 @@
}
}
+ @SuppressWarnings("UnusedVariable")
private void evaluateKeepRule(
ProgramDefinition item,
ProguardKeepRule context,
diff --git a/src/main/java/com/android/tools/r8/shaking/VerticalClassMerger.java b/src/main/java/com/android/tools/r8/shaking/VerticalClassMerger.java
index 760e11e..0f3b284 100644
--- a/src/main/java/com/android/tools/r8/shaking/VerticalClassMerger.java
+++ b/src/main/java/com/android/tools/r8/shaking/VerticalClassMerger.java
@@ -287,6 +287,7 @@
}
}
+ @SuppressWarnings("UnusedVariable")
private void markTypeAsPinned(DexType type, AbortReason reason) {
DexType baseType = type.toBaseType(appView.dexItemFactory());
if (!baseType.isClassType() || appInfo.isPinnedWithDefinitionLookup(baseType)) {
@@ -1986,6 +1987,7 @@
}
@Override
+ @SuppressWarnings("HidingField")
public boolean isContextFreeForMethods(GraphLens codeLens) {
return true;
}
@@ -1995,12 +1997,13 @@
// same package as [source].
public static class IllegalAccessDetector extends UseRegistryWithResult<Boolean, ProgramMethod> {
- private final AppView<? extends AppInfoWithClassHierarchy> appView;
+ private final AppView<? extends AppInfoWithClassHierarchy> appViewWithClassHierarchy;
public IllegalAccessDetector(
- AppView<? extends AppInfoWithClassHierarchy> appView, ProgramMethod context) {
- super(appView, context, false);
- this.appView = appView;
+ AppView<? extends AppInfoWithClassHierarchy> appViewWithClassHierarchy,
+ ProgramMethod context) {
+ super(appViewWithClassHierarchy, context, false);
+ this.appViewWithClassHierarchy = appViewWithClassHierarchy;
}
protected boolean checkFoundPackagePrivateAccess() {
@@ -2018,7 +2021,7 @@
}
private boolean checkFieldReference(DexField field) {
- return checkRewrittenFieldReference(appView.graphLens().lookupField(field));
+ return checkRewrittenFieldReference(appViewWithClassHierarchy.graphLens().lookupField(field));
}
private boolean checkRewrittenFieldReference(DexField field) {
@@ -2028,7 +2031,8 @@
if (checkRewrittenTypeReference(fieldHolder)) {
return checkFoundPackagePrivateAccess();
}
- DexClassAndField resolvedField = appView.appInfo().resolveField(field).getResolutionPair();
+ DexClassAndField resolvedField =
+ appViewWithClassHierarchy.appInfo().resolveField(field).getResolutionPair();
if (resolvedField == null) {
return setFoundPackagePrivateAccess();
}
@@ -2049,15 +2053,20 @@
private boolean checkRewrittenMethodReference(
DexMethod rewrittenMethod, OptionalBool isInterface) {
- DexType baseType = rewrittenMethod.getHolderType().toBaseType(appView.dexItemFactory());
+ DexType baseType =
+ rewrittenMethod.getHolderType().toBaseType(appViewWithClassHierarchy.dexItemFactory());
if (baseType.isClassType() && baseType.isSamePackage(getContext().getHolderType())) {
if (checkTypeReference(rewrittenMethod.getHolderType())) {
return checkFoundPackagePrivateAccess();
}
MethodResolutionResult resolutionResult =
isInterface.isUnknown()
- ? appView.appInfo().unsafeResolveMethodDueToDexFormat(rewrittenMethod)
- : appView.appInfo().resolveMethod(rewrittenMethod, isInterface.isTrue());
+ ? appViewWithClassHierarchy
+ .appInfo()
+ .unsafeResolveMethodDueToDexFormat(rewrittenMethod)
+ : appViewWithClassHierarchy
+ .appInfo()
+ .resolveMethod(rewrittenMethod, isInterface.isTrue());
if (!resolutionResult.isSingleResolution()) {
return setFoundPackagePrivateAccess();
}
@@ -2072,7 +2081,7 @@
}
private boolean checkTypeReference(DexType type) {
- return internalCheckTypeReference(type, appView.graphLens());
+ return internalCheckTypeReference(type, appViewWithClassHierarchy.graphLens());
}
private boolean checkRewrittenTypeReference(DexType type) {
@@ -2080,9 +2089,10 @@
}
private boolean internalCheckTypeReference(DexType type, GraphLens graphLens) {
- DexType baseType = graphLens.lookupType(type.toBaseType(appView.dexItemFactory()));
+ DexType baseType =
+ graphLens.lookupType(type.toBaseType(appViewWithClassHierarchy.dexItemFactory()));
if (baseType.isClassType() && baseType.isSamePackage(getContext().getHolderType())) {
- DexClass clazz = appView.definitionFor(baseType);
+ DexClass clazz = appViewWithClassHierarchy.definitionFor(baseType);
if (clazz == null || !clazz.isPublic()) {
return setFoundPackagePrivateAccess();
}
@@ -2092,11 +2102,12 @@
@Override
public void registerInitClass(DexType clazz) {
- if (appView.initClassLens().isFinal()) {
+ if (appViewWithClassHierarchy.initClassLens().isFinal()) {
// The InitClass lens is always rewritten up until the most recent graph lens, so first map
// the class type to the most recent graph lens.
- DexType rewrittenType = appView.graphLens().lookupType(clazz);
- DexField initClassField = appView.initClassLens().getInitClassField(rewrittenType);
+ DexType rewrittenType = appViewWithClassHierarchy.graphLens().lookupType(clazz);
+ DexField initClassField =
+ appViewWithClassHierarchy.initClassLens().getInitClassField(rewrittenType);
checkRewrittenFieldReference(initClassField);
} else {
checkTypeReference(clazz);
@@ -2105,31 +2116,36 @@
@Override
public void registerInvokeVirtual(DexMethod method) {
- MethodLookupResult lookup = appView.graphLens().lookupInvokeVirtual(method, getContext());
+ MethodLookupResult lookup =
+ appViewWithClassHierarchy.graphLens().lookupInvokeVirtual(method, getContext());
checkRewrittenMethodReference(lookup.getReference(), OptionalBool.FALSE);
}
@Override
public void registerInvokeDirect(DexMethod method) {
- MethodLookupResult lookup = appView.graphLens().lookupInvokeDirect(method, getContext());
+ MethodLookupResult lookup =
+ appViewWithClassHierarchy.graphLens().lookupInvokeDirect(method, getContext());
checkRewrittenMethodReference(lookup.getReference(), OptionalBool.UNKNOWN);
}
@Override
public void registerInvokeStatic(DexMethod method) {
- MethodLookupResult lookup = appView.graphLens().lookupInvokeStatic(method, getContext());
+ MethodLookupResult lookup =
+ appViewWithClassHierarchy.graphLens().lookupInvokeStatic(method, getContext());
checkRewrittenMethodReference(lookup.getReference(), OptionalBool.UNKNOWN);
}
@Override
public void registerInvokeInterface(DexMethod method) {
- MethodLookupResult lookup = appView.graphLens().lookupInvokeInterface(method, getContext());
+ MethodLookupResult lookup =
+ appViewWithClassHierarchy.graphLens().lookupInvokeInterface(method, getContext());
checkRewrittenMethodReference(lookup.getReference(), OptionalBool.TRUE);
}
@Override
public void registerInvokeSuper(DexMethod method) {
- MethodLookupResult lookup = appView.graphLens().lookupInvokeSuper(method, getContext());
+ MethodLookupResult lookup =
+ appViewWithClassHierarchy.graphLens().lookupInvokeSuper(method, getContext());
checkRewrittenMethodReference(lookup.getReference(), OptionalBool.UNKNOWN);
}
diff --git a/src/main/java/com/android/tools/r8/shaking/WhyAreYouNotInliningRule.java b/src/main/java/com/android/tools/r8/shaking/WhyAreYouNotInliningRule.java
index eff85ec..4801930 100644
--- a/src/main/java/com/android/tools/r8/shaking/WhyAreYouNotInliningRule.java
+++ b/src/main/java/com/android/tools/r8/shaking/WhyAreYouNotInliningRule.java
@@ -11,6 +11,7 @@
public static final String RULE_NAME = "whyareyounotinlining";
+ @SuppressWarnings("NonCanonicalType")
public static class Builder
extends ProguardConfigurationRule.Builder<WhyAreYouNotInliningRule, Builder> {
diff --git a/src/main/java/com/android/tools/r8/startup/generated/InstrumentationServerFactory.java b/src/main/java/com/android/tools/r8/startup/generated/InstrumentationServerFactory.java
index d63bcf5..a7219a9 100644
--- a/src/main/java/com/android/tools/r8/startup/generated/InstrumentationServerFactory.java
+++ b/src/main/java/com/android/tools/r8/startup/generated/InstrumentationServerFactory.java
@@ -61,10 +61,12 @@
DexProgramClass::invalidChecksumRequest);
}
+ @SuppressWarnings("UnusedVariable")
private static DexEncodedField[] createInstanceFields(DexItemFactory dexItemFactory) {
return new DexEncodedField[] {};
}
+ @SuppressWarnings("UnusedVariable")
private static DexEncodedField[] createStaticFields(DexItemFactory dexItemFactory) {
return new DexEncodedField[] {};
}
diff --git a/src/main/java/com/android/tools/r8/synthesis/SyntheticFinalization.java b/src/main/java/com/android/tools/r8/synthesis/SyntheticFinalization.java
index a8a25a6..6fe2e59 100644
--- a/src/main/java/com/android/tools/r8/synthesis/SyntheticFinalization.java
+++ b/src/main/java/com/android/tools/r8/synthesis/SyntheticFinalization.java
@@ -147,6 +147,7 @@
methodMap.setRepresentative(method, representative);
}
+ @SuppressWarnings("UnusedVariable")
SyntheticFinalizationGraphLens build(AppView<?> appView) {
if (typeMap.isEmpty() && fieldMap.isEmpty() && methodMap.isEmpty()) {
return null;
@@ -155,13 +156,10 @@
}
}
- private final InternalOptions options;
private final SyntheticItems synthetics;
private final CommittedSyntheticsCollection committed;
- SyntheticFinalization(
- InternalOptions options, SyntheticItems synthetics, CommittedSyntheticsCollection committed) {
- this.options = options;
+ SyntheticFinalization(SyntheticItems synthetics, CommittedSyntheticsCollection committed) {
this.synthetics = synthetics;
this.committed = committed;
}
@@ -654,6 +652,7 @@
return equivalences;
}
+ @SuppressWarnings("MixedMutabilityReturnType")
private <T extends SyntheticDefinition<?, T, ?>> int compareForFinalGroupSorting(
EquivalenceGroup<T> a, EquivalenceGroup<T> b) {
// Sort the equivalence groups based on the representative types. The representatives are
@@ -665,6 +664,7 @@
.compareTo(b.getRepresentative().getHolder().getType());
}
+ @SuppressWarnings("MixedMutabilityReturnType")
private static <T extends SyntheticDefinition<?, T, ?>> List<EquivalenceGroup<T>> groupEquivalent(
AppView<?> appView,
List<T> potentialEquivalence,
@@ -803,6 +803,7 @@
return true;
}
+ @SuppressWarnings("MixedMutabilityReturnType")
private DexType createExternalType(
SyntheticKind kind,
String externalSyntheticTypePrefix,
@@ -834,6 +835,7 @@
return externalType;
}
+ @SuppressWarnings("MixedMutabilityReturnType")
private static <T extends SyntheticDefinition<?, T, ?>>
Collection<List<T>> computePotentialEquivalences(
Map<DexType, T> definitions,
diff --git a/src/main/java/com/android/tools/r8/synthesis/SyntheticItems.java b/src/main/java/com/android/tools/r8/synthesis/SyntheticItems.java
index 11ef4e3..781be07 100644
--- a/src/main/java/com/android/tools/r8/synthesis/SyntheticItems.java
+++ b/src/main/java/com/android/tools/r8/synthesis/SyntheticItems.java
@@ -803,6 +803,7 @@
*
* <p>This method is thread safe and will synchronize based on the context of the fixed synthetic.
*/
+ @SuppressWarnings("ArgumentSelectionDefectChecker")
public DexProgramClass ensureFixedClass(
SyntheticKindSelector kindSelector,
DexClass context,
@@ -1193,8 +1194,7 @@
Result computeFinalSynthetics(AppView<?> appView, Timing timing) {
assert !hasPendingSyntheticClasses();
- return new SyntheticFinalization(appView.options(), this, committed)
- .computeFinalSynthetics(appView, timing);
+ return new SyntheticFinalization(this, committed).computeFinalSynthetics(appView, timing);
}
@SuppressWarnings("ReferenceEquality")
diff --git a/src/main/java/com/android/tools/r8/tracereferences/TraceReferencesCommandParser.java b/src/main/java/com/android/tools/r8/tracereferences/TraceReferencesCommandParser.java
index 836ec8f..df8ae25 100644
--- a/src/main/java/com/android/tools/r8/tracereferences/TraceReferencesCommandParser.java
+++ b/src/main/java/com/android/tools/r8/tracereferences/TraceReferencesCommandParser.java
@@ -137,6 +137,7 @@
}
}
+ @SuppressWarnings("DefaultCharset")
private TraceReferencesCommand.Builder parse(
String[] args, Origin origin, TraceReferencesCommand.Builder builder) {
String[] expandedArgs = FlagFile.expandFlagFiles(args, builder::error);
diff --git a/src/main/java/com/android/tools/r8/utils/AndroidApiLevelUtils.java b/src/main/java/com/android/tools/r8/utils/AndroidApiLevelUtils.java
index 85c637c..f448ee9 100644
--- a/src/main/java/com/android/tools/r8/utils/AndroidApiLevelUtils.java
+++ b/src/main/java/com/android/tools/r8/utils/AndroidApiLevelUtils.java
@@ -155,7 +155,7 @@
return apiLevel.isLessThanOrEqualTo(apiLevelOfOriginal).isTrue();
}
- @SuppressWarnings("ReferenceEquality")
+ @SuppressWarnings({"MixedMutabilityReturnType", "ReferenceEquality"})
public static boolean isApiSafeForTypeStrengthening(
DexType newType, DexType oldType, AppView<? extends AppInfoWithClassHierarchy> appView) {
// Type strengthening only applies to reference types.
@@ -279,6 +279,7 @@
.getValue();
}
+ @SuppressWarnings("MixedMutabilityReturnType")
private static Set<DexClass> findAllFirstLibraryInterfacesOrProgramClassWithDefinition(
AppInfoWithClassHierarchy appInfo, DexClass originalClass, DexMember<?, ?> reference) {
Set<DexClass> interfaces = Sets.newLinkedHashSet();
diff --git a/src/main/java/com/android/tools/r8/utils/AndroidApp.java b/src/main/java/com/android/tools/r8/utils/AndroidApp.java
index 7135faa..52bc5f5 100644
--- a/src/main/java/com/android/tools/r8/utils/AndroidApp.java
+++ b/src/main/java/com/android/tools/r8/utils/AndroidApp.java
@@ -137,6 +137,7 @@
}
@Override
+ @SuppressWarnings("CatchAndPrintStackTrace")
public String toString() {
StringBuilder builder = new StringBuilder();
try {
@@ -482,6 +483,7 @@
return programResourcesMainDescriptor.get(resource);
}
+ @SuppressWarnings("DefaultCharset")
public void dump(Path output, DumpOptions dumpOptions, InternalOptions options) {
int nextDexIndex = 0;
OpenOption[] openOptions =
@@ -542,7 +544,7 @@
ZipEntry.DEFLATED);
}
if (dumpOptions.hasArtProfileProviders()) {
- dumpArtProfileProviders(dumpOptions.getArtProfileProviders(), options, out);
+ dumpArtProfileProviders(dumpOptions.getArtProfileProviders(), out);
}
if (dumpOptions.hasStartupProfileProviders()) {
dumpStartupProfileProviders(dumpOptions.getStartupProfileProviders(), options, out);
@@ -568,6 +570,7 @@
return nextDexIndex;
}
+ @SuppressWarnings("UnusedVariable")
private int dumpClasspathResources(int nextDexIndex, ZipOutputStream out)
throws IOException, ResourceException {
nextDexIndex =
@@ -576,11 +579,9 @@
return nextDexIndex;
}
+ @SuppressWarnings("DefaultCharset")
private void dumpArtProfileProviders(
- Collection<ArtProfileProvider> artProfileProviders,
- InternalOptions options,
- ZipOutputStream out)
- throws IOException {
+ Collection<ArtProfileProvider> artProfileProviders, ZipOutputStream out) throws IOException {
int artProfileProviderIndex = 1;
for (ArtProfileProvider artProfileProvider : artProfileProviders) {
String artProfileFileName = "art-profile-" + artProfileProviderIndex + ".txt";
@@ -593,6 +594,7 @@
}
}
+ @SuppressWarnings("DefaultCharset")
private void dumpStartupProfileProviders(
Collection<StartupProfileProvider> startupProfileProviders,
InternalOptions options,
diff --git a/src/main/java/com/android/tools/r8/utils/AssertionConfigurationWithDefault.java b/src/main/java/com/android/tools/r8/utils/AssertionConfigurationWithDefault.java
index fc2adf2..bb1d723 100644
--- a/src/main/java/com/android/tools/r8/utils/AssertionConfigurationWithDefault.java
+++ b/src/main/java/com/android/tools/r8/utils/AssertionConfigurationWithDefault.java
@@ -39,6 +39,7 @@
return allAssertionHandlers;
}
+ @SuppressWarnings("MixedMutabilityReturnType")
private List<MethodReference> computeAllAssertionHandlers() {
assert !defaultConfiguration.isAssertionHandler();
if (assertionsConfigurations.isEmpty()) {
diff --git a/src/main/java/com/android/tools/r8/utils/BoxBase.java b/src/main/java/com/android/tools/r8/utils/BoxBase.java
index c2b4492..265ad88 100644
--- a/src/main/java/com/android/tools/r8/utils/BoxBase.java
+++ b/src/main/java/com/android/tools/r8/utils/BoxBase.java
@@ -73,6 +73,7 @@
}
@Override
+ @SuppressWarnings("EqualsGetClass")
public boolean equals(Object object) {
if (object == null || getClass() != object.getClass()) {
return false;
diff --git a/src/main/java/com/android/tools/r8/utils/CompareResult.java b/src/main/java/com/android/tools/r8/utils/CompareResult.java
index a3a04a1..05432ce 100644
--- a/src/main/java/com/android/tools/r8/utils/CompareResult.java
+++ b/src/main/java/com/android/tools/r8/utils/CompareResult.java
@@ -11,7 +11,7 @@
EQUAL(0),
GREATER_THAN(1);
- private int comparisonResult;
+ private final int comparisonResult;
CompareResult(int comparisonResult) {
this.comparisonResult = comparisonResult;
diff --git a/src/main/java/com/android/tools/r8/utils/CompileDumpBase.java b/src/main/java/com/android/tools/r8/utils/CompileDumpBase.java
index aa74f03..c5cb640 100644
--- a/src/main/java/com/android/tools/r8/utils/CompileDumpBase.java
+++ b/src/main/java/com/android/tools/r8/utils/CompileDumpBase.java
@@ -154,6 +154,7 @@
return true;
}
+ @SuppressWarnings({"CatchAndPrintStackTrace", "DefaultCharset"})
// We cannot use StringResource since this class is added to the class path and has access only
// to the public APIs.
static String readAllBytesJava7(Path filePath) {
diff --git a/src/main/java/com/android/tools/r8/utils/CompileDumpCompatR8.java b/src/main/java/com/android/tools/r8/utils/CompileDumpCompatR8.java
index e1bf867..6760583 100644
--- a/src/main/java/com/android/tools/r8/utils/CompileDumpCompatR8.java
+++ b/src/main/java/com/android/tools/r8/utils/CompileDumpCompatR8.java
@@ -71,6 +71,7 @@
|| name.endsWith(".aar");
}
+ @SuppressWarnings("BadImport")
public static void main(String[] args) throws CompilationFailedException {
boolean isCompatMode = false;
OutputMode outputMode = OutputMode.DexIndexed;
diff --git a/src/main/java/com/android/tools/r8/utils/DexVersion.java b/src/main/java/com/android/tools/r8/utils/DexVersion.java
index f878e37..f96774a 100644
--- a/src/main/java/com/android/tools/r8/utils/DexVersion.java
+++ b/src/main/java/com/android/tools/r8/utils/DexVersion.java
@@ -25,13 +25,17 @@
return this == CONTAINER_DEX;
}
+ @SuppressWarnings("ImmutableEnumChecker")
public int getHeaderSize() {
return isContainer() ? Constants.TYPE_HEADER_ITEM_SIZE_V41 : Constants.TYPE_HEADER_ITEM_SIZE;
}
}
private final int dexVersion;
+
+ @SuppressWarnings("ImmutableEnumChecker")
private final byte[] dexVersionBytes;
+
private final Layout layout;
DexVersion(int dexVersion, byte[] dexVersionBytes, Layout layout) {
diff --git a/src/main/java/com/android/tools/r8/utils/IterableUtils.java b/src/main/java/com/android/tools/r8/utils/IterableUtils.java
index 3da57da..6b10d2f 100644
--- a/src/main/java/com/android/tools/r8/utils/IterableUtils.java
+++ b/src/main/java/com/android/tools/r8/utils/IterableUtils.java
@@ -120,6 +120,7 @@
return min;
}
+ @SuppressWarnings("UnusedVariable")
public static <T> int size(Iterable<T> iterable) {
int result = 0;
for (T element : iterable) {
diff --git a/src/main/java/com/android/tools/r8/utils/IteratorUtils.java b/src/main/java/com/android/tools/r8/utils/IteratorUtils.java
index 0dd5b36..506d1e3b 100644
--- a/src/main/java/com/android/tools/r8/utils/IteratorUtils.java
+++ b/src/main/java/com/android/tools/r8/utils/IteratorUtils.java
@@ -145,8 +145,11 @@
}
}
- /** @deprecated Use {@link #removeIf(InstructionListIterator, Predicate)} instead. */
+ /**
+ * @deprecated Use {@link #removeIf(InstructionListIterator, Predicate)} instead.
+ */
@Deprecated
+ @SuppressWarnings("DoNotCallSuggester")
public static void removeIf(InstructionIterator iterator, Predicate<Instruction> predicate) {
throw new Unimplemented();
}
diff --git a/src/main/java/com/android/tools/r8/utils/ReflectionHelper.java b/src/main/java/com/android/tools/r8/utils/ReflectionHelper.java
index 5e1cdbe..45f06f6 100644
--- a/src/main/java/com/android/tools/r8/utils/ReflectionHelper.java
+++ b/src/main/java/com/android/tools/r8/utils/ReflectionHelper.java
@@ -12,7 +12,7 @@
public class ReflectionHelper {
- @SuppressWarnings("unchecked")
+ @SuppressWarnings({"TypeParameterUnusedInFormals", "unchecked"})
public static <T> T performReflection(Object object, ReflectiveOperation<?> operation)
throws Exception {
return (T) operation.compute(object);
diff --git a/src/main/java/com/android/tools/r8/utils/StringUtils.java b/src/main/java/com/android/tools/r8/utils/StringUtils.java
index 75f4a2e..7f22a4b 100644
--- a/src/main/java/com/android/tools/r8/utils/StringUtils.java
+++ b/src/main/java/com/android/tools/r8/utils/StringUtils.java
@@ -367,6 +367,7 @@
}
}
+ @SuppressWarnings("DefaultCharset")
public static String computeMD5Hash(String name) {
byte[] digest = null;
try {
diff --git a/src/main/java/com/android/tools/r8/utils/UTF8TextInputStream.java b/src/main/java/com/android/tools/r8/utils/UTF8TextInputStream.java
index 709df16..99b3202 100644
--- a/src/main/java/com/android/tools/r8/utils/UTF8TextInputStream.java
+++ b/src/main/java/com/android/tools/r8/utils/UTF8TextInputStream.java
@@ -21,6 +21,7 @@
this(Files.newInputStream(path));
}
+ @SuppressWarnings("DefaultCharset")
public UTF8TextInputStream(String string) {
this(new ByteArrayInputStream(string.getBytes()));
}
diff --git a/src/main/java/com/android/tools/r8/utils/ZipUtils.java b/src/main/java/com/android/tools/r8/utils/ZipUtils.java
index 068350c..a44a64e 100644
--- a/src/main/java/com/android/tools/r8/utils/ZipUtils.java
+++ b/src/main/java/com/android/tools/r8/utils/ZipUtils.java
@@ -100,6 +100,7 @@
}
}
+ @SuppressWarnings("UnnecessaryParentheses")
public static Path map(
Path zipFilePath, Path mappedFilePath, BiFunction<ZipEntry, byte[], byte[]> map)
throws IOException {
@@ -112,6 +113,7 @@
return builder.build();
}
+ @SuppressWarnings("UnnecessaryParentheses")
public static Path filter(Path zipFilePath, Path filteredFilePath, Predicate<ZipEntry> predicate)
throws IOException {
ZipBuilder builder = ZipBuilder.builder(filteredFilePath);
@@ -131,6 +133,7 @@
}
}
+ @SuppressWarnings("StreamResourceLeak")
public static void zip(Path zipFile, Path inputDirectory) throws IOException {
List<Path> files =
Files.walk(inputDirectory)
diff --git a/src/main/java/com/android/tools/r8/utils/positions/ClassFilePositionToMappedRangeMapper.java b/src/main/java/com/android/tools/r8/utils/positions/ClassFilePositionToMappedRangeMapper.java
index 7360a6c..787dd32 100644
--- a/src/main/java/com/android/tools/r8/utils/positions/ClassFilePositionToMappedRangeMapper.java
+++ b/src/main/java/com/android/tools/r8/utils/positions/ClassFilePositionToMappedRangeMapper.java
@@ -96,6 +96,7 @@
return mappedPositions;
}
+ @SuppressWarnings("UnusedVariable")
private List<MappedPosition> getPcEncodedPositions(
ProgramMethod method, PositionRemapper positionRemapper) {
List<MappedPosition> mappedPositions = new ArrayList<>();
diff --git a/src/main/java/com/android/tools/r8/utils/positions/LineNumberOptimizer.java b/src/main/java/com/android/tools/r8/utils/positions/LineNumberOptimizer.java
index 68968a8..c91839c 100644
--- a/src/main/java/com/android/tools/r8/utils/positions/LineNumberOptimizer.java
+++ b/src/main/java/com/android/tools/r8/utils/positions/LineNumberOptimizer.java
@@ -182,6 +182,7 @@
return builder.build();
}
+ @SuppressWarnings("ComplexBooleanConstant")
private static boolean verifyMethodsAreKeptDirectlyOrIndirectly(
AppView<?> appView, List<ProgramMethod> methods) {
if (appView.options().isGeneratingClassFiles() || !appView.appInfo().hasClassHierarchy()) {
@@ -257,6 +258,7 @@
});
}
+ @SuppressWarnings("UnusedVariable")
public static IdentityHashMap<DexString, List<ProgramMethod>> groupMethodsByRenamedName(
AppView<?> appView, DexProgramClass clazz) {
IdentityHashMap<DexString, List<ProgramMethod>> methodsByRenamedName =
diff --git a/src/main/java/com/android/tools/r8/utils/positions/PositionToMappedRangeMapper.java b/src/main/java/com/android/tools/r8/utils/positions/PositionToMappedRangeMapper.java
index 2ada4e3..78fb8d0 100644
--- a/src/main/java/com/android/tools/r8/utils/positions/PositionToMappedRangeMapper.java
+++ b/src/main/java/com/android/tools/r8/utils/positions/PositionToMappedRangeMapper.java
@@ -98,6 +98,7 @@
// Only param and max-pc are part of the key.
@Override
+ @SuppressWarnings("EqualsUnsafeCast")
public boolean equals(Object o) {
UpdateInfo that = (UpdateInfo) o;
return paramCount == that.paramCount && maxEncodingPc == that.maxEncodingPc;
diff --git a/src/main/java/com/android/tools/r8/utils/structural/HasherWrapper.java b/src/main/java/com/android/tools/r8/utils/structural/HasherWrapper.java
index 112aace..358359a 100644
--- a/src/main/java/com/android/tools/r8/utils/structural/HasherWrapper.java
+++ b/src/main/java/com/android/tools/r8/utils/structural/HasherWrapper.java
@@ -27,6 +27,7 @@
String hashCodeAsString();
+ @SuppressWarnings("TypeParameterUnusedInFormals")
<T> T hash();
static HasherWrapper sha256Hasher() {
@@ -75,8 +76,8 @@
hasher.putBytes(content);
}
- @SuppressWarnings("unchecked")
@Override
+ @SuppressWarnings({"TypeParameterUnusedInFormals", "unchecked"})
public <T> T hash() {
return (T) hasher.hash();
}