Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add @SuppressWarnings("nullness:initialization.field.uninitialized") to component fields. #4499

Merged
merged 1 commit into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
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 @@ -23,6 +23,7 @@
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;
import static dagger.internal.codegen.javapoet.AnnotationSpecs.Suppression.UNINITIALIZED;
import static dagger.internal.codegen.xprocessing.XElements.closestEnclosingTypeElement;

import androidx.room.compiler.processing.XElement;
Expand Down Expand Up @@ -92,7 +93,7 @@ private JavaFile buildJavaFile(T input, TypeSpec.Builder typeSpecBuilder) {
AnnotationSpecs.suppressWarnings(
ImmutableSet.<Suppression>builder()
.addAll(warningSuppressions())
.add(UNCHECKED, RAWTYPES, KOTLIN_INTERNAL, CAST, DEPRECATION)
.add(UNCHECKED, RAWTYPES, KOTLIN_INTERNAL, CAST, DEPRECATION, UNINITIALIZED)
.build()));

String packageName = closestEnclosingTypeElement(originatingElement).getPackageName();
Expand Down
4 changes: 2 additions & 2 deletions java/dagger/internal/codegen/javapoet/AnnotationSpecs.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ public enum Suppression {
FUTURE_RETURN_VALUE_IGNORED("FutureReturnValueIgnored"),
KOTLIN_INTERNAL("KotlinInternal", "KotlinInternalInJava"),
CAST("cast"),
DEPRECATION("deprecation")
;
DEPRECATION("deprecation"),
UNINITIALIZED("nullness:initialization.field.uninitialized");

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 @@ -34,7 +34,8 @@ public final class GeneratedLines {
private static final String SUPPRESS_WARNINGS_ANNOTATION =
"@SuppressWarnings({"
+ "\"unchecked\", \"rawtypes\", \"KotlinInternal\", \"KotlinInternalInJava\", \"cast\", "
+ "\"deprecation\""
+ "\"deprecation\","
+ "\"nullness:initialization.field.uninitialized\""
+ "})";

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 @@ -347,7 +347,8 @@ public void kotlinNullableProvides() {
" \"KotlinInternal\",",
" \"KotlinInternalInJava\",",
" \"cast\",",
" \"deprecation\"",
" \"deprecation\",",
" \"nullness:initialization.field.uninitialized\"",
"})",
"public final class TestModule_ProvideStringFactory implements"
+ " Factory<String> {",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ import javax.annotation.processing.Generated;
"KotlinInternal",
"KotlinInternalInJava",
"cast",
"deprecation"
"deprecation",
"nullness:initialization.field.uninitialized"
})
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;
"KotlinInternal",
"KotlinInternalInJava",
"cast",
"deprecation"
"deprecation",
"nullness:initialization.field.uninitialized"
})
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;
"KotlinInternal",
"KotlinInternalInJava",
"cast",
"deprecation"
"deprecation",
"nullness:initialization.field.uninitialized"
})
final class DaggerTestComponent {
private DaggerTestComponent() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ import javax.annotation.processing.Generated;
"KotlinInternal",
"KotlinInternalInJava",
"cast",
"deprecation"
"deprecation",
"nullness:initialization.field.uninitialized"
})
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;
"KotlinInternal",
"KotlinInternalInJava",
"cast",
"deprecation"
"deprecation",
"nullness:initialization.field.uninitialized"
})
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;
"KotlinInternal",
"KotlinInternalInJava",
"cast",
"deprecation"
"deprecation",
"nullness:initialization.field.uninitialized"
})
final class DaggerTestComponent {
private DaggerTestComponent() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ import javax.inject.Provider;
"KotlinInternal",
"KotlinInternalInJava",
"cast",
"deprecation"
"deprecation",
"nullness:initialization.field.uninitialized"
})
public final class Foo_Factory {
private final Provider<Bar> argProvider;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ import javax.inject.Provider;
"KotlinInternal",
"KotlinInternalInJava",
"cast",
"deprecation"
"deprecation",
"nullness:initialization.field.uninitialized"
})
public final class Foo_Factory {
private final Provider<Bar> argProvider;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ import javax.annotation.processing.Generated;
"KotlinInternal",
"KotlinInternalInJava",
"cast",
"deprecation"
"deprecation",
"nullness:initialization.field.uninitialized"
})
final class DaggerMyComponent {
private DaggerMyComponent() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ import javax.annotation.processing.Generated;
"KotlinInternal",
"KotlinInternalInJava",
"cast",
"deprecation"
"deprecation",
"nullness:initialization.field.uninitialized"
})
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;
"KotlinInternal",
"KotlinInternalInJava",
"cast",
"deprecation"
"deprecation",
"nullness:initialization.field.uninitialized"
})
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;
"KotlinInternal",
"KotlinInternalInJava",
"cast",
"deprecation"
"deprecation",
"nullness:initialization.field.uninitialized"
})
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;
"KotlinInternal",
"KotlinInternalInJava",
"cast",
"deprecation"
"deprecation",
"nullness:initialization.field.uninitialized"
})
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;
"KotlinInternal",
"KotlinInternalInJava",
"cast",
"deprecation"
"deprecation",
"nullness:initialization.field.uninitialized"
})
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;
"KotlinInternal",
"KotlinInternalInJava",
"cast",
"deprecation"
"deprecation",
"nullness:initialization.field.uninitialized"
})
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;
"KotlinInternal",
"KotlinInternalInJava",
"cast",
"deprecation"
"deprecation",
"nullness:initialization.field.uninitialized"
})
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;
"KotlinInternal",
"KotlinInternalInJava",
"cast",
"deprecation"
"deprecation",
"nullness:initialization.field.uninitialized"
})
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;
"KotlinInternal",
"KotlinInternalInJava",
"cast",
"deprecation"
"deprecation",
"nullness:initialization.field.uninitialized"
})
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;
"KotlinInternal",
"KotlinInternalInJava",
"cast",
"deprecation"
"deprecation",
"nullness:initialization.field.uninitialized"
})
final class DaggerSimpleComponent {
private DaggerSimpleComponent() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ import javax.annotation.processing.Generated;
"KotlinInternal",
"KotlinInternalInJava",
"cast",
"deprecation"
"deprecation",
"nullness:initialization.field.uninitialized"
})
final class DaggerSimpleComponent {
private DaggerSimpleComponent() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ import javax.annotation.processing.Generated;
"KotlinInternal",
"KotlinInternalInJava",
"cast",
"deprecation"
"deprecation",
"nullness:initialization.field.uninitialized"
})
final class DaggerSimpleComponent {
private DaggerSimpleComponent() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ import javax.annotation.processing.Generated;
"KotlinInternal",
"KotlinInternalInJava",
"cast",
"deprecation"
"deprecation",
"nullness:initialization.field.uninitialized"
})
final class DaggerSimpleComponent {
private DaggerSimpleComponent() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ import javax.annotation.processing.Generated;
"KotlinInternal",
"KotlinInternalInJava",
"cast",
"deprecation"
"deprecation",
"nullness:initialization.field.uninitialized"
})
final class DaggerSimpleComponent {
private DaggerSimpleComponent() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ import javax.annotation.processing.Generated;
"KotlinInternal",
"KotlinInternalInJava",
"cast",
"deprecation"
"deprecation",
"nullness:initialization.field.uninitialized"
})
final class DaggerSimpleComponent {
private DaggerSimpleComponent() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ import javax.annotation.processing.Generated;
"KotlinInternal",
"KotlinInternalInJava",
"cast",
"deprecation"
"deprecation",
"nullness:initialization.field.uninitialized"
})
final class DaggerSimpleComponent {
private DaggerSimpleComponent() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ import javax.annotation.processing.Generated;
"KotlinInternal",
"KotlinInternalInJava",
"cast",
"deprecation"
"deprecation",
"nullness:initialization.field.uninitialized"
})
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;
"KotlinInternal",
"KotlinInternalInJava",
"cast",
"deprecation"
"deprecation",
"nullness:initialization.field.uninitialized"
})
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;
"KotlinInternal",
"KotlinInternalInJava",
"cast",
"deprecation"
"deprecation",
"nullness:initialization.field.uninitialized"
})
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;
"KotlinInternal",
"KotlinInternalInJava",
"cast",
"deprecation"
"deprecation",
"nullness:initialization.field.uninitialized"
})
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;
"KotlinInternal",
"KotlinInternalInJava",
"cast",
"deprecation"
"deprecation",
"nullness:initialization.field.uninitialized"
})
final class DaggerSimpleComponent {
private DaggerSimpleComponent() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ import javax.annotation.processing.Generated;
"KotlinInternal",
"KotlinInternalInJava",
"cast",
"deprecation"
"deprecation",
"nullness:initialization.field.uninitialized"
})
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;
"KotlinInternal",
"KotlinInternalInJava",
"cast",
"deprecation"
"deprecation",
"nullness:initialization.field.uninitialized"
})
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;
"KotlinInternal",
"KotlinInternalInJava",
"cast",
"deprecation"
"deprecation",
"nullness:initialization.field.uninitialized"
})
final class DaggerBComponent {
private DaggerBComponent() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ import javax.annotation.processing.Generated;
"KotlinInternal",
"KotlinInternalInJava",
"cast",
"deprecation"
"deprecation",
"nullness:initialization.field.uninitialized"
})
final class DaggerBComponent {
private DaggerBComponent() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ import javax.annotation.processing.Generated;
"KotlinInternal",
"KotlinInternalInJava",
"cast",
"deprecation"
"deprecation",
"nullness:initialization.field.uninitialized"
})
final class DaggerBComponent {
private DaggerBComponent() {
Expand Down
Loading
Loading