Skip to content

Commit 7e6ec67

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

File tree

2 files changed

+18
-8
lines changed

2 files changed

+18
-8
lines changed

external/Java.Interop

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)