Skip to content

Commit a2de5ab

Browse files
committed
Test JI #1174.
1 parent e987ac4 commit a2de5ab

File tree

3 files changed

+21
-11
lines changed

3 files changed

+21
-11
lines changed

external/Java.Interop

src/Mono.Android/Mono.Android.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,13 @@
6969
<Compile Include="..\..\external\Java.Interop\src\Java.Interop.Tools.TypeNameMappings\Java.Interop.Tools.TypeNameMappings\JavaNativeTypeManager.cs">
7070
<Link>JavaNativeTypeManager.cs</Link>
7171
</Compile>
72-
<Compile Include="..\..\external\Java.Interop\src\Java.Interop.Tools.JavaCallableWrappers\Java.Interop.Tools.JavaCallableWrappers\Crc64.cs">
72+
<Compile Include="..\..\external\Java.Interop\src\Java.Interop.Tools.JavaCallableWrappers\Utilities\Crc64.cs">
7373
<Link>Crc64.cs</Link>
7474
</Compile>
75-
<Compile Include="..\..\external\Java.Interop\src\Java.Interop.Tools.JavaCallableWrappers\Java.Interop.Tools.JavaCallableWrappers\Crc64Helper.cs">
75+
<Compile Include="..\..\external\Java.Interop\src\Java.Interop.Tools.JavaCallableWrappers\Utilities\Crc64Helper.cs">
7676
<Link>Crc64Helper.cs</Link>
7777
</Compile>
78-
<Compile Include="..\..\external\Java.Interop\src\Java.Interop.Tools.JavaCallableWrappers\Java.Interop.Tools.JavaCallableWrappers\Crc64.Table.cs">
78+
<Compile Include="..\..\external\Java.Interop\src\Java.Interop.Tools.JavaCallableWrappers\Utilities\Crc64.Table.cs">
7979
<Link>Crc64.Table.cs</Link>
8080
</Compile>
8181
<Compile Include="Android.Content.PM\PackageManager.cs" />

src/Xamarin.Android.Build.Tasks/Tasks/GenerateJavaStubs.cs

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
using Xamarin.Android.Tools;
2222
using Microsoft.Android.Build.Tasks;
23+
using Java.Interop.Tools.JavaCallableWrappers.Adapters;
2324

2425
namespace Xamarin.Android.Tasks
2526
{
@@ -473,23 +474,32 @@ bool CreateJavaSources (IEnumerable<JavaType> newJavaTypes, TypeDefinitionCache
473474

474475
using (var writer = MemoryStreamPool.Shared.CreateStreamWriter ()) {
475476
try {
476-
var jti = new JavaCallableWrapperGenerator (t, Log.LogWarning, cache, classifier) {
477-
GenerateOnCreateOverrides = generateOnCreateOverrides,
478-
ApplicationJavaClass = ApplicationJavaClass,
479-
MonoRuntimeInitialization = monoInit,
477+
var reader_options = new CallableWrapperReaderOptions {
478+
DefaultApplicationJavaClass = ApplicationJavaClass,
479+
DefaultGenerateOnCreateOverrides = generateOnCreateOverrides,
480+
DefaultMonoRuntimeInitialization = monoInit,
481+
MethodClassifier = classifier,
480482
};
481483

482-
jti.Generate (writer);
484+
var jcw_type = CecilImporter.CreateType (t, cache, reader_options);
485+
486+
var writer_options = new CallableWrapperWriterOptions {
487+
CodeGenerationTarget = JavaPeerStyle.XAJavaInterop1
488+
};
489+
490+
jcw_type.Generate (writer, writer_options);
491+
483492
if (useMarshalMethods) {
484493
if (classifier.FoundDynamicallyRegisteredMethods (t)) {
485494
Log.LogWarning ($"Type '{t.GetAssemblyQualifiedName (cache)}' will register some of its Java override methods dynamically. This may adversely affect runtime performance. See preceding warnings for names of dynamically registered methods.");
486495
}
487496
}
497+
488498
writer.Flush ();
489499

490-
var path = jti.GetDestinationPath (outputPath);
500+
var path = jcw_type.GetDestinationPath (outputPath);
491501
Files.CopyIfStreamChanged (writer.BaseStream, path);
492-
if (jti.HasExport && !hasExportReference)
502+
if (jcw_type.HasExport && !hasExportReference)
493503
Diagnostic.Error (4210, Properties.Resources.XA4210);
494504
} catch (XamarinAndroidException xae) {
495505
ok = false;

0 commit comments

Comments
 (0)