Skip to content

Commit

Permalink
Suppress deprecation warnings in generated code.
Browse files Browse the repository at this point in the history
Fixes #4302.

RELNOTES=Suppress deprecation warnings in generated code. Fixes #4302
PiperOrigin-RevId: 633649389
  • Loading branch information
Chang-Eric authored and Dagger Team committed May 14, 2024
1 parent 9a67471 commit f41033c
Show file tree
Hide file tree
Showing 342 changed files with 694 additions and 347 deletions.
3 changes: 2 additions & 1 deletion java/dagger/internal/codegen/base/SourceFileGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import static androidx.room.compiler.processing.JavaPoetExtKt.addOriginatingElement;
import static com.google.common.base.Preconditions.checkNotNull;
import static dagger.internal.codegen.javapoet.AnnotationSpecs.Suppression.CAST;
import static dagger.internal.codegen.javapoet.AnnotationSpecs.Suppression.DEPRECATION;
import static dagger.internal.codegen.javapoet.AnnotationSpecs.Suppression.KOTLIN_INTERNAL;
import static dagger.internal.codegen.javapoet.AnnotationSpecs.Suppression.RAWTYPES;
import static dagger.internal.codegen.javapoet.AnnotationSpecs.Suppression.UNCHECKED;
Expand Down Expand Up @@ -91,7 +92,7 @@ private JavaFile buildJavaFile(T input, TypeSpec.Builder typeSpecBuilder) {
AnnotationSpecs.suppressWarnings(
ImmutableSet.<Suppression>builder()
.addAll(warningSuppressions())
.add(UNCHECKED, RAWTYPES, KOTLIN_INTERNAL, CAST)
.add(UNCHECKED, RAWTYPES, KOTLIN_INTERNAL, CAST, DEPRECATION)
.build()));

String packageName = closestEnclosingTypeElement(originatingElement).getPackageName();
Expand Down
3 changes: 2 additions & 1 deletion java/dagger/internal/codegen/javapoet/AnnotationSpecs.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ public enum Suppression {
UNCHECKED("unchecked"),
FUTURE_RETURN_VALUE_IGNORED("FutureReturnValueIgnored"),
KOTLIN_INTERNAL("KotlinInternal", "KotlinInternalInJava"),
CAST("cast")
CAST("cast"),
DEPRECATION("deprecation")
;

private final ImmutableList<String> values;
Expand Down
3 changes: 2 additions & 1 deletion javatests/dagger/internal/codegen/GeneratedLines.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ public final class GeneratedLines {

private static final String SUPPRESS_WARNINGS_ANNOTATION =
"@SuppressWarnings({"
+ "\"unchecked\", \"rawtypes\", \"KotlinInternal\", \"KotlinInternalInJava\", \"cast\""
+ "\"unchecked\", \"rawtypes\", \"KotlinInternal\", \"KotlinInternalInJava\", \"cast\", "
+ "\"deprecation\""
+ "})";

private static final String IMPORT_DAGGER_GENERATED = "import dagger.internal.DaggerGenerated;";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ import javax.annotation.processing.Generated;
"rawtypes",
"KotlinInternal",
"KotlinInternalInJava",
"cast"
"cast",
"deprecation"
})
final class DaggerTestComponent {
private DaggerTestComponent() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ import javax.annotation.processing.Generated;
"rawtypes",
"KotlinInternal",
"KotlinInternalInJava",
"cast"
"cast",
"deprecation"
})
final class DaggerTestComponent {
private DaggerTestComponent() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ import javax.annotation.processing.Generated;
"rawtypes",
"KotlinInternal",
"KotlinInternalInJava",
"cast"
"cast",
"deprecation"
})
final class DaggerTestComponent {
private DaggerTestComponent() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ import javax.annotation.processing.Generated;
"rawtypes",
"KotlinInternal",
"KotlinInternalInJava",
"cast"
"cast",
"deprecation"
})
final class DaggerTestComponent {
private DaggerTestComponent() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ import javax.annotation.processing.Generated;
"rawtypes",
"KotlinInternal",
"KotlinInternalInJava",
"cast"
"cast",
"deprecation"
})
final class DaggerTestComponent {
private DaggerTestComponent() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ import javax.annotation.processing.Generated;
"rawtypes",
"KotlinInternal",
"KotlinInternalInJava",
"cast"
"cast",
"deprecation"
})
final class DaggerTestComponent {
private DaggerTestComponent() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ import javax.inject.Provider;
"rawtypes",
"KotlinInternal",
"KotlinInternalInJava",
"cast"
"cast",
"deprecation"
})
public final class Foo_Factory {
private final Provider<Bar> argProvider;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ import javax.inject.Provider;
"rawtypes",
"KotlinInternal",
"KotlinInternalInJava",
"cast"
"cast",
"deprecation"
})
public final class Foo_Factory {
private final Provider<Bar> argProvider;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ import javax.annotation.processing.Generated;
"rawtypes",
"KotlinInternal",
"KotlinInternalInJava",
"cast"
"cast",
"deprecation"
})
final class DaggerMyComponent {
private DaggerMyComponent() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ import javax.annotation.processing.Generated;
"rawtypes",
"KotlinInternal",
"KotlinInternalInJava",
"cast"
"cast",
"deprecation"
})
final class DaggerMyComponent {
private DaggerMyComponent() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ import javax.annotation.processing.Generated;
"rawtypes",
"KotlinInternal",
"KotlinInternalInJava",
"cast"
"cast",
"deprecation"
})
final class DaggerTestComponent {
private DaggerTestComponent() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ import javax.annotation.processing.Generated;
"rawtypes",
"KotlinInternal",
"KotlinInternalInJava",
"cast"
"cast",
"deprecation"
})
final class DaggerTestComponent {
private DaggerTestComponent() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ import javax.annotation.processing.Generated;
"rawtypes",
"KotlinInternal",
"KotlinInternalInJava",
"cast"
"cast",
"deprecation"
})
final class DaggerTestComponent {
private DaggerTestComponent() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ import javax.annotation.processing.Generated;
"rawtypes",
"KotlinInternal",
"KotlinInternalInJava",
"cast"
"cast",
"deprecation"
})
final class DaggerTestComponent {
private DaggerTestComponent() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ import javax.annotation.processing.Generated;
"rawtypes",
"KotlinInternal",
"KotlinInternalInJava",
"cast"
"cast",
"deprecation"
})
final class DaggerTestComponent {
private DaggerTestComponent() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ import javax.annotation.processing.Generated;
"rawtypes",
"KotlinInternal",
"KotlinInternalInJava",
"cast"
"cast",
"deprecation"
})
final class DaggerTestComponent {
private DaggerTestComponent() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ import javax.annotation.processing.Generated;
"rawtypes",
"KotlinInternal",
"KotlinInternalInJava",
"cast"
"cast",
"deprecation"
})
final class DaggerTestComponent {
private DaggerTestComponent() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ import javax.annotation.processing.Generated;
"rawtypes",
"KotlinInternal",
"KotlinInternalInJava",
"cast"
"cast",
"deprecation"
})
final class DaggerTestComponent {
private DaggerTestComponent() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ import javax.annotation.processing.Generated;
"rawtypes",
"KotlinInternal",
"KotlinInternalInJava",
"cast"
"cast",
"deprecation"
})
final class DaggerSimpleComponent {
private DaggerSimpleComponent() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ import javax.annotation.processing.Generated;
"rawtypes",
"KotlinInternal",
"KotlinInternalInJava",
"cast"
"cast",
"deprecation"
})
final class DaggerSimpleComponent {
private DaggerSimpleComponent() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ import javax.annotation.processing.Generated;
"rawtypes",
"KotlinInternal",
"KotlinInternalInJava",
"cast"
"cast",
"deprecation"
})
final class DaggerSimpleComponent {
private DaggerSimpleComponent() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ import javax.annotation.processing.Generated;
"rawtypes",
"KotlinInternal",
"KotlinInternalInJava",
"cast"
"cast",
"deprecation"
})
final class DaggerSimpleComponent {
private DaggerSimpleComponent() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ import javax.annotation.processing.Generated;
"rawtypes",
"KotlinInternal",
"KotlinInternalInJava",
"cast"
"cast",
"deprecation"
})
final class DaggerSimpleComponent {
private DaggerSimpleComponent() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ import javax.annotation.processing.Generated;
"rawtypes",
"KotlinInternal",
"KotlinInternalInJava",
"cast"
"cast",
"deprecation"
})
final class DaggerSimpleComponent {
private DaggerSimpleComponent() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ import javax.annotation.processing.Generated;
"rawtypes",
"KotlinInternal",
"KotlinInternalInJava",
"cast"
"cast",
"deprecation"
})
final class DaggerSimpleComponent {
private DaggerSimpleComponent() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ import javax.annotation.processing.Generated;
"rawtypes",
"KotlinInternal",
"KotlinInternalInJava",
"cast"
"cast",
"deprecation"
})
final class DaggerSimpleComponent {
private DaggerSimpleComponent() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ import javax.annotation.processing.Generated;
"rawtypes",
"KotlinInternal",
"KotlinInternalInJava",
"cast"
"cast",
"deprecation"
})
final class DaggerSimpleComponent {
private DaggerSimpleComponent() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ import javax.annotation.processing.Generated;
"rawtypes",
"KotlinInternal",
"KotlinInternalInJava",
"cast"
"cast",
"deprecation"
})
final class DaggerSimpleComponent {
private DaggerSimpleComponent() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ import javax.annotation.processing.Generated;
"rawtypes",
"KotlinInternal",
"KotlinInternalInJava",
"cast"
"cast",
"deprecation"
})
final class DaggerSimpleComponent {
private DaggerSimpleComponent() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ import javax.annotation.processing.Generated;
"rawtypes",
"KotlinInternal",
"KotlinInternalInJava",
"cast"
"cast",
"deprecation"
})
final class DaggerSimpleComponent {
private DaggerSimpleComponent() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ import javax.annotation.processing.Generated;
"rawtypes",
"KotlinInternal",
"KotlinInternalInJava",
"cast"
"cast",
"deprecation"
})
final class DaggerTestComponent {
private DaggerTestComponent() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ import javax.annotation.processing.Generated;
"rawtypes",
"KotlinInternal",
"KotlinInternalInJava",
"cast"
"cast",
"deprecation"
})
final class DaggerTestComponent {
private DaggerTestComponent() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ import javax.annotation.processing.Generated;
"rawtypes",
"KotlinInternal",
"KotlinInternalInJava",
"cast"
"cast",
"deprecation"
})
final class DaggerBComponent {
private DaggerBComponent() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ import javax.annotation.processing.Generated;
"rawtypes",
"KotlinInternal",
"KotlinInternalInJava",
"cast"
"cast",
"deprecation"
})
final class DaggerBComponent {
private DaggerBComponent() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ import javax.annotation.processing.Generated;
"rawtypes",
"KotlinInternal",
"KotlinInternalInJava",
"cast"
"cast",
"deprecation"
})
final class DaggerBComponent {
private DaggerBComponent() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ import javax.annotation.processing.Generated;
"rawtypes",
"KotlinInternal",
"KotlinInternalInJava",
"cast"
"cast",
"deprecation"
})
final class DaggerBComponent {
private DaggerBComponent() {
Expand Down

0 comments on commit f41033c

Please sign in to comment.