Repository navigation
[Mono.Android] Suppress JDK removal warnings in FakeSSLSession peer - #13828
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported for the warning-suppression and annotation-array serialization changes.
No open issues 🎉
What changed in this PR
This PR suppresses JDK removal warnings from the generated FakeSSLSession Java peer without changing certificate-validation behavior.
Changes:
- Adds a class-scoped
SuppressWarnings("removal")annotation toFakeSSLSession. - Enables the trimmable type map’s annotation parser to serialize array-valued properties as Java array initializers.
| File | Description |
|---|---|
src/Mono.Android/Xamarin.Android.Net/ServerCertificateCustomValidator.cs |
Annotates FakeSSLSession to suppress removal warnings in its generated Java peer. |
src/Microsoft.Android.Sdk.TrimmableTypeMap/Scanner/JavaAnnotationParser.cs |
Serializes annotation arrays, enabling the suppression annotation’s value. |
Review effort: Balanced
|
Reviewed as PeppersMuse. Checked both files:
Copilot's review reported no open issues, and I found nothing to add. Looks good. |
|
/azp run Xamarin.Android-PR |
|
No pipelines are associated with this pull request. |
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
/azp run Xamarin.Android-PR |
|
No pipelines are associated with this pull request. |
|
Internal
The public CI (dnceng-public) is offline, so this internal build is the only CI result. |
|
/review |
|
✅ Android PR Reviewer completed successfully!
|
There was a problem hiding this comment.
⚠️ Needs Changes — CI remains red; no code findings
Reviewed both changed files in full and traced metadata decoding through Java annotation emission. 0 errors, 0 warnings, 0 suggestions. The array branch reuses the existing scalar formatting and string escaping, and the class-scoped suppression leaves hostname verification behavior unchanged.
CI: license/cla passed, but Xamarin.Android-PR [build 16171125]((devdiv.visualstudio.com/redacted) failed. The maintainer’s failure breakdown attributes the failures to existing tooling issues and network failures, and reports public CI offline. I could not independently verify the private build logs, so this is not a green-CI verdict or a finding against the patch.
Static review only; the validation reported in the PR description was not rerun.
Generated by Android PR Reviewer for #13828 · copilot · gpt61 · ~25 AIC · ⌖ ~8 AIC · ⊞ 23.1K
Comment /review to run again
Agent assessment
Self-reported assessment, not an independent review.
Assessed revision:
2a4970f6be47bd6396a2b276527833f8ba531ddc-Werroron JDK 21 and 25.↑ 142 migrated MSTest type-map cases passed after merging main; the source diff is unchanged.
↓ Other array values and device execution were not separately validated.
SSLSessionmethod and certificate type as the sources of the three warnings.↓ The nightly log lines were not directly re-inspected for this PR.
Every app build compiles the generated Java peer for
Xamarin.Android.Net.ServerCertificateCustomValidator.TrustManager.FakeSSLSession, and<Javac/>reports:<Javac/>putsandroid.jaron-classpathand uses-source 1.8 -target 1.8, sojavax.net.ssl.SSLSessionandjavax.security.cert.X509Certificateresolve against the JDK's modules, where they are@Deprecated(forRemoval=true). The peer can't avoid them: Android'sSSLSession.getPeerCertificateChain()is abstract, so the peer must implement it.FakeSSLSessionis now annotated with[Java.Lang.SuppressWarnings (Value = new [] { "removal" })], scoping the suppression to this one generated class. Emitting it required the trimmable type map'sJavaAnnotationParserto serialize array-valued annotation properties ({ "a", "b" }); previously they were written withToString().Replacing
FakeSSLSessionwith managed hostname matching (e.g.X509Certificate2.MatchesHostname()) would remove the Java peer entirely, but would change behavior: it would bypass the app'sHttpsURLConnection.DefaultHostnameVerifier.Validation
Before merging
main:make prepare CONFIGURATION=Debug && make leeroy CONFIGURATION=Debug MSBUILD_ARGS='-m:4': passed.dotnet new android+dotnet buildwith the local SDK: passed; generated peer starts with@java.lang.SuppressWarnings (value = { "removal" }).<Javac/>arguments (-classpath android.jar:java_runtime_trimmable.jar -source 1.8 -target 1.8 -Xlint:-options): without the annotation, the 3 warnings above; with it,-Werrorpasses.dotnet test src/Microsoft.Android.Build.Tasks/Tests/Microsoft.Android.Build.Tasks.Tests/Microsoft.Android.Build.Tasks.Tests.csproj --filter "FullyQualifiedName~TrimmableTypeMap": 142 passed.After merging
main:PATH="$PWD/bin/Debug/dotnet:$PATH" DOTNETSDK_WORKLOAD_MANIFEST_ROOTS="$PWD/bin/Debug/lib/sdk-manifests" DOTNETSDK_WORKLOAD_PACK_ROOTS="$PWD/bin/Debug/lib" TESTINGPLATFORM_PIPE_DIRECTORY=/tmp dotnet test --project src/Microsoft.Android.Build.Tasks/Tests/Microsoft.Android.Build.Tasks.Tests/Microsoft.Android.Build.Tasks.Tests.csproj --filter 'FullyQualifiedName~TrimmableTypeMap' --minimum-expected-tests 1 --no-ansi --no-progress -v minimal: 142 passed.