Skip to content

Commit dc3c01e

Browse files
committed
Ignore interfaces when generating JavaCallableWrappers
Context: dotnet/java-interop#824 With `Java.Interop` Java type scanner now including Java interfaces in the returned set of types, we need to ignore interfaces when generating JCWs.
1 parent 1970396 commit dc3c01e

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

external/Java.Interop

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,11 @@ bool CreateJavaSources (IEnumerable<TypeDefinition> javaTypes, TypeDefinitionCac
328328

329329
bool ok = true;
330330
foreach (var t in javaTypes) {
331+
if (t.IsInterface) {
332+
// Interfaces are in typemap but they shouldn't have JCW generated for them
333+
continue;
334+
}
335+
331336
using (var writer = MemoryStreamPool.Shared.CreateStreamWriter ()) {
332337
try {
333338
var jti = new JavaCallableWrapperGenerator (t, Log.LogWarning, cache) {

src/monodroid/jni/build-info.hh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
namespace xamarin::android::internal
99
{
1010
#define STRINGIFY(_val_) #_val_
11+
#define API_STRING(_api_) STRINGIFY(_api_)
1112
#define VERSION_STRING(_major_, _minor_, _build_) STRINGIFY(_major_) "." STRINGIFY(_minor_) "." STRINGIFY(_build_)
1213

1314
class BuildInfo final
@@ -50,7 +51,7 @@ namespace xamarin::android::internal
5051

5152
static constexpr char ndk_api_level[] =
5253
#if defined (__ANDROID_API__)
53-
STRINGIFY(__ANDROID_API__);
54+
API_STRING(__ANDROID_API__);
5455
#else // def __ANDROID_API__
5556
"";
5657
#endif // ndef __ANDROID_API__

0 commit comments

Comments
 (0)