Skip to content
Closed
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
4 changes: 2 additions & 2 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Dependencies>
<ProductDependencies>
<Dependency Name="Microsoft.NET.Sdk" Version="10.0.100-preview.1.25106.28">
<Dependency Name="Microsoft.NET.Sdk" Version="10.0.100-preview.1.25120.13">
<Uri>https://github.com/dotnet/sdk</Uri>
<Sha>e1a2886f5628dfdf192225870a62a1d029da68fb</Sha>
<Sha>ba56a9974738e0462269bfbcd89360d8a5064402</Sha>
</Dependency>
<Dependency Name="Microsoft.NET.ILLink.Tasks" Version="10.0.0-preview.1.25080.5" CoherentParentDependency="Microsoft.NET.Sdk">
<Uri>https://github.com/dotnet/runtime</Uri>
Expand Down
2 changes: 1 addition & 1 deletion eng/Versions.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project>
<!--Package versions-->
<PropertyGroup>
<MicrosoftNETSdkPackageVersion>10.0.100-preview.1.25106.28</MicrosoftNETSdkPackageVersion>
<MicrosoftNETSdkPackageVersion>10.0.100-preview.1.25120.13</MicrosoftNETSdkPackageVersion>
<MicrosoftDotnetSdkInternalPackageVersion>$(MicrosoftNETSdkPackageVersion)</MicrosoftDotnetSdkInternalPackageVersion>
<MicrosoftNETILLinkTasksPackageVersion>10.0.0-preview.1.25080.5</MicrosoftNETILLinkTasksPackageVersion>
<MicrosoftNETCoreAppRefPackageVersion>10.0.0-preview.1.25080.5</MicrosoftNETCoreAppRefPackageVersion>
Expand Down
2 changes: 1 addition & 1 deletion external/Java.Interop
Submodule Java.Interop updated 34 files
+72 −0 Localize/onelocbuild.yaml
+7 −143 build-tools/automation/azure-pipelines.yaml
+1 −1 src/Java.Interop.Tools.JavaCallableWrappers/Java.Interop.Tools.JavaCallableWrappers.Adapters/CecilImporter.cs
+1 −1 src/Java.Interop.Tools.TypeNameMappings/Java.Interop.Tools.TypeNameMappings/JavaNativeTypeManager.cs
+28 −0 src/Java.Interop/Documentation/Java.Interop/JniRuntime.JniTypeManager.xml
+45 −0 src/Java.Interop/Java.Interop/JniRuntime.JniTypeManager.cs
+37 −57 src/Java.Interop/Java.Interop/JniRuntime.JniValueManager.cs
+3 −0 src/Java.Interop/PublicAPI.Unshipped.txt
+33 −0 tests/Java.Interop-Tests/Java.Interop/JniRuntime.JniTypeManagerTests.cs
+0 −1 tests/Java.Interop.Dynamic-Tests/Java.Interop.Dynamic-Tests.csproj
+4 −0 tests/Java.Interop.Export-Tests/Java.Interop.Export-Tests.csproj
+49 −0 ...ols.JavaCallableWrappers-Tests/Java.Interop.Tools.JavaCallableWrappers/JavaCallableWrapperGeneratorTests.cs
+35 −0 ...ava.Interop.Tools.JavaCallableWrappers-Tests/Java.Interop.Tools.JavaCallableWrappers/SupportDeclarations.cs
+5 −3 ...terop.Tools.JavaCallableWrappers-Tests/Java.Interop.Tools.JavaCallableWrappers/TypeNameMapGeneratorTests.cs
+142 −0 tests/generator-Tests/Unit-Tests/BlittableTypeTests.cs
+6 −6 tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/Common/WriteDuplicateInterfaceEventArgs.txt
+6 −6 ...generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XAJavaInterop1/WriteDuplicateInterfaceEventArgs.txt
+9 −0 tests/generator-Tests/Unit-Tests/CodeGeneratorTestBase.cs
+3 −3 tests/generator-Tests/expected.xaji/GenericArguments/Com.Google.Android.Exoplayer.Drm.IExoMediaCrypto.cs
+2 −2 tests/generator-Tests/expected.xaji/GenericArguments/__NamespaceMapping__.cs
+3 −3 tests/generator-Tests/expected.xaji/Streams/Java.IO.InputStream.cs
+2 −2 tests/generator-Tests/expected.xaji/Streams/__NamespaceMapping__.cs
+3 −3 tests/generator-Tests/expected.xaji/TestInterface/Java.Util.ICollection.cs
+3 −3 tests/generator-Tests/expected.xaji/TestInterface/Java.Util.IDeque.cs
+3 −3 tests/generator-Tests/expected.xaji/TestInterface/Java.Util.IQueue.cs
+2 −2 tests/generator-Tests/expected.xaji/TestInterface/__NamespaceMapping__.cs
+2 −0 tools/generator/CodeGenerationOptions.cs
+1 −1 tools/generator/Java.Interop.Tools.Generator.ObjectModel/ClassGen.cs
+2 −2 tools/generator/Java.Interop.Tools.Generator.ObjectModel/ReturnValue.cs
+2 −0 tools/generator/Java.Interop.Tools.Generator.ObjectModel/Symbols/FormatSymbol.cs
+13 −0 tools/generator/Java.Interop.Tools.Generator.ObjectModel/Symbols/ISymbol.cs
+2 −2 tools/generator/Java.Interop.Tools.Generator.ObjectModel/Symbols/SymbolTable.cs
+7 −4 tools/generator/SourceWriters/BoundFieldAsProperty.cs
+1 −1 tools/generator/SourceWriters/Extensions/SourceWriterExtensions.cs
30 changes: 30 additions & 0 deletions src/Mono.Android/Android.Runtime/ExtraDelegates.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// There are built-in delegates for these, but we no longer generate them in Mono.Android.dll
// because bool is not a blittable type. But we still need them for pre-existing bindings.
using System;

[global::System.Runtime.InteropServices.UnmanagedFunctionPointer (global::System.Runtime.InteropServices.CallingConvention.Winapi)]
delegate bool _JniMarshal_PP_Z (IntPtr jnienv, IntPtr klass);
[global::System.Runtime.InteropServices.UnmanagedFunctionPointer (global::System.Runtime.InteropServices.CallingConvention.Winapi)]
delegate bool _JniMarshal_PPL_Z (IntPtr jnienv, IntPtr klass, IntPtr p0);
[global::System.Runtime.InteropServices.UnmanagedFunctionPointer (global::System.Runtime.InteropServices.CallingConvention.Winapi)]
delegate bool _JniMarshal_PPJ_Z (IntPtr jnienv, IntPtr klass, long p0);
[global::System.Runtime.InteropServices.UnmanagedFunctionPointer (global::System.Runtime.InteropServices.CallingConvention.Winapi)]
delegate void _JniMarshal_PPLZ_V (IntPtr jnienv, IntPtr klass, IntPtr p0, bool p1);
[global::System.Runtime.InteropServices.UnmanagedFunctionPointer (global::System.Runtime.InteropServices.CallingConvention.Winapi)]
delegate bool _JniMarshal_PPLL_Z (IntPtr jnienv, IntPtr klass, IntPtr p0, IntPtr p1);
[global::System.Runtime.InteropServices.UnmanagedFunctionPointer (global::System.Runtime.InteropServices.CallingConvention.Winapi)]
delegate bool _JniMarshal_PPIL_Z (IntPtr jnienv, IntPtr klass, int p0, IntPtr p1);
[global::System.Runtime.InteropServices.UnmanagedFunctionPointer (global::System.Runtime.InteropServices.CallingConvention.Winapi)]
delegate bool _JniMarshal_PPLII_Z (IntPtr jnienv, IntPtr klass, IntPtr p0, int p1, int p2);
[global::System.Runtime.InteropServices.UnmanagedFunctionPointer (global::System.Runtime.InteropServices.CallingConvention.Winapi)]
delegate bool _JniMarshal_PPLLJ_Z (IntPtr jnienv, IntPtr klass, IntPtr p0, IntPtr p1, long p2);
[global::System.Runtime.InteropServices.UnmanagedFunctionPointer (global::System.Runtime.InteropServices.CallingConvention.Winapi)]
delegate bool _JniMarshal_PPLIL_Z (IntPtr jnienv, IntPtr klass, IntPtr p0, int p1, IntPtr p2);
[global::System.Runtime.InteropServices.UnmanagedFunctionPointer (global::System.Runtime.InteropServices.CallingConvention.Winapi)]
delegate bool _JniMarshal_PPLLL_Z (IntPtr jnienv, IntPtr klass, IntPtr p0, IntPtr p1, IntPtr p2);
[global::System.Runtime.InteropServices.UnmanagedFunctionPointer (global::System.Runtime.InteropServices.CallingConvention.Winapi)]
delegate IntPtr _JniMarshal_PPIZI_L (IntPtr jnienv, IntPtr klass, int p0, bool p1, int p2);
[global::System.Runtime.InteropServices.UnmanagedFunctionPointer (global::System.Runtime.InteropServices.CallingConvention.Winapi)]
delegate bool _JniMarshal_PPLZZL_Z (IntPtr jnienv, IntPtr klass, IntPtr p0, bool p1, bool p2, IntPtr p3);
[global::System.Runtime.InteropServices.UnmanagedFunctionPointer (global::System.Runtime.InteropServices.CallingConvention.Winapi)]
delegate void _JniMarshal_PPZIIII_V (IntPtr jnienv, IntPtr klass, bool p0, int p1, int p2, int p3, int p4);
1 change: 1 addition & 0 deletions src/Mono.Android/Mono.Android.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@
<Compile Include="Android.Icu\DateIntervalFormat.cs" />
<Compile Include="Android.Net.Wifi.P2p\WifiP2pManager.cs" />
<Compile Include="Android.Runtime\DynamicMethodNameCounter.cs" />
<Compile Include="Android.Runtime\ExtraDelegates.cs" />
<Compile Include="Android.Runtime\IJavaObjectValueMarshaler.cs" />
<Compile Include="Android.Telecom\InCallService.cs" />
<Compile Include="Android.Telephony.Mbms\StreamingService.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ public void DotNetBuild (string runtimeIdentifiers, bool isRelease, bool aot, bo
new Package { Id = "Microsoft.AspNetCore.Components.WebView", Version = "8.0.*" },
new Package { Id = "Microsoft.Extensions.FileProviders.Embedded", Version = "8.0.*" },
new Package { Id = "Microsoft.JSInterop", Version = "8.0.*" },
new Package { Id = "System.Text.Json", Version = "8.0.*" },
},
Sources = {
new BuildItem ("EmbeddedResource", "Resource.resx") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
<NoWarn>$(NoWarn);CA1305</NoWarn>
<_IncludeMicrosoftBuildPackage>true</_IncludeMicrosoftBuildPackage>
<Nullable>annotations</Nullable>
<!-- NU1510 warning as error -->
<RestoreEnablePackagePruning>true</RestoreEnablePackagePruning>
</PropertyGroup>
<Import Project="..\..\..\..\Configuration.props" />
<Import Project="..\..\..\..\external\xamarin-android-tools\src\Microsoft.Android.Build.BaseTasks\MSBuildReferences.projitems" />
Expand All @@ -28,7 +30,6 @@
</Content>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Win32.Registry" />
<PackageReference Include="System.IO.Hashing" Version="$(SystemIOHashingPackageVersion)" />
<ProjectReference Include="..\..\..\..\external\xamarin-android-tools\src\Xamarin.Android.Tools.AndroidSdk\Xamarin.Android.Tools.AndroidSdk.csproj">
<Project>{E34BCFA0-CAA4-412C-AA1C-75DB8D67D157}</Project>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ public bool Matches (MethodDefinition method)
return false;
}

if (String.Compare (returnType, method.ReturnType.FullName, StringComparison.Ordinal) != 0) {
if (!TypeMatches (returnType, method.ReturnType.FullName)) {
log.LogWarning ($"Method '{method.FullName}' doesn't match native callback signature (invalid return type: expected '{returnType}', found '{method.ReturnType.FullName}')");
return false;
}
Expand All @@ -223,14 +223,37 @@ public bool Matches (MethodDefinition method)
parameterTypeName = pd.ParameterType.FullName;
}

if (String.Compare (parameterTypeName, paramTypes[i], StringComparison.Ordinal) != 0) {
if (!TypeMatches (parameterTypeName, paramTypes[i])) {
log.LogWarning ($"Method '{method.FullName}' doesn't match native callback signature, expected parameter type '{paramTypes[i]}' at position {i}, found '{parameterTypeName}'");
return false;
}
}

return true;
}

// Because these types are marshaled as different blittable types,
// we need to accept them as equivalent
static readonly (string Source, string Replacement)[] equivalent_types = [
(Source: "System.Boolean", Replacement: "System.SByte"),
(Source: "System.Char", Replacement: "System.UInt16"),
];

static bool TypeMatches (string type, string methodType)
{
if (String.Compare (type, methodType, StringComparison.Ordinal) == 0)
return true;

foreach (var eq in equivalent_types) {
if (string.Compare (eq.Source, type, StringComparison.Ordinal) == 0 && string.Compare (eq.Replacement, methodType, StringComparison.Ordinal) == 0)
return true;

if (string.Compare (eq.Source, methodType, StringComparison.Ordinal) == 0 && string.Compare (eq.Replacement, type, StringComparison.Ordinal) == 0)
return true;
}

return false;
}
}

TypeDefinitionCache tdCache;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
<!-- Causes issues with linker files imported from Mono -->
<NoWarn>$(NoWarn);CA1310;CA1305</NoWarn>
<WarningsAsErrors>Nullable</WarningsAsErrors>
<!-- NU1510 warning as error -->
<RestoreEnablePackagePruning>true</RestoreEnablePackagePruning>
</PropertyGroup>

<ItemGroup>
Expand Down
Loading