镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content
This repository was archived by the owner on Nov 9, 2026. It is now read-only.
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