Skip to content
Merged
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
18 changes: 12 additions & 6 deletions src/Java.Interop/Java.Interop/JniRuntime.JniTypeManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,20 @@ void AssertValid ()

internal static void AssertSimpleReference (string jniSimpleReference, string argumentName = "jniSimpleReference")
{
if (jniSimpleReference == null)
if (string.IsNullOrEmpty (jniSimpleReference))
throw new ArgumentNullException (argumentName);
if (jniSimpleReference != null && jniSimpleReference.IndexOf (".", StringComparison.Ordinal) >= 0)
if (jniSimpleReference.IndexOf ('.') >= 0)
throw new ArgumentException ("JNI type names do not contain '.', they use '/'. Are you sure you're using a JNI type name?", argumentName);
if (jniSimpleReference != null && jniSimpleReference.StartsWith ("[", StringComparison.Ordinal))
throw new ArgumentException ("Arrays cannot be present in simplified type references.", argumentName);
if (jniSimpleReference != null && jniSimpleReference.StartsWith ("L", StringComparison.Ordinal) && jniSimpleReference.EndsWith (";", StringComparison.Ordinal))
throw new ArgumentException ("JNI type references are not supported.", argumentName);
switch (jniSimpleReference [0]) {
case '[':
throw new ArgumentException ("Arrays cannot be present in simplified type references.", argumentName);
case 'L':
if (jniSimpleReference [jniSimpleReference.Length - 1] == ';')
throw new ArgumentException ("JNI type references are not supported.", argumentName);
break;
default:
break;
}
}

// NOTE: This method needs to be kept in sync with GetTypeSignatures()
Expand Down