Skip to content

Commit f41033c

Browse files
Chang-EricDagger Team
authored andcommitted
Suppress deprecation warnings in generated code.
Fixes #4302. RELNOTES=Suppress deprecation warnings in generated code. Fixes #4302 PiperOrigin-RevId: 633649389
1 parent 9a67471 commit f41033c

File tree

342 files changed

+694
-347
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

342 files changed

+694
-347
lines changed

java/dagger/internal/codegen/base/SourceFileGenerator.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import static androidx.room.compiler.processing.JavaPoetExtKt.addOriginatingElement;
2020
import static com.google.common.base.Preconditions.checkNotNull;
2121
import static dagger.internal.codegen.javapoet.AnnotationSpecs.Suppression.CAST;
22+
import static dagger.internal.codegen.javapoet.AnnotationSpecs.Suppression.DEPRECATION;
2223
import static dagger.internal.codegen.javapoet.AnnotationSpecs.Suppression.KOTLIN_INTERNAL;
2324
import static dagger.internal.codegen.javapoet.AnnotationSpecs.Suppression.RAWTYPES;
2425
import static dagger.internal.codegen.javapoet.AnnotationSpecs.Suppression.UNCHECKED;
@@ -91,7 +92,7 @@ private JavaFile buildJavaFile(T input, TypeSpec.Builder typeSpecBuilder) {
9192
AnnotationSpecs.suppressWarnings(
9293
ImmutableSet.<Suppression>builder()
9394
.addAll(warningSuppressions())
94-
.add(UNCHECKED, RAWTYPES, KOTLIN_INTERNAL, CAST)
95+
.add(UNCHECKED, RAWTYPES, KOTLIN_INTERNAL, CAST, DEPRECATION)
9596
.build()));
9697

9798
String packageName = closestEnclosingTypeElement(originatingElement).getPackageName();

java/dagger/internal/codegen/javapoet/AnnotationSpecs.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ public enum Suppression {
3131
UNCHECKED("unchecked"),
3232
FUTURE_RETURN_VALUE_IGNORED("FutureReturnValueIgnored"),
3333
KOTLIN_INTERNAL("KotlinInternal", "KotlinInternalInJava"),
34-
CAST("cast")
34+
CAST("cast"),
35+
DEPRECATION("deprecation")
3536
;
3637

3738
private final ImmutableList<String> values;

javatests/dagger/internal/codegen/GeneratedLines.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ public final class GeneratedLines {
3333

3434
private static final String SUPPRESS_WARNINGS_ANNOTATION =
3535
"@SuppressWarnings({"
36-
+ "\"unchecked\", \"rawtypes\", \"KotlinInternal\", \"KotlinInternalInJava\", \"cast\""
36+
+ "\"unchecked\", \"rawtypes\", \"KotlinInternal\", \"KotlinInternalInJava\", \"cast\", "
37+
+ "\"deprecation\""
3738
+ "})";
3839

3940
private static final String IMPORT_DAGGER_GENERATED = "import dagger.internal.DaggerGenerated;";

javatests/dagger/internal/codegen/goldens/AssistedFactoryTest_assistedParamConflictsWithComponentFieldName_successfulyDeduped_DEFAULT_MODE_test.DaggerTestComponent

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ import javax.annotation.processing.Generated;
1414
"rawtypes",
1515
"KotlinInternal",
1616
"KotlinInternalInJava",
17-
"cast"
17+
"cast",
18+
"deprecation"
1819
})
1920
final class DaggerTestComponent {
2021
private DaggerTestComponent() {

javatests/dagger/internal/codegen/goldens/AssistedFactoryTest_assistedParamConflictsWithComponentFieldName_successfulyDeduped_FAST_INIT_MODE_test.DaggerTestComponent

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ import javax.annotation.processing.Generated;
1515
"rawtypes",
1616
"KotlinInternal",
1717
"KotlinInternalInJava",
18-
"cast"
18+
"cast",
19+
"deprecation"
1920
})
2021
final class DaggerTestComponent {
2122
private DaggerTestComponent() {

javatests/dagger/internal/codegen/goldens/AssistedFactoryTest_testAssistedFactoryCycle_DEFAULT_MODE_test.DaggerTestComponent

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ import javax.annotation.processing.Generated;
1515
"rawtypes",
1616
"KotlinInternal",
1717
"KotlinInternalInJava",
18-
"cast"
18+
"cast",
19+
"deprecation"
1920
})
2021
final class DaggerTestComponent {
2122
private DaggerTestComponent() {

javatests/dagger/internal/codegen/goldens/AssistedFactoryTest_testAssistedFactoryCycle_FAST_INIT_MODE_test.DaggerTestComponent

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ import javax.annotation.processing.Generated;
1616
"rawtypes",
1717
"KotlinInternal",
1818
"KotlinInternalInJava",
19-
"cast"
19+
"cast",
20+
"deprecation"
2021
})
2122
final class DaggerTestComponent {
2223
private DaggerTestComponent() {

javatests/dagger/internal/codegen/goldens/AssistedFactoryTest_testAssistedFactory_DEFAULT_MODE_test.DaggerTestComponent

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ import javax.annotation.processing.Generated;
1414
"rawtypes",
1515
"KotlinInternal",
1616
"KotlinInternalInJava",
17-
"cast"
17+
"cast",
18+
"deprecation"
1819
})
1920
final class DaggerTestComponent {
2021
private DaggerTestComponent() {

javatests/dagger/internal/codegen/goldens/AssistedFactoryTest_testAssistedFactory_FAST_INIT_MODE_test.DaggerTestComponent

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ import javax.annotation.processing.Generated;
1515
"rawtypes",
1616
"KotlinInternal",
1717
"KotlinInternalInJava",
18-
"cast"
18+
"cast",
19+
"deprecation"
1920
})
2021
final class DaggerTestComponent {
2122
private DaggerTestComponent() {

javatests/dagger/internal/codegen/goldens/AssistedFactoryTest_testFactoryGeneratorDuplicatedParamNames_DEFAULT_MODE_test.Foo_Factory

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ import javax.inject.Provider;
1818
"rawtypes",
1919
"KotlinInternal",
2020
"KotlinInternalInJava",
21-
"cast"
21+
"cast",
22+
"deprecation"
2223
})
2324
public final class Foo_Factory {
2425
private final Provider<Bar> argProvider;

0 commit comments

Comments
 (0)