Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,13 @@ public override void RegisterNativeMembers (
ReadOnlySpan<char> methods)
{
if (methods.IsEmpty) {
base.RegisterNativeMembers (nativeClass, type, methods);
return;
}

int methodCount = CountMethods (methods);
if (methodCount < 1) {
base.RegisterNativeMembers (nativeClass, type, methods);
return;
}

Expand Down Expand Up @@ -129,12 +131,14 @@ public override void RegisterNativeMembers (

protected override IEnumerable<Type> GetTypesForSimpleReference (string jniSimpleReference)
{
if (ManagedTypeMapping.TryGetType (jniSimpleReference, out var target)) {
yield return target;
}
// Base class contains built-in mappings (e.g. java/lang/String → System.String)
// which must take priority over ManagedTypeMapping (which would return Java.Lang.String).
foreach (var t in base.GetTypesForSimpleReference (jniSimpleReference)) {
yield return t;
}
if (ManagedTypeMapping.TryGetType (jniSimpleReference, out var target)) {
yield return target;
}
Comment thread
jonathanpeppers marked this conversation as resolved.
}

protected override IEnumerable<string> GetSimpleReferences (Type type)
Expand All @@ -148,6 +152,19 @@ protected override IEnumerable<string> GetSimpleReferences (Type type)
}
}

protected override IReadOnlyList<string>? GetStaticMethodFallbackTypesCore (string jniSimpleReference)
{
int slash = jniSimpleReference.LastIndexOf ('/');
var desugarType = slash > 0
? $"{jniSimpleReference.Substring (0, slash + 1)}Desugar{jniSimpleReference.Substring (slash + 1)}"
: $"Desugar{jniSimpleReference}";

return new[] {
$"{desugarType}$_CC",
$"{jniSimpleReference}$-CC",
};
Comment thread
jonathanpeppers marked this conversation as resolved.
}
Comment thread
jonathanpeppers marked this conversation as resolved.

static int CountMethods (ReadOnlySpan<char> methodsSpan)
{
int count = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
<WarningsAsErrors>IL2037</WarningsAsErrors>
<AndroidUseNegotiateAuthentication>true</AndroidUseNegotiateAuthentication>
<AndroidNdkDirectory></AndroidNdkDirectory>
<DefineConstants Condition=" '$(UseMonoRuntime)' != 'true' and '$(PublishAot)' != 'true' ">$(DefineConstants);CORECLR</DefineConstants>
<DefineConstants Condition=" '$(UseMonoRuntime)' != 'true' and '$(PublishAot)' == 'true' ">$(DefineConstants);NATIVEAOT</DefineConstants>
<!--
TODO: Fix excluded tests
For $(EnableLLVM)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,12 @@ protected NUnitInstrumentation(IntPtr handle, JniHandleOwnership transfer)
protected override IList<TestAssemblyInfo> GetTestAssemblies()
{
Assembly asm = Assembly.GetExecutingAssembly();
#if !NATIVEAOT // TODO: Java.Interop-Tests not passing yet
Assembly ji = typeof (Java.InteropTests.JavaInterop_Tests_Reference).Assembly;
#endif


return new List<TestAssemblyInfo>()
{
new TestAssemblyInfo (asm, asm.Location ?? String.Empty),
#if !NATIVEAOT
new TestAssemblyInfo (ji, ji.Location ?? String.Empty),
#endif
};
}
}
Expand Down