Summary
Compiling the Capacitor Android library with -Xlint:unchecked reports eight
unchecked operations in the current 8.4.1 release and on main.
Reproduction
From an Android app that includes @capacitor/android@8.4.1, configure Java
compile tasks with -Xlint:unchecked and run:
./gradlew :capacitor-android:clean :capacitor-android:compileReleaseJavaWithJavac --console=plain
The default compilation emits the generic Some input files use unchecked or unsafe operations note.
Affected source
android/capacitor/src/main/java/com/getcapacitor/Plugin.java:679 constructs
a raw CopyOnWriteArrayList from a List<PluginCall>.
android/capacitor/src/main/java/com/getcapacitor/BridgeWebChromeClient.java
stores the permission and activity launchers as raw ActivityResultLauncher
values, producing six unchecked calls at lines 120, 267, 298, 350, 369, and
401.
Expected behavior
The released Android library should compile without unchecked-operation notes.
Parameterizing the collection construction and the two launcher fields should
remove the warnings without changing behavior.
Summary
Compiling the Capacitor Android library with
-Xlint:uncheckedreports eightunchecked operations in the current 8.4.1 release and on
main.Reproduction
From an Android app that includes
@capacitor/android@8.4.1, configure Javacompile tasks with
-Xlint:uncheckedand run:The default compilation emits the generic
Some input files use unchecked or unsafe operationsnote.Affected source
android/capacitor/src/main/java/com/getcapacitor/Plugin.java:679constructsa raw
CopyOnWriteArrayListfrom aList<PluginCall>.android/capacitor/src/main/java/com/getcapacitor/BridgeWebChromeClient.javastores the permission and activity launchers as raw
ActivityResultLaunchervalues, producing six unchecked calls at lines 120, 267, 298, 350, 369, and
401.
Expected behavior
The released Android library should compile without unchecked-operation notes.
Parameterizing the collection construction and the two launcher fields should
remove the warnings without changing behavior.