Skip to content

Remove Java.Interop.GenericMarshaler#1450

Open
simonrozsival wants to merge 1 commit into
mainfrom
dev/simonrozsival/remove-generic-marshaler
Open

Remove Java.Interop.GenericMarshaler#1450
simonrozsival wants to merge 1 commit into
mainfrom
dev/simonrozsival/remove-generic-marshaler

Conversation

@simonrozsival

Copy link
Copy Markdown
Member

Part of #1448.

This removes the standalone Java.Interop.GenericMarshaler helper assembly and its performance benchmark project. Java.Interop-Tests still exercises the few generic marshaling paths it needs via a small test-local helper instead of referencing the deleted assembly.

Also removes the now-obsolete CI/docs/metadata references and the InternalsVisibleTo entry for Java.Interop.GenericMarshaler.

Validation:

  • git diff --check origin/main
  • SDKROOT=$(xcrun --sdk macosx --show-sdk-path) dotnet test tests/Java.Interop-Tests/Java.Interop-Tests.csproj
    • Passed: 671, Failed: 0, Skipped: 4

Note for dotnet/android codeflow:

  • Android has test-only references to this helper in Xamarin.Android-Tests.sln and tests/Mono.Android-Tests/Java.Interop-Tests/Java.Interop-Tests.NET.csproj; those will need to be removed or updated when this flows.

Remove the standalone generic JNI marshaling helper assembly and its performance tests. Keep Java.Interop-Tests compiling by moving the few needed helper wrappers into the test assembly.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 9, 2026 06:13

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR removes the standalone Java.Interop.GenericMarshaler assembly (and its performance benchmark project) as part of the repo reduction effort in #1448, while keeping required generic marshaling test coverage by introducing a small test-local replacement for the few extension methods the unit tests still need.

Changes:

  • Removed the src/Java.Interop.GenericMarshaler project and the Java.Interop-PerformanceTests project (and associated sources/CI/docs references).
  • Updated Java.Interop-Tests to stop referencing Java.Interop.GenericMarshaler and added a test-local JniPeerMembersExtensions helper to cover required generic marshaling paths.
  • Removed the InternalsVisibleTo entry for Java.Interop.GenericMarshaler from Java.Interop.
Show a summary per file
File Description
tests/Java.Interop-Tests/Java.Interop/TestType.cs Drops Java.Interop.GenericMarshaler using; continues to exercise generic marshaling via test-local extensions.
tests/Java.Interop-Tests/Java.Interop/JniPeerMembersTests.cs Drops Java.Interop.GenericMarshaler using; keeps tests using extension-method-based generic marshal paths.
tests/Java.Interop-Tests/Java.Interop/JniPeerMembersExtensions.cs Adds test-local extension methods replacing the limited generic marshaling helpers previously sourced from the deleted assembly.
tests/Java.Interop-Tests/Java.Interop/CallVirtualFromConstructorBase.cs Drops Java.Interop.GenericMarshaler using; continues constructor/method invocation coverage via test-local extensions.
tests/Java.Interop-Tests/Java.Interop-Tests.csproj Removes project reference to Java.Interop.GenericMarshaler.
tests/Java.Interop-PerformanceTests/java/com/xamarin/interop/performance/JavaTiming.java Deletes Java timing helper source as part of removing the performance test project.
tests/Java.Interop-PerformanceTests/Java.Interop/TimingTests.cs Deletes performance benchmark test suite.
tests/Java.Interop-PerformanceTests/Java.Interop/JavaVMFixture.cs Deletes performance-test JVM fixture.
tests/Java.Interop-PerformanceTests/Java.Interop/JavaTiming.cs Deletes managed wrapper used by performance benchmarks (and its generic marshal benchmark paths).
tests/Java.Interop-PerformanceTests/Java.Interop/JavaPrimitiveArraysTiming.cs Deletes primitive array lookup/creation performance benchmarks.
tests/Java.Interop-PerformanceTests/Java.Interop-PerformanceTests.targets Deletes MSBuild target used to build the performance-test JAR.
tests/Java.Interop-PerformanceTests/Java.Interop-PerformanceTests.csproj Deletes the performance test project definition.
src/Java.Interop/Properties/AssemblyInfo.cs Removes InternalsVisibleTo for Java.Interop.GenericMarshaler.
src/Java.Interop.GenericMarshaler/Java.Interop.GenericMarshaler/JniPeerInstanceMethodsExtensions.tt Deletes T4 template which generated the generic marshaling extension surface.
src/Java.Interop.GenericMarshaler/Java.Interop.GenericMarshaler.csproj Deletes the Java.Interop.GenericMarshaler project file.
Java.Interop.sln Removes the deleted projects from the solution.
build-tools/automation/templates/core-tests.yaml Removes CI execution of the deleted performance test project.
.github/skills/build-and-test/SKILL.md Removes mention of Java.Interop-PerformanceTests from the documented common test projects list.
.github/copilot-instructions.md Removes mention of Java.Interop-PerformanceTests from repo testing structure documentation.

Copilot's findings

  • Files reviewed: 19/20 changed files
  • Comments generated: 0

@simonrozsival simonrozsival added the ready-to-review This PR is ready to review/merge, thanks! label Jun 9, 2026
@simonrozsival

Copy link
Copy Markdown
Member Author

/review

@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown

Java.Interop PR Reviewer completed successfully!

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ LGTM

Clean removal of Java.Interop.GenericMarshaler and Java.Interop-PerformanceTests. The test-local JniPeerMembersExtensions helper covers exactly the 5 extension methods still used by tests, with proper [DynamicallyAccessedMembers] annotations and try/finally cleanup for DestroyGenericArgumentState.

Summary of changes verified:

  • All using Java.Interop.GenericMarshaler; removed; call sites resolve the extension methods from the new test-local helper in the same namespace ✅
  • InternalsVisibleTo for GenericMarshaler removed from AssemblyInfo.cs
  • Solution, CI pipeline, and documentation references all cleaned up ✅
  • Pre-existing missing EndProject for Java.Interop.Tools.Maven-Tests in .sln fixed incidentally — nice catch 👍
  • No remaining references to GenericMarshaler anywhere in the repo ✅

Positive callouts:

  • PR description is thorough — documents downstream dotnet/android impact
  • Validation section includes test counts
  • The replacement helper is minimal and well-scoped to only what tests actually need

CI note: Only license/cla and copilot-pull-request-reviewer checks are visible — no build/test CI run yet. The author reports local test success (671 passed, 0 failed), but a green CI run would be nice before merge.

Severity Count
❌ error 0
⚠️ warning 0
💡 suggestion 1

Generated by Java.Interop PR Reviewer for issue #1450 · ● 3.5M

Comment on lines +48 to +49
}
public static unsafe void InvokeGenericVirtualVoidMethod<

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 💡 Formatting — Missing blank line between FinishGenericCreateInstance and InvokeGenericVirtualVoidMethod. All other method boundaries in this file have a separating blank line (lines 22–24, 73–75, 99–101); this one is the exception.

Rule: Minimal diffs / consistency

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-review This PR is ready to review/merge, thanks!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants