diff --git a/src/Java.Interop/Java.Interop-MonoAndroid.csproj b/src/Java.Interop/Java.Interop-MonoAndroid.csproj
index 4ba37e451..9061a960f 100644
--- a/src/Java.Interop/Java.Interop-MonoAndroid.csproj
+++ b/src/Java.Interop/Java.Interop-MonoAndroid.csproj
@@ -18,12 +18,16 @@
true
+
+ ..\..\bin\Build$(Configuration)\XAConfig.props
+
+
true
full
false
..\..\bin\Debug
- DEBUG;INTEROP;FEATURE_JNIENVIRONMENT_JI_PINVOKES;FEATURE_JNIOBJECTREFERENCE_INTPTRS;INTERNAL_NULLABLE_ATTRIBUTES
+ DEBUG;INTEROP;FEATURE_JNIENVIRONMENT_JI_PINVOKES;FEATURE_JNIOBJECTREFERENCE_INTPTRS;INTERNAL_NULLABLE_ATTRIBUTES;$(JavaInteropDefineConstants)
prompt
4
false
@@ -39,7 +43,7 @@
prompt
4
false
- INTEROP;FEATURE_JNIENVIRONMENT_JI_PINVOKES;FEATURE_JNIOBJECTREFERENCE_INTPTRS;INTERNAL_NULLABLE_ATTRIBUTES
+ INTEROP;FEATURE_JNIENVIRONMENT_JI_PINVOKES;FEATURE_JNIOBJECTREFERENCE_INTPTRS;INTERNAL_NULLABLE_ATTRIBUTES;$(JavaInteropDefineConstants)
true
enable
..\..\bin\Release\Java.Interop.xml
diff --git a/src/Java.Interop/Java.Interop.csproj b/src/Java.Interop/Java.Interop.csproj
index d3b589f1a..88eadd83d 100644
--- a/src/Java.Interop/Java.Interop.csproj
+++ b/src/Java.Interop/Java.Interop.csproj
@@ -1,11 +1,15 @@
+
+ ..\..\bin\Build$(Configuration)\XAConfig.props
+
+
netstandard2.0;netcoreapp3.1
1591
true
..\..\product.snk
- INTEROP;FEATURE_JNIENVIRONMENT_JI_PINVOKES;FEATURE_JNIOBJECTREFERENCE_INTPTRS;INTERNAL_NULLABLE_ATTRIBUTES
+ INTEROP;FEATURE_JNIENVIRONMENT_JI_PINVOKES;FEATURE_JNIOBJECTREFERENCE_INTPTRS;INTERNAL_NULLABLE_ATTRIBUTES;$(JavaInteropDefineConstants)
true
false
$(BaseIntermediateOutputPath)$(Configuration)\$(TargetFramework.ToLowerInvariant())\
diff --git a/src/Java.Interop/Java.Interop/JniEnvironment.Errors.cs b/src/Java.Interop/Java.Interop/JniEnvironment.Errors.cs
index f88cd8d58..8211771e6 100644
--- a/src/Java.Interop/Java.Interop/JniEnvironment.Errors.cs
+++ b/src/Java.Interop/Java.Interop/JniEnvironment.Errors.cs
@@ -30,7 +30,6 @@ public static void ThrowNew (JniObjectReference klass, string message)
throw new InvalidOperationException (string.Format ("Could not raise an exception; JNIEnv::ThrowNew() returned {0}.", r));
}
-#if !XA_INTEGRATION
public static void Throw (Exception e)
{
if (e == null)
@@ -41,7 +40,6 @@ public static void Throw (Exception e)
}
Throw (je.PeerReference);
}
-#endif // !XA_INTEGRATION
}
}
}
diff --git a/src/Java.Interop/Java.Interop/JniEnvironment.References.cs b/src/Java.Interop/Java.Interop/JniEnvironment.References.cs
index f1b6e8fdb..974b5cfe5 100644
--- a/src/Java.Interop/Java.Interop/JniEnvironment.References.cs
+++ b/src/Java.Interop/Java.Interop/JniEnvironment.References.cs
@@ -59,12 +59,10 @@ public static void PushLocalFrame (int capacity)
throw new InvalidOperationException (string.Format ("Could not push a frame; JNIEnv::PushLocalFrame() returned {0}.", r));
}
-#if !XA_INTEGRATION
public static int GetIdentityHashCode (JniObjectReference value)
{
return JniSystem.IdentityHashCode (value);
}
-#endif // !XA_INTEGRATION
public static IntPtr NewReturnToJniRef (IJavaPeerable value)
{
diff --git a/src/Java.Interop/Java.Interop/JniEnvironment.Strings.cs b/src/Java.Interop/Java.Interop/JniEnvironment.Strings.cs
index e4b555577..f04fbf01a 100644
--- a/src/Java.Interop/Java.Interop/JniEnvironment.Strings.cs
+++ b/src/Java.Interop/Java.Interop/JniEnvironment.Strings.cs
@@ -17,7 +17,6 @@ public static unsafe JniObjectReference NewString (string? value)
return NewString (s, value.Length);
}
-#if !XA_INTEGRATION
public static string? ToString (IntPtr reference)
{
return ToString (new JniObjectReference (reference));
@@ -28,7 +27,6 @@ public static unsafe JniObjectReference NewString (string? value)
Debug.Assert (targetType == typeof (string), "Expected targetType==typeof(string); was: " + targetType);
return ToString (ref reference, transfer);
}
-#endif // !XA_INTEGRATION
public static unsafe string? ToString (JniObjectReference value)
{
diff --git a/src/Java.Interop/Java.Interop/JniObjectReferenceOptions.cs b/src/Java.Interop/Java.Interop/JniObjectReferenceOptions.cs
index 5a1169169..367e4157a 100644
--- a/src/Java.Interop/Java.Interop/JniObjectReferenceOptions.cs
+++ b/src/Java.Interop/Java.Interop/JniObjectReferenceOptions.cs
@@ -19,12 +19,9 @@ partial struct JniObjectReference {
const JniObjectReferenceOptions DisposeSource = (JniObjectReferenceOptions) (1 << 1);
}
-#if !XA_INTEGRATION
partial class JniRuntime {
partial class JniValueManager {
const JniObjectReferenceOptions DoNotRegisterTarget = (JniObjectReferenceOptions) (1 << 2);
}
}
-#endif // !XA_INTEGRATION
}
-
diff --git a/src/Java.Interop/Java.Interop/JniPeerMembers.JniInstanceMethods.cs b/src/Java.Interop/Java.Interop/JniPeerMembers.JniInstanceMethods.cs
index be18a9c7b..2a825486c 100644
--- a/src/Java.Interop/Java.Interop/JniPeerMembers.JniInstanceMethods.cs
+++ b/src/Java.Interop/Java.Interop/JniPeerMembers.JniInstanceMethods.cs
@@ -111,7 +111,6 @@ public unsafe JniObjectReference StartCreateInstance (string constructorSignatur
return r;
}
-#if !XA_INTEGRATION
internal JniObjectReference AllocObject (Type declaringType)
{
var r = GetConstructorsForType (declaringType)
@@ -120,7 +119,6 @@ internal JniObjectReference AllocObject (Type declaringType)
r.Flags = JniObjectReferenceFlags.Alloc;
return r;
}
-#endif // !XA_INTEGRATION
internal unsafe JniObjectReference NewObject (string constructorSignature, Type declaringType, JniArgumentValue* parameters)
{
diff --git a/src/Java.Interop/Java.Interop/JniPeerMembers.cs b/src/Java.Interop/Java.Interop/JniPeerMembers.cs
index 52c8f24c2..29be44adb 100644
--- a/src/Java.Interop/Java.Interop/JniPeerMembers.cs
+++ b/src/Java.Interop/Java.Interop/JniPeerMembers.cs
@@ -24,14 +24,12 @@ public JniPeerMembers (string jniPeerTypeName, Type managedPeerType)
if (!typeof (IJavaPeerable).IsAssignableFrom (managedPeerType))
throw new ArgumentException ("'managedPeerType' must implement the IJavaPeerable interface.", nameof (managedPeerType));
-#if !XA_INTEGRATION
Debug.Assert (
JniEnvironment.Runtime.TypeManager.GetTypeSignature (managedPeerType).SimpleReference == jniPeerTypeName,
string.Format ("ManagedPeerType <=> JniTypeName Mismatch! javaVM.GetJniTypeInfoForType(typeof({0})).JniTypeName=\"{1}\" != \"{2}\"",
managedPeerType.FullName,
JniEnvironment.Runtime.TypeManager.GetTypeSignature (managedPeerType).SimpleReference,
jniPeerTypeName));
-#endif // !XA_INTEGRATION
ManagedPeerType = managedPeerType;
}
@@ -47,14 +45,12 @@ public JniPeerMembers (string jniPeerTypeName, Type managedPeerType)
if (!typeof (IJavaPeerable).IsAssignableFrom (managedPeerType))
throw new ArgumentException ("'managedPeerType' must implement the IJavaPeerable interface.", nameof (managedPeerType));
-#if !XA_INTEGRATION
Debug.Assert (
JniEnvironment.Runtime.TypeManager.GetTypeSignature (managedPeerType).SimpleReference == jniPeerTypeName,
string.Format ("ManagedPeerType <=> JniTypeName Mismatch! javaVM.GetJniTypeInfoForType(typeof({0})).JniTypeName=\"{1}\" != \"{2}\"",
managedPeerType.FullName,
JniEnvironment.Runtime.TypeManager.GetTypeSignature (managedPeerType).SimpleReference,
jniPeerTypeName));
-#endif // !XA_INTEGRATION
}
JniPeerTypeName = jniPeerTypeName;
diff --git a/src/Java.Interop/Java.Interop/JniRuntime.JniTypeManager.cs b/src/Java.Interop/Java.Interop/JniRuntime.JniTypeManager.cs
index 1dd3fd1ac..273256fc8 100644
--- a/src/Java.Interop/Java.Interop/JniRuntime.JniTypeManager.cs
+++ b/src/Java.Interop/Java.Interop/JniRuntime.JniTypeManager.cs
@@ -201,7 +201,7 @@ IEnumerable CreateGetTypesEnumerator (JniTypeSignature typeSignature)
yield return type;
continue;
}
-#if !XA_INTEGRATION
+
if (typeSignature.ArrayRank > 0) {
var rank = typeSignature.ArrayRank;
var arrayType = type;
@@ -214,7 +214,7 @@ IEnumerable CreateGetTypesEnumerator (JniTypeSignature typeSignature)
}
yield return arrayType;
}
-#endif // !XA_INTEGRATION
+
if (typeSignature.ArrayRank > 0) {
var rank = typeSignature.ArrayRank;
var arrayType = type;
diff --git a/src/Java.Interop/Java.Interop/JniRuntime.cs b/src/Java.Interop/Java.Interop/JniRuntime.cs
index d61bd172a..5c19e5123 100644
--- a/src/Java.Interop/Java.Interop/JniRuntime.cs
+++ b/src/Java.Interop/Java.Interop/JniRuntime.cs
@@ -248,9 +248,9 @@ protected JniRuntime (CreationOptions options)
}
}
-#if !XA_INTEGRATION
+#if !XA_JI_EXCLUDE
ManagedPeer.Init ();
-#endif // !XA_INTEGRATION
+#endif // !XA_JI_EXCLUDE
}
T SetRuntime (T value)
@@ -325,11 +325,9 @@ protected virtual void Dispose (bool disposing)
JniObjectReference.Dispose (ref ClassLoader);
ClearTrackedReferences ();
-#if !XA_INTEGRATION
ValueManager.Dispose ();
marshalMemberBuilder?.Dispose ();
TypeManager.Dispose ();
-#endif // !XA_INTEGRATION
ObjectReferenceManager.Dispose ();
var environments = JniEnvironment.Info.Values;
@@ -389,11 +387,7 @@ public void DestroyRuntime ()
public virtual Exception? GetExceptionForThrowable (ref JniObjectReference reference, JniObjectReferenceOptions options)
{
-#if XA_INTEGRATION
- throw new NotSupportedException ("Do not know h ow to convert a JniObjectReference to a System.Exception!");
-#else // !XA_INTEGRATION
return ValueManager.GetValue (ref reference, options);
-#endif // !̀£XA_INTEGRATION
}
public int GlobalReferenceCount {
@@ -436,13 +430,7 @@ partial class JniRuntime {
public virtual void RaisePendingException (Exception pendingException)
{
-#if XA_INTEGRATION
- if (pendingException == null)
- throw new ArgumentNullException (nameof (pendingException));
- throw new NotSupportedException ("Do not know how to marshal System.Exception instances.");
-#else // !XA_INTEGRATION
JniEnvironment.Exceptions.Throw (pendingException);
-#endif // !XA_INTEGRATION
}
}
}
diff --git a/src/Java.Interop/Java.Interop/JniType.cs b/src/Java.Interop/Java.Interop/JniType.cs
index 9feaacdb9..be6bcd8f0 100644
--- a/src/Java.Interop/Java.Interop/JniType.cs
+++ b/src/Java.Interop/Java.Interop/JniType.cs
@@ -67,12 +67,7 @@ public override string ToString ()
return $"JniType(Name='{Name}' PeerReference={PeerReference})";
}
-#if XA_INTEGRATION
- internal
-#else // !XA_INTEGRATION
- public
-#endif // !XA_INTEGRATION
- void RegisterWithRuntime ()
+ public void RegisterWithRuntime ()
{
AssertValid ();