Skip to content

Commit 87459c4

Browse files
[various] Enable warnings as errors, and all warnings, for Android lint (flutter#3648)
For all Android plugins: - Enable all warnings for `lint` - Treat all warnings as errors for `lint` This significantly increases the scope of issues that we'll catch in CI. To allow enabling this without having to make tons of fixes first, so that we get the incremental benefit immediately, this adds new baselines for all plugins. We can incrementally clean those baselines up over time. (In practice we haven't prioritized that, but it would be good to start paying down that technical debt incrementally at some point.) See flutter#88011
1 parent 3437d91 commit 87459c4

File tree

32 files changed

+13996
-309
lines changed

32 files changed

+13996
-309
lines changed

packages/camera/camera_android/android/build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ android {
3535
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
3636
}
3737
lintOptions {
38+
checkAllWarnings true
39+
warningsAsErrors true
3840
disable 'AndroidGradlePluginVersion', 'InvalidPackage', 'GradleDependency'
3941
baseline file("lint-baseline.xml")
4042
}

packages/camera/camera_android/android/lint-baseline.xml

Lines changed: 3059 additions & 67 deletions
Large diffs are not rendered by default.

packages/camera/camera_android_camerax/android/build.gradle

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,10 @@ android {
4949
}
5050

5151
lintOptions {
52-
disable 'AndroidGradlePluginVersion'
53-
disable 'GradleDependency'
52+
checkAllWarnings true
53+
warningsAsErrors true
54+
disable 'AndroidGradlePluginVersion', 'GradleDependency', 'InvalidPackage'
55+
baseline file("lint-baseline.xml")
5456
}
5557
}
5658

packages/camera/camera_android_camerax/android/lint-baseline.xml

Lines changed: 1434 additions & 0 deletions
Large diffs are not rendered by default.

packages/espresso/android/build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ android {
2929
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
3030
}
3131
lintOptions {
32+
checkAllWarnings true
33+
warningsAsErrors true
3234
disable 'AndroidGradlePluginVersion', 'InvalidPackage', 'GradleDependency'
3335
baseline file("lint-baseline.xml")
3436
}

packages/espresso/android/lint-baseline.xml

Lines changed: 2244 additions & 209 deletions
Large diffs are not rendered by default.

packages/flutter_plugin_android_lifecycle/android/build.gradle

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@ android {
3030
consumerProguardFiles 'proguard.txt'
3131
}
3232
lintOptions {
33+
checkAllWarnings true
34+
warningsAsErrors true
3335
disable 'AndroidGradlePluginVersion', 'InvalidPackage', 'GradleDependency'
36+
baseline file("lint-baseline.xml")
3437
}
3538

3639
dependencies {
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<issues format="6" by="lint 7.4.2" type="baseline" client="gradle" dependencies="false" name="AGP (7.4.2)" variant="all" version="7.4.2">
3+
4+
<issue
5+
id="UnknownNullness"
6+
message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations"
7+
errorLine1=" public static void registerWith(io.flutter.plugin.common.PluginRegistry.Registrar registrar) {"
8+
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
9+
<location
10+
file="src/main/java/io/flutter/plugins/flutter_plugin_android_lifecycle/FlutterAndroidLifecyclePlugin.java"
11+
line="18"
12+
column="35"/>
13+
</issue>
14+
15+
</issues>

packages/google_maps_flutter/google_maps_flutter_android/android/build.gradle

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@ android {
2929
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
3030
}
3131
lintOptions {
32+
checkAllWarnings true
33+
warningsAsErrors true
3234
disable 'AndroidGradlePluginVersion', 'InvalidPackage', 'GradleDependency'
35+
baseline file("lint-baseline.xml")
3336
}
3437

3538
dependencies {
Lines changed: 202 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,202 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<issues format="6" by="lint 7.0.1" type="baseline" client="gradle" name="AGP (7.0.1)" variant="all" version="7.0.1">
3+
4+
<issue
5+
id="SyntheticAccessor"
6+
message="Access to `private` field `loadedCallbackPending` of class `GoogleMapController` requires synthetic accessor"
7+
errorLine1=" loadedCallbackPending = false;"
8+
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~">
9+
<location
10+
file="src/main/java/io/flutter/plugins/googlemaps/GoogleMapController.java"
11+
line="165"
12+
column="13"/>
13+
</issue>
14+
15+
<issue
16+
id="SyntheticAccessor"
17+
message="Access to `private` method `postFrameCallback` of class `GoogleMapController` requires synthetic accessor"
18+
errorLine1=" postFrameCallback("
19+
errorLine2=" ~~~~~~~~~~~~~~~~~">
20+
<location
21+
file="src/main/java/io/flutter/plugins/googlemaps/GoogleMapController.java"
22+
line="166"
23+
column="13"/>
24+
</issue>
25+
26+
<issue
27+
id="SyntheticAccessor"
28+
message="Access to `private` method `postFrameCallback` of class `GoogleMapController` requires synthetic accessor"
29+
errorLine1=" postFrameCallback("
30+
errorLine2=" ~~~~~~~~~~~~~~~~~">
31+
<location
32+
file="src/main/java/io/flutter/plugins/googlemaps/GoogleMapController.java"
33+
line="168"
34+
column="19"/>
35+
</issue>
36+
37+
<issue
38+
id="SyntheticAccessor"
39+
message="Access to `private` field `mapView` of class `GoogleMapController` requires synthetic accessor"
40+
errorLine1=" if (mapView != null) {"
41+
errorLine2=" ~~~~~~~">
42+
<location
43+
file="src/main/java/io/flutter/plugins/googlemaps/GoogleMapController.java"
44+
line="170"
45+
column="29"/>
46+
</issue>
47+
48+
<issue
49+
id="SyntheticAccessor"
50+
message="Access to `private` field `mapView` of class `GoogleMapController` requires synthetic accessor"
51+
errorLine1=" mapView.invalidate();"
52+
errorLine2=" ~~~~~~~">
53+
<location
54+
file="src/main/java/io/flutter/plugins/googlemaps/GoogleMapController.java"
55+
line="171"
56+
column="27"/>
57+
</issue>
58+
59+
<issue
60+
id="SyntheticAccessor"
61+
message="Access to `private` constructor of class `ProxyLifecycleProvider` requires synthetic accessor"
62+
errorLine1=" new ProxyLifecycleProvider(activity)));"
63+
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
64+
<location
65+
file="src/main/java/io/flutter/plugins/googlemaps/GoogleMapsPlugin.java"
66+
line="64"
67+
column="19"/>
68+
</issue>
69+
70+
<issue
71+
id="SyntheticAccessor"
72+
message="Access to `private` field `lifecycle` of class `GoogleMapsPlugin` requires synthetic accessor"
73+
errorLine1=" return lifecycle;"
74+
errorLine2=" ~~~~~~~~~">
75+
<location
76+
file="src/main/java/io/flutter/plugins/googlemaps/GoogleMapsPlugin.java"
77+
line="85"
78+
column="28"/>
79+
</issue>
80+
81+
<issue
82+
id="SyntheticAccessor"
83+
message="Access to `private` field `handler` of class `TileProviderController` requires synthetic accessor"
84+
errorLine1=" handler.post("
85+
errorLine2=" ~~~~~~~">
86+
<location
87+
file="src/main/java/io/flutter/plugins/googlemaps/TileProviderController.java"
88+
line="52"
89+
column="7"/>
90+
</issue>
91+
92+
<issue
93+
id="SyntheticAccessor"
94+
message="Access to `private` field `methodChannel` of class `TileProviderController` requires synthetic accessor"
95+
errorLine1=" methodChannel.invokeMethod("
96+
errorLine2=" ~~~~~~~~~~~~~">
97+
<location
98+
file="src/main/java/io/flutter/plugins/googlemaps/TileProviderController.java"
99+
line="54"
100+
column="15"/>
101+
</issue>
102+
103+
<issue
104+
id="SyntheticAccessor"
105+
message="Access to `private` field `tileOverlayId` of class `TileProviderController` requires synthetic accessor"
106+
errorLine1=" Convert.tileOverlayArgumentsToJson(tileOverlayId, x, y, zoom),"
107+
errorLine2=" ~~~~~~~~~~~~~">
108+
<location
109+
file="src/main/java/io/flutter/plugins/googlemaps/TileProviderController.java"
110+
line="56"
111+
column="54"/>
112+
</issue>
113+
114+
<issue
115+
id="UnknownNullness"
116+
message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://android.github.io/kotlin-guides/interop.html#nullability-annotations"
117+
errorLine1=" public PlatformView create(Context context, int id, Object args) {"
118+
errorLine2=" ~~~~~~~~~~~~">
119+
<location
120+
file="src/main/java/io/flutter/plugins/googlemaps/GoogleMapFactory.java"
121+
line="33"
122+
column="10"/>
123+
</issue>
124+
125+
<issue
126+
id="UnknownNullness"
127+
message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://android.github.io/kotlin-guides/interop.html#nullability-annotations"
128+
errorLine1=" public PlatformView create(Context context, int id, Object args) {"
129+
errorLine2=" ~~~~~~~">
130+
<location
131+
file="src/main/java/io/flutter/plugins/googlemaps/GoogleMapFactory.java"
132+
line="33"
133+
column="30"/>
134+
</issue>
135+
136+
<issue
137+
id="UnknownNullness"
138+
message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://android.github.io/kotlin-guides/interop.html#nullability-annotations"
139+
errorLine1=" public PlatformView create(Context context, int id, Object args) {"
140+
errorLine2=" ~~~~~~">
141+
<location
142+
file="src/main/java/io/flutter/plugins/googlemaps/GoogleMapFactory.java"
143+
line="33"
144+
column="55"/>
145+
</issue>
146+
147+
<issue
148+
id="UnknownNullness"
149+
message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://android.github.io/kotlin-guides/interop.html#nullability-annotations"
150+
errorLine1=" final io.flutter.plugin.common.PluginRegistry.Registrar registrar) {"
151+
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
152+
<location
153+
file="src/main/java/io/flutter/plugins/googlemaps/GoogleMapsPlugin.java"
154+
line="35"
155+
column="13"/>
156+
</issue>
157+
158+
<issue
159+
id="UnknownNullness"
160+
message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://android.github.io/kotlin-guides/interop.html#nullability-annotations"
161+
errorLine1=" public void onAttachedToEngine(FlutterPluginBinding binding) {"
162+
errorLine2=" ~~~~~~~~~~~~~~~~~~~~">
163+
<location
164+
file="src/main/java/io/flutter/plugins/googlemaps/GoogleMapsPlugin.java"
165+
line="73"
166+
column="34"/>
167+
</issue>
168+
169+
<issue
170+
id="UnknownNullness"
171+
message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://android.github.io/kotlin-guides/interop.html#nullability-annotations"
172+
errorLine1=" public void onDetachedFromEngine(FlutterPluginBinding binding) {}"
173+
errorLine2=" ~~~~~~~~~~~~~~~~~~~~">
174+
<location
175+
file="src/main/java/io/flutter/plugins/googlemaps/GoogleMapsPlugin.java"
176+
line="91"
177+
column="36"/>
178+
</issue>
179+
180+
<issue
181+
id="UnknownNullness"
182+
message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://android.github.io/kotlin-guides/interop.html#nullability-annotations"
183+
errorLine1=" public void onAttachedToActivity(ActivityPluginBinding binding) {"
184+
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~">
185+
<location
186+
file="src/main/java/io/flutter/plugins/googlemaps/GoogleMapsPlugin.java"
187+
line="96"
188+
column="36"/>
189+
</issue>
190+
191+
<issue
192+
id="UnknownNullness"
193+
message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://android.github.io/kotlin-guides/interop.html#nullability-annotations"
194+
errorLine1=" public void onReattachedToActivityForConfigChanges(ActivityPluginBinding binding) {"
195+
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~">
196+
<location
197+
file="src/main/java/io/flutter/plugins/googlemaps/GoogleMapsPlugin.java"
198+
line="106"
199+
column="54"/>
200+
</issue>
201+
202+
</issues>

0 commit comments

Comments
 (0)