Repository navigation
[Java.Interop] Remove orphaned internal JNI runtime helpers - #13057
Merged
Merged
Conversation
JavaInterop1 retirement in #13030 left three internal helpers without callers: JniRuntime.JniValueManager.GetRuntimeType() and JniPeerMembers.JniInstanceMethods.AllocObject()/NewObject(). Remove only these orphaned members. Preserve public JNI allocation, StartCreateInstance()/FinishCreateInstance(), constructor caches, and peer activation, identity, and reference-ownership behavior. Validated with rebuilt Release SDK and 97 focused JNI construction, identity, and ownership tests on both CoreCLR and NativeAOT. Co-authored-by: Copilot App <[email protected]>
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
Repository searches found no consumers, public API records are unchanged, and validation is comprehensive.
0 open findings
What changed in this PR
Removes three unused internal Java.Interop helpers left after JavaInterop1 retirement.
Changes:
- Removes unused runtime type lookup.
- Removes unused JNI object allocation helpers.
- Preserves public construction and peer-management APIs.
| File | Description |
|---|---|
JniRuntime.JniValueManager.cs |
Removes orphaned GetRuntimeType(). |
JniPeerMembers.JniInstanceMethods.cs |
Removes orphaned AllocObject() and NewObject(). |
🧠 Review effort: Balanced
Member
Author
|
@dalexsoto stamp |
simonrozsival
enabled auto-merge (squash)
October 10, 2026 05:16
dalexsoto
approved these changes
Oct 10, 2026
dalexsoto
left a comment
Member
There was a problem hiding this comment.
Stamping as requested by @simonrozsival; no code review performed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Small, independently mergeable .NET 12 cleanup follow-up to #13030. Remove only internal
JniRuntime.JniValueManager.GetRuntimeType()andJniPeerMembers.JniInstanceMethods.AllocObject()/NewObject()(two files, 26 deleted lines).Semantic references contain only the declarations. Source, generators/templates, reflection strings, conditional sources, friend-assembly tests, and API records were checked for consumers. Public JNI allocation APIs,
StartCreateInstance()/FinishCreateInstance(), constructor caches,ActivatePeer, expression marshalling, type management, and ownership logic are unchanged. No framework/package/API-gate upgrade is included.Build and host validation
dotnet build external/Java.Interop/src/Java.Interop/Java.Interop.csproj -c Release -v minimaldotnet build external/Java.Interop/src/Java.Interop/Java.Interop.csproj -c Debug -v minimaldotnet test external/Java.Interop/tests/generator-Tests/generator-Tests.csproj -c Release -v minimal --filter 'FullyQualifiedName~generatortests.Constructors'make prepare CONFIGURATION=Releasemake all CONFIGURATION=Release./dotnet-local.sh build Microsoft.Android.slnx -t:BuildExtraApiLevels -c Release -v quiet./dotnet-local.sh build external/Java.Interop/src/Java.Interop/Java.Interop.csproj -c Release -v minimalgit diff --checkPreparation/build environment:
Device validation
Executed against the SDK rebuilt from this change on selected
emulator-5554(API 36, arm64). Focused categories cover constructor parity and activation, Unicode type lookup, core JNI control blocks, peer identity, and transferred-reference ownership. Both TRX files confirm 97 passed, 0 failed, 0 skipped, includingConstructorActivationTests,JavaPeerControlBlockTests,PeerIdentityTests, andTransferredReferenceTests.Device environment:
CoreCLR install/build passed (38 warnings, 0 errors); test passed 97/97:
NativeAOT install/build passed (11 warnings, 0 errors); test passed 97/97:
Bounded broader-suite comparison
An initial unfiltered CoreCLR run crashed in
Java.InteropTests.JnienvTest.ThreadReuse: 241 passed, 1 crashed, 2 skipped. Device logcat recorded a fatal runtime error and SIGABRT on the test's native-created thread. Its cause was not established and is not labelled pre-existing.Before opening this PR, the original versions of the two owned files were temporarily restored and verified exactly against
338725eac0c9e9a4c23f151d18ee52831eed630b. The affected SDK project was rebuilt and its staged Java.Interop assembly checked against the build output, followed by one matching unfiltered CoreCLR run. Then the committed helper deletions were restored and the same affected-project rebuild/install/run repeated. No unrelated source changes, new exclusions, or new tests were introduced.ThreadReuseThe initial crash was not reproduced in this bounded comparison; no root-cause claim is made.
Commands used for each implementation (the baseline used result directory
OrphanedJniRetirementBaseline; the restored change usedOrphanedJniChangedComparison):All matched comparison build/install commands passed; both full test invocations passed. The worktree is restored to the committed deletions, with no temporary baseline source changes left.