Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
96 commits
Select commit Hold shift + click to select a range
6bae3ac
[TrimmableTypeMap] Remove post-trim generation pass
simonrozsival Jun 8, 2026
579ea8a
Bump external/Java.Interop from `b881d21` to `d7dbad5`
dependabot[bot] Jun 10, 2026
f79c0cc
Implement Android JavaMarshal value manager split
simonrozsival Jun 9, 2026
676dca4
Use pure trimmable typemap value manager
simonrozsival Jun 9, 2026
01dfd04
Use pure trimmable typemap type manager
simonrozsival Jun 9, 2026
b77c841
Propagate trimmable typemap DAM annotations
simonrozsival Jun 9, 2026
0554d57
Prefer Requires annotations for reflection managers
simonrozsival Jun 9, 2026
7d81397
Remove manager suppression attributes
simonrozsival Jun 9, 2026
1fe2ef5
Remove invoker lookup suppression attributes
simonrozsival Jun 9, 2026
7228982
Use feature guards for runtime manager selection
simonrozsival Jun 9, 2026
326f0fd
Inline CoreCLR JavaMarshal peer delegation
simonrozsival Jun 9, 2026
6a8ec68
Throw unreachable from trimmable native registration
simonrozsival Jun 9, 2026
7d3d1e3
Remove SimpleValueManager
simonrozsival Jun 10, 2026
725d433
Simplify changes to the ManagedTypeManager
simonrozsival Jun 10, 2026
caaea85
Remove the option to use ManagedTypeManager
simonrozsival Jun 10, 2026
b489d1f
Cleanup value managers
simonrozsival Jun 10, 2026
f1ce2a2
Refine trimmable typemap runtime paths
simonrozsival Jun 10, 2026
0a1072a
Reuse Java.Interop value marshalers in trimmable runtime
simonrozsival Jun 11, 2026
78cb7d6
Support JavaObjectArray in trimmable value marshaling
simonrozsival Jun 11, 2026
169bc8f
Generalize trimmable primitive value marshaling
simonrozsival Jun 11, 2026
869f183
Apply trimmable test exclusions to new runner
simonrozsival Jun 11, 2026
93ddc73
Remove LayoutInflater test contamination
simonrozsival Jun 11, 2026
933a38d
Address trimmable review cleanup
simonrozsival Jun 11, 2026
65a2cf5
Flow excluded NUnit categories from MSBuild
simonrozsival Jun 11, 2026
6b4aedb
Extract trimmable primitive marshaler helpers
simonrozsival Jun 11, 2026
80997b8
Address trimmable review feedback
simonrozsival Jun 11, 2026
6071fd0
Support trimmable custom value marshalers
simonrozsival Jun 11, 2026
d45a519
Unwrap trimmable proxy throwables
simonrozsival Jun 11, 2026
4282882
Support trimmable type manager lookups
simonrozsival Jun 11, 2026
152845b
Use trimmable CrossReferenceBridge fixture
simonrozsival Jun 11, 2026
8105789
Use trimmable method binding fixtures
simonrozsival Jun 11, 2026
7a7ca23
Support trimmable marshaler expressions
simonrozsival Jun 11, 2026
fece7d7
Remove generated value marshaler registry
simonrozsival Jun 11, 2026
b134621
Address trimmable test review feedback
simonrozsival Jun 11, 2026
6e1a69a
Fix trimmable typemap CI failures
simonrozsival Jun 12, 2026
8447f63
Simplify generated proxy trim suppression
simonrozsival Jun 12, 2026
18f39bc
Address trimmable runtime review feedback
simonrozsival Jun 12, 2026
4e40404
Clean stale trimmable typemap Java sources
simonrozsival Jun 12, 2026
7496a32
Simplify trimmable marshaler integration
simonrozsival Jun 12, 2026
f2c59bd
Re-enable trimmable GC bridge coverage
simonrozsival Jun 12, 2026
298f262
Re-enable trimmable replacement method lookup test
simonrozsival Jun 12, 2026
7ab9659
Re-enable trimmable method binding coverage
simonrozsival Jun 12, 2026
12946a7
Remove JavaProxyThrowable Exception wrapper
simonrozsival Jun 12, 2026
1cae90b
Remove ManagedPeer workarounds from trimmable PR
simonrozsival Jun 12, 2026
a53fb70
Document built-in type signature mapping choice
simonrozsival Jun 12, 2026
25a0526
Split Java marshal value manager types
simonrozsival Jun 12, 2026
a5b39d1
Simplify trimmable object array marshaling
simonrozsival Jun 12, 2026
5dff3a8
Return object references from trimmable marshaling
simonrozsival Jun 12, 2026
f928f99
Clarify trimmable local reference ownership
simonrozsival Jun 12, 2026
66c29f3
Merge origin/main into dev/simonrozsival/java-interop-1441-android
simonrozsival Jun 17, 2026
f7b0fec
Fix AndroidRuntime merge follow-ups
simonrozsival Jun 17, 2026
39583fa
Update tests + cleanup
simonrozsival Jun 17, 2026
db14c80
Remove unnecessary code
simonrozsival Jun 17, 2026
4bbc8fa
Merge remote-tracking branch 'origin/main' into android-remove-second…
Copilot Jun 17, 2026
a23c1f2
Merge latest main, resolve conflicts (keep post-trim pass removal)
Copilot Jun 17, 2026
7412129
Fix more stuff
simonrozsival Jun 17, 2026
6a0b25f
Merge remote-tracking branch 'origin/main' into dev/simonrozsival/jav…
simonrozsival Jun 17, 2026
dcdfbae
Use Java.Interop from main
simonrozsival Jun 17, 2026
89e133e
Merge PR #11604 post-trim typemap cleanup
simonrozsival Jun 18, 2026
d95a356
Remove unnecessary MakeArrayType
simonrozsival Jun 18, 2026
2ba985f
Annotate JNINativeWrapper.CreateDelegate method
simonrozsival Jun 18, 2026
8ec4aee
Drop assertions which expect AOT and trimming warnings
simonrozsival Jun 18, 2026
200b6a4
Update apkdesc files
simonrozsival Jun 18, 2026
0aa8bad
Avoid more MakeArrayType
simonrozsival Jun 18, 2026
ebc9b9e
Suppress expected runtime manager trim warnings
simonrozsival Jun 18, 2026
46bb3ff
We removed AOT warning, do not assert that there will be a warning
simonrozsival Jun 18, 2026
1392c44
Address trimmable typemap review feedback
simonrozsival Jun 18, 2026
d4dd398
[TrimmableTypeMap] Support built-in reference arrays
simonrozsival Jun 18, 2026
b76c959
[TrimmableTypeMap] Prefer dynamic array creation on CoreCLR
simonrozsival Jun 19, 2026
94eeb39
Merge branch 'main' of github.com:dotnet/android into dev/simonrozsiv…
simonrozsival Jun 22, 2026
9b41a8f
[typemap] Fix trimmable typemap CI failures
simonrozsival Jun 22, 2026
2a12f82
[typemap] Include runtime version in root fingerprint
simonrozsival Jun 22, 2026
48a1e77
[typemap] Extract deterministic hash builder
simonrozsival Jun 22, 2026
46bf686
[typemap] Restore span-based MVID hashing
simonrozsival Jun 22, 2026
a9336e4
[typemap] Keep NativeAOT managed typemap default
simonrozsival Jun 22, 2026
c2522ea
[typemap] Restore managed NativeAOT runtime managers
simonrozsival Jun 22, 2026
1d45090
Revert "[typemap] Restore managed NativeAOT runtime managers"
simonrozsival Jun 22, 2026
a0d0fb7
Revert "[typemap] Keep NativeAOT managed typemap default"
simonrozsival Jun 22, 2026
f54ef34
[deps] Update android-tools for task hashing compatibility
simonrozsival Jun 22, 2026
b50a4c8
[runtime] Proxy opaque objects in trimmable value manager
simonrozsival Jun 22, 2026
0152cc1
Merge remote-tracking branch 'origin/main' into dev/simonrozsival/jav…
simonrozsival Jun 22, 2026
ef8cbb3
[deps] Update android-tools task hashing fix
simonrozsival Jun 22, 2026
78efb4f
[runtime] Override Java proxy object methods
simonrozsival Jun 23, 2026
705fc27
[runtime] Override Java proxy object methods
simonrozsival Jun 23, 2026
9d5110b
Remove DAM where they're causing more harm than good
simonrozsival Jun 23, 2026
c6bafae
Merge remote-tracking branch 'origin/main' into dev/simonrozsival/jav…
simonrozsival Jun 23, 2026
97eb32e
[runtime] Disable ManagedPeer for trimmable apps
simonrozsival Jun 23, 2026
158fa0c
Merge remote-tracking branch 'origin/dev/simonrozsival/java-interop-1…
simonrozsival Jun 23, 2026
828dbe9
Improve array handling
simonrozsival Jun 23, 2026
8a8cbde
Clean-up trimmable value manager
simonrozsival Jun 23, 2026
33de611
Add support for nullable primitive types without unwrapping Nullable
simonrozsival Jun 23, 2026
2d5fef1
Fix incrementality
simonrozsival Jun 24, 2026
6645710
Temporary bump to external/Java.Interop
simonrozsival Jun 24, 2026
840d342
Revert "Temporary bump to external/Java.Interop"
simonrozsival Jun 24, 2026
18f3b9d
Merge branch 'main' of github.com:dotnet/android into dev/simonrozsiv…
simonrozsival Jun 24, 2026
8fe902d
Temporary bump to external/Java.Interop
simonrozsival Jun 24, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions Documentation/docs-mobile/messages/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,6 @@ Either change the value in the AndroidManifest.xml to match the $(SupportedOSPla
+ [XA4250](xa4250.md): Manifest-referenced type '{type}' was not found in any scanned assembly. It may be a framework type.
+ [XA4252](xa4252.md): Insecure HTTP Maven repository URL '{url}' is not allowed. Use an HTTPS URL, or set AllowInsecureHttp="true" metadata on the item to override this check.
+ [XA4253](xa4253.md): Generated Java callable wrapper code changed: '{path}'
+ [XA4254](xa4254.md): Trimmable type map Java source input directory '{input}' and output directory '{output}' must be different.
+ [XA4255](xa4255.md): Generated trimmable type map Java source '{path}' was not found.
+ XA4300: Native library '{library}' will not be bundled because it has an unsupported ABI.
+ [XA4301](xa4301.md): Apk already contains the item `xxx`.
+ [XA4302](xa4302.md): Unhandled exception merging \`AndroidManifest.xml\`: {ex}
Expand Down
25 changes: 0 additions & 25 deletions Documentation/docs-mobile/messages/xa4254.md

This file was deleted.

27 changes: 0 additions & 27 deletions Documentation/docs-mobile/messages/xa4255.md

This file was deleted.

2 changes: 1 addition & 1 deletion external/Java.Interop
Submodule Java.Interop updated 27 files
+1 −8 samples/Hello-NativeAOTFromAndroid/NativeAotTypeManager.cs
+1 −7 samples/Hello-NativeAOTFromJNI/NativeAotTypeManager.cs
+2 −55 src/Java.Interop.Tools.Maven/Models/Artifact.cs
+6 −24 src/Java.Interop.Tools.Maven/Repositories/CachedMavenRepository.cs
+1 −5 src/Java.Interop/Java.Interop/JavaArray.cs
+1 −6 src/Java.Interop/Java.Interop/JavaObjectArray.cs
+0 −15 src/Java.Interop/Java.Interop/JavaPrimitiveArrays.cs
+27 −48 src/Java.Interop/Java.Interop/JniBuiltinMarshalers.cs
+12 −12 src/Java.Interop/Java.Interop/JniBuiltinMarshalers.tt
+6 −44 src/Java.Interop/Java.Interop/JniRuntime.JniTypeManager.cs
+8 −16 src/Java.Interop/Java.Interop/JniRuntime.JniValueManager.cs
+5 −35 src/Java.Interop/Java.Interop/JniRuntime.ReflectionJniTypeManager.cs
+10 −24 src/Java.Interop/Java.Interop/JniRuntime.ReflectionJniValueManager.cs
+7 −0 src/Java.Interop/Java.Interop/JniRuntime.cs
+0 −1 src/Java.Interop/Java.Interop/JniStringValueMarshaler.cs
+1 −11 src/Java.Interop/Java.Interop/JniValueMarshaler.cs
+2 −7 src/Java.Interop/Java.Interop/ManagedPeer.cs
+4 −3 src/Java.Interop/Java.Interop/RuntimeFeature.cs
+0 −5 src/Java.Interop/PublicAPI.Unshipped.txt
+0 −1 src/Java.Runtime.Environment/Java.Interop/JreTypeManager.cs
+1 −1 tests/Java.Interop-Tests/Java.Interop/JavaObjectArrayTest.cs
+0 −1 tests/Java.Interop-Tests/Java.Interop/JavaVMFixture.cs
+0 −1 tests/Java.Interop-Tests/Java.Interop/JniPeerMembersTests.cs
+0 −15 tests/Java.Interop-Tests/Java.Interop/JniRuntimeTest.cs
+0 −2 tests/Java.Interop-Tests/Java.Interop/JniValueMarshalerContractTests.cs
+0 −125 tests/Java.Interop.Tools.Maven-Tests/ArtifactTests.cs
+0 −185 tests/Java.Interop.Tools.Maven-Tests/CachedMavenRepositoryTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ static NativeAotRuntimeOptions CreateJreVM (NativeAotRuntimeOptions builder)
builder.TypeManager ??= CreateDefaultTypeManager ();
#endif // NET

builder.ValueManager ??= new JavaMarshalValueManager ();
builder.ValueManager ??= Android.Runtime.JNIEnvInit.CreateValueManager ();
builder.ObjectReferenceManager ??= new Android.Runtime.AndroidObjectReferenceManager ();

if (builder.InvocationPointer != IntPtr.Zero || builder.EnvironmentPointer != IntPtr.Zero)
Expand All @@ -81,7 +81,7 @@ static JniRuntime.JniTypeManager CreateDefaultTypeManager ()
return new TrimmableTypeMapTypeManager ();
}

return new ManagedTypeManager ();
throw new NotImplementedException ();
}

public override string? GetCurrentManagedThreadName ()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
<type fullname="Android.Runtime.RaiseThrowableEventArgs" />
<type fullname="Android.Runtime.RegisterAttribute" />
<type fullname="Android.Runtime.TypeManager" />
<type fullname="Microsoft.Android.Runtime.ManagedTypeMapping" preserve="all" />
<!--
<type fullname="Android.Runtime.XmlResourceParserReader" />
<type fullname="Android.Runtime.XmlPullParserReader" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
using System;
using System.Buffers;
using System.Security.Cryptography;
using System.Text;

namespace Microsoft.Android.Sdk.TrimmableTypeMap;

sealed class DeterministicHashBuilder : IDisposable
{
readonly HashAlgorithm hash = SHA256.Create ();
readonly byte [] intBuffer = new byte [4];
readonly byte [] byteBuffer = new byte [1];
bool finished;

public void AddString (string value)
{
var bytes = Encoding.UTF8.GetBytes (value);
AddInt32 (bytes.Length);
AddBytes (bytes);
}

public void AddVersion (Version version)
{
AddInt32 (version.Major);
AddInt32 (version.Minor);
AddInt32 (version.Build);
AddInt32 (version.Revision);
}

public void AddInt32 (int value)
{
intBuffer [0] = (byte) value;
intBuffer [1] = (byte) (value >> 8);
intBuffer [2] = (byte) (value >> 16);
intBuffer [3] = (byte) (value >> 24);
AddBytes (intBuffer);
}

public void AddByte (byte value)
{
byteBuffer [0] = value;
AddBytes (byteBuffer);
}

public void AddBytes (byte [] bytes)
{
EnsureNotFinished ();
if (bytes.Length != 0) {
hash.TransformBlock (bytes, 0, bytes.Length, null, 0);
}
}

public void AddBytes (ReadOnlySpan<byte> bytes)
{
EnsureNotFinished ();
if (bytes.IsEmpty) {
return;
}

var buffer = ArrayPool<byte>.Shared.Rent (Math.Min (bytes.Length, 4096));
try {
while (!bytes.IsEmpty) {
var count = Math.Min (bytes.Length, buffer.Length);
bytes.Slice (0, count).CopyTo (buffer);
hash.TransformBlock (buffer, 0, count, null, 0);
bytes = bytes.Slice (count);
}
} finally {
ArrayPool<byte>.Shared.Return (buffer);
}
}

public byte [] ToHash ()
{
if (!finished) {
hash.TransformFinalBlock ([], 0, 0);
finished = true;
}
if (hash.Hash is not null) {
return hash.Hash;
}
throw new InvalidOperationException ("SHA256 did not produce a hash.");
}

void EnsureNotFinished ()
{
if (finished) {
throw new InvalidOperationException ("Cannot add data after finalizing the hash.");
}
}

public void Dispose ()
{
hash.Dispose ();
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System;
using System.Security.Cryptography;
using System.Text;
using System.Collections.Generic;

namespace Microsoft.Android.Sdk.TrimmableTypeMap;

Expand All @@ -12,12 +11,12 @@ static class MetadataHelper
/// </summary>
public static Guid DeterministicMvid (string moduleName, ReadOnlySpan<byte> contentBytes = default)
{
using var sha = SHA256.Create ();
byte [] nameBytes = Encoding.UTF8.GetBytes (moduleName);
byte [] input = new byte [nameBytes.Length + contentBytes.Length];
nameBytes.CopyTo (input, 0);
contentBytes.CopyTo (input.AsSpan (nameBytes.Length));
byte [] hash = sha.ComputeHash (input);
using var hashBuilder = new DeterministicHashBuilder ();
hashBuilder.AddString (moduleName);
if (!contentBytes.IsEmpty) {
hashBuilder.AddBytes (contentBytes);
}
byte [] hash = hashBuilder.ToHash ();
byte [] guidBytes = new byte [16];
Array.Copy (hash, guidBytes, 16);
return new Guid (guidBytes);
Expand All @@ -28,26 +27,35 @@ public static Guid DeterministicMvid (string moduleName, ReadOnlySpan<byte> cont
/// </summary>
public static byte [] ComputeContentFingerprint (TypeMapAssemblyData data)
{
using var sha = SHA256.Create ();
using var stream = new System.IO.MemoryStream ();
using var writer = new System.IO.BinaryWriter (stream, Encoding.UTF8);
using var hash = new DeterministicHashBuilder ();
foreach (var entry in data.Entries) {
writer.Write (entry.JniName);
writer.Write (entry.ProxyTypeReference);
writer.Write (entry.TargetTypeReference ?? "");
hash.AddString (entry.JniName);
hash.AddString (entry.ProxyTypeReference);
hash.AddString (entry.TargetTypeReference ?? "");
}
foreach (var proxy in data.ProxyTypes) {
writer.Write (proxy.TypeName);
writer.Write (proxy.TargetType.ManagedTypeName);
writer.Write (proxy.TargetType.AssemblyName);
writer.Write ((byte)(proxy.ActivationCtor?.Style ?? 0));
writer.Write ((byte)(proxy.InvokerActivationCtorStyle ?? 0));
hash.AddString (proxy.TypeName);
hash.AddString (proxy.TargetType.ManagedTypeName);
hash.AddString (proxy.TargetType.AssemblyName);
hash.AddByte ((byte)(proxy.ActivationCtor?.Style ?? 0));
hash.AddByte ((byte)(proxy.InvokerActivationCtorStyle ?? 0));
}
foreach (var assoc in data.Associations) {
writer.Write (assoc.SourceTypeReference);
writer.Write (assoc.AliasProxyTypeReference);
hash.AddString (assoc.SourceTypeReference);
hash.AddString (assoc.AliasProxyTypeReference);
}
return hash.ToHash ();
}

public static byte [] ComputeRootContentFingerprint (Version systemRuntimeVersion, IReadOnlyList<string> perAssemblyTypeMapNames, bool useSharedTypemapUniverse, int maxArrayRank)
{
using var hash = new DeterministicHashBuilder ();
hash.AddVersion (systemRuntimeVersion);
hash.AddByte (useSharedTypemapUniverse ? (byte) 1 : (byte) 0);
hash.AddInt32 (maxArrayRank);
foreach (var name in perAssemblyTypeMapNames) {
hash.AddString (name);
}
writer.Flush ();
return sha.ComputeHash (stream.ToArray ());
return hash.ToHash ();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -505,14 +505,10 @@ static string AssemblyQualify (string typeName, string assemblyName)
/// <summary>
/// Emits per-rank array TypeMap entries for one peer, anchored to the per-assembly
/// <c>__ArrayMapRank{N}</c> sentinels. Keys are bare element JNI names (rank is encoded
/// by the sentinel anchor, not by JNI array prefixes). Skips open generics, primitive JNI
/// keyword keys (handled by the legacy primitive-array path), and alias groups.
/// by the sentinel anchor, not by JNI array prefixes). Skips open generics and alias groups.
/// </summary>
static void EmitArrayEntries (TypeMapAssemblyData model, string jniName, List<JavaPeerInfo> peersForName, int maxArrayRank)
{
if (jniName.Length == 1 && IsJniPrimitiveKeyword (jniName [0])) {
return;
}
if (peersForName.Count != 1) {
return;
}
Expand All @@ -526,6 +522,9 @@ static void EmitArrayEntries (TypeMapAssemblyData model, string jniName, List<Ja
}

for (int rank = 1; rank <= maxArrayRank; rank++) {
// TODO: we should also map elements to `JavaObjectArray<JavaObjectArray<...<T>...>>`
// so we migth want to generate a `ProxyTypeReference` which would return `JavaObjectArray<JavaObjectArray<...<T>...>>` AND `T[]`

string arrayTypeRef = AssemblyQualify (peer.ManagedTypeName + Brackets (rank), peer.AssemblyName);
model.Entries.Add (new TypeMapAttributeData {
JniName = jniName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.Reflection.Metadata;
using System.Reflection.Metadata.Ecma335;
using System.Reflection.PortableExecutable;
using System.Security.Cryptography;

namespace Microsoft.Android.Sdk.TrimmableTypeMap;

Expand Down Expand Up @@ -106,12 +107,31 @@ public void WritePE (Stream stream)
new PEHeaderBuilder (imageCharacteristics: Characteristics.Dll),
new MetadataRootBuilder (Metadata),
ILBuilder,
mappedFieldData: _mappedFieldData.Count > 0 ? _mappedFieldData : null);
mappedFieldData: _mappedFieldData.Count > 0 ? _mappedFieldData : null,
deterministicIdProvider: CreateDeterministicContentId);
var peBlob = new BlobBuilder ();
peBuilder.Serialize (peBlob);
peBlob.WriteContentTo (stream);
}

static BlobContentId CreateDeterministicContentId (IEnumerable<Blob> blobs)
{
using var sha = SHA256.Create ();
foreach (var blob in blobs) {
var bytes = blob.GetBytes ();
if (bytes.Array is null) {
continue;
}
sha.TransformBlock (bytes.Array, bytes.Offset, bytes.Count, null, 0);
}
sha.TransformFinalBlock ([], 0, 0);
var hash = sha.Hash;
if (hash is null) {
throw new InvalidOperationException ("SHA256 did not produce a hash.");
}
return BlobContentId.FromHash (hash);
}

/// <summary>
/// Adds (or retrieves from cache) an assembly reference.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public void Generate (IReadOnlyList<string> perAssemblyTypeMapNames, bool useSha
moduleName ??= assemblyName + ".dll";

var pe = new PEAssemblyBuilder (_systemRuntimeVersion);
pe.EmitPreamble (assemblyName, moduleName);
pe.EmitPreamble (assemblyName, moduleName, MetadataHelper.ComputeRootContentFingerprint (_systemRuntimeVersion, perAssemblyTypeMapNames, useSharedTypemapUniverse, maxArrayRank));

EntityHandle anchorTypeHandle;
if (useSharedTypemapUniverse) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,13 +210,16 @@ void ScanAssembly (AssemblyIndex index, Dictionary<(string ManagedName, string A

var fullName = MetadataTypeNameResolver.GetFullName (typeDef, index.Reader);

// Temporarily allow [JniAddNativeMethodRegistrationAttribute] while we investigate
// which scenarios fail later in the trimmable typemap pipeline.
// if (index.MayUseJniAddNativeMethodRegistrationAttribute &&
// !IsBuiltInJniAddNativeMethodRegistrationType (fullName, index) &&
// HasJniAddNativeMethodRegistrationAttribute (typeDef, index)) {
// logger?.LogJniAddNativeMethodRegistrationAttributeError (fullName);
// }
// Framework/runtime assemblies contain internal [JniAddNativeMethodRegistration]
// users such as Java.Interop.JavaProxyObject and Java.Interop.ManagedPeer.
// The diagnostic is for user assemblies because the trimmable runtime either
// has generated replacements for framework registration or intentionally
// disables unsupported runtime paths.
if (!frameworkAssemblyNames.Contains (index.AssemblyName) &&
index.MayUseJniAddNativeMethodRegistrationAttribute &&
HasJniAddNativeMethodRegistrationAttribute (typeDef, index)) {
logger?.LogJniAddNativeMethodRegistrationAttributeError (fullName);
}

// Determine the JNI name and whether this is a known Java peer.
// Priority:
Expand Down Expand Up @@ -413,12 +416,6 @@ static bool HasJniAddNativeMethodRegistrationAttribute (TypeDefinition typeDef,
return false;
}

static bool IsBuiltInJniAddNativeMethodRegistrationType (string fullName, AssemblyIndex index)
{
return string.Equals (index.AssemblyName, "Java.Interop", StringComparison.Ordinal) &&
string.Equals (fullName, "Java.Interop.JavaProxyObject", StringComparison.Ordinal);
}

/// <summary>
/// For each virtual override method on <paramref name="typeDef"/> that wasn't already
/// collected (no direct [Register]), walks up the base type hierarchy to find a
Expand Down
Loading
Loading