fix(android): remove unchecked Java compilation warnings
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
Research direction
Inspect android/capacitor/src/main/java/com/getcapacitor/Plugin.java around line 679 and BridgeWebChromeClient.java, focusing on the raw collection and ActivityResultLauncher fields identified in the issue. Run ./gradlew :capacitor-android:clean :capacitor-android:compileReleaseJavaWithJavac --console=plain with -Xlint:unchecked enabled; done means the Android library compiles without unchecked-operation warnings and behavior is unchanged.
Written by the indexing model from the issue text.
Description
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:679constructs
a rawCopyOnWriteArrayListfrom aList<PluginCall>.android/capacitor/src/main/java/com/getcapacitor/BridgeWebChromeClient.java
stores the permission and activity launchers as rawActivityResultLauncher
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.
- Dominant language
- TypeScript
- Stars
- 16.7k
- Forks
- 1.3k
- Avg merge
- 3d 10h
- Merged PRs (30d)
- 10
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from ionic-team/capacitor
-
triage
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
ionic-team/capacitor#8616 ·
-
triage
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
ionic-team/capacitor#8601 ·
-
triage
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
ionic-team/capacitor#8574 ·
-
SystemBars: safe area CSS injection throws "Cannot read properties of null" on startup (Android 16) Opentriage
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
ionic-team/capacitor#8530 · 2 comments ·
-
needs reproduction
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
ionic-team/capacitor#8472 · 2 comments · 1 reaction ·
All issues in ionic-team/capacitor
Similar issues
-
calcite-components needs triage refactor
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Esri/calcite-design-system#15203 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 91/100
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficulty 1/5 Under an hour Newbie friendliness 95/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Automattic/studio#4908 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 90/100